nix-config/systems/x86_64-linux/navis/default.nix

525 lines
12 KiB
Nix
Raw Permalink Normal View History

2024-05-07 03:23:55 -04:00
{
pkgs,
config,
inputs,
2024-05-16 02:40:39 -04:00
lib,
2024-05-07 03:23:55 -04:00
...
2024-09-28 22:03:51 -04:00
}: {
2024-11-07 01:27:11 -05:00
facter.reportPath = ./facter.json;
fileSystems = {
"/" = {
2024-11-11 15:57:56 -05:00
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
2024-11-07 01:27:11 -05:00
fsType = "btrfs";
options = ["subvol=root"];
};
"/home" = {
2024-11-11 15:57:56 -05:00
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
2024-11-07 01:27:11 -05:00
fsType = "btrfs";
options = ["subvol=home" "compress=zstd"];
};
"/nix" = {
2024-11-11 15:57:56 -05:00
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
2024-11-07 01:27:11 -05:00
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
"/persist" = {
2024-11-11 15:57:56 -05:00
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
2024-11-07 01:27:11 -05:00
neededForBoot = true;
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd"];
};
"/var/log" = {
2024-11-11 15:57:56 -05:00
device = "/dev/disk/by-uuid/d375c3a3-63a3-47f8-8b77-58fabbb8f67b";
2024-11-07 01:27:11 -05:00
fsType = "btrfs";
options = ["subvol=log" "compress=zstd" "noatime"];
neededForBoot = true;
};
"/boot" = {
device = "/dev/disk/by-uuid/12CE-A600";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};
};
2024-05-07 03:23:55 -04:00
2024-05-28 04:08:06 -04:00
security = {
rtkit.enable = true;
2024-06-13 23:47:00 -04:00
pam = {
2024-11-11 16:03:50 -05:00
services.login.enableGnomeKeyring = true;
2024-06-13 23:47:00 -04:00
loginLimits = [
{
domain = "*";
item = "nofile";
type = "-";
value = "32768";
}
{
domain = "*";
item = "memlock";
type = "-";
value = "32768";
}
];
};
2024-05-16 02:40:39 -04:00
2024-09-28 22:03:51 -04:00
sudo-rs = {
enable = true;
wheelNeedsPassword = false;
execWheelOnly = true;
};
2024-11-11 15:57:56 -05:00
tpm2 = {
enable = true;
pkcs11.enable = true;
tctiEnvironment.enable = true;
};
2024-05-28 04:08:06 -04:00
};
2024-05-16 02:40:39 -04:00
fonts = {
2024-10-18 00:43:17 -04:00
packages = with pkgs;
[
ibm-plex
nerdfonts
]
++ (with iosevka-comfy; [
comfy
comfy-duo
comfy-fixed
comfy-motion
comfy-motion-duo
comfy-motion-fixed
comfy-wide
comfy-wide-duo
comfy-wide-fixed
comfy-wide-motion
comfy-wide-motion-duo
comfy-wide-motion-fixed
]);
2024-10-05 00:43:16 -04:00
fontconfig = {
2024-10-18 00:43:17 -04:00
hinting.enable = true;
subpixel.lcdfilter = "none";
};
};
2024-05-16 02:40:39 -04:00
console.catppuccin.enable = true;
2024-11-11 15:57:56 -05:00
systemd = {
tpm2.enable = true;
network.networks = {
"10-lan1" = {
DHCP = "yes";
matchConfig.MACAddress = "04:42:1a:02:fe:f5";
dhcpV4Config.RouteMetric = 10;
dhcpV6Config.RouteMetric = 10;
networkConfig = {
IPv6PrivacyExtensions = "yes";
MulticastDNS = true;
};
};
"10-wlan1" = {
DHCP = "yes";
matchConfig.MACAddress = "64:49:7d:c1:01:10";
dhcpV4Config.RouteMetric = 40;
dhcpV6Config.RouteMetric = 40;
networkConfig = {
IPv6PrivacyExtensions = "yes";
MulticastDNS = true;
};
};
};
user.extraConfig = let
path = lib.concatStringsSep ":" [
"/run/wrappers/bin"
"/etc/profiles/per-user/%u/bin"
"/nix/var/nix/profiles/default/bin"
"/run/current-system/sw/bin"
];
in ''
DefaultEnvironment="PATH=${path}"
'';
};
2024-05-16 02:40:39 -04:00
2024-05-07 03:23:55 -04:00
age = {
2024-09-28 22:03:51 -04:00
secrets.passwd.file = ../../../secrets/passwd.age;
2024-05-28 04:08:06 -04:00
identityPaths = ["/persist/root/.ssh/id_ed25519"];
2024-05-07 03:23:55 -04:00
};
2024-05-16 02:40:39 -04:00
virtualisation = {
spiceUSBRedirection.enable = true;
2024-11-07 01:27:11 -05:00
waydroid.enable = true;
2024-05-16 02:40:39 -04:00
podman = {
enable = true;
dockerCompat = true;
dockerSocket.enable = true;
};
};
2024-05-07 03:23:55 -04:00
environment = {
sessionVariables = {
2024-09-30 23:23:51 -04:00
BROWSER = "zen";
2024-06-13 23:47:00 -04:00
DIRENV_WARN_TIMEOUT = "100s";
2024-05-07 03:23:55 -04:00
EDITOR = "nvim";
2024-09-30 23:23:51 -04:00
NIXOS_OZONE_WL = 1;
2024-05-28 04:08:06 -04:00
TERMINAL = "wezterm";
2024-05-07 03:23:55 -04:00
};
2024-09-28 22:03:51 -04:00
systemPackages = with pkgs; [
2024-10-27 17:54:13 -04:00
ddccontrol-db
2024-11-11 15:57:56 -05:00
inputs.agenix.packages.${system}.default
2024-06-13 23:47:00 -04:00
looking-glass-client
2024-11-11 15:57:56 -05:00
nautilus
qemu
2024-05-16 02:40:39 -04:00
snowfallorg.flake
sound-theme-freedesktop
2024-11-11 15:57:56 -05:00
uutils-coreutils-noprefix
2024-06-13 23:47:00 -04:00
virtio-win
2024-07-28 02:49:27 -04:00
(warp-terminal.override {waylandSupport = true;})
2024-05-28 04:08:06 -04:00
winetricks
wineWowPackages.staging
2024-05-16 02:40:39 -04:00
xclip
yt-dlp
];
2024-05-07 03:23:55 -04:00
persistence."/persist" = {
hideMounts = true;
directories = [
"/etc/ssh"
2024-05-16 03:56:19 -04:00
"/root/.ssh"
2024-05-07 03:23:55 -04:00
"/var/lib/bluetooth"
2024-11-11 15:57:56 -05:00
"/var/lib/iwd"
2024-06-13 23:47:00 -04:00
"/var/lib/libvirt"
2024-05-07 03:23:55 -04:00
"/var/lib/nixos"
"/var/lib/systemd/coredump"
];
2024-05-28 04:08:06 -04:00
files = ["/etc/machine-id"];
2024-05-07 03:23:55 -04:00
};
};
boot = {
2024-08-15 01:59:55 -04:00
blacklistedKernelModules = ["nouveau" "i915"];
2024-09-28 22:03:51 -04:00
kernelPackages = pkgs.linuxPackages_cachyos;
2024-05-07 03:23:55 -04:00
supportedFilesystems = ["btrfs" "ntfs"];
2024-11-07 01:27:11 -05:00
tmp.useTmpfs = true;
2024-11-11 15:57:56 -05:00
initrd = {
# Encrypted device
luks.devices."enc".device = "/dev/disk/by-uuid/9952fcd1-46eb-4c9c-ab7d-361d31fdb9a2";
2024-11-10 22:15:07 -05:00
2024-11-11 15:57:56 -05:00
systemd = {
enable = true;
emergencyAccess = true;
dbus.enable = true;
2024-11-10 22:15:07 -05:00
2024-11-11 15:57:56 -05:00
network = {
enable = true;
networks = {
inherit (config.systemd.network.networks) "10-lan1" "10-wlan1";
};
};
2024-05-16 02:40:39 -04:00
2024-11-11 15:57:56 -05:00
initrdBin = with pkgs; [
iwd
nix
vim
];
services.wipe-root = {
requires = ["dev-mapper-enc.device"];
after = ["dev-mapper-enc.device"];
wantedBy = ["initrd.target"];
script = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/mapper/enc /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
};
};
2024-05-16 02:40:39 -04:00
};
extraModprobeConfig =
"options nvidia "
2024-09-28 22:03:51 -04:00
+ lib.concatStringsSep " " [
2024-05-16 02:40:39 -04:00
"NVreg_EnablePCIeGen3=1"
"NVreg_RegistryDwords=RMUseSwI2c=0x01;RMI2cSpeed=100"
2024-11-11 15:57:56 -05:00
"NVreg_UsePageAttributeTable=1"
2024-05-16 02:40:39 -04:00
];
kernelParams = [
"intel_iommu=on"
"iommu=pt"
"kvm.ignore_msrs=1"
2024-08-15 01:59:55 -04:00
"modprobe.blacklist=nouveau,i915"
"nvidia_drm.fbdev=1"
2024-05-16 02:40:39 -04:00
];
2024-05-07 03:23:55 -04:00
loader = {
efi.canTouchEfiVariables = true;
2024-05-16 02:40:39 -04:00
systemd-boot = {
enable = true;
configurationLimit = 20;
};
2024-05-07 03:23:55 -04:00
};
};
2024-11-07 01:27:11 -05:00
nix = {
2024-05-16 02:40:39 -04:00
daemonCPUSchedPolicy = "batch";
daemonIOSchedClass = "idle";
daemonIOSchedPriority = 7;
gc = {
automatic = true;
dates = "Sat *-*-* 03:00";
options = "--delete-older-than 30d";
};
optimise = {
automatic = true;
dates = ["04:00"];
};
2024-05-07 03:23:55 -04:00
settings = {
2024-05-16 02:40:39 -04:00
auto-optimise-store = true;
builders-use-substitutes = true;
flake-registry = "/etc/nix/registry.json";
keep-going = true;
log-lines = 30;
max-jobs = "auto";
sandbox-fallback = false;
sandbox = true;
2024-08-12 00:31:35 -04:00
system-features = ["nixos-test" "kvm" "recursive-nix" "big-parallel" "gccarch-x86-64-v4"];
2024-05-16 02:40:39 -04:00
use-cgroups = true;
use-xdg-base-directories = true;
warn-dirty = false;
allowed-users = ["root" "@wheel" "nix-builder"];
trusted-users = ["root" "@wheel" "nix-builder"];
min-free = "${toString (5 * 1024 * 1024 * 1024)}";
max-free = "${toString (10 * 1024 * 1024 * 1024)}";
extra-experimental-features = [
"flakes" # flakes
"nix-command" # experimental nix commands
"recursive-nix" # let nix invoke itself
"ca-derivations" # content addressed nix
"auto-allocate-uids" # allow nix to automatically pick UIDs, rather than creating nixbld* user accounts
"cgroups" # allow nix to execute builds inside cgroups
];
2024-05-07 03:23:55 -04:00
substituters = [
2024-06-16 01:52:32 -04:00
"https://cache.nixos.org?priority=100"
2024-05-28 04:08:06 -04:00
"https://cache.privatevoid.net"
2024-08-15 01:59:55 -04:00
"https://cosmic.cachix.org/"
2024-05-28 04:08:06 -04:00
"https://cuda-maintainers.cachix.org"
"https://hyprland.cachix.org"
2024-05-07 03:23:55 -04:00
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
2024-05-28 04:08:06 -04:00
"cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
2024-08-15 01:59:55 -04:00
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
2024-05-16 02:40:39 -04:00
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
2024-05-28 04:08:06 -04:00
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
2024-05-07 03:23:55 -04:00
];
};
};
programs = {
2024-05-16 02:40:39 -04:00
dconf.enable = true;
2024-05-07 03:23:55 -04:00
fish.enable = true;
gamemode.enable = true;
steam.enable = true;
gnupg.agent.enable = true;
2024-05-16 02:40:39 -04:00
virt-manager.enable = true;
2024-05-07 03:23:55 -04:00
2024-09-29 00:41:05 -04:00
appimage = {
2024-05-28 04:08:06 -04:00
enable = true;
2024-09-29 00:41:05 -04:00
binfmt = true;
};
hyprland = {
enable = false;
2024-09-28 22:03:51 -04:00
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
2024-05-28 04:08:06 -04:00
};
2024-05-07 03:23:55 -04:00
nh = {
enable = true;
flake = "/home/marshall/nix-config";
};
2024-06-26 03:14:20 -04:00
2024-10-18 00:43:17 -04:00
obs-studio = {
enable = true;
enableVirtualCamera = true;
};
2024-05-07 03:23:55 -04:00
};
networking = {
firewall.enable = false;
2024-11-11 15:57:56 -05:00
networkmanager.enable = false;
hostName = "navis";
2024-05-16 02:40:39 -04:00
nameservers = ["1.1.1.1" "1.0.0.1"];
2024-11-11 15:57:56 -05:00
useDHCP = lib.mkForce true;
useNetworkd = true;
wireless.iwd.enable = true;
2024-05-07 03:23:55 -04:00
};
2024-07-28 02:49:27 -04:00
time = {
hardwareClockInLocalTime = true;
timeZone = "America/New_York";
};
2024-05-07 03:23:55 -04:00
services = {
2024-10-27 17:54:13 -04:00
ddccontrol.enable = true;
2024-05-07 03:23:55 -04:00
flatpak.enable = true;
2024-05-28 04:08:06 -04:00
getty.autologinUser = "marshall";
2024-11-11 16:03:50 -05:00
gnome.gnome-keyring.enable = true;
2024-05-07 03:23:55 -04:00
openssh.enable = true;
2024-05-16 02:40:39 -04:00
spice-vdagentd.enable = true;
2024-05-28 04:08:06 -04:00
udisks2.enable = true;
2024-05-16 02:40:39 -04:00
2024-11-07 01:27:11 -05:00
btrfs.autoScrub = {
enable = true;
fileSystems = ["/dev/mapper/enc"];
};
2024-08-15 01:59:55 -04:00
displayManager.cosmic-greeter.enable = true;
2024-09-28 22:03:51 -04:00
desktopManager.cosmic.enable = true;
2024-08-15 01:59:55 -04:00
2024-05-16 02:40:39 -04:00
libinput = {
enable = true;
touchpad.naturalScrolling = true;
};
2024-05-07 03:23:55 -04:00
xserver = {
enable = true;
videoDrivers = ["nvidia"];
2024-09-28 22:03:51 -04:00
displayManager.startx.enable = true;
windowManager.xmonad = {
2024-09-29 00:53:12 -04:00
enable = false;
2024-09-28 22:03:51 -04:00
enableContribAndExtras = true;
enableConfiguredRecompile = true;
flake = {
enable = true;
compiler = "ghc982";
};
};
2024-05-07 03:23:55 -04:00
};
pipewire = {
enable = true;
pulse.enable = true;
2024-11-11 15:57:56 -05:00
alsa = {
enable = true;
support32Bit = true;
};
2024-05-07 03:23:55 -04:00
};
};
users = {
mutableUsers = false;
users.marshall = {
2024-11-11 15:57:56 -05:00
hashedPasswordFile = config.age.secrets.passwd.path;
2024-05-07 03:23:55 -04:00
isNormalUser = true;
2024-09-28 22:03:51 -04:00
shell = pkgs.fish;
2024-11-11 15:57:56 -05:00
extraGroups = [
"disk"
"gamemode"
"libvirtd"
"qemu-libvirtd"
"tss"
"wheel"
];
2024-05-07 03:23:55 -04:00
};
};
2024-07-28 02:49:27 -04:00
snowfallorg.users.marshall = {
create = true;
admin = true;
};
2024-07-31 01:03:58 -04:00
home-manager.useGlobalPkgs = true;
2024-05-07 03:23:55 -04:00
hardware = {
2024-05-16 02:40:39 -04:00
bluetooth.enable = true;
2024-05-28 04:08:06 -04:00
i2c.enable = true;
2024-05-16 02:40:39 -04:00
graphics = {
2024-05-07 03:23:55 -04:00
enable = true;
enable32Bit = true;
2024-09-28 22:03:51 -04:00
extraPackages = with pkgs; [
2024-05-16 02:40:39 -04:00
vaapiVdpau
nvidia-vaapi-driver
];
2024-05-07 03:23:55 -04:00
};
2024-05-16 02:40:39 -04:00
nvidia-container-toolkit.enable = true;
2024-05-07 03:23:55 -04:00
nvidia = {
2024-05-28 04:08:06 -04:00
package = config.boot.kernelPackages.nvidiaPackages.beta;
2024-05-07 03:23:55 -04:00
modesetting.enable = true;
2024-05-16 02:40:39 -04:00
powerManagement.enable = true;
2024-08-15 01:59:55 -04:00
open = false;
2024-05-07 03:23:55 -04:00
};
};
2024-10-18 00:43:17 -04:00
xdg.portal = {
enable = true;
2024-11-11 15:57:56 -05:00
xdgOpenUsePortal = true;
config.common.default = [
"cosmic"
"gtk"
];
2024-10-18 00:43:17 -04:00
extraPortals = [
pkgs.xdg-desktop-portal-cosmic
pkgs.xdg-desktop-portal-gtk
];
};
2024-06-13 23:47:00 -04:00
2024-05-07 03:23:55 -04:00
system.stateVersion = "24.05";
}