From 037d68a9d428aa6a8b23e0b28c62b488bd07f45e Mon Sep 17 00:00:00 2001 From: William Date: Thu, 13 Mar 2025 17:51:04 -0300 Subject: [PATCH] refactoring for isServer and isWorkstation: part 5 (final?) --- flake.lock | 21 ----------- flake.nix | 8 ----- hosts/alexandria.nix | 36 ++++++++----------- hosts/alexandria/paperless.nix | 30 ---------------- hosts/io.nix | 17 +++++++-- .../alexandria/changedetection.nix | 0 hosts/{ => modules}/alexandria/cinny.nix | 0 hosts/{ => modules}/alexandria/default.nix | 1 - hosts/{ => modules}/alexandria/forgejo.nix | 0 .../alexandria/hardware-configuration.nix | 22 ++++++++---- hosts/{ => modules}/alexandria/jellyfin.nix | 0 hosts/{ => modules}/alexandria/librespeed.nix | 0 hosts/{ => modules}/alexandria/memos.nix | 0 hosts/{ => modules}/alexandria/minecraft.nix | 0 hosts/modules/alexandria/networking.nix | 15 ++++++++ hosts/{ => modules}/alexandria/nextcloud.nix | 0 hosts/{ => modules}/alexandria/nginx.nix | 0 hosts/{ => modules}/alexandria/searx.nix | 0 hosts/{ => modules}/alexandria/services.nix | 0 hosts/{ => modules}/alexandria/users.nix | 0 .../{ => modules}/alexandria/vaultwarden.nix | 0 hosts/modules/default.nix | 5 +-- hosts/modules/flatpak.nix | 35 ++++++++++++++++++ hosts/modules/impermanence.nix | 6 +++- hosts/{ => modules}/io/boot.nix | 0 hosts/{ => modules}/io/default.nix | 2 +- hosts/{ => modules}/io/ephermal.nix | 0 .../io/hardware-configuration.nix | 0 hosts/{ => modules}/io/programs.nix | 0 hosts/{ => modules}/io/services.nix | 0 hosts/modules/programs.nix | 16 --------- hosts/{ => modules}/rotterdam/boot.nix | 0 hosts/{ => modules}/rotterdam/default.nix | 0 hosts/{ => modules}/rotterdam/ephermal.nix | 0 .../rotterdam/hardware-configuration.nix | 0 hosts/{ => modules}/rotterdam/hardware.nix | 0 hosts/{ => modules}/rotterdam/programs.nix | 0 hosts/{ => modules}/rotterdam/services.nix | 0 hosts/rotterdam.nix | 17 +++++++-- users/{ => modules}/root/default.nix | 0 users/{ => modules}/user/default.nix | 0 users/{ => modules}/user/programs.nix | 0 users/root.nix | 2 +- users/user.nix | 2 +- 44 files changed, 120 insertions(+), 115 deletions(-) delete mode 100644 hosts/alexandria/paperless.nix rename hosts/{ => modules}/alexandria/changedetection.nix (100%) rename hosts/{ => modules}/alexandria/cinny.nix (100%) rename hosts/{ => modules}/alexandria/default.nix (98%) rename hosts/{ => modules}/alexandria/forgejo.nix (100%) rename hosts/{ => modules}/alexandria/hardware-configuration.nix (66%) rename hosts/{ => modules}/alexandria/jellyfin.nix (100%) rename hosts/{ => modules}/alexandria/librespeed.nix (100%) rename hosts/{ => modules}/alexandria/memos.nix (100%) rename hosts/{ => modules}/alexandria/minecraft.nix (100%) create mode 100644 hosts/modules/alexandria/networking.nix rename hosts/{ => modules}/alexandria/nextcloud.nix (100%) rename hosts/{ => modules}/alexandria/nginx.nix (100%) rename hosts/{ => modules}/alexandria/searx.nix (100%) rename hosts/{ => modules}/alexandria/services.nix (100%) rename hosts/{ => modules}/alexandria/users.nix (100%) rename hosts/{ => modules}/alexandria/vaultwarden.nix (100%) create mode 100644 hosts/modules/flatpak.nix rename hosts/{ => modules}/io/boot.nix (100%) rename hosts/{ => modules}/io/default.nix (89%) rename hosts/{ => modules}/io/ephermal.nix (100%) rename hosts/{ => modules}/io/hardware-configuration.nix (100%) rename hosts/{ => modules}/io/programs.nix (100%) rename hosts/{ => modules}/io/services.nix (100%) rename hosts/{ => modules}/rotterdam/boot.nix (100%) rename hosts/{ => modules}/rotterdam/default.nix (100%) rename hosts/{ => modules}/rotterdam/ephermal.nix (100%) rename hosts/{ => modules}/rotterdam/hardware-configuration.nix (100%) rename hosts/{ => modules}/rotterdam/hardware.nix (100%) rename hosts/{ => modules}/rotterdam/programs.nix (100%) rename hosts/{ => modules}/rotterdam/services.nix (100%) rename users/{ => modules}/root/default.nix (100%) rename users/{ => modules}/user/default.nix (100%) rename users/{ => modules}/user/programs.nix (100%) diff --git a/flake.lock b/flake.lock index 47ee129..dac8000 100644 --- a/flake.lock +++ b/flake.lock @@ -449,26 +449,6 @@ "type": "github" } }, - "nix-index-db": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1740281615, - "narHash": "sha256-dZWcbAQ1sF8oVv+zjSKkPVY0ebwENQEkz5vc6muXbKY=", - "owner": "nix-community", - "repo": "nix-index-database", - "rev": "465792533d03e6bb9dc849d58ab9d5e31fac9023", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-index-database", - "type": "github" - } - }, "nix-minecraft": { "inputs": { "flake-compat": "flake-compat_2", @@ -584,7 +564,6 @@ "homepage": "homepage", "impermanence": "impermanence", "nix-flatpak": "nix-flatpak", - "nix-index-db": "nix-index-db", "nix-minecraft": "nix-minecraft", "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index fd161f8..60f0c76 100644 --- a/flake.nix +++ b/flake.nix @@ -33,11 +33,6 @@ nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; - nix-index-db = { - url = "github:nix-community/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-minecraft = { url = "github:Infinidoge/nix-minecraft"; inputs.nixpkgs.follows = "nixpkgs"; @@ -64,7 +59,6 @@ homepage, impermanence, nix-flatpak, - nix-index-db, nix-minecraft, nixos-generators, stylix, @@ -86,7 +80,6 @@ agenix.nixosModules.default home-manager.nixosModules.default impermanence.nixosModules.impermanence - nix-index-db.nixosModules.nix-index nix-flatpak.nixosModules.nix-flatpak stylix.nixosModules.stylix { @@ -112,7 +105,6 @@ agenix.nixosModules.default home-manager.nixosModules.default impermanence.nixosModules.impermanence - nix-index-db.nixosModules.nix-index nix-flatpak.nixosModules.nix-flatpak stylix.nixosModules.stylix { diff --git a/hosts/alexandria.nix b/hosts/alexandria.nix index 50920e6..7f5f000 100644 --- a/hosts/alexandria.nix +++ b/hosts/alexandria.nix @@ -1,30 +1,22 @@ { ... }: { + networking.hostName = "alexandria"; + imports = [ - ./modules - ./alexandria + ./modules/alexandria + ./modules/boot.nix + ./modules/console.nix + ./modules/desktop.nix + ./modules/locale.nix + ./modules/networking.nix + ./modules/nix.nix + ./modules/programs.nix + ./modules/security.nix + ./modules/services.nix + ./modules/users.nix + ./modules/virtualisation.nix ]; nix.nixPath = [ "nixos-config=${./alexandria.nix}" ]; - - swapDevices = [ - { - device = "/swapfile"; - size = 8192; - } - ]; - - networking = { - hostName = "alexandria"; - firewall = { - allowedTCPPorts = [ - 80 - 443 - 8010 - 9666 - ]; - allowedUDPPorts = [ 24454 ]; - }; - }; } diff --git a/hosts/alexandria/paperless.nix b/hosts/alexandria/paperless.nix deleted file mode 100644 index d78d107..0000000 --- a/hosts/alexandria/paperless.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, lib, ... }: - -{ - services = { - paperless = { - enable = true; - dataDir = "/data/paperless/data"; - mediaDir = "/data/paperless/media"; - passwordFile = config.age.secrets.paperless.path; - port = lib.toInt "${config.ports.paperless}"; - consumptionDirIsPublic = true; - settings = { - PAPERLESS_OCR_LANGUAGE = "eng+por+deu"; - }; - }; - - nginx.virtualHosts."docs.baduhai.dev" = { - useACMEHost = "baduhai.dev"; - forceSSL = true; - kTLS = true; - locations."/".proxyPass = "http://127.0.0.1:${config.ports.paperless}"; - }; - }; - - age.secrets.paperless = { - file = ../../../secrets/paperless.age; - owner = "paperless"; - group = "hosted"; - }; -} diff --git a/hosts/io.nix b/hosts/io.nix index 0eba1ed..ffa4218 100644 --- a/hosts/io.nix +++ b/hosts/io.nix @@ -4,8 +4,21 @@ networking.hostName = "io"; imports = [ - ./modules - ./io + ./modules/io + ./modules/boot.nix + ./modules/console.nix + ./modules/desktop.nix + ./modules/flatpak.nix + ./modules/impermanence.nix + ./modules/locale.nix + ./modules/networking.nix + ./modules/nix.nix + ./modules/programs.nix + ./modules/security.nix + ./modules/services.nix + ./modules/stylix.nix + ./modules/users.nix + ./modules/virtualisation.nix ]; nix.nixPath = [ "nixos-config=${./io.nix}" ]; diff --git a/hosts/alexandria/changedetection.nix b/hosts/modules/alexandria/changedetection.nix similarity index 100% rename from hosts/alexandria/changedetection.nix rename to hosts/modules/alexandria/changedetection.nix diff --git a/hosts/alexandria/cinny.nix b/hosts/modules/alexandria/cinny.nix similarity index 100% rename from hosts/alexandria/cinny.nix rename to hosts/modules/alexandria/cinny.nix diff --git a/hosts/alexandria/default.nix b/hosts/modules/alexandria/default.nix similarity index 98% rename from hosts/alexandria/default.nix rename to hosts/modules/alexandria/default.nix index d5069a1..bb81971 100644 --- a/hosts/alexandria/default.nix +++ b/hosts/modules/alexandria/default.nix @@ -22,7 +22,6 @@ in ./minecraft.nix ./nextcloud.nix ./nginx.nix - ./paperless.nix ./searx.nix ./services.nix ./users.nix diff --git a/hosts/alexandria/forgejo.nix b/hosts/modules/alexandria/forgejo.nix similarity index 100% rename from hosts/alexandria/forgejo.nix rename to hosts/modules/alexandria/forgejo.nix diff --git a/hosts/alexandria/hardware-configuration.nix b/hosts/modules/alexandria/hardware-configuration.nix similarity index 66% rename from hosts/alexandria/hardware-configuration.nix rename to hosts/modules/alexandria/hardware-configuration.nix index 05eac80..63ecba5 100644 --- a/hosts/alexandria/hardware-configuration.nix +++ b/hosts/modules/alexandria/hardware-configuration.nix @@ -23,15 +23,23 @@ extraModulePackages = [ ]; }; - fileSystems."/" = { - device = "/dev/disk/by-uuid/31289617-1d84-4432-a833-680b52e88525"; - fsType = "ext4"; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/31289617-1d84-4432-a833-680b52e88525"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-uuid/4130-BE54"; + fsType = "vfat"; + }; }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/4130-BE54"; - fsType = "vfat"; - }; + swapDevices = [ + { + device = "/swapfile"; + size = 8192; + } + ]; networking.useDHCP = lib.mkDefault true; diff --git a/hosts/alexandria/jellyfin.nix b/hosts/modules/alexandria/jellyfin.nix similarity index 100% rename from hosts/alexandria/jellyfin.nix rename to hosts/modules/alexandria/jellyfin.nix diff --git a/hosts/alexandria/librespeed.nix b/hosts/modules/alexandria/librespeed.nix similarity index 100% rename from hosts/alexandria/librespeed.nix rename to hosts/modules/alexandria/librespeed.nix diff --git a/hosts/alexandria/memos.nix b/hosts/modules/alexandria/memos.nix similarity index 100% rename from hosts/alexandria/memos.nix rename to hosts/modules/alexandria/memos.nix diff --git a/hosts/alexandria/minecraft.nix b/hosts/modules/alexandria/minecraft.nix similarity index 100% rename from hosts/alexandria/minecraft.nix rename to hosts/modules/alexandria/minecraft.nix diff --git a/hosts/modules/alexandria/networking.nix b/hosts/modules/alexandria/networking.nix new file mode 100644 index 0000000..504fce6 --- /dev/null +++ b/hosts/modules/alexandria/networking.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + networking = { + firewall = { + allowedTCPPorts = [ + 80 + 443 + 8010 + 9666 + ]; + allowedUDPPorts = [ 24454 ]; + }; + }; +} diff --git a/hosts/alexandria/nextcloud.nix b/hosts/modules/alexandria/nextcloud.nix similarity index 100% rename from hosts/alexandria/nextcloud.nix rename to hosts/modules/alexandria/nextcloud.nix diff --git a/hosts/alexandria/nginx.nix b/hosts/modules/alexandria/nginx.nix similarity index 100% rename from hosts/alexandria/nginx.nix rename to hosts/modules/alexandria/nginx.nix diff --git a/hosts/alexandria/searx.nix b/hosts/modules/alexandria/searx.nix similarity index 100% rename from hosts/alexandria/searx.nix rename to hosts/modules/alexandria/searx.nix diff --git a/hosts/alexandria/services.nix b/hosts/modules/alexandria/services.nix similarity index 100% rename from hosts/alexandria/services.nix rename to hosts/modules/alexandria/services.nix diff --git a/hosts/alexandria/users.nix b/hosts/modules/alexandria/users.nix similarity index 100% rename from hosts/alexandria/users.nix rename to hosts/modules/alexandria/users.nix diff --git a/hosts/alexandria/vaultwarden.nix b/hosts/modules/alexandria/vaultwarden.nix similarity index 100% rename from hosts/alexandria/vaultwarden.nix rename to hosts/modules/alexandria/vaultwarden.nix diff --git a/hosts/modules/default.nix b/hosts/modules/default.nix index 1dbed53..37e2863 100644 --- a/hosts/modules/default.nix +++ b/hosts/modules/default.nix @@ -5,14 +5,15 @@ ./boot.nix ./console.nix ./desktop.nix - ./impermanence.nix + # ./flatpak.nix + # ./impermanence.nix ./locale.nix ./networking.nix ./nix.nix ./programs.nix ./security.nix ./services.nix - ./stylix.nix + # ./stylix.nix ./users.nix ./virtualisation.nix ]; diff --git a/hosts/modules/flatpak.nix b/hosts/modules/flatpak.nix new file mode 100644 index 0000000..39d57d9 --- /dev/null +++ b/hosts/modules/flatpak.nix @@ -0,0 +1,35 @@ +{ + hostType, + lib, + ... +}: + +{ + config = lib.mkMerge [ + # Common configuration + { + } + + # Server specific configuration + (lib.mkIf hostType.isServer { + }) + + # Workstation specific configuration + (lib.mkIf hostType.isWorkstation { + services.flatpak = { + enable = true; + packages = [ + "com.github.k4zmu2a.spacecadetpinball" + "com.github.tchx84.Flatseal" + "com.steamgriddb.SGDBoop" + "app.zen_browser.zen" + "io.github.Foldex.AdwSteamGtk" + "io.itch.itch" + "org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/24.08" + ]; + uninstallUnmanaged = true; + update.auto.enable = true; + }; + }) + ]; +} diff --git a/hosts/modules/impermanence.nix b/hosts/modules/impermanence.nix index 65e6139..7c5c7d6 100644 --- a/hosts/modules/impermanence.nix +++ b/hosts/modules/impermanence.nix @@ -1,4 +1,8 @@ -{ hostType, lib, ... }: +{ + hostType, + lib, + ... +}: { config = lib.mkMerge [ diff --git a/hosts/io/boot.nix b/hosts/modules/io/boot.nix similarity index 100% rename from hosts/io/boot.nix rename to hosts/modules/io/boot.nix diff --git a/hosts/io/default.nix b/hosts/modules/io/default.nix similarity index 89% rename from hosts/io/default.nix rename to hosts/modules/io/default.nix index 53179f8..aac6e12 100644 --- a/hosts/io/default.nix +++ b/hosts/modules/io/default.nix @@ -2,7 +2,7 @@ { imports = [ - ./boot + ./boot.nix ./ephermal.nix ./hardware-configuration.nix ./programs.nix diff --git a/hosts/io/ephermal.nix b/hosts/modules/io/ephermal.nix similarity index 100% rename from hosts/io/ephermal.nix rename to hosts/modules/io/ephermal.nix diff --git a/hosts/io/hardware-configuration.nix b/hosts/modules/io/hardware-configuration.nix similarity index 100% rename from hosts/io/hardware-configuration.nix rename to hosts/modules/io/hardware-configuration.nix diff --git a/hosts/io/programs.nix b/hosts/modules/io/programs.nix similarity index 100% rename from hosts/io/programs.nix rename to hosts/modules/io/programs.nix diff --git a/hosts/io/services.nix b/hosts/modules/io/services.nix similarity index 100% rename from hosts/io/services.nix rename to hosts/modules/io/services.nix diff --git a/hosts/modules/programs.nix b/hosts/modules/programs.nix index 14d4c9c..8f2da19 100644 --- a/hosts/modules/programs.nix +++ b/hosts/modules/programs.nix @@ -129,21 +129,6 @@ ] ++ kdepkgs; - services.flatpak = { - enable = true; - packages = [ - "com.github.k4zmu2a.spacecadetpinball" - "com.github.tchx84.Flatseal" - "com.steamgriddb.SGDBoop" - "app.zen_browser.zen" - "io.github.Foldex.AdwSteamGtk" - "io.itch.itch" - "org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/24.08" - ]; - uninstallUnmanaged = true; - update.auto.enable = true; - }; - programs = { adb.enable = true; steam.enable = true; @@ -152,7 +137,6 @@ kdeconnect.enable = true; partition-manager.enable = true; gamemode.enable = true; - nix-index-database.comma.enable = true; appimage = { enable = true; binfmt = true; diff --git a/hosts/rotterdam/boot.nix b/hosts/modules/rotterdam/boot.nix similarity index 100% rename from hosts/rotterdam/boot.nix rename to hosts/modules/rotterdam/boot.nix diff --git a/hosts/rotterdam/default.nix b/hosts/modules/rotterdam/default.nix similarity index 100% rename from hosts/rotterdam/default.nix rename to hosts/modules/rotterdam/default.nix diff --git a/hosts/rotterdam/ephermal.nix b/hosts/modules/rotterdam/ephermal.nix similarity index 100% rename from hosts/rotterdam/ephermal.nix rename to hosts/modules/rotterdam/ephermal.nix diff --git a/hosts/rotterdam/hardware-configuration.nix b/hosts/modules/rotterdam/hardware-configuration.nix similarity index 100% rename from hosts/rotterdam/hardware-configuration.nix rename to hosts/modules/rotterdam/hardware-configuration.nix diff --git a/hosts/rotterdam/hardware.nix b/hosts/modules/rotterdam/hardware.nix similarity index 100% rename from hosts/rotterdam/hardware.nix rename to hosts/modules/rotterdam/hardware.nix diff --git a/hosts/rotterdam/programs.nix b/hosts/modules/rotterdam/programs.nix similarity index 100% rename from hosts/rotterdam/programs.nix rename to hosts/modules/rotterdam/programs.nix diff --git a/hosts/rotterdam/services.nix b/hosts/modules/rotterdam/services.nix similarity index 100% rename from hosts/rotterdam/services.nix rename to hosts/modules/rotterdam/services.nix diff --git a/hosts/rotterdam.nix b/hosts/rotterdam.nix index 8e41f04..8b5fa32 100644 --- a/hosts/rotterdam.nix +++ b/hosts/rotterdam.nix @@ -4,8 +4,21 @@ networking.hostName = "rotterdam"; imports = [ - ./rotterdam - ./modules + ./modules/rotterdam + ./modules/boot.nix + ./modules/console.nix + ./modules/desktop.nix + ./modules/flatpak.nix + ./modules/impermanence.nix + ./modules/locale.nix + ./modules/networking.nix + ./modules/nix.nix + ./modules/programs.nix + ./modules/security.nix + ./modules/services.nix + ./modules/stylix.nix + ./modules/users.nix + ./modules/virtualisation.nix ]; nix.nixPath = [ "nixos-config=${./rotterdam.nix}" ]; diff --git a/users/root/default.nix b/users/modules/root/default.nix similarity index 100% rename from users/root/default.nix rename to users/modules/root/default.nix diff --git a/users/user/default.nix b/users/modules/user/default.nix similarity index 100% rename from users/user/default.nix rename to users/modules/user/default.nix diff --git a/users/user/programs.nix b/users/modules/user/programs.nix similarity index 100% rename from users/user/programs.nix rename to users/modules/user/programs.nix diff --git a/users/root.nix b/users/root.nix index 44b8116..be5e00b 100644 --- a/users/root.nix +++ b/users/root.nix @@ -9,6 +9,6 @@ imports = [ ./modules - ./root + ./modules/root ]; } diff --git a/users/user.nix b/users/user.nix index c844a51..9950533 100644 --- a/users/user.nix +++ b/users/user.nix @@ -9,6 +9,6 @@ imports = [ ./modules - ./user + ./modules/user ]; }