113 lines
3.2 KiB
Nix
113 lines
3.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (config) host;
|
|
inherit (lib) mkOption removePrefix;
|
|
inherit (lib.types) path;
|
|
|
|
identity = import ./resources/identity.nix;
|
|
palette = import ./resources/palette.nix { inherit lib; };
|
|
in
|
|
{
|
|
imports = [
|
|
./components/backup.system.nix
|
|
./components/desktop.system.nix
|
|
./components/keyboard.system.nix
|
|
./components/locale.system.nix
|
|
./components/mail.system.nix
|
|
./components/networking.system.nix
|
|
./components/nix.system.nix
|
|
./components/openpgp.system.nix
|
|
./components/printer.system.nix
|
|
./components/scanner.system.nix
|
|
./components/users.system.nix
|
|
./components/virtualization.system.nix
|
|
];
|
|
|
|
options.host = {
|
|
local = mkOption { type = path; };
|
|
resources = mkOption { type = path; };
|
|
};
|
|
|
|
config = {
|
|
# Boot
|
|
allowedUnfree = [ "memtest86-efi" ];
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.systemd-boot.memtest86.enable = true;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
boot.plymouth.enable = true;
|
|
|
|
# Swap
|
|
zramSwap.enable = true;
|
|
|
|
# Filesystems
|
|
boot.initrd.luks = {
|
|
gpgSupport = true;
|
|
devices.pv = {
|
|
device = "/dev/disk/by-partlabel/pv-enc";
|
|
allowDiscards = true;
|
|
fallbackToPassword = true;
|
|
gpgCard.encryptedPass = ./local/resources/luks-passphrase.gpg;
|
|
gpgCard.publicKey = identity.openpgp.asc;
|
|
};
|
|
};
|
|
fileSystems."/".options = [ "compress=zstd:2" "discard=async" "noatime" ];
|
|
services.btrfs.autoScrub.enable = true;
|
|
boot.tmp.cleanOnBoot = true;
|
|
|
|
# Console
|
|
console.packages = with pkgs; [ terminus_font ];
|
|
console.font = "ter-v32n";
|
|
console.colors = map (removePrefix "#") (with palette; [
|
|
"#000000" red green yellow blue orange purple white
|
|
gray red green yellow blue orange purple white
|
|
]);
|
|
|
|
# Power
|
|
systemd.ctrlAltDelUnit = "poweroff.target";
|
|
services.irqbalance.enable = true;
|
|
|
|
# Authentication
|
|
security.pam.u2f = {
|
|
enable = true;
|
|
appId = "pam://${host.name}";
|
|
authFile = host.local + "/resources/andrew.u2f";
|
|
control = "sufficient";
|
|
cue = true;
|
|
};
|
|
|
|
# Authorization
|
|
security.sudo.extraRules = [
|
|
{
|
|
groups = [ "wheel" ];
|
|
commands = [
|
|
{ command = "/run/current-system/sw/bin/btrfs balance start --enqueue -dusage=50 -musage=50 /"; options = [ "NOPASSWD" ]; }
|
|
{ command = "/run/current-system/sw/bin/nix-channel --update"; options = [ "NOPASSWD" ]; }
|
|
{ command = "/run/current-system/sw/bin/nixos-rebuild boot"; options = [ "NOPASSWD" ]; }
|
|
{ command = "/run/current-system/sw/bin/nixos-rebuild switch"; options = [ "NOPASSWD" ]; }
|
|
{ command = "/run/current-system/sw/bin/poweroff"; options = [ "NOPASSWD" ]; }
|
|
];
|
|
}
|
|
];
|
|
|
|
# SSH
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PasswordAuthentication = false;
|
|
};
|
|
|
|
# SMART monitoring
|
|
services.smartd = {
|
|
enable = true;
|
|
notifications.mail.enable = true;
|
|
};
|
|
|
|
# Firmware updates
|
|
hardware.enableRedistributableFirmware = true;
|
|
services.fwupd.enable = true;
|
|
|
|
# Applications
|
|
environment.localBinInPath = true;
|
|
programs.zsh.enable = true;
|
|
};
|
|
}
|