diff --git a/shell.nix b/shell.nix index e5c4214..c677a80 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,24 @@ { pkgs ? import {} }: +let + configs = "${toString ./.}#nixosConfigurations"; + hostname = pkgs.lib.fileContents /etc/hostname; + build = "config.system.build"; + + rebuild = pkgs.writeShellScriptBin "rebuild" '' + if [[ -z $1 ]]; then + echo "Usage: $0 [host] {switch|boot|test|iso}" + elif [[ $1 == "iso" ]]; then + nix build ${configs}.niximg.${build}.isoImage + elif [[ -z $2 ]]; then + nix run -vv ${configs}.${hostname}.${build}.toplevel -c switch-to-configuration $1 + else + nix run -vv ${configs}.$1.${build}.toplevel -c switch-to-configuration $2 + fi + ''; +in pkgs.mkShell { nativeBuildInputs = with pkgs; [ + rebuild nixFlakes ];