Large refactor to clean up flake.nix

This commit is contained in:
Lauren Lagarde 2025-08-12 22:53:14 -05:00
parent 916595caa3
commit 67f0d12fc4
11 changed files with 206 additions and 362 deletions

377
flake.nix
View file

@ -3,6 +3,7 @@
# https://bitbucket.org/bzz/nixos/src/master/configuration.nix
# https://grahamc.com/blog/erase-your-darlings/
# https://github.com/Misterio77/nix-starter-configs
# https://github.com/solomon-b/nixos-config
{
inputs = {
@ -48,38 +49,12 @@
inherit system;
config.allowUnfree = true;
};
# Look into: https://git.sr.ht/~magic_rb/dotfiles/tree/master/item/nixos/systems/gooseberry
pi_modules = [{
# Disabling the whole `profiles/base.nix` module, which is responsible
# for adding ZFS and a bunch of other unnecessary programs:
disabledModules = [
"profiles/base.nix"
];
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
};
}];
# TODO: Surely a better way, no?
_inherited_modules = [
home-manager.nixosModules.home-manager
disko.nixosModules.default
lix-module.nixosModules.default
];
in {
############################################################################
############################################################################
############################################################################
# Home Manager Configurations
homeManagerModules = {
"lauren_lagarde" = [
{
@ -92,360 +67,80 @@
./home-manager/base.nix
];
"lauren_lagarde@living-room" = self.homeManagerModules."lauren_lagarde" ++ [
./home-manager/i3.nix
"lauren_lagarde@tui.mlaga97.space" = self.homeManagerModules."lauren_lagarde" ++ [
./secrets/mlaga97.nix
#./secrets/mlaga97-gui.nix
./systems/living-room/home.nix
];
"lauren_lagarde@ll-latitude-e5591" = self.homeManagerModules."lauren_lagarde" ++ [
"lauren_lagarde@gui.mlaga97.space" = self.homeManagerModules."lauren_lagarde@tui.mlaga97.space" ++ [
./home-manager/i3.nix
];
./secrets/mlaga97.nix
"lauren_lagarde@personal.mlaga97.space" = self.homeManagerModules."lauren_lagarde@gui.mlaga97.space" ++ [
./secrets/mlaga97-gui.nix
./systems/ll-latitude-e5591/home.nix
];
};
homeConfigurations = {
"lauren_lagarde" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = self.homeManagerModules."lauren_lagarde";
extraSpecialArgs = { inherit self inputs pkgs-unstable; };
modules = self.homeManagerModules."lauren_lagarde";
};
"lauren_lagarde@ll-latitude-e5591" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = self.homeManagerModules."lauren_lagarde@ll-latitude-e5591";
extraSpecialArgs = { inherit self inputs pkgs-unstable; };
modules = self.homeManagerModules."lauren_lagarde@personal.mlaga97.space";
};
};
############################################################################
############################################################################
############################################################################
# NixOS System Configurations
nixosConfigurations = {
##########################################################################
##########################################################################
##########################################################################
# Physical Systems
ll-latitude-e5591 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "ll-latitude-e5591";
networking.hostId = "f55542ee";
system.stateVersion = "24.11";
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/ll-latitude-e5591/configuration.nix
./nixos/disko/nvme/uefi-luks-lvm-ext4.nix
sops-nix.nixosModules.sops
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
waveforms.nixosModule
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
};
living-room = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "living-room";
system.stateVersion = "25.05";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde@living-room";
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/living-room/configuration.nix
sops-nix.nixosModules.sops
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
};
bastion = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "bastion";
networking.hostId = "0d13f99b";
system.stateVersion = "24.11";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "24.11";
imports = self.homeManagerModules."lauren_lagarde" ++ [
./secrets/mlaga97.nix
];
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/bastion/configuration.nix
sops-nix.nixosModules.sops
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/bastion/configuration.nix ];
};
blockhouse = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "blockhouse";
networking.hostId = "ed658529";
system.stateVersion = "23.11";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "24.11";
imports = self.homeManagerModules."lauren_lagarde" ++ [
./secrets/mlaga97.nix
];
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/blockhouse/configuration.nix
sops-nix.nixosModules.sops
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/blockhouse/configuration.nix ];
};
fortress = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "fortress";
system.stateVersion = "25.05";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde" ++ [
./secrets/mlaga97.nix
];
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/fortress/configuration.nix
sops-nix.nixosModules.sops
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
];
specialArgs = { inherit inputs pkgs-unstable; };
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/fortress/configuration.nix ];
};
stronghold = nixpkgs.lib.nixosSystem {
living-room = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "stronghold";
networking.hostId = "c581a1cd";
}
./systems/stronghold/configuration.nix
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/living-room/configuration.nix ];
};
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
ll-latitude-e5591 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs pkgs-unstable; };
modules = [ ./systems/ll-latitude-e5591/configuration.nix ];
};
redoubt = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = pi_modules ++ [
{
networking.hostName = "redoubt";
system.stateVersion = "25.05";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde" ++ [
./secrets/mlaga97.nix
];
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ./secrets.yaml;
}
./systems/redoubt/configuration.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
];
specialArgs = { inherit inputs pkgs-unstable; };
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/redoubt/configuration.nix ];
};
##########################################################################
##########################################################################
##########################################################################
# Other
ll-nixos-headless-pi = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = pi_modules ++ [
{
networking.hostName = "ll-nixos-headless-pi";
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
};
}
./systems/ll-nixos-headless.nix
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
waveforms.nixosModule
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
};
ll-nixos-base = nixpkgs.lib.nixosSystem {
stronghold = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "ll-nixos-base";
home-manager.users."lauren_lagarde" = { config, pkgs-unstable, ... }: {
imports = inputs.mlaga97-home-manager.homeManagerModules."lauren_lagarde@ll-latitude-e5591";
};
}
./systems/ll-nixos-base.nix
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
waveforms.nixosModule
disko.nixosModules.default
];
specialArgs = { inherit inputs pkgs-unstable; };
};
vm-docker-luks-test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "vm-docker-luks-test";
networking.hostId = "1b5432b7";
}
./systems/vm-docker-luks.nix
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
};
vm-docker-zfs-test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
networking.hostName = "vm-docker-zfs-test";
networking.hostId = "459ecfce";
}
./systems/vm-docker-host/vm-docker-host-zfs.nix
lix-module.nixosModules.default
home-manager.nixosModules.home-manager
disko.nixosModules.default
];
specialArgs = { inherit self inputs pkgs-unstable; };
modules = [ ./systems/stronghold/configuration.nix ];
};
};
#packages.aarch64-linux = {
# ll-nixos-headless-pi-sdcard = nixos-generators.nixosGenerate {
# system = "aarch64-linux";
# format = "sd-aarch64";
# modules = pi_modules ++ [
# { networking.hostName = "ll-nixos-headless-pi"; }
# ./systems/ll-nixos-headless.nix
# lix-module.nixosModules.default
# home-manager.nixosModules.home-manager
# ];
# specialArgs = { inherit inputs pkgs-unstable; };
# };
# token-pi-sdcard = nixos-generators.nixosGenerate {
# system = "aarch64-linux";
# format = "sd-aarch64";
# modules = pi_modules ++ [
# { networking.hostName = "token-pi"; }
# ./systems/ll-nixos-headless.nix
# lix-module.nixosModules.default
# home-manager.nixosModules.home-manager
# ];
# specialArgs = { inherit inputs pkgs-unstable; };
# };
# outpost-sdcard = nixos-generators.nixosGenerate {
# system = "aarch64-linux";
# format = "sd-aarch64";
# modules = pi_modules ++ [
# ./systems/outpost.nix
# lix-module.nixosModules.default
# home-manager.nixosModules.home-manager
# ];
# specialArgs = { inherit inputs pkgs-unstable; };
# };
#};
};
}

View file

@ -1,3 +1,5 @@
# sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake .#$TARGET_HOSTNAME --disk nvme0n1 /dev/nvme0n1
# tar -xvf /Parlor/Lauren/mlaga97-nixos.tar.zst; sudo nixos-rebuild switch --flake mlaga97-nixos?submodules=1#$HOSTNAME
{ ... }: {
disko.devices = {
disk = {

24
nixos/features/pi.nix Normal file
View file

@ -0,0 +1,24 @@
{ ... }: {
# Look into: https://git.sr.ht/~magic_rb/dotfiles/tree/master/item/nixos/systems/gooseberry
# Disabling the whole `profiles/base.nix` module, which is responsible
# for adding ZFS and a bunch of other unnecessary programs:
disabledModules = [
"profiles/base.nix"
];
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
};
}

View file

@ -1,3 +1,6 @@
{ ... }: {
virtualisation.libvirtd.enable = true;
# TODO: Is this the right place?
virtualisation.spiceUSBRedirection.enable = true;
}

View file

@ -1,7 +1,4 @@
# WARNING: BUILT-IN ETHERNET HARDWARE IS BORKED!!!
# https://xcp-ng.org/docs/networking.html#intel-i218-i219-slow-speed
# https://serverfault.com/questions/581265/disable-tcp-checksum-offloading-on-kvm-virtual-network
{ pkgs, ... }: {
{ inputs, self, pkgs, pkgs-unstable, ... }: {
# System Info:
# - Model: Dell OptiPlex 7060 Micro
# - CPU: Intel Core i7-8700T (6C/12T, Passmark: 2301/10172)
@ -10,8 +7,32 @@
# - PNY CS900 PNY244624111201023FB 1TB SATA SSD
# - Samsung 970 EVO Plus S58SNG0MA07159M 500GB NVMe SSD
# - WD MyBook 25EE 3145484E3348454E 8TB External HDD
#
# WARNING: BUILT-IN ETHERNET HARDWARE IS BORKED!!!
# https://xcp-ng.org/docs/networking.html#intel-i218-i219-slow-speed
# https://serverfault.com/questions/581265/disable-tcp-checksum-offloading-on-kvm-virtual-network
networking.hostName = "bastion";
networking.hostId = "0d13f99b";
system.stateVersion = "24.11";
home-manager = {
users."lauren_lagarde" = {
home.stateVersion = "24.11";
imports = self.homeManagerModules."lauren_lagarde@tui.mlaga97.space";
};
extraSpecialArgs = { inherit self pkgs-unstable; };
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix

View file

@ -1,11 +1,31 @@
{ config, lib, pkgs, modulesPath, ... }: {
{ inputs, self, pkgs, pkgs-unstable, config, ... }: {
# System Info:
# - Model: Custom
# - CPU: AMD Ryzen 9 3900X (12C/24T, Passmark: 2703/32546)
# - RAM: 128GB
# - Storage: Yes
networking.hostName = "blockhouse";
networking.hostId = "ed658529";
system.stateVersion = "23.11";
home-manager = {
users."lauren_lagarde" = {
home.stateVersion = "24.11";
imports = self.homeManagerModules."lauren_lagarde@tui.mlaga97.space";
};
extraSpecialArgs = { inherit self pkgs-unstable; };
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix
@ -29,7 +49,6 @@
# Blockhouse Features
../../nixos/tweaks/aarch64-crosscompile.nix
../../nixos/features/gpu/nvidia.nix
#../../nixos/features/networking/networkd-br0.nix
../../nixos/features/virtualization/dockge.nix
../../nixos/features/virtualization/docker.nix
../../nixos/features/virtualization/libvirt-host.nix

View file

@ -1,13 +1,33 @@
# To recover/repeat this monstrosity:
# - Comment out the digital-ocean-image.nix import
# - Build qcow2 image with `nixos-rebuild build-image --image-variant digital-ocean --flake ".#fortress"`
# - Convert image output from .qcow2.gz to .img.zst
# - Pipe the .img.zst over ssh into dd on the "Recovery ISO" environment of the droplet
# - Resize the partition and reboot
# - ????
# - Profit
{ lib, config, pkgs, inputs, ... }: {
{ lib, self, inputs, pkgs, pkgs-unstable, ... }: {
# To recover/repeat this monstrosity:
# - Comment out the digital-ocean-image.nix import
# - Build qcow2 image with `nixos-rebuild build-image --image-variant digital-ocean --flake ".#fortress"`
# - Convert image output from .qcow2.gz to .img.zst
# - Pipe the .img.zst over ssh into dd on the "Recovery ISO" environment of the droplet
# - Resize the partition and reboot
# - ????
# - Profit
networking.hostName = "fortress";
system.stateVersion = "25.05";
home-manager = {
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde@tui.mlaga97.space";
};
extraSpecialArgs = { inherit self pkgs-unstable; };
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# NOTE: This has to be uncommented to rebuild on a live system, but commented for build-image to work.
"${inputs.nixpkgs}/nixos/modules/virtualisation/digital-ocean-image.nix"

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: {
{ inputs, self, pkgs, pkgs-unstable, ... }: {
# System Info:
# - Model: Dell OptiPlex 3040 Micro
# - CPU: Intel Core i3-6100T (2C/4T, Passmark: 1859/3642)
@ -6,7 +6,29 @@
# - Storage:
# - ADATA SP550 2G3720040332 240GB SATA SSD
networking.hostName = "living-room";
system.stateVersion = "25.05";
home-manager = {
extraSpecialArgs = { inherit self pkgs-unstable; };
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde@gui.mlaga97.space" ++ [
./home.nix
];
};
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.disko.nixosModules.default
inputs.sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix

View file

@ -1,6 +1,4 @@
# sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake .#$TARGET_HOSTNAME --disk nvme0n1 /dev/nvme0n1
# tar -xvf /Parlor/Lauren/mlaga97-nixos.tar.zst; sudo nixos-rebuild switch --flake mlaga97-nixos?submodules=1#$HOSTNAME
{ config, pkgs, ... }: {
{ inputs, config, pkgs, ... }: {
# System Info:
# - Model: Dell Latitude 5591
# - CPU: Intel Core i7-8850H (6C/12T, Passmark: 2369/10147)
@ -8,7 +6,20 @@
# - Storage:
# - Toshiba KXG60ZNV512G 512GB NVMe SSD
networking.hostName = "ll-latitude-e5591";
networking.hostId = "f55542ee";
system.stateVersion = "24.11";
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.waveforms.nixosModule
inputs.disko.nixosModules.default
inputs.sops-nix.nixosModules.sops
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix
@ -46,6 +57,7 @@
../../nixos/features/gpu/intel.nix
../../nixos/features/systemd-boot.nix
../../nixos/features/factorio.nix
../../nixos/disko/nvme/uefi-luks-lvm-ext4.nix
];
specialisation = {

View file

@ -1,5 +1,24 @@
{ lib, ... }: {
{ lib, inputs, self, pkgs, pkgs-unstable, ... }: {
networking.hostName = "redoubt";
system.stateVersion = "25.05";
home-manager = {
users."lauren_lagarde" = {
home.stateVersion = "25.05";
imports = self.homeManagerModules."lauren_lagarde@tui.mlaga97.space";
};
extraSpecialArgs = { inherit self pkgs-unstable; };
};
time.timeZone = "America/Chicago";
sops.defaultSopsFile = ../../secrets.yaml;
imports = [
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
../../nixos/features/pi.nix
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix

View file

@ -1,5 +1,12 @@
{ pkgs, ... }: {
{ inputs, self, pkgs, pkgs-unstable, ... }: {
networking.hostName = "stronghold";
networking.hostId = "c581a1cd";
imports = [
inputs.disko.nixosModules.default
inputs.lix-module.nixosModules.default
inputs.home-manager.nixosModules.home-manager
# Core Features
../../nixos/features/base.nix
../../nixos/features/tui-apps.nix