modularization

This commit is contained in:
zuma 2025-11-04 23:02:58 +01:00
parent fdcd4dbce9
commit f1fe0d8549
7 changed files with 39 additions and 62 deletions

7
README.md Normal file
View file

@ -0,0 +1,7 @@
# Infra - La filouterie
Pour deployer une config, faites :
```
sudo ./deploy_nix <node_name> (ex : deploy_nix loulou)
```

5
cluster/nodes/fifi.nix Executable file
View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, ...}:
{
networking.hostName = "fifi";
}

5
cluster/nodes/loulou.nix Executable file
View file

@ -0,0 +1,5 @@
{ config, lib, pkgs, ...}:
{
networking.hostName = "loulou";
}

9
cluster/nodes/riri.nix Executable file
View file

@ -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";
}

23
configuration.nix Normal file → Executable file
View file

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

11
deploy_nix.sh Executable file
View file

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

View file

@ -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.<interface>.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;
}