diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..62c554c4 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail +set -x + +BUILD_ARGS=() + +if [ -d "../nixpkgs" -a -z "${NO_LOCAL:-}" ] +then + BUILD_ARGS+=("--override-input" "nixpkgs" "../nixpkgs" "--no-write-lock-file") +fi + +sudo nix build --profile /nix/var/nix/profiles/system ".#nixosConfigurations.$(hostname).config.system.build.toplevel" --no-link "${BUILD_ARGS[@]}" && \ + sudo nix shell -vv /nix/var/nix/profiles/system -c switch-to-configuration switch diff --git a/update.sh b/update.sh index 41fe64cd..cdaf4d00 100755 --- a/update.sh +++ b/update.sh @@ -2,11 +2,8 @@ set -euo pipefail set -x -BUILD_ARGS=() - if [ -d "../nixpkgs" -a -z "${NO_LOCAL:-}" ] then - BUILD_ARGS+=("--override-input" "nixpkgs" "../nixpkgs" "--no-write-lock-file") pushd ../nixpkgs git fetch --all --prune git rebase upstream/nixos-unstable-small || exit 1 @@ -16,5 +13,4 @@ fi nix flake update --update-input nixpkgs --update-input home-manager --update-input flake-utils -sudo nix build --profile /nix/var/nix/profiles/system ".#nixosConfigurations.$(hostname).config.system.build.toplevel" --no-link "${BUILD_ARGS[@]}" && \ - sudo nix --experimental-features "nix-command flakes" shell -vv /nix/var/nix/profiles/system -c switch-to-configuration switch +./build.sh