Update scripts for flakes
This commit is contained in:
parent
ef64f8bc5d
commit
74573c6eb0
7 changed files with 24 additions and 40 deletions
10
build.sh
10
build.sh
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
set -x
|
|
||||||
|
|
||||||
nix-build \
|
|
||||||
--no-out-link \
|
|
||||||
--pure \
|
|
||||||
"${@}"
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -18,7 +18,7 @@
|
||||||
use_flake() {
|
use_flake() {
|
||||||
watch_file flake.nix
|
watch_file flake.nix
|
||||||
watch_file flake.lock
|
watch_file flake.lock
|
||||||
eval "$(nix --experimental-features 'nix-commnand flakes' print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"
|
eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,14 +5,6 @@
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
'';
|
'';
|
||||||
package = pkgs.nixUnstable.overrideAttrs (oldAttrs: {
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "NixOS";
|
|
||||||
repo = "nix";
|
|
||||||
rev = "ff314f186e3f91d87af6ad96c0ae3b472494b940";
|
|
||||||
hash = "sha256-QibpLo4/gf2xYGoeQcgjZzH/qy5TBRVH+QCHgqOwur0=";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "hourly";
|
dates = "hourly";
|
||||||
|
@ -25,6 +17,19 @@
|
||||||
trustedUsers = [ "@wheel" ];
|
trustedUsers = [ "@wheel" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
|
nix = super.nixUnstable.overrideAttrs (oldAttrs: {
|
||||||
|
src = self.fetchFromGitHub {
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nix";
|
||||||
|
rev = "ff314f186e3f91d87af6ad96c0ae3b472494b940";
|
||||||
|
hash = "sha256-QibpLo4/gf2xYGoeQcgjZzH/qy5TBRVH+QCHgqOwur0=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
nixpkgs.config = import ./nix-store/config.nix;
|
nixpkgs.config = import ./nix-store/config.nix;
|
||||||
|
|
||||||
home-manager.users.charlotte = { ... }: {
|
home-manager.users.charlotte = { ... }: {
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = with nixpkgs.legacyPackages.${system}; [
|
buildInputs = with nixpkgs.legacyPackages.${system}; [ nixpkgs-fmt ];
|
||||||
jq
|
|
||||||
nixUnstable
|
|
||||||
nixpkgs-fmt
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}) // {
|
}) // {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
|
||||||
src = ./.;
|
|
||||||
}).shellNix
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
set -x
|
|
||||||
|
|
||||||
BUILD_ARGS=("--secret-key-files" "/etc/nix/key.private")
|
|
||||||
for machine in machines/*
|
|
||||||
do
|
|
||||||
output=$(./build.sh "${BUILD_ARGS[@]}" "$machine")
|
|
||||||
nix-env --set -p /nix/var/nix/profiles/per-user/charlotte/${machine#machines/} $output
|
|
||||||
done
|
|
12
update.sh
12
update.sh
|
@ -2,16 +2,22 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
./update-imports.sh
|
nix flake update
|
||||||
|
|
||||||
BUILD_ARGS=(
|
BUILD_ARGS=(
|
||||||
"--builders"
|
"--builders"
|
||||||
"ssh://charlotte@sunspear.vanpetegem.me"
|
"ssh://charlotte@sunspear.vanpetegem.me"
|
||||||
|
"--builders-use-substitutes"
|
||||||
"--extra-substituters"
|
"--extra-substituters"
|
||||||
"ssh://charlotte@sunspear.vanpetegem.me"
|
"ssh://charlotte@sunspear.vanpetegem.me"
|
||||||
"--trusted-public-keys"
|
"--trusted-public-keys"
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= sunspear-nix-cache:4mgL4qS7EweCug1gAFiZKgQK+xuoJMBYThIUE+kPX4s="
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= sunspear-nix-cache:4mgL4qS7EweCug1gAFiZKgQK+xuoJMBYThIUE+kPX4s="
|
||||||
)
|
)
|
||||||
result="$(./build.sh "${BUILD_ARGS[@]}" "./machines/$(hostname)")"
|
|
||||||
|
|
||||||
sudo bash -c "nix-env --set --profile /nix/var/nix/profiles/system/ ${result} && ${result}/bin/switch-to-configuration switch"
|
if [ -d "../nixpkgs" ]
|
||||||
|
then
|
||||||
|
BUILD_ARGS+=("--override-input" "nixpkgs" "../nixpkgs")
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue