From df731b0703d7c1f184818c0738f1f64f042a9adb Mon Sep 17 00:00:00 2001 From: kiri Date: Sat, 29 Nov 2025 22:51:38 +0100 Subject: [PATCH] Refactor hosts folder --- flake.nix | 6 +- hosts/altair/configuration.nix | 25 -- hosts/altair/hardware-configuration.nix | 2 +- hosts/altair/home.nix | 90 +---- hosts/altair/system.nix | 13 + hosts/altair/variables.nix | 43 +-- hosts/orion/hardware-configuration.nix | 2 +- hosts/orion/home.nix | 8 +- hosts/orion/{configuration.nix => system.nix} | 6 +- hosts/orion/variables.nix | 44 +-- hosts/polaris/configuration.nix | 27 -- hosts/polaris/hardware-configuration.nix | 2 +- hosts/polaris/home.nix | 90 +---- hosts/polaris/system.nix | 13 + hosts/polaris/variables.nix | 44 +-- modules/home-manager/common.nix | 8 + modules/home-manager/desktop.nix | 97 +++++ modules/home-manager/hyprsunset.nix | 3 +- modules/home-manager/wofi.nix | 102 ----- modules/nixos/adguardhome.nix | 20 - modules/nixos/arr.nix | 65 ---- modules/nixos/common.nix | 10 + modules/nixos/desktop.nix | 12 + modules/nixos/docker.nix | 6 - modules/nixos/eleakxir.nix | 35 -- modules/nixos/glance-nixy.nix | 353 ------------------ modules/nixos/mealie.nix | 19 - modules/nixos/nginx.nix | 45 --- modules/nixos/omen.nix | 63 ---- modules/variables.nix | 41 ++ 30 files changed, 214 insertions(+), 1080 deletions(-) delete mode 100644 hosts/altair/configuration.nix create mode 100644 hosts/altair/system.nix rename hosts/orion/{configuration.nix => system.nix} (81%) delete mode 100644 hosts/polaris/configuration.nix create mode 100644 hosts/polaris/system.nix create mode 100644 modules/home-manager/common.nix create mode 100644 modules/home-manager/desktop.nix delete mode 100644 modules/home-manager/wofi.nix delete mode 100644 modules/nixos/adguardhome.nix delete mode 100644 modules/nixos/arr.nix create mode 100644 modules/nixos/common.nix create mode 100644 modules/nixos/desktop.nix delete mode 100644 modules/nixos/docker.nix delete mode 100644 modules/nixos/eleakxir.nix delete mode 100644 modules/nixos/glance-nixy.nix delete mode 100644 modules/nixos/mealie.nix delete mode 100644 modules/nixos/nginx.nix delete mode 100644 modules/nixos/omen.nix create mode 100644 modules/variables.nix diff --git a/flake.nix b/flake.nix index 0ecd961..8315d2e 100644 --- a/flake.nix +++ b/flake.nix @@ -75,7 +75,7 @@ inputs.nixos-hardware.nixosModules.common-cpu-amd inputs.nixos-hardware.nixosModules.common-gpu-amd - ./hosts/polaris/configuration.nix + ./hosts/polaris/system.nix ]; }; @@ -90,7 +90,7 @@ inputs.nixos-hardware.nixosModules.lenovo-yoga-7-14ARH7-amdgpu - ./hosts/altair/configuration.nix + ./hosts/altair/system.nix ]; }; @@ -108,7 +108,7 @@ inputs.copyparty.nixosModules.default inputs.disko.nixosModules.disko - ./hosts/orion/configuration.nix + ./hosts/orion/system.nix ]; }; }; diff --git a/hosts/altair/configuration.nix b/hosts/altair/configuration.nix deleted file mode 100644 index 327168e..0000000 --- a/hosts/altair/configuration.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, ... }: -{ - imports = [ - # Mostly system related configuration - ../../modules/nixos/audio.nix - ../../modules/nixos/bluetooth.nix - ../../modules/nixos/fonts.nix - ../../modules/nixos/home-manager.nix - ../../modules/nixos/nix.nix - ../../modules/nixos/systemd-boot.nix - ../../modules/nixos/sddm.nix - ../../modules/nixos/users.nix - ../../modules/nixos/utils.nix - ../../modules/nixos/hyprland.nix - - # You should let those lines as is - ./hardware-configuration.nix - ./variables.nix - ]; - - home-manager.users."${config.var.username}" = import ./home.nix; - - # Don't touch this - system.stateVersion = "24.05"; -} diff --git a/hosts/altair/hardware-configuration.nix b/hosts/altair/hardware-configuration.nix index c7e5d99..84f876e 100644 --- a/hosts/altair/hardware-configuration.nix +++ b/hosts/altair/hardware-configuration.nix @@ -1,6 +1,6 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. +# to /etc/nixos/system.nix instead. { config, lib, pkgs, modulesPath, ... }: { diff --git a/hosts/altair/home.nix b/hosts/altair/home.nix index 067eea9..87b2bd1 100644 --- a/hosts/altair/home.nix +++ b/hosts/altair/home.nix @@ -6,100 +6,14 @@ }: { imports = [ - # Mostly user-specific configuration + ../../modules/home-manager/desktop.nix + ./variables.nix - ../../secrets - - # Programs - ../../modules/home-manager/accounts - ../../modules/home-manager/nixCats - ../../modules/home-manager/shell - - ../../modules/home-manager/aerc.nix - ../../modules/home-manager/bitwarden.nix - ../../modules/home-manager/direnv.nix - ../../modules/home-manager/discord.nix - ../../modules/home-manager/ghostty.nix - ../../modules/home-manager/git.nix - ../../modules/home-manager/gpg.nix - ../../modules/home-manager/khal.nix - ../../modules/home-manager/kitty.nix - ../../modules/home-manager/lazygit.nix - ../../modules/home-manager/nh.nix - ../../modules/home-manager/rclone.nix - ../../modules/home-manager/spicetify.nix - ../../modules/home-manager/ssh.nix - ../../modules/home-manager/thunar.nix - ../../modules/home-manager/thunderbird.nix - ../../modules/home-manager/todoman.nix - ../../modules/home-manager/vicinae.nix - ../../modules/home-manager/zathura.nix - - # Scripts - ../../modules/home-manager/scripts - - # System (Desktop environment like stuff) - ../../modules/home-manager/hyprland - ../../modules/home-manager/hyprpanel.nix - ../../modules/home-manager/hyprpaper.nix - ../../modules/home-manager/mime.nix - ../../modules/home-manager/udiskie.nix ]; home = { inherit (config.var) username; homeDirectory = "/home/" + config.var.username; - - packages = with pkgs; [ - dotnet-runtime - dafny - - gemini-cli - - # Apps - bitwarden-desktop # Password manager - vlc # Video player - blanket # White-noise app - obsidian # Note taking app - planify # Todolists - textpieces # Manipulate texts - curtail # Compress images - resources # Ressource monitor - gnome-clocks # Clocks app - gnome-text-editor # Basic graphic text editor - mpv # Video player - brave # Web browser - - # Privacy - session-desktop # Session app, private messages - signal-desktop # Signal app, private messages - protonvpn-gui - proton-pass - proton-authenticator - ticktick # Privacy friendly todo app - - # Utils - zip - unzip - optipng - jpegoptim - pfetch - btop - fastfetch - - # Just cool - peaclock - cbonsai - pipes - cmatrix - - # Backup - vscode - - libreoffice-qt6-fresh - ]; - - # Don't touch this stateVersion = "24.05"; }; diff --git a/hosts/altair/system.nix b/hosts/altair/system.nix new file mode 100644 index 0000000..309f3e2 --- /dev/null +++ b/hosts/altair/system.nix @@ -0,0 +1,13 @@ +{ config, ... }: +{ + imports = [ + ../../modules/nixos/desktop.nix + + ./hardware-configuration.nix + ./variables.nix + ]; + + home-manager.users."${config.var.username}" = import ./home.nix; + + system.stateVersion = "24.05"; +} diff --git a/hosts/altair/variables.nix b/hosts/altair/variables.nix index ac7570e..bbe6c30 100644 --- a/hosts/altair/variables.nix +++ b/hosts/altair/variables.nix @@ -1,41 +1,10 @@ +{ config, ... }: { - config, - lib, - ... -}: -{ - imports = [ - # Choose your theme here: - ../../modules/themes/catppuccin.nix - ]; - config.var = { hostname = "altair"; - username = "kiri"; - configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory - keyboardLayout = "us"; + hyprsunset.temperature = 2000; - location = "Meterik"; - timeZone = "Europe/Amsterdam"; - defaultLocale = "en_US.UTF-8"; - timeLocale = "en_DK.UTF-8"; - numericLocale = "en_IE.UTF-8"; - otherLocale = "nl_NL.UTF-8"; - - git = { - username = "kiri"; - email = "mail@jelles.net"; - }; - - preferred = { - editor = "nvim"; - terminal = "kitty"; - browser = "brave"; - }; - - autoUpgrade = false; - autoGarbageCollector = true; hyprland = { workspace = [ "1, monitor:desc:California Institute of Technology 0x1410, persistent:true, default:true" @@ -52,12 +21,4 @@ ]; }; }; - - # Let this here - options = { - var = lib.mkOption { - type = lib.types.attrs; - default = { }; - }; - }; } diff --git a/hosts/orion/hardware-configuration.nix b/hosts/orion/hardware-configuration.nix index bb23f0b..271fec2 100644 --- a/hosts/orion/hardware-configuration.nix +++ b/hosts/orion/hardware-configuration.nix @@ -1,6 +1,6 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. +# to /etc/nixos/system.nix instead. { config, lib, pkgs, modulesPath, ... }: { diff --git a/hosts/orion/home.nix b/hosts/orion/home.nix index 936a6a5..8405e99 100644 --- a/hosts/orion/home.nix +++ b/hosts/orion/home.nix @@ -5,12 +5,9 @@ }: { imports = [ - # Mostly user-specific configuration - ./variables.nix + ../../modules/home-manager/common.nix - # Programs - ../../modules/home-manager/shell - ../../modules/home-manager/git.nix + ./variables.nix ]; home = { @@ -26,7 +23,6 @@ ghostty ]; - # Don't touch this stateVersion = "24.05"; }; diff --git a/hosts/orion/configuration.nix b/hosts/orion/system.nix similarity index 81% rename from hosts/orion/configuration.nix rename to hosts/orion/system.nix index 180f602..597146c 100644 --- a/hosts/orion/configuration.nix +++ b/hosts/orion/system.nix @@ -4,10 +4,7 @@ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/profiles/qemu-guest.nix") - ../../modules/nixos/home-manager.nix - ../../modules/nixos/nix.nix - ../../modules/nixos/users.nix - ../../modules/nixos/utils.nix + ../../modules/nixos/common.nix ../../modules/nixos/ssh.nix ../../modules/nixos/caddy.nix @@ -27,6 +24,5 @@ home-manager.users."${config.var.username}" = import ./home.nix; - # Don't touch this system.stateVersion = "24.05"; } diff --git a/hosts/orion/variables.nix b/hosts/orion/variables.nix index 92c70d3..8294f05 100644 --- a/hosts/orion/variables.nix +++ b/hosts/orion/variables.nix @@ -1,48 +1,6 @@ +{ config, ... }: { - config, - lib, - ... -}: -{ - imports = [ - # Choose your theme here: - ../../modules/themes/catppuccin.nix - ]; - config.var = { hostname = "orion"; - username = "kiri"; - configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory - - keyboardLayout = "us"; - - location = "Meterik"; - timeZone = "Europe/Amsterdam"; - defaultLocale = "en_US.UTF-8"; - timeLocale = "en_DK.UTF-8"; - numericLocale = "en_IE.UTF-8"; - otherLocale = "nl_NL.UTF-8"; - - git = { - username = "kiri"; - email = "mail@jelles.net"; - }; - - preferred = { - editor = "nvim"; - terminal = "kitty"; - browser = "brave"; - }; - - autoUpgrade = false; - autoGarbageCollector = true; - }; - - # Let this here - options = { - var = lib.mkOption { - type = lib.types.attrs; - default = { }; - }; }; } diff --git a/hosts/polaris/configuration.nix b/hosts/polaris/configuration.nix deleted file mode 100644 index b5efffd..0000000 --- a/hosts/polaris/configuration.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, ... }: -{ - imports = [ - # Mostly system related configuration - ../../modules/nixos/audio.nix - ../../modules/nixos/bluetooth.nix - ../../modules/nixos/fonts.nix - ../../modules/nixos/home-manager.nix - ../../modules/nixos/nix.nix - ../../modules/nixos/systemd-boot.nix - ../../modules/nixos/sddm.nix - ../../modules/nixos/users.nix - ../../modules/nixos/utils.nix - #../../modules/nixos/tailscale.nix - ../../modules/nixos/hyprland.nix - #../../modules/nixos/docker.nix - - # You should let those lines as is - ./hardware-configuration.nix - ./variables.nix - ]; - - home-manager.users."${config.var.username}" = import ./home.nix; - - # Don't touch this - system.stateVersion = "24.05"; -} diff --git a/hosts/polaris/hardware-configuration.nix b/hosts/polaris/hardware-configuration.nix index 5b9b649..f3f7da3 100644 --- a/hosts/polaris/hardware-configuration.nix +++ b/hosts/polaris/hardware-configuration.nix @@ -1,6 +1,6 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. +# to /etc/nixos/system.nix instead. { config, lib, pkgs, modulesPath, ... }: { diff --git a/hosts/polaris/home.nix b/hosts/polaris/home.nix index 159c70c..87b2bd1 100644 --- a/hosts/polaris/home.nix +++ b/hosts/polaris/home.nix @@ -6,100 +6,14 @@ }: { imports = [ - # Mostly user-specific configuration + ../../modules/home-manager/desktop.nix + ./variables.nix - ../../secrets - - # Programs - ../../modules/home-manager/accounts - ../../modules/home-manager/nixCats - ../../modules/home-manager/shell - - ../../modules/home-manager/aerc.nix - ../../modules/home-manager/bitwarden.nix - ../../modules/home-manager/direnv.nix - ../../modules/home-manager/discord.nix - ../../modules/home-manager/ghostty.nix - ../../modules/home-manager/git.nix - ../../modules/home-manager/gpg.nix - ../../modules/home-manager/khal.nix - ../../modules/home-manager/kitty.nix - ../../modules/home-manager/lazygit.nix - ../../modules/home-manager/nh.nix - ../../modules/home-manager/rclone.nix - ../../modules/home-manager/spicetify.nix - ../../modules/home-manager/ssh.nix - ../../modules/home-manager/thunar.nix - ../../modules/home-manager/thunderbird.nix - ../../modules/home-manager/todoman.nix - ../../modules/home-manager/vicinae.nix - ../../modules/home-manager/zathura.nix - - # Scripts - ../../modules/home-manager/scripts - - # System (Desktop environment like stuff) - ../../modules/home-manager/hyprland - ../../modules/home-manager/hyprpanel.nix - ../../modules/home-manager/hyprpaper.nix - ../../modules/home-manager/mime.nix - ../../modules/home-manager/udiskie.nix ]; home = { inherit (config.var) username; homeDirectory = "/home/" + config.var.username; - - packages = with pkgs; [ - dotnet-runtime - dafny - - gemini-cli - - # Apps - bitwarden-desktop # Password manager - vlc # Video player - blanket # White-noise app - obsidian # Note taking app - planify # Todolists - textpieces # Manipulate texts - curtail # Compress images - resources # Ressource monitor - gnome-clocks # Clocks app - gnome-text-editor # Basic graphic text editor - mpv # Video player - brave # Web browser - - # Privacy - session-desktop # Session app, private messages - signal-desktop # Signal app, private messages - protonvpn-gui - proton-pass - proton-authenticator - # ticktick # Privacy friendly todo app - - # Utils - zip - unzip - optipng - jpegoptim - pfetch - btop - fastfetch - - # Just cool - peaclock - cbonsai - pipes - cmatrix - - # Backup - vscode - - libreoffice-qt6-fresh - ]; - - # Don't touch this stateVersion = "24.05"; }; diff --git a/hosts/polaris/system.nix b/hosts/polaris/system.nix new file mode 100644 index 0000000..309f3e2 --- /dev/null +++ b/hosts/polaris/system.nix @@ -0,0 +1,13 @@ +{ config, ... }: +{ + imports = [ + ../../modules/nixos/desktop.nix + + ./hardware-configuration.nix + ./variables.nix + ]; + + home-manager.users."${config.var.username}" = import ./home.nix; + + system.stateVersion = "24.05"; +} diff --git a/hosts/polaris/variables.nix b/hosts/polaris/variables.nix index e2977c7..b11ba77 100644 --- a/hosts/polaris/variables.nix +++ b/hosts/polaris/variables.nix @@ -1,41 +1,9 @@ +{ config, ... }: { - config, - lib, - ... -}: -{ - imports = [ - # Choose your theme here: - ../../modules/themes/catppuccin.nix - ]; - config.var = { hostname = "polaris"; - username = "kiri"; - configDirectory = "/home/" + config.var.username + "/.config/nixos"; # The path of the nixos configuration directory - keyboardLayout = "us"; - - location = "Meterik"; - timeZone = "Europe/Amsterdam"; - defaultLocale = "en_US.UTF-8"; - timeLocale = "en_DK.UTF-8"; - numericLocale = "en_IE.UTF-8"; - otherLocale = "nl_NL.UTF-8"; - - git = { - username = "kiri"; - email = "mail@jelles.net"; - }; - - preferred = { - editor = "nvim"; - terminal = "kitty"; - browser = "brave"; - }; - - autoUpgrade = false; - autoGarbageCollector = true; + hyprsunset.temperature = 3500; hyprland = { workspace = [ @@ -54,12 +22,4 @@ ]; }; }; - - # Let this here - options = { - var = lib.mkOption { - type = lib.types.attrs; - default = { }; - }; - }; } diff --git a/modules/home-manager/common.nix b/modules/home-manager/common.nix new file mode 100644 index 0000000..189adc4 --- /dev/null +++ b/modules/home-manager/common.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: +{ + imports = [ + ../variables.nix + ./shell + ./git.nix + ]; +} diff --git a/modules/home-manager/desktop.nix b/modules/home-manager/desktop.nix new file mode 100644 index 0000000..6968a5a --- /dev/null +++ b/modules/home-manager/desktop.nix @@ -0,0 +1,97 @@ +{ + pkgs, + config, + inputs, + ... +}: +{ + imports = [ + ./common.nix + ../../secrets + + # Programs + ./accounts + ./nixCats + + ./aerc.nix + ./bitwarden.nix + ./direnv.nix + ./discord.nix + ./ghostty.nix + ./gpg.nix + ./khal.nix + ./kitty.nix + ./lazygit.nix + ./nh.nix + ./rclone.nix + ./spicetify.nix + ./ssh.nix + ./thunar.nix + ./thunderbird.nix + ./todoman.nix + ./vicinae.nix + ./zathura.nix + + # Scripts + ./scripts + + # System (Desktop environment like stuff) + ./hyprland + ./hyprpanel.nix + ./hyprpaper.nix + ./hyprsunset.nix + ./mime.nix + ./udiskie.nix + ]; + + home = { + packages = with pkgs; [ + dotnet-runtime + dafny + + gemini-cli + + # Apps + bitwarden-desktop # Password manager + vlc # Video player + blanket # White-noise app + obsidian # Note taking app + planify # Todolists + textpieces # Manipulate texts + curtail # Compress images + resources # Ressource monitor + gnome-clocks # Clocks app + gnome-text-editor # Basic graphic text editor + mpv # Video player + brave # Web browser + + # Privacy + session-desktop # Session app, private messages + signal-desktop # Signal app, private messages + protonvpn-gui + proton-pass + proton-authenticator + ticktick # Privacy friendly todo app + + # Utils + zip + unzip + optipng + jpegoptim + pfetch + btop + fastfetch + + # Just cool + peaclock + cbonsai + pipes + cmatrix + + # Backup + vscode + + libreoffice-qt6-fresh + ]; + }; +} diff --git a/modules/home-manager/hyprsunset.nix b/modules/home-manager/hyprsunset.nix index e6a72c4..664fd5d 100644 --- a/modules/home-manager/hyprsunset.nix +++ b/modules/home-manager/hyprsunset.nix @@ -1,3 +1,4 @@ +{ config, ... }: { services = { hyprsunset = { @@ -12,7 +13,7 @@ } { time = "23:00"; - temperature = 2000; + temperature = config.var.hyprsunset.temperature; gamma = 0.8; } ]; diff --git a/modules/home-manager/wofi.nix b/modules/home-manager/wofi.nix deleted file mode 100644 index ea1aea9..0000000 --- a/modules/home-manager/wofi.nix +++ /dev/null @@ -1,102 +0,0 @@ -# Wofi is a launcher for Wayland, inspired by rofi. -{ - config, - pkgs, - lib, - ... -}: -let - accent = "#${config.lib.stylix.colors.base0D}"; - background = "#${config.lib.stylix.colors.base00}"; - background-alt = "#${config.lib.stylix.colors.base01}"; - foreground = "#${config.lib.stylix.colors.base05}"; - font = config.stylix.fonts.serif.name; - rounding = config.theme.rounding; - font-size = config.stylix.fonts.sizes.popups; -in -{ - home.packages = with pkgs; [ wofi-emoji ]; - - programs.wofi = { - enable = true; - - settings = { - allow_markup = true; - width = 450; - show = "drun"; - prompt = "Apps"; - normal_window = true; - height = 305; - allow_images = true; - image_size = 24; - insensitive = true; - hide_scroll = true; - no_actions = true; - gtk_dark = true; - }; - - style = - lib.mkForce - # css - '' - * { - font-family: "${font}"; - font-weight: 500; - font-size: ${toString font-size}px; - } - - #window { - background-color: ${background}; - color: ${foreground}; - border-radius: ${toString rounding}px; - } - - #outer-box { - padding: 20px; - } - - #input { - background-color: ${background-alt}; - border: 0px solid ${accent}; - color: ${foreground}; - padding: 8px 12px; - } - - #scroll { - margin-top: 20px; - } - - #inner-box {} - - #img { - padding-right: 8px; - } - - #text { - color: ${foreground}; - } - - #text:selected { - color: ${foreground}; - } - - #entry { - padding: 6px; - } - - #entry:selected { - background-color: ${accent}; - color: ${foreground}; - } - - #unselected {} - - #selected {} - - #input, - #entry:selected { - border-radius: ${toString rounding}px; - } - ''; - }; -} diff --git a/modules/nixos/adguardhome.nix b/modules/nixos/adguardhome.nix deleted file mode 100644 index af3c52a..0000000 --- a/modules/nixos/adguardhome.nix +++ /dev/null @@ -1,20 +0,0 @@ -# Adguard is a network-wide ad blocker -# When installed, open localhost:3000 to setup -{config, ...}: let - domain = "adguard.hadi.diy"; -in { - services = { - adguardhome = { - enable = true; - port = 3000; - }; - - nginx.virtualHosts."${domain}" = { - useACMEHost = "hadi.diy"; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.adguardhome.port}"; - }; - }; - }; -} diff --git a/modules/nixos/arr.nix b/modules/nixos/arr.nix deleted file mode 100644 index ee7ccfc..0000000 --- a/modules/nixos/arr.nix +++ /dev/null @@ -1,65 +0,0 @@ -# *arr is a collection of media management applications. -# See https://github.com/rasmus-kirk/nixarr -# Setup guide: https://nixarr.com/wiki/setup/ -{config, ...}: let - domain = "hadi.diy"; - mkVirtualHost = port: { - useACMEHost = domain; - forceSSL = true; - locations."/" = {proxyPass = "http://127.0.0.1:${toString port}";}; - }; - username = config.var.username; -in { - # Add my secrets - sops.secrets = { - recyclarr = { - owner = "recyclarr"; - mode = "0777"; - }; - wireguard-pia = { - group = "media"; - mode = "0600"; - }; - }; - - nixarr = { - enable = true; - - mediaUsers = [username]; - mediaDir = "/mnt/data/media"; - stateDir = "/mnt/data/.state/nixarr"; - - vpn = { - enable = true; - wgConf = config.sops.secrets.wireguard-pia.path; - }; - - jellyfin.enable = true; - jellyseerr.enable = true; - prowlarr.enable = true; - radarr.enable = true; - sonarr.enable = true; - bazarr.enable = true; - readarr.enable = true; - transmission = { - enable = true; - extraSettings = {trash-original-torrent-files = true;}; - vpn.enable = true; - }; - recyclarr = { - enable = true; - configFile = config.sops.secrets.recyclarr.path; - }; - }; - - services.nginx.virtualHosts = { - "jellyfin.${domain}" = mkVirtualHost 8096; - "jellyseerr.${domain}" = mkVirtualHost 5055; - "bazarr.${domain}" = mkVirtualHost 6767; - "prowlarr.${domain}" = mkVirtualHost 9696; - "radarr.${domain}" = mkVirtualHost 7878; - "sonarr.${domain}" = mkVirtualHost 8989; - "transmission.${domain}" = mkVirtualHost 9091; - "readarr.${domain}" = mkVirtualHost 8787; - }; -} diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix new file mode 100644 index 0000000..3e3df88 --- /dev/null +++ b/modules/nixos/common.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./home-manager.nix + ./nix.nix + ./users.nix + ./utils.nix + ../variables.nix + ]; +} \ No newline at end of file diff --git a/modules/nixos/desktop.nix b/modules/nixos/desktop.nix new file mode 100644 index 0000000..c66743e --- /dev/null +++ b/modules/nixos/desktop.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./common.nix + ./audio.nix + ./bluetooth.nix + ./fonts.nix + ./sddm.nix + ./hyprland.nix + ./systemd-boot.nix + ]; +} diff --git a/modules/nixos/docker.nix b/modules/nixos/docker.nix deleted file mode 100644 index 163db66..0000000 --- a/modules/nixos/docker.nix +++ /dev/null @@ -1,6 +0,0 @@ -# Docker is a containerization platform that allows you to run applications in isolated environments called containers. -{ config, ... }: -{ - virtualisation.docker.enable = true; - users.users."${config.var.username}".extraGroups = [ "docker" ]; -} diff --git a/modules/nixos/eleakxir.nix b/modules/nixos/eleakxir.nix deleted file mode 100644 index 270c386..0000000 --- a/modules/nixos/eleakxir.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - inputs, - pkgs, - ... -}: -{ - users.groups.eleakxir = { }; - users.users.hadi.extraGroups = [ "eleakxir" ]; - - services.eleakxir = { - enable = true; - port = 9198; - user = "eleakxir"; - group = "eleakxir"; - limit = 1000; - folders = [ - "/var/lib/eleakxir/leaks/" - "/mnt/data/clean-leak/" - ]; - debug = true; - }; - - environment.systemPackages = [ - inputs.eleakxir.packages.${pkgs.stdenv.hostPlatform.system}.leak-utils - ]; - - services.nginx.virtualHosts."eleakxir-back.hadi.diy" = { - useACMEHost = "hadi.diy"; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.eleakxir.port}"; - }; - }; -} diff --git a/modules/nixos/glance-nixy.nix b/modules/nixos/glance-nixy.nix deleted file mode 100644 index d7c06a1..0000000 --- a/modules/nixos/glance-nixy.nix +++ /dev/null @@ -1,353 +0,0 @@ -# Glance is a self-hosted homepage/dashboard service. -{ - config, - lib, - ... -}: let - domain = "start.hadi.diy"; - - rgb-to-hsl = color: let - r = ((lib.toInt config.lib.stylix.colors."${color}-rgb-r") * 100.0) / 255; - g = ((lib.toInt config.lib.stylix.colors."${color}-rgb-g") * 100.0) / 255; - b = ((lib.toInt config.lib.stylix.colors."${color}-rgb-b") * 100.0) / 255; - max = lib.max r (lib.max g b); - min = lib.min r (lib.min g b); - delta = max - min; - fmod = base: int: base - (int * builtins.floor (base / int)); - h = - if delta == 0 - then 0 - else if max == r - then 60 * (fmod ((g - b) / delta) 6) - else if max == g - then 60 * (((b - r) / delta) + 2) - else if max == b - then 60 * (((r - g) / delta) + 4) - else 0; - l = (max + min) / 2; - s = - if delta == 0 - then 0 - else 100 * delta / (100 - lib.max (2 * l - 100) (100 - (2 * l))); - roundToString = value: toString (builtins.floor (value + 0.5)); - in - lib.concatMapStringsSep " " roundToString [h s l]; -in { - # TODO: Add tailscale custom widget - services = { - glance = { - enable = true; - settings = { - theme = { - contrast-multiplier = lib.mkForce 1.4; - }; - pages = [ - { - hide-desktop-navigation = true; - columns = [ - { - size = "small"; - widgets = [ - { - type = "clock"; - hour-format = "24h"; - } - { - type = "weather"; - location = "Paris, France"; - } - { - type = "markets"; - markets = [ - { - symbol = "BTC-USD"; - name = "Bitcoin"; - chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD"; - } - { - symbol = "SOL-USD"; - name = "Solana"; - chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:SOLUSD"; - } - { - symbol = "ETH-USD"; - name = "Ethereum"; - chart-link = "https://www.tradingview.com/chart/?symbol=INDEX:ETHUSD"; - } - ]; - } - { - type = "dns-stats"; - service = "adguard"; - url = "https://adguard.hadi.diy"; - username = "hadi"; - password = "\${secret:adguard-pwd}"; - } - ]; - } - { - size = "full"; - widgets = [ - { - type = "search"; - search-engine = "duckduckgo"; - } - { - type = "bookmarks"; - groups = [ - { - title = ""; - same-tab = true; - color = "200 50 50"; - links = [ - { - title = "ProtonMail"; - url = "https://proton.me/mail"; - } - { - title = "Github"; - url = "https://github.com"; - } - { - title = "Youtube"; - url = "https://youtube.com"; - } - { - title = "Figma"; - url = "https://figma.com"; - } - ]; - } - { - title = "Docs"; - same-tab = true; - color = "200 50 50"; - links = [ - { - title = "Nixpkgs repo"; - url = "https://github.com/NixOS/nixpkgs"; - } - { - title = "Nixvim"; - url = "https://nix-community.github.io/nixvim/"; - } - { - title = "Hyprland wiki"; - url = "https://wiki.hyprland.org/"; - } - { - title = "Search NixOS"; - url = "https://search-nixos.hadi.diy"; - } - ]; - } - { - title = "Homelab"; - same-tab = true; - color = "100 50 50"; - links = [ - { - title = "Router"; - url = "http://192.168.1.254/"; - } - { - title = "Cloudflare"; - url = "https://dash.cloudflare.com/"; - } - ]; - } - { - title = "Work"; - same-tab = true; - color = "50 50 50"; - links = [ - { - title = "Outlook"; - url = "https://outlook.office.com/"; - } - { - title = "Teams"; - url = "https://teams.microsoft.com/"; - } - { - title = "Office"; - url = "https://www.office.com/"; - } - ]; - } - { - title = "Cyber"; - same-tab = true; - color = rgb-to-hsl "base09"; - links = [ - { - title = "CyberChef"; - url = "https://cyberchef.org/"; - } - { - title = "TryHackMe"; - url = "https://tryhackme.com/"; - } - { - title = "RootMe"; - url = "https://www.root-me.org/"; - } - { - title = "Exploit-DB"; - url = "https://www.exploit-db.com/"; - } - { - title = "CrackStation"; - url = "https://crackstation.net/"; - } - ]; - } - { - title = "Misc"; - same-tab = true; - color = rgb-to-hsl "base01"; - links = [ - { - title = "Svgl"; - url = "https://svgl.app/"; - } - { - title = "Excalidraw"; - url = "https://excalidraw.com/"; - } - { - title = "Cobalt (Downloader)"; - url = "https://cobalt.tools/"; - } - { - title = "Mazanoke (Image optimizer)"; - url = "https://mazanoke.com/"; - } - { - title = "Vert (File converter)"; - url = "https://vert.sh/"; - } - ]; - } - ]; - } - { - type = "server-stats"; - servers = [ - { - type = "local"; - name = "Jack"; - } - ]; - } - { - type = "group"; - widgets = [ - { - type = "monitor"; - title = "Services"; - cache = "1m"; - sites = [ - { - title = "Vaultwarden"; - url = "https://vault.hadi.diy"; - icon = "si:bitwarden"; - } - { - title = "Nextcloud"; - url = "https://cloud.hadi.diy"; - icon = "si:nextcloud"; - } - { - title = "Adguard"; - url = "https://adguard.hadi.diy"; - icon = "si:adguard"; - } - { - title = "Mealie"; - url = "https://mealie.hadi.diy"; - icon = "si:mealie"; - } - ]; - } - { - type = "monitor"; - title = "*arr"; - cache = "1m"; - sites = [ - { - title = "Jellyfin"; - url = "https://jellyfin.hadi.diy"; - icon = "si:jellyfin"; - } - { - title = "Jellyseerr"; - url = "https://jellyseerr.hadi.diy"; - icon = "si:odysee"; - } - { - title = "Radarr"; - url = "https://radarr.hadi.diy"; - icon = "si:radarr"; - } - { - title = "Sonarr"; - url = "https://sonarr.hadi.diy"; - icon = "si:sonarr"; - } - { - title = "Prowlarr"; - url = "https://prowlarr.hadi.diy"; - icon = "si:podcastindex"; - } - { - title = "Transmission"; - url = "https://transmission.hadi.diy"; - icon = "si:transmission"; - } - ]; - } - ]; - } - ]; - } - ]; - name = "Home"; - } - ]; - server = {port = 5678;}; - }; - }; - nginx.virtualHosts."${domain}" = { - useACMEHost = "hadi.diy"; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:${ - toString config.services.glance.settings.server.port - }"; - }; - }; - }; - - systemd.services.glance = { - serviceConfig = { - DynamicUser = lib.mkForce false; - User = "glance"; - Group = "glance"; - }; - }; - - users = { - groups.glance = {}; - users.glance = { - isSystemUser = true; - description = "Glance user"; - group = "glance"; - }; - }; - - sops.secrets.adguard-pwd = { - owner = "glance"; - mode = "0600"; - }; -} diff --git a/modules/nixos/mealie.nix b/modules/nixos/mealie.nix deleted file mode 100644 index 78007f7..0000000 --- a/modules/nixos/mealie.nix +++ /dev/null @@ -1,19 +0,0 @@ -# Mealie is a recipe management and meal planning application. -{config, ...}: let - domain = "mealie.hadi.diy"; -in { - services = { - mealie = { - enable = true; - port = 8092; - }; - - nginx.virtualHosts."${domain}" = { - useACMEHost = "hadi.diy"; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.mealie.port}"; - }; - }; - }; -} diff --git a/modules/nixos/nginx.nix b/modules/nixos/nginx.nix deleted file mode 100644 index 0f0bb24..0000000 --- a/modules/nixos/nginx.nix +++ /dev/null @@ -1,45 +0,0 @@ -# Nginx is a web server that can also be used as a reverse proxy, load balancer, and HTTP cache. -{config, ...}: let - domain = "hadi.diy"; -in { - security.acme = { - acceptTerms = true; - defaults.email = config.var.git.email; - certs."${domain}" = { - domain = "${domain}"; - extraDomainNames = ["*.${domain}"]; - group = "nginx"; - dnsProvider = "cloudflare"; - dnsPropagationCheck = true; - credentialsFile = config.sops.secrets.cloudflare-dns-token.path; - }; - }; - - # Return 444 for all requests not matching a used subdomain. - services.nginx = { - enable = true; - virtualHosts = { - "default" = { - default = true; - locations."/" = {return = 444;}; - }; - "*.${domain}" = { - useACMEHost = domain; - forceSSL = true; - locations."/" = {return = 444;}; - }; - "aaaaaa.${domain}" = { - useACMEHost = domain; - forceSSL = true; - locations."/" = {return = 444;}; - }; - }; - }; - - networking.firewall = { - allowedTCPPorts = [80 443]; - allowedUDPPorts = [80 443]; - }; - - sops.secrets.cloudflare-dns-token = {path = "/etc/cloudflare/dnskey.txt";}; -} diff --git a/modules/nixos/omen.nix b/modules/nixos/omen.nix deleted file mode 100644 index 794f8b6..0000000 --- a/modules/nixos/omen.nix +++ /dev/null @@ -1,63 +0,0 @@ -# Omen laptop configuration for NixOS -# Import this only if you have an HP Omen laptop -{ - config, - pkgs, - ... -}: let - hp-omen-linux-module = - pkgs.callPackage - ({ - kernel ? config.boot.kernelPackages.kernel, - stdenv, - fetchFromGitHub, - }: - stdenv.mkDerivation (finalAttrs: { - pname = "hp-omen-linux-module"; - version = "rebase-6.14"; - src = fetchFromGitHub { - owner = "ranisalt"; - repo = "hp-omen-linux-module"; - rev = finalAttrs.version; - sha256 = "sha256-2zCm29bdboSjRm/caMjBPGNc0tZXPUnIIYlHxxfhAok="; - }; - setSourceRoot = '' - export sourceRoot=$(pwd)/${finalAttrs.src.name}/src - ''; - nativeBuildInputs = kernel.moduleBuildDependencies; - makeFlags = [ - "KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - ]; - installPhase = '' - runHook preInstall - install hp-wmi.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86/hp/ - runHook postInstall - ''; - })) {kernel = config.boot.kernelPackages.kernel;}; -in { - boot.extraModulePackages = [hp-omen-linux-module]; - boot.kernelModules = ["hp-wmi"]; - - users.groups.omen-rgb = {}; - users.users.${config.var.username}.extraGroups = ["omen-rgb"]; - - systemd.tmpfiles.rules = [ - "w /sys/devices/platform/hp-wmi/rgb_zones/zone00 0660 root omen-rgb -" - "w /sys/devices/platform/hp-wmi/rgb_zones/zone01 0660 root omen-rgb -" - "w /sys/devices/platform/hp-wmi/rgb_zones/zone02 0660 root omen-rgb -" - "w /sys/devices/platform/hp-wmi/rgb_zones/zone03 0660 root omen-rgb -" - ]; - - services.udev.extraRules = '' - SUBSYSTEM=="platform", KERNEL=="hp-wmi", ACTION=="add", \ - RUN+="${pkgs.coreutils-full}/bin/sleep 2", \ - RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone00", \ - RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone00", \ - RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone01", \ - RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone01", \ - RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone02", \ - RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone02", \ - RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone03", \ - RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone03" - ''; -} diff --git a/modules/variables.nix b/modules/variables.nix new file mode 100644 index 0000000..0e661ce --- /dev/null +++ b/modules/variables.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: +{ + imports = [ + ./themes/catppuccin.nix + ]; + + config.var = { + username = "kiri"; + configDirectory = "/home/" + config.var.username + "/.config/nixos"; + + keyboardLayout = "us"; + + location = "Meterik"; + timeZone = "Europe/Amsterdam"; + defaultLocale = "en_US.UTF-8"; + timeLocale = "en_DK.UTF-8"; + numericLocale = "en_IE.UTF-8"; + otherLocale = "nl_NL.UTF-8"; + + git = { + username = "kiri"; + email = "mail@jelles.net"; + }; + + preferred = { + editor = "nvim"; + terminal = "kitty"; + browser = "brave"; + }; + + autoUpgrade = false; + autoGarbageCollector = true; + }; + + options = { + var = lib.mkOption { + type = lib.types.attrs; + default = { }; + }; + }; +}