diff options
-rw-r--r-- | .sops.yaml | 1 | ||||
-rw-r--r-- | flake.nix | 75 | ||||
-rw-r--r-- | home/cez/home.nix | 1 | ||||
-rw-r--r-- | home/common/home.nix | 2 | ||||
-rw-r--r-- | home/common/modules/dev.nix (renamed from home/pc/modules/dev.nix) | 0 | ||||
-rw-r--r-- | home/pc/home.nix | 1 | ||||
-rw-r--r-- | os/cez/configuration.nix | 3 | ||||
-rw-r--r-- | os/common/configuration.nix | 8 | ||||
-rw-r--r-- | os/common/modules/home-manager.nix | 18 | ||||
-rw-r--r-- | os/fscusat/configuration.nix | 1 | ||||
-rw-r--r-- | os/kay/configuration.nix | 1 | ||||
-rw-r--r-- | os/kay/modules/alina.nix | 4 | ||||
-rw-r--r-- | os/lia/configuration.nix | 2 | ||||
-rw-r--r-- | os/pc/configuration.nix | 9 | ||||
-rw-r--r-- | os/server/configuration.nix | 3 |
15 files changed, 76 insertions, 53 deletions
@@ -5,7 +5,6 @@ keys: - &kay age15989j5lkkf2kn5wa2p6qc8wlxjjksc63k5ync8rz8t4e87394pzqm7h4rm - &lia age1l9kd320xj89vdr06u7ej8fhjrxl470t04trgwd3jwzczknf05aesv2pp8x - - &dspace age15hsgvg3tz9lql0jpr5x8pm66r42kemd65fpz0wa6t8nhvwrxygcssjxd9c - &fscusat age1yqma4xm4qss787cnwv2v7j2e0eswhm5k9f27n6zhp74euyydv9essxdrmn creation_rules: @@ -33,69 +33,50 @@ let lib = nixpkgs.lib; - makeGlobalImports = - host: - [ - ./global/common - ] - ++ lib.optional (builtins.pathExists ./global/${host}) ./global/${host}; - - makeHomeImports = - host: - makeGlobalImports host - ++ [ - ./home/common/home.nix - ] - ++ lib.optional (builtins.pathExists ./home/${host}) ./home/${host}/home.nix; - makeNixos = host: system: lib.nixosSystem { inherit system; - specialArgs = { inherit nixos-hardware; }; - modules = [ - alina.nixosModules.alina - sops-nix.nixosModules.sops + specialArgs = { + inherit alina; + inherit nixos-hardware; + }; + modules = [ + self.nixosModules.common ./os/${host}/configuration.nix - { - networking.hostName = host; - nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; - } - - home-manager.nixosModules.home-manager - ( - { config, ... }: - let - username = config.global.userdata.name; - in - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = false; - users.${username} = - { ... }: - { - imports = makeHomeImports host; - }; - }; - } - ) - ] ++ (makeGlobalImports host); + ]; }; makeHome = host: system: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; - modules = makeHomeImports host; + modules = [ + ./home/common/home.nix + ] ++ lib.optional (builtins.pathExists ./home/${host}) ./home/${host}/home.nix; }; in { - nixosConfigurations = lib.genAttrs [ "cez" "kay" "lia" "fscusat" "dspace" ] ( - host: makeNixos host "x86_64-linux" - ); + nixosModules = lib.genAttrs [ "common" "server" "pc" ] (host: { + nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; + imports = [ + ./os/${host}/configuration.nix + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + ]; + }); + + nixosConfigurations = lib.genAttrs [ + "common" + "server" + "pc" + "cez" + "kay" + "lia" + "fscusat" + ] (host: makeNixos host "x86_64-linux"); homeConfigurations = lib.genAttrs [ "common" "wayland" "pc" "cez" ] ( host: makeHome host "x86_64-linux" diff --git a/home/cez/home.nix b/home/cez/home.nix index f39ddff..c83a5fa 100644 --- a/home/cez/home.nix +++ b/home/cez/home.nix @@ -3,5 +3,6 @@ imports = [ ../pc/home.nix ./modules/wayland.nix + ../../global/cez ]; } diff --git a/home/common/home.nix b/home/common/home.nix index b2f4480..6d26166 100644 --- a/home/common/home.nix +++ b/home/common/home.nix @@ -11,6 +11,8 @@ in ./modules/mimeapps.nix ./modules/xdg_ninja.nix ./modules/ssh.nix + ./modules/dev.nix + ../../global/common ]; programs.home-manager.enable = true; diff --git a/home/pc/modules/dev.nix b/home/common/modules/dev.nix index 6488aa8..6488aa8 100644 --- a/home/pc/modules/dev.nix +++ b/home/common/modules/dev.nix diff --git a/home/pc/home.nix b/home/pc/home.nix index 54a2e09..e34507c 100644 --- a/home/pc/home.nix +++ b/home/pc/home.nix @@ -2,7 +2,6 @@ { imports = [ ./modules/pass.nix - ./modules/dev.nix ../wayland/home.nix ]; diff --git a/os/cez/configuration.nix b/os/cez/configuration.nix index a069f21..a05f00e 100644 --- a/os/cez/configuration.nix +++ b/os/cez/configuration.nix @@ -7,5 +7,8 @@ ./modules/specialisation.nix ./modules/wireguard.nix ./modules/tlp.nix + ../../global/cez ]; + + networking.hostName = "cez"; } diff --git a/os/common/configuration.nix b/os/common/configuration.nix index b1dd263..d8d465e 100644 --- a/os/common/configuration.nix +++ b/os/common/configuration.nix @@ -16,11 +16,17 @@ in ./modules/user.nix ./modules/environment.nix ./modules/pppd.nix + ./modules/home-manager.nix + ../../global/common ]; system.stateVersion = "24.05"; time.timeZone = "Asia/Kolkata"; - networking.useDHCP = false; + + networking = { + useDHCP = false; + hostName = lib.mkOptionDefault "common"; + }; swapDevices = lib.mkDefault [ { diff --git a/os/common/modules/home-manager.nix b/os/common/modules/home-manager.nix new file mode 100644 index 0000000..d93df49 --- /dev/null +++ b/os/common/modules/home-manager.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: +let + username = config.global.userdata.name; + host = config.networking.hostName; +in +{ + home-manager = { + useGlobalPkgs = true; + useUserPackages = false; + users.${username} = + { ... }: + { + imports = [ + ../../../home/common/home.nix + ] ++ lib.optional (builtins.pathExists ../../../home/${host}) ../../../home/${host}/home.nix; + }; + }; +} diff --git a/os/fscusat/configuration.nix b/os/fscusat/configuration.nix index 598ae8c..68d9765 100644 --- a/os/fscusat/configuration.nix +++ b/os/fscusat/configuration.nix @@ -10,6 +10,7 @@ ./modules/mirror ]; + networking.hostName = "fscusat"; services.openssh.ports = [ 22 465 diff --git a/os/kay/configuration.nix b/os/kay/configuration.nix index 696cad3..a7765a8 100644 --- a/os/kay/configuration.nix +++ b/os/kay/configuration.nix @@ -21,6 +21,7 @@ ./modules/alina.nix ]; + networking.hostName = "kay"; boot = { consoleLogLevel = 3; binfmt.emulatedSystems = [ "aarch64-linux" ]; diff --git a/os/kay/modules/alina.nix b/os/kay/modules/alina.nix index 6f8fac4..c567953 100644 --- a/os/kay/modules/alina.nix +++ b/os/kay/modules/alina.nix @@ -1,8 +1,10 @@ -{ config, pkgs, ... }: +{ config, alina, ... }: let domain = "alinafs.com"; in { + imports = [ alina.nixosModules.alina ]; + sops.secrets."misc/alina" = { }; services.postgresql = { diff --git a/os/lia/configuration.nix b/os/lia/configuration.nix index 6e5323e..27a0959 100644 --- a/os/lia/configuration.nix +++ b/os/lia/configuration.nix @@ -10,4 +10,6 @@ ./modules/lxc.nix ./modules/sshfwd.nix ]; + + networking.hostName = "lia"; } diff --git a/os/pc/configuration.nix b/os/pc/configuration.nix index 33f38cd..423f66d 100644 --- a/os/pc/configuration.nix +++ b/os/pc/configuration.nix @@ -1,4 +1,9 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + lib, + ... +}: let user = config.global.userdata.name; in @@ -15,6 +20,8 @@ in ./modules/firejail.nix ]; + networking.hostName = lib.mkDefault "pc"; + boot = { consoleLogLevel = 3; kernelPackages = pkgs.linuxPackages_latest; diff --git a/os/server/configuration.nix b/os/server/configuration.nix index 24f6f09..124b227 100644 --- a/os/server/configuration.nix +++ b/os/server/configuration.nix @@ -1,7 +1,8 @@ -{ ... }: +{ lib, ... }: { imports = [ ../common/configuration.nix ]; + networking.hostName = lib.mkDefault "server"; services.openssh = { enable = true; settings.PasswordAuthentication = false; |