nixos/hosts/sparky/default.nix

107 lines
2.4 KiB
Nix
Raw Permalink Normal View History

{
inputs,
config,
lib,
configVars,
...
}: let
2024-05-27 16:19:00 +01:00
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
2024-05-28 20:19:30 +01:00
dev = "/dev/sda"; # depends on target hardware
2024-05-27 16:19:00 +01:00
encrypted = false; # currrently only applies to btrfs
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
2024-06-28 20:21:27 +01:00
impermanence = true;
pieholeIp = configVars.networking.addresses.piehole.ip;
gatewayIp = configVars.networking.addresses.gateway.ip;
in {
imports = [
# Create users for this host
../common/users/media
2024-05-23 00:10:58 +01:00
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
2024-05-27 16:19:00 +01:00
# Impermanence
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
2024-05-27 16:19:00 +01:00
# Import core options
./hardware-configuration.nix
../common/core
2024-05-16 11:55:24 +01:00
# Import optional options
../common/optional/openssh.nix
../common/optional/persistence.nix
../common/optional/nfs-mounts/media.nix
../common/optional/gaming.nix
../common/optional/printing.nix
];
2024-05-16 11:55:24 +01:00
2024-05-16 20:19:01 +01:00
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
boot.kernelParams = ["i915.enable_psr=0"];
2024-05-16 20:19:01 +01:00
networking = {
2024-05-17 20:17:53 +01:00
hostName = "sparky";
2024-05-16 20:19:01 +01:00
networkmanager.enable = true;
enableIPv6 = false;
nameservers = ["${pieholeIp}" "${gatewayIp}" "8.8.8.8"];
2024-05-16 20:19:01 +01:00
};
2024-05-29 20:14:20 +01:00
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Add additional package names here
"nvidia-x11"
"nvidia-settings"
"nvidia-persistenced"
];
2024-05-23 19:41:54 +01:00
services.displayManager.defaultSession = "cinnamon";
2024-05-29 19:49:31 +01:00
services.libinput.enable = true;
2024-05-23 19:41:54 +01:00
2024-05-24 14:32:18 +01:00
services.xserver = {
enable = true;
videoDrivers = ["nvidia"];
2024-05-24 14:32:18 +01:00
displayManager.lightdm.enable = true;
2024-05-29 19:49:31 +01:00
exportConfiguration = true;
deviceSection = ''
'';
2024-05-24 14:32:18 +01:00
desktopManager = {
cinnamon.enable = true;
2024-06-10 14:05:06 +01:00
};
2024-05-24 14:32:18 +01:00
};
2024-05-29 20:14:20 +01:00
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver
hardware.nvidia = {
# https://nixos.wiki/wiki/Nvidia
modesetting.enable = true;
powerManagement.enable = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
2024-05-16 20:19:01 +01:00
}