factorize os configurations
Some checks failed
/ build-all (push) Failing after 1m7s

This commit is contained in:
ant 2025-09-01 22:37:33 +02:00
parent 8de0ba7158
commit 058d223259
7 changed files with 134 additions and 155 deletions

48
os/common-graphics.nix Normal file
View file

@ -0,0 +1,48 @@
{ config, pkgs, ... }: {
programs.hyprland.enable = true;
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services.xserver.enable = true;
services.displayManager = {
defaultSession = "hyprland";
autoLogin = {
enable = false;
user = "ant";
};
sddm = {
enable = true;
wayland.enable = true;
package = pkgs.kdePackages.sddm;
extraPackages = with pkgs; [
where-is-my-sddm-theme
kdePackages.qt5compat
];
theme = "where_is_my_sddm_theme";
};
};
services.printing.enable = true;
boot.plymouth = {
enable = true;
theme = "fade-in";
};
security.pam.services.ant.enableGnomeKeyring = true;
services.gnome.gnome-keyring.enable = true;
programs.light.enable = true;
programs.gamemode.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
}

View file

@ -8,12 +8,6 @@
}; };
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
boot.plymouth = {
enable = true;
theme = "fade-in";
};
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
@ -35,57 +29,28 @@
}; };
console.keyMap = "fr"; console.keyMap = "fr";
services.printing.enable = true; programs.fish = {
enable = true;
programs.fish.enable = true; interactiveShellInit = ''
set -gx fish_greeting
'';
};
users.defaultUserShell = pkgs.fish;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nh nh
neovim neovim
where-is-my-sddm-theme where-is-my-sddm-theme
]; ];
programs.hyprland.enable = true;
services.xserver.enable = true;
services.displayManager = {
defaultSession = "hyprland";
autoLogin = {
enable = false;
user = "ant";
};
sddm = {
enable = true;
wayland.enable = true;
package = pkgs.kdePackages.sddm;
extraPackages = with pkgs; [
where-is-my-sddm-theme
kdePackages.qt5compat
];
theme = "where_is_my_sddm_theme";
};
};
security.rtkit.enable = true; security.rtkit.enable = true;
security.pam.services.swaylock = { }; security.pam.services.swaylock = { };
security.polkit.enable = true; security.polkit.enable = true;
security.pam.services.ant.enableGnomeKeyring = true;
services.gnome.gnome-keyring.enable = true;
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
services.udisks2.enable = true; services.udisks2.enable = true;
programs.gamemode.enable = true;
programs.gnupg.agent.enable = true; programs.gnupg.agent.enable = true;
programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses; programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses;
programs.light.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
} }

View file

@ -1,13 +1,14 @@
# Edit this conle to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { config, pkgs, ... }:
let sshKeys = with (import ../sshKeys.nix); [
moon
];
in
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./common.nix ./common.nix
./common-graphics.nix
(import ./remote-disk-unlock.nix sshKeys)
]; ];
boot.loader = { boot.loader = {
@ -24,30 +25,30 @@
}; };
# unlock over ssh # unlock over ssh
boot.initrd = { # boot.initrd = {
availableKernelModules = [ "igb" ]; # availableKernelModules = [ "igb" ];
network = { # network = {
enable = true; # enable = true;
udhcpc = { # udhcpc = {
enable = true; # enable = true;
extraArgs = [ "--background" "--retries" "1" ]; # extraArgs = [ "--background" "--retries" "1" ];
}; # };
flushBeforeStage2 = true; # flushBeforeStage2 = true;
ssh = { # ssh = {
enable = true; # enable = true;
port = 22; # port = 22;
authorizedKeys = [ # authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCTCKcHgCZOlGeCEz0+HcoYMyXzFy3l3igsG+nhMC8Z ant@moon " # "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCTCKcHgCZOlGeCEz0+HcoYMyXzFy3l3igsG+nhMC8Z ant@moon "
]; # ];
# hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ]; # # hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ]; # hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
}; # };
postCommands = '' # postCommands = ''
# Automatically ask for the password on SSH login # # Automatically ask for the password on SSH login
echo 'cryptsetup-askpass || echo "Unlock was successful; exiting SSH session" && exit 1' >> /root/.profile # echo 'cryptsetup-askpass || echo "Unlock was successful; exiting SSH session" && exit 1' >> /root/.profile
''; # '';
}; # };
}; # };
hardware.bluetooth.enable = true; # enables support for Bluetooth hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
@ -87,11 +88,6 @@
fsType = "ext4"; fsType = "ext4";
}; };
hardware.graphics = {
enable = true;
enable32Bit = true;
};
# NVIDIA # NVIDIA
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = { hardware.nvidia = {
@ -110,8 +106,6 @@
openFirewall = true; openFirewall = true;
}; };
networking.firewall.enable = true;
virtualisation.docker = { enable = true; }; virtualisation.docker = { enable = true; };
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true; programs.virt-manager.enable = true;

View file

@ -1,78 +1,41 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
sshKeys = [ sshKeys = with (import ../../sshKeys.nix); [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAM15boHYClgaBXAIyWSjbJd3W/bwcIE6YZwLu/K+Ipp ant@nixos" basado
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCTCKcHgCZOlGeCEz0+HcoYMyXzFy3l3igsG+nhMC8Z ant@moon" moon
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5zrLxiyG6T5eupXT/wqhvtt8Cuak4DtPEzCyksqa1a ant@allegro" allegro
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKt6WkeBNowTOqSv1GAvTSIMReaMDvltOKGpUC2jStGG ant@hs" hs
]; ];
domain = "antoinev.freeboxos.fr"; domain = "antoinev.freeboxos.fr";
# ./ssh/authorized_keys_root;
in { in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./syncthing.nix ./syncthing.nix
./disks.nix ./disks.nix
./backup.nix ./backup.nix
../common.nix
(import ../remote-disk-unlock.nix sshKeys)
]; ];
nix.settings = { experimental-features = [ "nix-command" "flakes" ]; };
boot.kernelParams = [ "ip=dhcp" ];
boot = { boot = {
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
initrd = { };
availableKernelModules = [ "r8169" ];
network = { hardware = {
enable = true; graphics = {
ssh = { enable = true;
enable = true; enable32Bit = true;
port = 22; extraPackages = with pkgs; [ nvidia-vaapi-driver ];
authorizedKeys = sshKeys;
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
shell = "/bin/cryptsetup-askpass";
};
};
}; };
nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_535;
}; };
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
};
hardware.nvidia.package =
config.boot.kernelPackages.nvidiaPackages.legacy_535;
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
networking.hostName = "hs"; # Define your hostname. networking.hostName = "hs"; # Define your hostname.
networking.networkmanager.enable = true;
networking.domain = domain; networking.domain = domain;
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "fr_FR.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.xkb = {
layout = "fr";
variant = "";
};
console.keyMap = "fr";
users.users.ant = { users.users.ant = {
isNormalUser = true; isNormalUser = true;
description = "ant"; description = "ant";
@ -88,30 +51,10 @@ in {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ neovim tmux nh git curl wget htop ]; environment.systemPackages = with pkgs; [ neovim tmux nh git curl wget htop ];
# 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 = { services.openssh = {
enable = true; enable = true;
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
}; };
users.users.root.openssh.authorizedKeys.keys = sshKeys;
programs.fish = {
enable = true;
interactiveShellInit = ''
set -gx fish_greeting
'';
};
users.defaultUserShell = pkgs.fish;
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
@ -120,11 +63,8 @@ in {
25565 25565
]; ];
networking.firewall.allowedUDPPorts = [ 25565 ]; networking.firewall.allowedUDPPorts = [ 25565 ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
networking.interfaces.enp10s0.wakeOnLan.enable = true; networking.interfaces.enp10s0.wakeOnLan.enable = true;
systemd.services.ragnamod = { systemd.services.ragnamod = {
enable = false; enable = false;
after = [ "network.target" ]; after = [ "network.target" ];

View file

@ -3,6 +3,7 @@
imports = [ # Include the results of the hardware scan. imports = [ # Include the results of the hardware scan.
./moon-hardware-configuration.nix ./moon-hardware-configuration.nix
./common.nix ./common.nix
./common-graphics.nix
]; ];
# Bootloader. # Bootloader.
@ -26,7 +27,6 @@
hardware.bluetooth.powerOnBoot = true; hardware.bluetooth.powerOnBoot = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
programs.fish.enable = true;
users.users.ant = { users.users.ant = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.fish; shell = pkgs.fish;
@ -61,7 +61,6 @@
to = 1764; to = 1764;
} # KDE Connect } # KDE Connect
]; ];
networking.hosts = { "90.52.247.64" = [ "home" ]; };
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [ programs.nix-ld.libraries = with pkgs; [

27
os/remote-disk-unlock.nix Normal file
View file

@ -0,0 +1,27 @@
sshKeys: ({ config, pkgs, ... }: {
boot.kernelParams = [ "ip=dhcp" ];
boot = {
initrd = {
availableKernelModules = [ "r8169" "igd" ];
network = {
enable = true;
udhcpc = {
enable = true;
extraArgs = [ "--background" "--retries" "1" ];
};
flushBeforeStage2 = true;
ssh = {
enable = true;
port = 22;
authorizedKeys = sshKeys;
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
# shell = "/bin/cryptsetup-askpass";
};
postCommands = ''
# Automatically ask for the password on SSH login
echo 'cryptsetup-askpass || echo "Unlock was successful; exiting SSH session" && exit 1' >> /root/.profile
'';
};
};
};
})

6
sshKeys.nix Normal file
View file

@ -0,0 +1,6 @@
{
basado = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAM15boHYClgaBXAIyWSjbJd3W/bwcIE6YZwLu/K+Ipp ant@nixos";
moon = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCTCKcHgCZOlGeCEz0+HcoYMyXzFy3l3igsG+nhMC8Z ant@moon";
allegro = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5zrLxiyG6T5eupXT/wqhvtt8Cuak4DtPEzCyksqa1a ant@allegro";
hs = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKt6WkeBNowTOqSv1GAvTSIMReaMDvltOKGpUC2jStGG ant@hs";
}