chore: modularization, factorization

This commit is contained in:
Henri Saudubray 2026-01-21 00:10:30 +01:00
parent 6aa29a5f50
commit 8c7e350325
7 changed files with 40 additions and 94 deletions

View file

@ -1 +1,11 @@
# Nixos configuration # Nixos configuration
```
.
├── flake.nix // Top-level flake
├── home/ // home-manager configuration
├── hosts/ // host-specific configuration
├── nixos/ // generic system configuration
├── shells/ // generic development shells
└── [...]
```

View file

@ -13,12 +13,12 @@
nixosConfigurations.selune = nixpkgs.lib.nixosSystem { nixosConfigurations.selune = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./hosts/selune/configuration.nix ./hosts/selune
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.hms = ./home/home.nix; home-manager.users.hms = ./home;
home-manager.backupFileExtension = "bak"; home-manager.backupFileExtension = "bak";
} }
]; ];
@ -26,12 +26,12 @@
nixosConfigurations.shar = nixpkgs.lib.nixosSystem { nixosConfigurations.shar = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./hosts/shar/configuration.nix ./hosts/shar
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.hms = ./home/home.nix; home-manager.users.hms = ./home;
home-manager.backupFileExtension = "bak"; home-manager.backupFileExtension = "bak";
} }
]; ];

13
hosts/selune/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }:
{
imports = [
../../nixos
./hardware-configuration.nix
];
boot.initrd.luks.devices."luks-374c6259-18c4-462b-9f30-9c9648de00ae".device =
"/dev/disk/by-uuid/374c6259-18c4-462b-9f30-9c9648de00ae";
networking.hostName = "selune";
system.stateVersion = "25.11";
}

View file

@ -1,82 +0,0 @@
{ config, pkgs, ... }:
{
imports = [ ./hardware-configuration.nix ];
nix.settings.experimental-features = "nix-command flakes";
system.autoUpgrade.enable = true;
system.autoUpgrade.dates = "weekly";
nix.gc.automatic = true;
nix.gc.dates = "daily";
nix.gc.options = "--delete-older-than 10d";
nix.settings.auto-optimise-store = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.luks.devices."luks-324ce23c-e630-42a1-8558-184e999053a5".device =
"/dev/disk/by-uuid/324ce23c-e630-42a1-8558-184e999053a5";
networking.hostName = "shar";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.UTF-8";
LC_IDENTIFICATION = "fr_FR.UTF-8";
LC_MEASUREMENT = "fr_FR.UTF-8";
LC_MONETARY = "fr_FR.UTF-8";
LC_NAME = "fr_FR.UTF-8";
LC_NUMERIC = "fr_FR.UTF-8";
LC_PAPER = "fr_FR.UTF-8";
LC_TELEPHONE = "fr_FR.UTF-8";
LC_TIME = "fr_FR.UTF-8";
};
services.xserver.enable = true;
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
services.xserver.xkb = {
layout = "fr";
variant = "ergol";
};
services.gnome.gnome-browser-connector.enable = true;
services.printing.enable = true;
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
services.openssh.enable = true;
console.keyMap = "fr";
users.users.hms = {
isNormalUser = true;
description = "hms";
extraGroups = [ "networkmanager" "wheel" ];
packages = [ ];
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
helix
wget
];
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
system.stateVersion = "25.11";
}

13
hosts/shar/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }:
{
imports = [
../../nixos
./hardware-configuration.nix
];
boot.initrd.luks.devices."luks-324ce23c-e630-42a1-8558-184e999053a5".device =
"/dev/disk/by-uuid/324ce23c-e630-42a1-8558-184e999053a5";
networking.hostName = "shar";
system.stateVersion = "25.11";
}

View file

@ -1,7 +1,5 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = [ ./hardware-configuration.nix ];
nix.settings.experimental-features = "nix-command flakes"; nix.settings.experimental-features = "nix-command flakes";
system.autoUpgrade.enable = true; system.autoUpgrade.enable = true;
@ -15,14 +13,10 @@
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.luks.devices."luks-374c6259-18c4-462b-9f30-9c9648de00ae".device =
"/dev/disk/by-uuid/374c6259-18c4-462b-9f30-9c9648de00ae";
networking.hostName = "selune";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_GB.UTF-8"; i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.UTF-8"; LC_ADDRESS = "fr_FR.UTF-8";
@ -79,6 +73,4 @@
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
system.stateVersion = "25.11";
} }