From 9b38a10457554dd94af01459d40d888c7f4e81b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20H=C3=A9mono?= Date: Sat, 6 Dec 2025 14:28:28 +0100 Subject: [PATCH] Factor gwiad and sesame configuration into base mdule --- hosts/gwiad/configuration.nix | 28 +-------------------- hosts/sesame/configuration.nix | 46 ++-------------------------------- modules/nixos/base.nix | 30 ++++++++++++++++++++++ modules/nixos/jhemono.nix | 7 ++++-- 4 files changed, 38 insertions(+), 73 deletions(-) diff --git a/hosts/gwiad/configuration.nix b/hosts/gwiad/configuration.nix index 1bea7f3..76e1a81 100644 --- a/hosts/gwiad/configuration.nix +++ b/hosts/gwiad/configuration.nix @@ -1,4 +1,4 @@ -{ inputs, flake, pkgs, hostName, ... }: +{ inputs, flake, pkgs, ... }: { imports = with flake.nixosModules; [ ./hardware-configuration.nix @@ -9,23 +9,9 @@ ./syncthing.nix ]; - # Boot configuration - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.configurationLimit = 10; - boot.loader.efi.canTouchEfiVariables = true; - # Networking - networking.hostName = hostName; networking.networkmanager.enable = true; - # Set your time zone. - time.timeZone = "Europe/Paris"; - - # Console - console = { - keyMap = "fr"; - }; - users.users.jhemono.uid = 1000; users.groups.jhemono.gid = 1000; @@ -43,17 +29,7 @@ # System packages environment.systemPackages = with pkgs; [ android-tools - bc - git - htop - jq - ncdu rclone - tmux - tree - unzip - vim - zip ]; virtualisation.docker.rootless = { @@ -83,8 +59,6 @@ orca ]; - environment.variables.EDITOR = "vim"; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; diff --git a/hosts/sesame/configuration.nix b/hosts/sesame/configuration.nix index 82b5f9a..b34f344 100644 --- a/hosts/sesame/configuration.nix +++ b/hosts/sesame/configuration.nix @@ -2,12 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ flake, config, hostName, lib, pkgs, ... }: +{ flake, config, lib, pkgs, ... }: { imports = with flake.nixosModules; [ ./hardware-configuration.nix base + jhemono # Supporting ./buckets.nix ./nginx.nix @@ -21,54 +22,11 @@ ./syncthing.nix ]; - # Boot configuration - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.configurationLimit = 10; - boot.loader.efi.canTouchEfiVariables = true; - - # Networking - networking.hostName = hostName; - networking.domain = "hemono.fr"; - - # Set your time zone. - time.timeZone = "Europe/Paris"; - - # Console - console = { - keyMap = "fr"; - }; - - # User account - users.users.jhemono = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable 'sudo' for the user. - openssh = { - authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8Q2lWsqvoqoIxqb8HM96IpvZkFhnwcPdEo+m5peH5N/0PZloEp/NfLbzktXGNACe+bwfweR1Kokjs/Ep0tQQggGtgqB0jAopd1Yw0wzlFWYGqJsGyuFBGP4SljsQvGhU2IwgvuJFIRrOVu+gRTIM1DYGQOveNqlRU/QoqOZDQPvHsoQCLvwmZBzzi7DLktBQZ7h/CJ3GrzD2YUuIyulZGbhfM86i0p7NQ5+TSxuo7Yotbwzrzi7hAROO22ghRfv0vxAPip9SCF1SKIZpSDd8s7Nk6dkDE+95N5cMOkFwokWWsxaTM+EgZfTjQZon1L1/X3UC3hK6C+7GLusoNe8xdjm14e9LA5qG5ZRtLrmIrI2bW5KBj/8iTxRmXpE9x70d2Hl6jtHBQv4rQOAO3BET0TjlNAXchNDOcDbNX1ZqEwyImoF4c3kbr5M2ezWCDltAdvd74mMMiaenxwYkZeZbR3EJPbtC1v//9QQ9S7OzKa5utwjhZFlh0g79GKq8DiU6W8IzzmD7pGi8MIV3wOh1NGlcIlPaIyJY60XN0iRNI9NhMASAF493xPfMlVWl7Tly1VDVcPp5pC47vHU6/2mBbx5tnVShNPnkf4OwF3nC8i0DT+dRKXAxjfpoM5iYIrSHrNj9EKKFE4qNbqtAPTNGGtxJ0fUdWOgXLf5BMfYmaiQ== jhemono@gwiad" - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFWZ1MF5Srp1AkfgzO/19RCeYfCU+HtJFYESS9PhQrQYhUwZtoHExHYyD1nf71+jGFu6HJjXAPDD5ZW1XqYEh8kFvkx8uXw+kKHOVwuVhkcIYduQlsR8e8kbu8y6OABPe3SWmmtiA2HdWCwlZNoyTL1X4+LsA+Hbs0EHn1p+RQ4YeOSuZV/5VETt1Mcu/d0GyFBlnoCtu3VwexBdZgsVkw/kOpjNrY0RhqEwiO7P9J+jXT6HB8wvus6MzgvNPzoFo6hAXqRGu3SvCQJnVkE/AulHBfWLFCwdIrekGCKMv9v51dUJ5pgHxWyZZQhYNFpE2qTj8meExBDfnnYl7MFQ3j termbot" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxc+ov8QKWxdGq3kgGqouGd7nExXgpQtZrjv2TR6ILk jhemono@ipad-fred" - ]; - }; - # packages = with pkgs; [ - # firefox - # tree - # ]; - }; - # System packages environment.systemPackages = with pkgs; [ git - htop - jq - ncdu - tmux - tree - unzip - vim ]; - environment.variables.EDITOR = "vim"; - # OpenSSH services.openssh = { enable = true; diff --git a/modules/nixos/base.nix b/modules/nixos/base.nix index b3ff87b..573f2a3 100644 --- a/modules/nixos/base.nix +++ b/modules/nixos/base.nix @@ -1,5 +1,35 @@ +{ pkgs, hostName, ... }: { + # Boot configuration + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.configurationLimit = 10; + boot.loader.efi.canTouchEfiVariables = true; + + # Networking + networking.hostName = hostName; + networking.domain = "hemono.fr"; + + # Time Zone + time.timeZone = "Europe/Paris"; + + # Console + console.keyMap = "fr"; + + # System packages + environment.systemPackages = with pkgs; [ + htop + jq + ncdu + tmux + tree + unzip + vim + zip + ]; + + environment.variables.EDITOR = "vim"; + nix = { gc = { automatic = true; diff --git a/modules/nixos/jhemono.nix b/modules/nixos/jhemono.nix index e16c274..c42c990 100644 --- a/modules/nixos/jhemono.nix +++ b/modules/nixos/jhemono.nix @@ -7,9 +7,12 @@ in users.users.${username} = { description = "Julien Hémono"; isNormalUser = true; - createHome = true; extraGroups = [ "wheel" ]; - # openssh.authorizedKeys.keys = info.authorizedKeys; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8Q2lWsqvoqoIxqb8HM96IpvZkFhnwcPdEo+m5peH5N/0PZloEp/NfLbzktXGNACe+bwfweR1Kokjs/Ep0tQQggGtgqB0jAopd1Yw0wzlFWYGqJsGyuFBGP4SljsQvGhU2IwgvuJFIRrOVu+gRTIM1DYGQOveNqlRU/QoqOZDQPvHsoQCLvwmZBzzi7DLktBQZ7h/CJ3GrzD2YUuIyulZGbhfM86i0p7NQ5+TSxuo7Yotbwzrzi7hAROO22ghRfv0vxAPip9SCF1SKIZpSDd8s7Nk6dkDE+95N5cMOkFwokWWsxaTM+EgZfTjQZon1L1/X3UC3hK6C+7GLusoNe8xdjm14e9LA5qG5ZRtLrmIrI2bW5KBj/8iTxRmXpE9x70d2Hl6jtHBQv4rQOAO3BET0TjlNAXchNDOcDbNX1ZqEwyImoF4c3kbr5M2ezWCDltAdvd74mMMiaenxwYkZeZbR3EJPbtC1v//9QQ9S7OzKa5utwjhZFlh0g79GKq8DiU6W8IzzmD7pGi8MIV3wOh1NGlcIlPaIyJY60XN0iRNI9NhMASAF493xPfMlVWl7Tly1VDVcPp5pC47vHU6/2mBbx5tnVShNPnkf4OwF3nC8i0DT+dRKXAxjfpoM5iYIrSHrNj9EKKFE4qNbqtAPTNGGtxJ0fUdWOgXLf5BMfYmaiQ== jhemono@gwiad" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFWZ1MF5Srp1AkfgzO/19RCeYfCU+HtJFYESS9PhQrQYhUwZtoHExHYyD1nf71+jGFu6HJjXAPDD5ZW1XqYEh8kFvkx8uXw+kKHOVwuVhkcIYduQlsR8e8kbu8y6OABPe3SWmmtiA2HdWCwlZNoyTL1X4+LsA+Hbs0EHn1p+RQ4YeOSuZV/5VETt1Mcu/d0GyFBlnoCtu3VwexBdZgsVkw/kOpjNrY0RhqEwiO7P9J+jXT6HB8wvus6MzgvNPzoFo6hAXqRGu3SvCQJnVkE/AulHBfWLFCwdIrekGCKMv9v51dUJ5pgHxWyZZQhYNFpE2qTj8meExBDfnnYl7MFQ3j termbot" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxc+ov8QKWxdGq3kgGqouGd7nExXgpQtZrjv2TR6ILk jhemono@ipad-fred" + ]; initialPassword = "cheval"; };