diff options
author | Karel Kočí <cynerd@email.cz> | 2024-02-20 21:34:43 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2024-02-20 21:34:43 +0100 |
commit | c014ef4360ebc9fe23d5abf253141f44a94160ca (patch) | |
tree | 19300ce3effeca6b435cb5c8c2891e5a0c7f8656 /nixos | |
parent | c9c4f84bd1303281d7520c2a519d7be7d678c83c (diff) | |
download | nixos-personal-c014ef4360ebc9fe23d5abf253141f44a94160ca.tar.gz nixos-personal-c014ef4360ebc9fe23d5abf253141f44a94160ca.tar.bz2 nixos-personal-c014ef4360ebc9fe23d5abf253141f44a94160ca.zip |
nixos: merge router to normal modules
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/configurations.nix | 44 | ||||
-rw-r--r-- | nixos/default.nix | 3 | ||||
-rw-r--r-- | nixos/modules/router.nix (renamed from nixos/routers/router.nix) | 0 | ||||
-rw-r--r-- | nixos/modules/switch.nix (renamed from nixos/routers/switch.nix) | 0 | ||||
-rw-r--r-- | nixos/modules/wifi-adm.nix (renamed from nixos/routers/wifi-adm.nix) | 0 | ||||
-rw-r--r-- | nixos/modules/wifi-spt.nix (renamed from nixos/routers/wifi-spt.nix) | 0 | ||||
-rw-r--r-- | nixos/routers/default.nix | 6 |
7 files changed, 21 insertions, 32 deletions
diff --git a/nixos/configurations.nix b/nixos/configurations.nix index 47f6ce2..7d9bc3d 100644 --- a/nixos/configurations.nix +++ b/nixos/configurations.nix @@ -1,7 +1,6 @@ -self: -with builtins; -with self.inputs.nixpkgs.lib; let +self: let inherit (self.inputs) nixpkgs nixos-hardware nixturris vpsadminos; + inherit (nixpkgs.lib) optional hasAttr composeManyExtensions; modules = hostname: [ @@ -15,23 +14,19 @@ with self.inputs.nixpkgs.lib; let ] ++ (optional (hasAttr "machine-${hostname}" self.nixosModules) self.nixosModules."machine-${hostname}"); specialArgs = { - lib = nixpkgs.lib.extend (prev: final: import ../lib prev); + lib = nixpkgs.lib.extend (composeManyExtensions [ + nixturris.overlays.lib + (prev: final: import ../lib prev) + ]); }; genericSystem = { - system ? "x86_64-linux", + platform ? {system = "x86_64-linux";}, extra_modules ? [], }: hostname: { ${hostname} = nixturris.lib.addBuildPlatform (nixpkgs.lib.nixosSystem { - inherit system specialArgs; - modules = - (modules hostname) - ++ extra_modules - ++ [ - { - nixpkgs.hostPlatform.system = system; - } - ]; + inherit specialArgs; + modules = (modules hostname) ++ extra_modules ++ [{nixpkgs.hostPlatform = platform;}]; }); }; amd64System = genericSystem {}; @@ -42,7 +37,7 @@ with self.inputs.nixpkgs.lib; let ]; }; raspi2System = genericSystem { - system = "armv7l-linux"; + platform.system = "armv7l-linux"; extra_modules = [ nixos-hardware.nixosModules.raspberry-pi-2 ({pkgs, ...}: { @@ -52,7 +47,7 @@ with self.inputs.nixpkgs.lib; let ]; }; raspi3System = genericSystem { - system = "aarch64-linux"; + platform.system = "aarch64-linux"; extra_modules = [ ({pkgs, ...}: { boot = { @@ -68,7 +63,7 @@ with self.inputs.nixpkgs.lib; let ]; }; beagleboneSystem = genericSystem { - system = "armv7l-linux"; + platform.system = "armv7l-linux"; extra_modules = [ { boot.loader = { @@ -82,10 +77,9 @@ with self.inputs.nixpkgs.lib; let vmSystem = system: hostSystem: genericSystem { - inherit system; + platform.system = system; extra_modules = [ { - nixpkgs.hostPlatform.system = system; boot.loader.systemd-boot.enable = false; virtualisation.qemu.package = self.nixosConfigurations."${hostSystem}".pkgs.qemu; } @@ -95,12 +89,14 @@ with self.inputs.nixpkgs.lib; let armv7lvmSystem = vmSystem "armv7l-linux"; aarch64vmSystem = vmSystem "aarch64-linux"; - turrisSystem = board: hostname: { - ${hostname} = nixturris.lib.nixturrisSystem { - inherit nixpkgs board specialArgs; - modules = [self.nixosModules.defaultRouters] ++ modules hostname; + turrisSystem = board: + genericSystem { + platform = nixturris.lib.boardPlatform.${board}; + extra_modules = [ + nixturris.nixosModules.default + {turris.board = board;} + ]; }; - }; turrisMoxSystem = turrisSystem "mox"; turrisOmniaSystem = turrisSystem "omnia"; in diff --git a/nixos/default.nix b/nixos/default.nix index 90d6b3a..8385b11 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,7 +1,6 @@ self: let machines = import ./machine self; modules = import ./modules self; - routers = import ./routers; in modules // machines @@ -9,11 +8,11 @@ in default = { imports = with self.inputs; [ + nixosdeploy.nixosModules.default shellrc.nixosModules.default usbkey.nixosModules.default nixbigclown.nixosModules.default ] ++ builtins.attrValues modules; }; - defaultRouters = {imports = builtins.attrValues routers;}; } diff --git a/nixos/routers/router.nix b/nixos/modules/router.nix index ed634b1..ed634b1 100644 --- a/nixos/routers/router.nix +++ b/nixos/modules/router.nix diff --git a/nixos/routers/switch.nix b/nixos/modules/switch.nix index 16d57bc..16d57bc 100644 --- a/nixos/routers/switch.nix +++ b/nixos/modules/switch.nix diff --git a/nixos/routers/wifi-adm.nix b/nixos/modules/wifi-adm.nix index 733f167..733f167 100644 --- a/nixos/routers/wifi-adm.nix +++ b/nixos/modules/wifi-adm.nix diff --git a/nixos/routers/wifi-spt.nix b/nixos/modules/wifi-spt.nix index 769449d..769449d 100644 --- a/nixos/routers/wifi-spt.nix +++ b/nixos/modules/wifi-spt.nix diff --git a/nixos/routers/default.nix b/nixos/routers/default.nix deleted file mode 100644 index dfc1266..0000000 --- a/nixos/routers/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - cynerd-router = import ./router.nix; - cynerd-switch = import ./switch.nix; - cynerd-wifi-adm = import ./wifi-adm.nix; - cynerd-wifi-spt = import ./wifi-spt.nix; -} |