libkookie: formatting change of build script

main
Katharina Fey 2 years ago
parent 69f1d7da38
commit 20993c24b1
Signed by: kookie
GPG Key ID: 90734A9E619C8A6C
  1. 63
      infra/libkookie/build

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

Loading…
Cancel
Save