Split off build.sh from update.sh

This commit is contained in:
Charlotte Van Petegem 2020-09-23 13:12:40 +02:00
parent 397c0e222f
commit 35e9ce3c5f
2 changed files with 14 additions and 5 deletions

13
build.sh Executable file
View file

@ -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

View file

@ -2,11 +2,8 @@
set -euo pipefail set -euo pipefail
set -x set -x
BUILD_ARGS=()
if [ -d "../nixpkgs" -a -z "${NO_LOCAL:-}" ] if [ -d "../nixpkgs" -a -z "${NO_LOCAL:-}" ]
then then
BUILD_ARGS+=("--override-input" "nixpkgs" "../nixpkgs" "--no-write-lock-file")
pushd ../nixpkgs pushd ../nixpkgs
git fetch --all --prune git fetch --all --prune
git rebase upstream/nixos-unstable-small || exit 1 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 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[@]}" && \ ./build.sh
sudo nix --experimental-features "nix-command flakes" shell -vv /nix/var/nix/profiles/system -c switch-to-configuration switch