Update and clean up modules
All checks were successful
CI / build (push) Successful in 2m9s

This commit is contained in:
Fabian Hauser 2025-03-03 23:46:19 +02:00
parent cc3d5090ac
commit e02d86dffd
21 changed files with 270 additions and 241 deletions

View file

@ -6,6 +6,7 @@
./networking.nix ./networking.nix
]; ];
facter.reportPath = ./facter.json; # TODO: Update facter.reportPath = ./facter.json; # TODO: Update
dotfiles.hardware.thinkpad-x1-gen9.enable = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like fi:le locations and database versions # settings for stateful data, like fi:le locations and database versions

View file

@ -7,6 +7,7 @@
./disko-config.nix ./disko-config.nix
]; ];
facter.reportPath = ./facter.json; facter.reportPath = ./facter.json;
dotfiles.hardware.amd-desktop.enable = true;
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Tallinn"; time.timeZone = "Europe/Tallinn";

View file

@ -1,28 +0,0 @@
{
inputs,
pkgs,
lib,
...
}:
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
environment.systemPackages = [
# For debugging and troubleshooting Secure Boot.
pkgs.sbctl
];
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.systemd.enable = true;
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
}

View file

@ -4,6 +4,18 @@
}: }:
{ {
environment.etc = {
gitconfig.source = ./etc/gitconfig;
vimrc.source = ./etc/vimrc;
};
programs.autojump.enable = true;
programs.vim = {
enable = true;
defaultEditor = true;
};
environment.systemPackages = environment.systemPackages =
with pkgs; with pkgs;
[ [
@ -33,6 +45,7 @@
nix-diff nix-diff
nixpkgs-review nixpkgs-review
nixos-option nixos-option
comma
] ]
++ [ ++ [
autojump autojump
@ -53,20 +66,6 @@
git git
git-lfs git-lfs
] ]
++ [
# Filesystem & Disk Utilities
exfat
samba
cifs-utils
keyutils # required for cifs kerberos auth
sshfs-fuse
hdparm
mtpfs
ntfs3g
smartmontools
parted
usbutils
]
++ [ ++ [
# Networking Utilities # Networking Utilities
nmap nmap

View file

@ -0,0 +1,34 @@
{
inputs,
pkgs,
lib,
...
}:
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
environment.systemPackages = [
pkgs.sbctl
];
boot = {
loader.timeout = 2;
tmp.useTmpfs = true;
kernelPackages = pkgs.linuxPackages_latest;
bootspec.enable = true;
loader.efi.canTouchEfiVariables = true;
initrd.systemd.enable = true;
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
loader.systemd-boot.enable = lib.mkForce false;
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
};
}

View file

@ -1,65 +1,19 @@
{ {
lib,
pkgs, pkgs,
inputs,
... ...
}: }:
let
users = {
fhauser = {
uid = 1000;
isNormalUser = true;
description = "Fabian Hauser";
group = "fhauser";
extraGroups = [
"wheel"
"video"
"docker"
"networkmanager"
"libvirtd"
"adbusers"
];
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000603507108"
];
};
};
in
{ {
imports = [ imports = [
inputs.private.nixosModules.users # Contains hashedPasswords for users.
./unfree.nix
./applications.nix ./applications.nix
./boot.nix
./unfree.nix
./users.nix
]; ];
boot.loader.timeout = 2;
boot.tmp.useTmpfs = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.bootspec.enable = true;
catppuccin = {
flavor = "mocha";
tty.enable = true;
};
console.keyMap = "de_CH-latin1"; console.keyMap = "de_CH-latin1";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
users.mutableUsers = false;
users.groups = {
fhauser.gid = 1000;
};
users.users = users // {
root.openssh.authorizedKeys.keys =
with lib;
concatLists (
mapAttrsToList (
_name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else [ ]
) users
);
};
# Package management # Package management
nix = { nix = {
settings.trusted-users = [ settings.trusted-users = [
@ -69,7 +23,7 @@ in
optimise.automatic = true; optimise.automatic = true;
gc = { gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "monthly";
options = "--delete-older-than 60d"; options = "--delete-older-than 60d";
}; };
package = pkgs.nixVersions.stable; package = pkgs.nixVersions.stable;
@ -78,10 +32,6 @@ in
''; '';
}; };
# System Services
services.btrfs.autoScrub.enable = true;
services.fwupd.enable = true;
# Network services # Network services
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.firewall = { networking.firewall = {
@ -95,18 +45,5 @@ in
settings.PasswordAuthentication = false; settings.PasswordAuthentication = false;
}; };
# Default Settings
environment.etc = {
gitconfig.source = ./etc/gitconfig;
vimrc.source = ./etc/vimrc;
};
programs.autojump.enable = true;
programs.vim = {
enable = true;
defaultEditor = true;
};
environment.systemPackages = [ pkgs.comma ];
services.dbus.implementation = "broker"; services.dbus.implementation = "broker";
} }

View file

@ -0,0 +1,48 @@
{
lib,
inputs,
...
}:
let
users = {
fhauser = {
uid = 1000;
isNormalUser = true;
description = "Fabian Hauser";
group = "fhauser";
extraGroups = [
"wheel"
"video"
"docker"
"networkmanager"
"libvirtd"
"adbusers"
];
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIPF8ZV7vhpbVvLxiKq8ANVusNUHMbtii5MuvjxCbVz7vSNVPo9OOLvYyDqhbRAWMTdQeGZVAaALBufKKmprDTRFMpnA7Ut4TFrdz/5DTaR2KEjJ7P75moH+0xooR/GsbzFGsNBSQSXK3u1igndPYEC/PqCHN++32kDo2wLqTB4VLrEovU3iq8BMckn329Bu1fGbXKTgDpEvUEEwFO2brQZLMmzILGF/v4B9ImEGtinAUNgDSfEpgPN23sdWQH9rwEClGv95JmWNf05tuVomhZzOBtCFoAno3XB1nj16avjsqJ3aGFY2CCcfsNrwKzhIotmm82bcI4BJuJIVRIKbZ1 cardno:000603507108"
];
};
};
in
{
imports = [
inputs.private.nixosModules.users # Contains hashedPasswords for users.
];
users = {
mutableUsers = false;
groups = {
fhauser.gid = 1000;
};
users = users // {
root.openssh.authorizedKeys.keys =
with lib;
concatLists (
mapAttrsToList (
_name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else [ ]
) users
);
};
};
}

View file

@ -2,12 +2,10 @@
{ {
imports = [ imports = [
./base ./base
./base-system
./desktop ./desktop
./filesystems ./filesystems
./hardware ./hardware
./home-manager ./home-manager
./printing
./theme ./theme
./virtualisation ./virtualisation
]; ];

View file

@ -6,7 +6,6 @@
imports = [ imports = [
./desktop-environment.nix ./desktop-environment.nix
./greeter.nix ./greeter.nix
./hardware.nix
./office-suite.nix ./office-suite.nix
./security.nix ./security.nix
./video.nix ./video.nix

View file

@ -9,9 +9,6 @@
defaultSession = "sway"; defaultSession = "sway";
}; };
# Enable touchpad support.
services.libinput.enable = true;
services.xserver = { services.xserver = {
enable = true; enable = true;
desktopManager.xterm.enable = false; desktopManager.xterm.enable = false;

View file

@ -1,60 +0,0 @@
{
config,
pkgs,
...
}:
{
services.blueman.enable = true;
# Enable sound.
nixpkgs.config.pulseaudio = true;
services.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
security.rtkit.enable = true;
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
intel-compute-runtime
intel-media-driver
libvdpau-va-gl
vaapiVdpau
];
};
acpilight.enable = true;
bluetooth = {
enable = true;
package = pkgs.bluez;
};
logitech.wireless = {
enable = true;
enableGraphical = true;
};
};
services.hardware.bolt.enable = true;
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
programs.light.enable = true;
programs.adb.enable = true;
services.fprintd = {
enable = true;
package = pkgs.fprintd-tod;
tod = {
enable = true;
driver = pkgs.libfprint-2-tod1-vfs0090;
};
};
}

View file

@ -1,4 +1,6 @@
{ {
config,
lib,
... ...
}: }:
@ -6,7 +8,7 @@
services.pcscd.enable = true; services.pcscd.enable = true;
# Make pam accept both password and fingerprint # Make pam accept both password and fingerprint
security.pam.services.swaylock.rules.auth = { security.pam.services.swaylock.rules.auth = lib.mkIf config.services.fprintd.enable {
fprintd.order = 11601; fprintd.order = 11601;
unix.args = [ "nullok" ]; unix.args = [ "nullok" ];
}; };

View file

@ -1,4 +1,21 @@
{ inputs, ... }: { inputs, pkgs, ... }:
{ {
imports = [ inputs.disko.nixosModules.disko ]; imports = [ inputs.disko.nixosModules.disko ];
services.btrfs.autoScrub.enable = true;
environment.systemPackages = with pkgs; [
# Filesystem & Disk Utilities
exfat
samba
cifs-utils
keyutils # required for cifs kerberos auth
sshfs-fuse
hdparm
mtpfs
ntfs3g
smartmontools
parted
usbutils
];
} }

View file

@ -1,7 +1,7 @@
{ {
lib, lib,
config,
pkgs, pkgs,
modulesPath,
... ...
}: }:
let let
@ -40,30 +40,20 @@ let
''; '';
in in
{ {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; options.dotfiles.hardware.amd-desktop.enable =
lib.mkEnableOption "Enable AMD Desktop Setup Support";
boot.initrd.availableKernelModules = [ config = lib.mkIf config.dotfiles.hardware.amd-desktop.enable {
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"xhci_pci"
"ahci"
"virtio-pci"
"igb"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [
"kvm-amd"
"uhid"
];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "acpi_enforce_resources=lax" ];
environment.systemPackages = [ thunderboltDockRestart ]; dotfiles.hardware.ecc-memory.enable = true;
hardware.cpu.amd.updateMicrocode = true; boot.kernelParams = [ "acpi_enforce_resources=lax" ];
nix.settings.max-jobs = lib.mkDefault 24;
powerManagement.powerUpCommands = "${forceThunderboltOnScript}/bin/force-thunderbolt-power-on"; # The Thunderbolt card in combination with a Thinkpad Dock has power issues after suspend and boot.
# These scripts help with some cases.
environment.systemPackages = [ thunderboltDockRestart ];
powerManagement.powerUpCommands = "${forceThunderboltOnScript}/bin/force-thunderbolt-power-on";
nix.settings.max-jobs = lib.mkDefault 24;
};
} }

View file

@ -1,7 +1,75 @@
{ {
config,
inputs, inputs,
lib,
pkgs,
... ...
}: }:
{ {
imports = [ inputs.nixos-facter-modules.nixosModules.facter ];
imports = [
inputs.nixos-facter-modules.nixosModules.facter
./ecc-memory.nix
./amd-desktop.nix
./modem-em120r-gl.nix
./thinkpad-x1-gen9.nix
./printing.nix
];
# Enable touchpad support.
services.libinput.enable = true;
services.fwupd.enable = true;
services.blueman.enable = true;
# Enable sound.
nixpkgs.config.pulseaudio = true;
services.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
security.rtkit.enable = true;
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
intel-compute-runtime
intel-media-driver
libvdpau-va-gl
vaapiVdpau
];
};
acpilight.enable = true;
bluetooth = {
enable = true;
package = pkgs.bluez;
};
logitech.wireless = {
enable = true;
enableGraphical = true;
};
};
services.hardware.bolt.enable = true;
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
programs.light.enable = true;
programs.adb.enable = true;
services.fprintd = lib.mkIf config.facter.detected.fingerprint.enable {
enable = true;
package = pkgs.fprintd-tod;
tod = {
enable = true;
driver = pkgs.libfprint-2-tod1-vfs0090;
};
};
} }

View file

@ -1,8 +1,13 @@
{ {
config,
lib,
... ...
}: }:
{ {
hardware.rasdaemon = { options.dotfiles.hardware.ecc-memory.enable = lib.mkEnableOption "Enable ECC Memory Support";
enable = true;
config = lib.mkIf config.dotfiles.hardware.ecc-memory.enable {
hardware.rasdaemon.enable = true;
}; };
} }

View file

@ -0,0 +1,24 @@
{
lib,
pkgs,
config,
inputs,
...
}:
{
options.dotfiles.hardware.modem-em120r-gl.enable = lib.mkEnableOption "Enable EM120R GL Support";
config = lib.mkIf config.dotfiles.hardware.modem-em120r-gl.enable {
environment.systemPackages = with pkgs; [
modemmanager
libmbim
];
environment.etc."ModemManager/fcc-unlock.d/1eac:1001".source =
let
package = inputs.fcc-unlock.packages.${config.nixpkgs.hostPlatform.system}.default;
in
"${package}/bin/fcc-unlock";
};
}

View file

@ -3,6 +3,7 @@
}: }:
{ {
# TODO: Revive when needed.
#services.printing = { #services.printing = {
# enable = true; # enable = true;
# drivers = with pkgs; [ # drivers = with pkgs; [

View file

@ -1,42 +1,19 @@
{ {
lib, lib,
pkgs, config,
modulesPath,
hardwareModules,
pkgFccUnlock,
... ...
}: }:
{ {
imports = with hardwareModules; [ options.dotfiles.hardware.thinkpad-x1-gen9.enable =
(modulesPath + "/installer/scan/not-detected.nix") lib.mkEnableOption "Enable ThinkPad X1 Gen9 Support";
hardwareModules.lenovo-thinkpad-x1-9th-gen
];
boot.initrd.availableKernelModules = [ config = lib.mkIf config.dotfiles.hardware.thinkpad-x1-gen9.enable {
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"ahci"
"usbhid"
];
boot.kernelModules = [ "kvm-intel" ];
boot.initrd.kernelModules = [ "dm-snapshot" ]; # TODO: This should be moved to defaults dotfiles.hardware.modem-em120r-gl.enable = true;
environment.systemPackages = with pkgs; [ # CPU Configuration
modemmanager services.throttled.enable = true;
libmbim powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
];
environment.etc."ModemManager/fcc-unlock.d/1eac:1001" = {
source = "${pkgFccUnlock}/bin/fcc-unlock";
}; };
# CPU Configuration
hardware.cpu.intel.updateMicrocode = true;
services.throttled.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
} }

View file

@ -3,4 +3,9 @@
{ {
imports = [ inputs.catppuccin.nixosModules.catppuccin ]; imports = [ inputs.catppuccin.nixosModules.catppuccin ];
catppuccin = {
flavor = "mocha";
tty.enable = true;
};
} }

View file

@ -1,7 +1,6 @@
{ ... }: { config, ... }:
{ {
virtualisation = { virtualisation = {
# TODO: This should probably be somewhere else.
docker = { docker = {
enable = true; enable = true;
enableOnBoot = false; enableOnBoot = false;
@ -10,9 +9,24 @@
spiceUSBRedirection.enable = true; spiceUSBRedirection.enable = true;
}; };
boot.extraModprobeConfig = '' boot.extraModprobeConfig =
options kvm_intel nested=1 let
options kvm_intel emulate_invalid_guest_state=0 isIntel = config.hardware.cpu.intel.updateMicrocode;
options kvm ignore_msrs=1 isAmd = config.hardware.cpu.amd.updateMicrocode;
''; procName =
if isIntel then
"intel"
else if isAmd then
"amd"
else
"";
in
if isIntel || isAmd then
''
options kvm_${procName} nested=1
options kvm_${procName} emulate_invalid_guest_state=0
options kvm ignore_msrs=1
''
else
"";
} }