diff options
author | Vincent Ambo <mail@tazj.in> | 2021-04-01T17·57+0200 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-04-01T18·00+0000 |
commit | 7907319a11c659c3f5f7d68a3c221083892fd4fb (patch) | |
tree | bad83fee5e3666b24796a08b7813329a588982c7 /users/tazjin/nixos/default.nix | |
parent | d2376e24d1084146bb1ee20139fe3dd575c4c546 (diff) |
refactor(tazjin/nixos): Use setup scripts from //ops/nixos r/2392
Change-Id: I8baf2404f0f6e9c4fad767911646cdc55051dd2e Reviewed-on: https://cl.tvl.fyi/c/depot/+/2753 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/nixos/default.nix')
-rw-r--r-- | users/tazjin/nixos/default.nix | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/users/tazjin/nixos/default.nix b/users/tazjin/nixos/default.nix index 370049859f68..04123a3b5ab1 100644 --- a/users/tazjin/nixos/default.nix +++ b/users/tazjin/nixos/default.nix @@ -1,47 +1,10 @@ -# TODO(tazjin): Generalise this and move to //ops/nixos { depot, lib, ... }: -let - inherit (builtins) foldl'; - - systemFor = configs: (depot.third_party.nixos { - configuration = lib.fix(config: - foldl' lib.recursiveUpdate {} (map (c: c config) configs) - ); - }).system; - - caseFor = hostname: '' - ${hostname}) - echo "Rebuilding NixOS for //users/tazjin/nixos/${hostname}" - system=$(nix-build -E '(import <depot> {}).users.tazjin.nixos.${hostname}System' --no-out-link) - ;; - ''; - - rebuilder = depot.third_party.writeShellScriptBin "rebuilder" '' - set -ue - if [[ $EUID -ne 0 ]]; then - echo "Oh no! Only root is allowed to rebuild the system!" >&2 - exit 1 - fi - - case $HOSTNAME in - ${caseFor "camden"} - ${caseFor "frog"} - *) - echo "$HOSTNAME is not a known NixOS host!" >&2 - exit 1 - ;; - esac - - nix-env -p /nix/var/nix/profiles/system --set $system - $system/bin/switch-to-configuration switch - ''; +let systemFor = sys: (depot.ops.nixos.nixosFor sys).system; in { - inherit rebuilder; - - camdenSystem = systemFor [ depot.users.tazjin.nixos.camden ]; - frogSystem = systemFor [ depot.users.tazjin.nixos.frog ]; - tverskoySystem = systemFor [ depot.users.tazjin.nixos.tverskoy ]; + camdenSystem = systemFor depot.users.tazjin.nixos.camden; + frogSystem = systemFor depot.users.tazjin.nixos.frog; + tverskoySystem = systemFor depot.users.tazjin.nixos.tverskoy; meta.targets = [ "camdenSystem" "frogSystem" "tverskoySystem" ]; } |