|
|
|
@ -15,15 +15,15 @@ echo Active tree: "$ROOT" |
|
|
|
|
## Build the libkookie tree |
|
|
|
|
function build { |
|
|
|
|
NIXPKGS_ALLOW_UNFREE=1 \ |
|
|
|
|
nix build -f '<nixpkgs/nixos>' system \ |
|
|
|
|
-I nixos-config="$ROOT" \ |
|
|
|
|
-I "nixpkgs=$DIR/nixpkgs/unstable" \ |
|
|
|
|
-I "nixpkgs-overlays=$DIR/overlays" \ |
|
|
|
|
-I "home-manager=$DIR/home-manager" \ |
|
|
|
|
-I "modules=$DIR/modules" \ |
|
|
|
|
-I "shells=$DIR/shells" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--out-link "$OUT" "$@" |
|
|
|
|
nix build -f '<nixpkgs/nixos>' system \ |
|
|
|
|
-I nixos-config="$ROOT" \ |
|
|
|
|
-I "nixpkgs=$DIR/nixpkgs/unstable" \ |
|
|
|
|
-I "nixpkgs-overlays=$DIR/overlays" \ |
|
|
|
|
-I "home-manager=$DIR/home-manager" \ |
|
|
|
|
-I "modules=$DIR/modules" \ |
|
|
|
|
-I "shells=$DIR/shells" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--out-link "$OUT" "$@" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## Build and output build path for debugging |
|
|
|
@ -40,19 +40,26 @@ function switch { |
|
|
|
|
"$OUT"/bin/switch-to-configuration switch |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## Build and switch to the new configuration (requires root) |
|
|
|
|
function switch_reboot { |
|
|
|
|
build "$@" |
|
|
|
|
nix-env -p /nix/var/nix/profiles/system --set "$OUT" |
|
|
|
|
"$OUT"/bin/switch-to-configuration boot |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 "shells=$DIR/shells" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--argstr system x86_64-linux "$@" |
|
|
|
|
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 "shells=$DIR/shells" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--argstr system x86_64-linux "$@" |
|
|
|
|
|
|
|
|
|
if [ "$RUN" -eq "1" ]; then |
|
|
|
|
echo "Running VM image..." |
|
|
|
@ -62,9 +69,25 @@ function vmimage { |
|
|
|
|
exit 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function iso { |
|
|
|
|
echo "Running iso command" |
|
|
|
|
NIXPKGS_ALLOW_UNFREE=1 \ |
|
|
|
|
nix build -f '<nixpkgs/nixos>' system.build.isoImage \ |
|
|
|
|
-I nixos-config="$DIR/roots/iso.nix" |
|
|
|
|
-I "nixpkgs=$DIR/nixpkgs/unstable" \ |
|
|
|
|
-I "nixpkgs-overlays=$DIR/overlays" \ |
|
|
|
|
-I "home-manager=$DIR/home-manager" \ |
|
|
|
|
-I "modules=$DIR/modules" \ |
|
|
|
|
-I "shells=$DIR/shells" \ |
|
|
|
|
-I "configuration=$DIR/configuration" \ |
|
|
|
|
--out-link "$OUT" "$@" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case "$1" in |
|
|
|
|
-s* | --switch*) shift; switch "$@" ;; |
|
|
|
|
-d* | --debug*) shift; debug "$@" ;; |
|
|
|
|
-sb* | --switch-rb) shift; switch_reboot "$@" ;; |
|
|
|
|
-s* | --switch*) shift; switch "$@" ;; |
|
|
|
|
-d* | --debug*) shift; debug "$@" ;; |
|
|
|
|
-i* | --iso*) shift; iso "$@" ;; |
|
|
|
|
-vr*) shift; vmimage "1" "$@" ;; |
|
|
|
|
-v*) shift; vmimage "0" "$@" ;; |
|
|
|
|
*) build "$@" ;; |
|
|
|
|