Merge branch 'main' of ssh://code.8bitbuddhism.com/aires/nix-configuration
This commit is contained in:
commit
d595181cc0
105
hosts/Dimaga/default.nix
Normal file
105
hosts/Dimaga/default.nix
Normal file
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# Do not change this value! This tracks when NixOS was installed on your system.
|
||||
stateVersion = "24.11";
|
||||
in
|
||||
{
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
|
||||
system.stateVersion = stateVersion;
|
||||
|
||||
###*** Configure your system below this line. ***###
|
||||
# Set your time zone.
|
||||
# To see all available timezones, run `timedatectl list-timezones`.
|
||||
time.timeZone = "America/New_York";
|
||||
|
||||
# Configure the system.
|
||||
aux.system = {
|
||||
# Enable to allow unfree (e.g. closed source) packages.
|
||||
# Some settings may override this (e.g. enabling Nvidia GPU support).
|
||||
# https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree
|
||||
allowUnfree = true;
|
||||
|
||||
apps = {
|
||||
development.enable = true;
|
||||
#media.enable = true;
|
||||
#office.enable = true;
|
||||
#recording.enable = true;
|
||||
#social.enable = true;
|
||||
#writing.enable = true;
|
||||
};
|
||||
|
||||
# Enable Secure Boot support.
|
||||
bootloader = {
|
||||
enable = true;
|
||||
#secureboot.enable = true;
|
||||
tpm2.enable = true;
|
||||
};
|
||||
|
||||
# Change the default text editor. Options are "emacs", "nano", or "vim".
|
||||
editor = "nano";
|
||||
|
||||
# Enable GPU support.
|
||||
gpu = {
|
||||
intel.enable = true;
|
||||
nvidia = {
|
||||
enable = true;
|
||||
hybrid = {
|
||||
enable = true;
|
||||
busIDs.nvidia = "PCI:3:0:0";
|
||||
busIDs.intel = "PCI:0:2:0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Change how long old generations are kept for.
|
||||
retentionPeriod = "14d";
|
||||
|
||||
services = {
|
||||
autoUpgrade = {
|
||||
enable = true;
|
||||
configDir = config.secrets.nixConfigFolder;
|
||||
onCalendar = "daily";
|
||||
user = config.users.users.aires.name;
|
||||
};
|
||||
virtualization.enable = true;
|
||||
};
|
||||
|
||||
ui = {
|
||||
desktops.gnome = {
|
||||
enable = true;
|
||||
tripleBuffering.enable = true;
|
||||
};
|
||||
flatpak = {
|
||||
# Enable Flatpak support.
|
||||
enable = true;
|
||||
|
||||
# Define Flatpak packages to install.
|
||||
packages = [
|
||||
"com.github.tchx84.Flatseal"
|
||||
"com.github.wwmm.easyeffects"
|
||||
"md.obsidian.Obsidian"
|
||||
"org.keepassxc.KeePassXC"
|
||||
"org.mozilla.firefox"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
users.aires = {
|
||||
enable = true;
|
||||
services = {
|
||||
syncthing = {
|
||||
enable = true;
|
||||
autostart = true;
|
||||
enableTray = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
74
hosts/Dimaga/hardware-configuration.nix
Normal file
74
hosts/Dimaga/hardware-configuration.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
luksPartition = "/dev/disk/by-uuid/dfb4fc8f-e82b-43a1-91c1-a77acb6337cb";
|
||||
luksDevice = "9fdc521b-a037-4070-af47-f54da03675e4";
|
||||
standardMountOpts = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
luks.devices."luks-${luksDevice}" = {
|
||||
device = "/dev/disk/by-uuid/${luksDevice}";
|
||||
crypttabExtraOpts = [ "tpm2-device=auto" ]; # Enable TPM auto-unlocking
|
||||
};
|
||||
};
|
||||
kernelModules = [ "kvm-intel" ];
|
||||
extraModulePackages = [ ];
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = luksPartition;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" ] ++ standardMountOpts;
|
||||
};
|
||||
"/home" = {
|
||||
device = luksPartition;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@home" ] ++ standardMountOpts;
|
||||
};
|
||||
"/nix" = {
|
||||
device = luksPartition;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@nix" ] ++ standardMountOpts;
|
||||
};
|
||||
"/swap" = {
|
||||
device = luksPartition;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@swap" ];
|
||||
};
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/FC20-D155";
|
||||
fsType = "vfat";
|
||||
};
|
||||
};
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.disko;
|
||||
cfg = config.aux.system.disko;
|
||||
|
||||
standardMountOpts = [
|
||||
"compress=zstd"
|
||||
|
@ -9,20 +9,12 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
disko = {
|
||||
aux.system.disko = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "Enables Disko for disk & partition management.");
|
||||
primaryDisk = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
description = "The disk to format using Disko.";
|
||||
default = {
|
||||
name = "nvme0n1";
|
||||
id = "";
|
||||
};
|
||||
};
|
||||
enableTPM = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Enables TPM2 support.";
|
||||
default = true;
|
||||
primaryDiskID = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The ID of the disk to manage using Disko. If possible, use the World Wide Name (WWN), e.g `/dev/disk/by-id/nvme-eui.*`";
|
||||
default = "";
|
||||
};
|
||||
swapFile = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "Enables the creation of swap files.");
|
||||
|
@ -36,13 +28,20 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Check for blank values
|
||||
assertions = [
|
||||
{
|
||||
assertion = (cfg.primaryDiskID != "");
|
||||
message = "aux.system.disko.primaryDiskID is not set. Please enter a valid disk ID.";
|
||||
}
|
||||
];
|
||||
# Disk management
|
||||
disko.enableConfig = false;
|
||||
disko.enableConfig = true;
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/${cfg.primaryDisk.id}";
|
||||
device = "/dev/disk/by-id/${cfg.primaryDiskID}";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
@ -66,7 +65,7 @@ in
|
|||
name = "cryptroot";
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
crypttabExtraOpts = lib.mkIf cfg.enableTPM [ "tpm2-device=auto" ];
|
||||
crypttabExtraOpts = lib.mkIf config.aux.system.bootloader.tpm2.enable [ "tpm2-device=auto" ];
|
||||
};
|
||||
content = {
|
||||
type = "btrfs";
|
|
@ -45,11 +45,11 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = (cfg.busIDs.nvidia == "");
|
||||
assertion = (cfg.hybrid.busIDs.nvidia != "");
|
||||
message = "You need to define a bus ID for your Nvidia GPU. To learn how to find the bus ID, see https://nixos.wiki/wiki/Nvidia#Configuring_Optimus_PRIME:_Bus_ID_Values_.28Mandatory.29.";
|
||||
}
|
||||
{
|
||||
assertion = (cfg.busIDs.intel == "" && cfg.busIDs.amd == "");
|
||||
assertion = (cfg.hybrid.busIDs.intel != "" || cfg.hybrid.busIDs.amd != "");
|
||||
message = "You need to define a bus ID for your non-Nvidia GPU. To learn how to find your bus ID, see https://nixos.wiki/wiki/Nvidia#Configuring_Optimus_PRIME:_Bus_ID_Values_.28Mandatory.29.";
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue