diff --git a/cluster/nodes/fifi.nix b/cluster/nodes/fifi.nix index e13981e..1a1d104 100755 --- a/cluster/nodes/fifi.nix +++ b/cluster/nodes/fifi.nix @@ -1,10 +1,19 @@ { config, lib, pkgs, ...}: { + # Defining hostname + networking.hostName = "fifi"; + + + # Setting up environment variables + + environment.sessionVariables = rec { + NODE = "fifi"; + }; - # Configuration du Wifi et configuration IP fixe (hors du range DHCP: 50-200) + # Setting up wifi networking and static ip (out of DHCP range 50-200) networking.wireless.enable = true; networking.wireless.networks = { @@ -23,8 +32,9 @@ networking.defaultGateway = "192.168.1.1"; - # Configuration du bootloader en mode EFI + # Setting up bootloader in UEFI mode boot.loader.grub.devices = [ "nodev"]; + } diff --git a/cluster/nodes/loulou.nix b/cluster/nodes/loulou.nix index 094fb0d..0fd5ea2 100755 --- a/cluster/nodes/loulou.nix +++ b/cluster/nodes/loulou.nix @@ -2,4 +2,12 @@ { networking.hostName = "loulou"; + + + # Setting up environment variables + + environment.sessionVariables = rec { + NODE = "loulou"; + }; + } diff --git a/cluster/nodes/riri.nix b/cluster/nodes/riri.nix index 0bdc65f..42cedca 100755 --- a/cluster/nodes/riri.nix +++ b/cluster/nodes/riri.nix @@ -6,4 +6,11 @@ boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "riri"; + + # Setting up environment variables + + environment.sessionVariables = rec { + NODE = "riri"; + }; + } diff --git a/deploy_nix.sh b/deploy_nix.sh index d005047..9718b00 100755 --- a/deploy_nix.sh +++ b/deploy_nix.sh @@ -1,11 +1,11 @@ #! /usr/bin/env bash -if [ -z "$1" ] +if [ -z "${NODE:-}" ] then - echo "Erreur : Précisez le noeud à installer" + echo "Erreur : Si c'est la première fois que vous déployez le serveur, merci de faire: export NODE='riri', 'fifi' ou 'loulou' en fonction de votre serveur" exit 1 fi cp ./configuration.nix /etc/nixos/configuration.nix -cp ./cluster/nodes/$1.nix /etc/nixos/node.nix +cp ./cluster/nodes/$NODE.nix /etc/nixos/node.nix nixos-rebuild switch