From a02f90422e1e9594f47dd4a694b1cbb55bd70e54 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 2 Nov 2021 10:15:37 +0100 Subject: [PATCH] Add deploy script --- configuration.nix | 10 ++++++++++ deploy.sh | 8 ++++++++ inventory | 3 +++ node/carcajou.nix | 11 +---------- node/cariacou.nix | 11 +---------- node/caribou.nix | 1 - 6 files changed, 23 insertions(+), 21 deletions(-) create mode 100755 deploy.sh create mode 100644 inventory diff --git a/configuration.nix b/configuration.nix index d500108..e47cdbf 100644 --- a/configuration.nix +++ b/configuration.nix @@ -17,10 +17,20 @@ boot.loader.timeout = 20; boot.loader.efi.canTouchEfiVariables = true; + nix = { + binaryCaches = [ + "http://binarycache.home.adnab.me" + ]; + binaryCachePublicKeys = [ + "binarycache.home.adnab.me:ErR6pMnewf9oVyZJd5uC2nI4EZF49c7Mh86eDZWYZaw=" + ]; + }; + # The global useDHCP flag is deprecated, therefore explicitly set to false here. # Per-interface useDHCP will be mandatory in the future, so this generated config # replicates the default behaviour. networking.useDHCP = false; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Set your time zone. time.timeZone = "Europe/Paris"; diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..a9a9261 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +for NIXHOST in $(cat inventory); do + echo "==== DOING $NIXHOST ====" + cat configuration.nix | ssh root@$NIXHOST tee /etc/nixos/configuration.nix > /dev/null + cat node/$NIXHOST.nix | ssh root@$NIXHOST tee /etc/nixos/node.nix > /dev/null + ssh root@$NIXHOST nixos-rebuild switch +done diff --git a/inventory b/inventory new file mode 100644 index 0000000..2a207b8 --- /dev/null +++ b/inventory @@ -0,0 +1,3 @@ +caribou +carcajou +cariacou diff --git a/node/carcajou.nix b/node/carcajou.nix index ae6b488..a9f64c2 100644 --- a/node/carcajou.nix +++ b/node/carcajou.nix @@ -3,7 +3,7 @@ { config, pkgs, ... }: { - networking.hostName = "carcajou"; # Define your hostname. + networking.hostName = "carcajou"; networking.interfaces.eno1.useDHCP = false; networking.interfaces.eno1.ipv4.addresses = [ @@ -12,13 +12,4 @@ prefixLength = 24; } ]; - - nix = { - binaryCaches = [ - "http://binarycache.home.adnab.me" - ]; - binaryCachePublicKeys = [ - "binarycache.home.adnab.me:ErR6pMnewf9oVyZJd5uC2nI4EZF49c7Mh86eDZWYZaw=" - ]; - }; } diff --git a/node/cariacou.nix b/node/cariacou.nix index 5ed6154..c94d2b8 100644 --- a/node/cariacou.nix +++ b/node/cariacou.nix @@ -3,7 +3,7 @@ { config, pkgs, ... }: { - networking.hostName = "cariacou"; # Define your hostname. + networking.hostName = "cariacou"; networking.interfaces.eno1.useDHCP = false; networking.interfaces.eno1.ipv4.addresses = [ @@ -12,13 +12,4 @@ prefixLength = 24; } ]; - - nix = { - binaryCaches = [ - "http://binarycache.home.adnab.me" - ]; - binaryCachePublicKeys = [ - "binarycache.home.adnab.me:ErR6pMnewf9oVyZJd5uC2nI4EZF49c7Mh86eDZWYZaw=" - ]; - }; } diff --git a/node/caribou.nix b/node/caribou.nix index 95b0d52..1ffdaf1 100644 --- a/node/caribou.nix +++ b/node/caribou.nix @@ -4,7 +4,6 @@ { networking.hostName = "caribou"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.interfaces.eno1.useDHCP = false; networking.interfaces.eno1.ipv4.addresses = [