From 35e9ce3c5ff43f5499b179fd46d49a64b2b46cf1 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Wed, 23 Sep 2020 13:12:40 +0200 Subject: [PATCH] Split off build.sh from update.sh --- build.sh | 13 +++++++++++++ update.sh | 6 +----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100755 build.sh 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