hosts/ni: modularize parts of the hardware setup

This commit is contained in:
Gabriel Arazas 2023-12-12 21:28:41 +08:00
parent 509ac5cdef
commit 3da9dc89fa
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 35 additions and 21 deletions

View File

@ -26,6 +26,7 @@
];
hosts.ni = {
hardware.qol.enable = true;
networking.setup = "networkmanager";
networking.wireguard.enable = true;
};

View File

@ -47,31 +47,10 @@
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
# We're using some better filesystems so we're using it.
boot.initrd.supportedFilesystems = [ "btrfs" ];
boot.supportedFilesystems = [ "btrfs" ];
services.btrfs.autoScrub = {
enable = true;
fileSystems = [
"/mnt/archives"
];
};
# Set up printers.
services.printing = {
enable = true;
browsing = true;
drivers = with pkgs; [
gutenprint
hplip
splix
];
};
# Make your CPU more useful.
services.auto-cpufreq.enable = true;
# Extend the life of an SSD.
services.fstrim.enable = true;
}

View File

@ -1,6 +1,7 @@
# Only optional modules should be imported here.
{
imports = [
./hardware/qol.nix
./networking/setup.nix
./networking/wireguard.nix
];

View File

@ -0,0 +1,33 @@
# Some quality-of-life features for your hardware.
{ config, lib, pkgs, ... }:
let
hostCfg = config.hosts.ni;
cfg = hostCfg.hardware.qol;
in
{
options.hosts.ni.hardware.qol.enable = lib.mkEnableOption "quality-of-life hardware features";
config = lib.mkIf cfg.enable {
# We're using some better filesystems so we're using it.
boot.initrd.supportedFilesystems = [ "btrfs" ];
boot.supportedFilesystems = [ "btrfs" ];
# Set up printers.
services.printing = {
enable = true;
browsing = true;
drivers = with pkgs; [
gutenprint
hplip
splix
];
};
# Make your CPU more useful.
services.auto-cpufreq.enable = true;
# Extend the life of an SSD.
services.fstrim.enable = true;
};
}