feat(nixos): encapsulate CachyOS kernel configuration

This commit was merged in pull request #133.
This commit is contained in:
2026-10-06 19:42:52 -04:00
parent c7c3257b9d
commit 4f7fbef35b
5 changed files with 29 additions and 18 deletions

View File

@@ -61,3 +61,5 @@
Do not describe NixOS route choices as public-DNS management. Do not describe NixOS route choices as public-DNS management.
- Do not hand-author `hardware-configuration.nix` for a host that has not been generated on that machine. - Do not hand-author `hardware-configuration.nix` for a host that has not been generated on that machine.
Generate it on the target system or live ISO, then stage it before evaluating the flake. Generate it on the target system or live ISO, then stage it before evaluating the flake.
- Configure the Chaotic Nyx cache only on hosts that select `linuxPackages_cachyos` (currently Neogaia
and Zeus), not in the generic host module.

View File

@@ -1,6 +1,5 @@
{ {
inputs, inputs,
pkgs,
... ...
}: }:
# neogaia — Dell XPS 13 9380 laptop. # neogaia — Dell XPS 13 9380 laptop.
@@ -13,7 +12,7 @@
./disk.nix ./disk.nix
]; ];
boot.kernelPackages = pkgs.linuxPackages_cachyos; modules.kernel.cachyos.enable = true;
# So wifi can be joined from the console. # So wifi can be joined from the console.
networking.networkmanager.enable = true; networking.networkmanager.enable = true;

View File

@@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
# zeus — Ryzen desktop with AMD graphics. # zeus — Ryzen desktop with AMD graphics.
@@ -15,7 +14,7 @@
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
boot.kernelPackages = pkgs.linuxPackages_cachyos; modules.kernel.cachyos.enable = true;
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;

View File

@@ -5,20 +5,12 @@
... ...
}: }:
let let
cfg = config.modules.host; # NOLINT(let_order)
inherit (config) user;
hostSecrets = ../secrets + "/${config.networking.hostName}.yaml"; hostSecrets = ../secrets + "/${config.networking.hostName}.yaml";
passwordSecret = "${user.name}-password";
in in
{ {
options.modules.host.enable = lib.mkEnableOption "physical-host base configuration"; options.modules.host.enable = lib.mkEnableOption "physical-host base configuration";
config = lib.mkIf cfg.enable { config = lib.mkIf config.modules.host.enable {
nix.settings.extra-substituters = [ "https://nyx-cache.chaotic.cx/" ];
nix.settings.extra-trusted-public-keys = [
"nyx-cache.chaotic.cx:dJxTrgMC3V3cFfyIiBQDQorG6k1LsqurH/srpMSq7qk="
];
nix.gc.automatic = true; nix.gc.automatic = true;
nix.gc.dates = "Mon 03:15"; nix.gc.dates = "Mon 03:15";
nix.gc.options = "--delete-older-than 30d"; nix.gc.options = "--delete-older-than 30d";
@@ -47,8 +39,9 @@ in
sops.gnupg.sshKeyPaths = [ ]; sops.gnupg.sshKeyPaths = [ ];
users.mutableUsers = false; users.mutableUsers = false;
sops.secrets.${passwordSecret}.neededForUsers = true; sops.secrets."${config.user.name}-password".neededForUsers = true;
users.users.${user.name}.hashedPasswordFile = config.sops.secrets.${passwordSecret}.path; users.users.${config.user.name}.hashedPasswordFile =
config.sops.secrets."${config.user.name}-password".path;
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
Defaults env_keep += "EDITOR VISUAL" Defaults env_keep += "EDITOR VISUAL"
@@ -57,9 +50,9 @@ in
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users.${user.name} = { users.${config.user.name} = {
home.username = user.name; home.username = config.user.name;
home.homeDirectory = "/home/${user.name}"; home.homeDirectory = "/home/${config.user.name}";
home.stateVersion = config.system.stateVersion; home.stateVersion = config.system.stateVersion;
home.packages = with pkgs; [ home.packages = with pkgs; [
eza eza

View File

@@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}:
{
options.modules.kernel.cachyos.enable = lib.mkEnableOption "CachyOS kernel";
config = lib.mkIf config.modules.kernel.cachyos.enable {
boot.kernelPackages = pkgs.linuxPackages_cachyos;
nix.settings.extra-substituters = [ "https://nyx-cache.chaotic.cx/" ];
nix.settings.extra-trusted-public-keys = [
"nyx-cache.chaotic.cx:dJxTrgMC3V3cFfyIiBQDQorG6k1LsqurH/srpMSq7qk="
];
};
}