Skip to content

Commit

Permalink
host: add deault implementation for system.build.isoImage target (per…
Browse files Browse the repository at this point in the history
… host)
  • Loading branch information
David Arnold committed Jan 25, 2021
1 parent a1fade8 commit a5ef9c9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
34 changes: 33 additions & 1 deletion hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
13 changes: 0 additions & 13 deletions hosts/niximg.nix

This file was deleted.

4 changes: 2 additions & 2 deletions shell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit a5ef9c9

Please sign in to comment.