From f1fe0d85491418d65a7b9a2e068bd24199b79ead Mon Sep 17 00:00:00 2001 From: zuma Date: Tue, 4 Nov 2025 23:02:58 +0100 Subject: [PATCH] modularization --- README.md | 7 +++++++ cluster/nodes/fifi.nix | 5 +++++ cluster/nodes/loulou.nix | 5 +++++ cluster/nodes/riri.nix | 9 +++++++++ configuration.nix | 25 ++---------------------- deploy_nix.sh | 11 +++++++++++ hardware-configuration.nix | 39 -------------------------------------- 7 files changed, 39 insertions(+), 62 deletions(-) create mode 100644 README.md create mode 100755 cluster/nodes/fifi.nix create mode 100755 cluster/nodes/loulou.nix create mode 100755 cluster/nodes/riri.nix mode change 100644 => 100755 configuration.nix create mode 100755 deploy_nix.sh delete mode 100644 hardware-configuration.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..262bfd8 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Infra - La filouterie + +Pour deployer une config, faites : + +``` +sudo ./deploy_nix (ex : deploy_nix loulou) +``` diff --git a/cluster/nodes/fifi.nix b/cluster/nodes/fifi.nix new file mode 100755 index 0000000..7dd9ea1 --- /dev/null +++ b/cluster/nodes/fifi.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ...}: + +{ + networking.hostName = "fifi"; +} diff --git a/cluster/nodes/loulou.nix b/cluster/nodes/loulou.nix new file mode 100755 index 0000000..094fb0d --- /dev/null +++ b/cluster/nodes/loulou.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ...}: + +{ + networking.hostName = "loulou"; +} diff --git a/cluster/nodes/riri.nix b/cluster/nodes/riri.nix new file mode 100755 index 0000000..0bdc65f --- /dev/null +++ b/cluster/nodes/riri.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ...}: + +{ + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "riri"; +} diff --git a/configuration.nix b/configuration.nix old mode 100644 new mode 100755 index b523459..7ddcf5a --- a/configuration.nix +++ b/configuration.nix @@ -11,19 +11,11 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./node.nix ]; programs.nix-ld.enable = true; # for vscode server - # Use the systemd-boot EFI boot loader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "riri"; # Define your hostname. - - # Configure bootloader device - boot.loader.grub.device = "/dev/mmcblk0p2"; # or "nodev" for EFI only - # Set your time zone. time.timeZone = "Europe/Paris"; @@ -79,8 +71,6 @@ }; }; - # programs.firefox.enable = true; - # List packages installed in system profile. # You can use https://search.nixos.org/ to find more packages (and options). environment.systemPackages = with pkgs; [ @@ -93,16 +83,6 @@ neofetch ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - # Enable the OpenSSH daemon. services.openssh.enable = true; services.openssh.settings.PasswordAuthentication = false; @@ -119,5 +99,4 @@ # system.copySystemConfiguration = true; system.stateVersion = "25.05"; # Never bloody change this value, got it lads ? - -} \ No newline at end of file +} diff --git a/deploy_nix.sh b/deploy_nix.sh new file mode 100755 index 0000000..d005047 --- /dev/null +++ b/deploy_nix.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +if [ -z "$1" ] + then + echo "Erreur : Précisez le noeud à installer" + exit 1 +fi + +cp ./configuration.nix /etc/nixos/configuration.nix +cp ./cluster/nodes/$1.nix /etc/nixos/node.nix +nixos-rebuild switch diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index a622b75..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,39 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = [ ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -}