diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-09-20 02:18:09 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-09-20 02:23:35 +0200 |
commit | daaf66420582db82f8cad09510324656d429d229 (patch) | |
tree | d335d4265669c7ad3dee658389bacda787830b42 | |
parent | Misc: Remove code duplication by merging sets (diff) | |
download | nixos-config-daaf66420582db82f8cad09510324656d429d229.tar.gz nixos-config-daaf66420582db82f8cad09510324656d429d229.tar.bz2 nixos-config-daaf66420582db82f8cad09510324656d429d229.zip |
Fully separate hosts from hardwares
Now hosts/ and hardware/ live under different directories and their joined system configurations are permutated and exposed throught the host-hardware outputs
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | hardware/chromebook/default.nix (renamed from hosts/luna/hardware/chromebook/default.nix) | 0 | ||||
-rw-r--r-- | hardware/chromebook/disks.nix (renamed from hosts/luna/hardware/chromebook/disks.nix) | 0 | ||||
-rw-r--r-- | hardware/chromebook/hardware.nix (renamed from hosts/luna/hardware/chromebook/hardware.nix) | 0 | ||||
-rw-r--r-- | hardware/laptop/default.nix (renamed from hosts/phobos/hardware/laptop/default.nix) | 0 | ||||
-rw-r--r-- | hardware/laptop/disks.nix (renamed from hosts/phobos/hardware/laptop/disks.nix) | 0 | ||||
-rw-r--r-- | hardware/laptop/hardware.nix (renamed from hosts/phobos/hardware/laptop/hardware.nix) | 0 | ||||
-rw-r--r-- | hardware/virtualbox/default.nix (renamed from hosts/vm/hardware/virtualbox/default.nix) | 0 | ||||
-rw-r--r-- | hardware/virtualbox/disks.nix (renamed from hosts/vm/hardware/virtualbox/disks.nix) | 0 | ||||
-rw-r--r-- | hardware/virtualbox/hardware.nix (renamed from hosts/vm/hardware/virtualbox/hardware.nix) | 0 | ||||
-rw-r--r-- | hosts/default.nix | 19 |
11 files changed, 18 insertions, 11 deletions
diff --git a/README.md b/README.md index 23c16e8..3d6b3bc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ My Personal NixOS Flake. ## Installing ``` -nixos-install --flake . #HOST +nixos-install --flake . #HOST-HARDWARE ``` ## Updating @@ -14,23 +14,23 @@ nixos-install --flake . #HOST ``` nix flake update -nixos-rebuild switch --flake . #HOST +nixos-rebuild switch --flake . #HOST-HARDWARE ``` # Non-Nixos ## Installing ``` -nix build .#homeManagerConfigurations.HOST.activationPackage +nix build .#homeManagerConfigurations.HOST-HARDWARE.activationPackage ./result/activate ``` ## Updating ``` -home-manager switch --flake .#HOST +home-manager switch --flake .#HOST-HARDWARE ``` # ISO ## Building ``` -nix build .#isoConfigurations.HOST.config.system.build.isoImage +nix build .#isoConfigurations.HOST-HARDWARE.config.system.build.isoImage ``` diff --git a/hosts/luna/hardware/chromebook/default.nix b/hardware/chromebook/default.nix index b0125ee..b0125ee 100644 --- a/hosts/luna/hardware/chromebook/default.nix +++ b/hardware/chromebook/default.nix diff --git a/hosts/luna/hardware/chromebook/disks.nix b/hardware/chromebook/disks.nix index ad0e014..ad0e014 100644 --- a/hosts/luna/hardware/chromebook/disks.nix +++ b/hardware/chromebook/disks.nix diff --git a/hosts/luna/hardware/chromebook/hardware.nix b/hardware/chromebook/hardware.nix index 85b7227..85b7227 100644 --- a/hosts/luna/hardware/chromebook/hardware.nix +++ b/hardware/chromebook/hardware.nix diff --git a/hosts/phobos/hardware/laptop/default.nix b/hardware/laptop/default.nix index b0125ee..b0125ee 100644 --- a/hosts/phobos/hardware/laptop/default.nix +++ b/hardware/laptop/default.nix diff --git a/hosts/phobos/hardware/laptop/disks.nix b/hardware/laptop/disks.nix index 07618df..07618df 100644 --- a/hosts/phobos/hardware/laptop/disks.nix +++ b/hardware/laptop/disks.nix diff --git a/hosts/phobos/hardware/laptop/hardware.nix b/hardware/laptop/hardware.nix index cbec828..cbec828 100644 --- a/hosts/phobos/hardware/laptop/hardware.nix +++ b/hardware/laptop/hardware.nix diff --git a/hosts/vm/hardware/virtualbox/default.nix b/hardware/virtualbox/default.nix index b0125ee..b0125ee 100644 --- a/hosts/vm/hardware/virtualbox/default.nix +++ b/hardware/virtualbox/default.nix diff --git a/hosts/vm/hardware/virtualbox/disks.nix b/hardware/virtualbox/disks.nix index 6ba15ec..6ba15ec 100644 --- a/hosts/vm/hardware/virtualbox/disks.nix +++ b/hardware/virtualbox/disks.nix diff --git a/hosts/vm/hardware/virtualbox/hardware.nix b/hardware/virtualbox/hardware.nix index 470f733..470f733 100644 --- a/hosts/vm/hardware/virtualbox/hardware.nix +++ b/hardware/virtualbox/hardware.nix diff --git a/hosts/default.nix b/hosts/default.nix index a43f2bd..2a1f526 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -2,11 +2,16 @@ let secrets = import ../secrets; - #TODO: Better implementation of hardare (not having to declare here but just in command) hosts = [ - { host = "phobos"; hardware = "laptop"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } - { host = "luna"; hardware = "chromebook"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } - { host = "vm"; hardware = "virtualbox"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } + { host = "phobos"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } + { host = "luna"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } + { host = "vm"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } + ]; + + hardwares = [ + { hardware = "laptop"; } + { hardware = "chromebook"; } + { hardware = "virtualbox"; } ]; mkHost = { host, hardware, system, timezone, location }: extraModules: isNixOS: isIso: isHardware: @@ -26,7 +31,7 @@ let extraArgs = { inherit pkgs inputs isIso isHardware user secrets timezone location; hostname = host; }; #TODO: FIXME extraSpecialModules = if isIso then extraModules ++ [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ] else extraModules; - megaSpecialModules = if isHardware then extraSpecialModules ++ [ ./${ host}/hardware/${hardware} ] else extraSpecialModules; + megaSpecialModules = if isHardware then extraSpecialModules ++ [ ../hardware/${hardware} ] else extraSpecialModules; in if isNixOS then @@ -61,10 +66,12 @@ let ./${ host }/home.nix ]; }; + + permutatedHosts = lib.concatMap (hardware: map (host: host // hardware) hosts) hardwares; in /* We have a list of sets. Map each element of the list applying the mkHost function to its elements and returning a set in the listToAttrs format builtins.listToAttrs on the result */ -builtins.listToAttrs (map ({ host, hardware, system, timezone, location }: { name = host; value = mkHost { inherit host hardware system timezone location; } extraModules isNixOS isIso isHardware; }) hosts) +builtins.listToAttrs (map ({ host, hardware, system, timezone, location }: { name = host + "-" + hardware; value = mkHost { inherit host hardware system timezone location; } extraModules isNixOS isIso isHardware; }) permutatedHosts) |