Added environment variables in nodes to make deploy_nix.sh target the correct node file, changed deploy_nix.sh accordingly

This commit is contained in:
mayel 2025-11-05 16:11:13 +01:00
parent 59a46d1968
commit 8799736e7f
4 changed files with 30 additions and 5 deletions

View file

@ -1,10 +1,19 @@
{ config, lib, pkgs, ...}:
{
# Defining hostname
networking.hostName = "fifi";
# Configuration du Wifi et configuration IP fixe (hors du range DHCP: 50-200)
# Setting up environment variables
environment.sessionVariables = rec {
NODE = "fifi";
};
# 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"];
}

View file

@ -2,4 +2,12 @@
{
networking.hostName = "loulou";
# Setting up environment variables
environment.sessionVariables = rec {
NODE = "loulou";
};
}

View file

@ -6,4 +6,11 @@
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "riri";
# Setting up environment variables
environment.sessionVariables = rec {
NODE = "riri";
};
}

View file

@ -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