diff --git a/hosts/default.nix b/hosts/default.nix index 52d2a59b3..fbfc86ef3 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -15,8 +15,40 @@ let unstableModules = [ ]; addToDisabledModules = [ ]; + lib = lib.extend ( + final: prev: { + nixosSystemExtended = { modules, ... } @ args: + lib.nixosSystem (args // { + modules = + let + isoConfig = ( + import (nixos + "/nixos/lib/eval-config.nix") + ( + args // { + modules = modules ++ [ + (nixos + "/installer/cd-dvd/installation-cd-minimal-new-kernel.nix") + { + isoImage.imageBaseName = "nixos-" + config.networking.hostName; + } + ]; + } + ) + ).config; + in + modules ++ [ + { + system.build = { + iso = isoConfig.system.build.isoImage; + }; + } + ]; + } + ); + } + ); + config = hostName: - lib.nixosSystem { + lib.nixosSystemExtended { inherit system; specialArgs = diff --git a/hosts/niximg.nix b/hosts/niximg.nix deleted file mode 100644 index 823eeb604..000000000 --- a/hosts/niximg.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ unstableModulesPath, ... }: { - imports = [ - # passwd is nixos by default - ../users/nixos - # passwd is empty by default - ../users/root - "${unstableModulesPath}/installer/cd-dvd/iso-image.nix" - ]; - - isoImage.makeEfiBootable = true; - isoImage.makeUsbBootable = true; - networking.networkmanager.enable = true; -} diff --git a/shell/default.nix b/shell/default.nix index 31e01c24b..4a6c5a4fe 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -12,7 +12,7 @@ let flk = pkgs.writeShellScriptBin "flk" '' if [[ -z "$1" ]]; then - echo "Usage: $(basename "$0") [ iso | up | install {host} | {host} [switch|boot|test] ]" + echo "Usage: $(basename "$0") [ up | iso {host} | install {host} | {host} [switch|boot|test] ]" elif [[ "$1" == "up" ]]; then mkdir -p $DEVSHELL_ROOT/up hostname=$(hostname) @@ -24,7 +24,7 @@ let git add -f $DEVSHELL_ROOT/up/$hostname git add -f $DEVSHELL_ROOT/hosts/up-$hostname.nix elif [[ "$1" == "iso" ]]; then - nix build $DEVSHELL_ROOT#nixosConfigurations.niximg.${build}.isoImage "${"\${@:2}"}" + nix build "$DEVSHELL_ROOT#nixosConfigurations.$2.${build}.isoImage" "${"\${@:2}"}" elif [[ "$1" == "install" ]]; then sudo nixos-install --flake "$DEVSHELL_ROOT#$2" "${"\${@:3}"}" else