ops/nixos: move rebuilder derivation into its own file.
This commit is contained in:
parent
fc8e2e7419
commit
606151ddb4
2 changed files with 15 additions and 14 deletions
|
@ -12,20 +12,7 @@ let
|
|||
modules = [ (baseModule systemName) (args: { imports = [ lib/common.nix config ]; }) ];
|
||||
}).config.system.build.toplevel;
|
||||
systems = [ "porcorosso" "ixvm-fra01" "marukuru" "clouvider-fra01" ];
|
||||
rebuilder = system:
|
||||
pkgs.writeShellScriptBin "rebuilder" ''
|
||||
set -ue
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
exec sudo "$0" "$@"
|
||||
fi
|
||||
|
||||
export AWS_ACCESS_KEY_ID="${depot.ops.secrets.nixCache.AWS_ACCESS_KEY_ID}"
|
||||
export AWS_SECRET_ACCESS_KEY="${depot.ops.secrets.nixCache.AWS_SECRET_ACCESS_KEY}"
|
||||
|
||||
system="$(nix-build -E '(import <depot> {}).ops.nixos.${system}' --no-out-link)"
|
||||
nix-env -p /nix/var/nix/profiles/system --set "$system"
|
||||
"$system/bin/switch-to-configuration" switch
|
||||
'';
|
||||
rebuilder = system: (import ./lib/rebuilder.nix (args // { system = system; }));
|
||||
systemCfgs = lib.genAttrs systems
|
||||
(name: import (./. + "/${name}"));
|
||||
systemDrvs = mapAttrs systemFor systemCfgs;
|
||||
|
|
14
ops/nixos/lib/rebuilder.nix
Normal file
14
ops/nixos/lib/rebuilder.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ system, depot, pkgs, ... }:
|
||||
pkgs.writeShellScriptBin "rebuilder" ''
|
||||
set -ue
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
exec sudo "$0" "$@"
|
||||
fi
|
||||
|
||||
export AWS_ACCESS_KEY_ID="${depot.ops.secrets.nixCache.AWS_ACCESS_KEY_ID}"
|
||||
export AWS_SECRET_ACCESS_KEY="${depot.ops.secrets.nixCache.AWS_SECRET_ACCESS_KEY}"
|
||||
|
||||
system="$(nix-build -E '(import <depot> {}).ops.nixos.${system}' --no-out-link)"
|
||||
nix-env -p /nix/var/nix/profiles/system --set "$system"
|
||||
"$system/bin/switch-to-configuration" switch
|
||||
''
|
Loading…
Reference in a new issue