|
|
|
@ -24,9 +24,8 @@ function build { |
|
|
|
|
|
|
|
|
|
## Build and output build path for debugging |
|
|
|
|
function debug { |
|
|
|
|
build "$@" |
|
|
|
|
echo "Build path: $OUT" |
|
|
|
|
exit 0 |
|
|
|
|
exec build "$@" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## Build and switch to the new configuration (requires root) |
|
|
|
@ -36,9 +35,32 @@ function switch { |
|
|
|
|
"$OUT"/bin/switch-to-configuration switch |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function vmimage { |
|
|
|
|
RUN="$1"; shift |
|
|
|
|
|
|
|
|
|
NIXPKGS_ALLOW_UNFREE=1 \ |
|
|
|
|
nix build -f '<nixpkgs/nixos>' vm \ |
|
|
|
|
-I nixos-config="$ROOT" \ |
|
|
|
|
-I "nixpkgs=$DIR" \ |
|
|
|
|
-I "nixpkgs-overlays=$DIR/overlays" \ |
|
|
|
|
-I "home-manager=$DIR/home-manager" \ |
|
|
|
|
-I "modules=$DIR/modules" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--argstr system x86_64-linux "$@" |
|
|
|
|
|
|
|
|
|
if [ "$RUN" -eq "1" ]; then |
|
|
|
|
echo "Running VM image..." |
|
|
|
|
./result/bin/run-$HOST-vm |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
exit 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case "$1" in |
|
|
|
|
-s* | --switch*) shift; switch "$@" ;; |
|
|
|
|
-d* | --debug*) shift; debug "$@" ;; |
|
|
|
|
-vr*) shift; vmimage "1" "$@" ;; |
|
|
|
|
-v*) shift; vmimage "0" "$@" ;; |
|
|
|
|
*) build "$@" ;; |
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|