Refactoring

This commit is contained in:
2026-03-12 23:38:13 +00:00
parent 95740b26bf
commit 69232abb6c
13 changed files with 117 additions and 106 deletions

View File

@@ -57,8 +57,7 @@
mkHost = hostname: nixpkgs.lib.nixosSystem {
modules = [
./hosts/${hostname}/hardware-configuration.nix
./hosts/${hostname}/disko.nix
./hardware
./system
home-manager.nixosModules.home-manager
{

View File

@@ -1,7 +1,9 @@
{ ... }:
{ hostname, ... }:
{
imports = [
./disko.nix
./filesystem.nix
./${hostname}-hardware-configuration.nix
];
}

View File

@@ -1,14 +1,10 @@
{ disko, ... }:
# nix --extra-experimental-features "nix-command flakes" run github:nix-community/disko/latest#disko-install -- --flake ./#stationette --disk stationette --write-efi-boot-entries /dev/sda
{
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
stationette = {
let
mkDisk = { hostname, drive }: {
type = "disk";
# Check this with lsblk
device = "/dev/sda";
# Check this with lsblk
device = drive;
content = {
type = "gpt";
partitions = {
@@ -26,7 +22,7 @@
size = "100%";
content = {
type = "btrfs";
# Force overwrite
# Force overwrite
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
@@ -50,7 +46,16 @@
};
};
};
};
};
in
# nix --extra-experimental-features "nix-command flakes" run github:nix-community/disko/latest#disko-install -- --flake ./#${hostname} --disk stationette --write-efi-boot-entries ${drive}
{
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
station = mkDisk { hostname = "station"; drive = "/dev/nvme0n1"; };
stationette= mkDisk { hostname = "stationette"; drive = "/dev/sda"; };
};
};
}

View File

@@ -1,25 +1,14 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ config, lib, pkgs, modulesPath, hostname, ... }:
let
rootDisk = "/dev/disk/by-partlabel/disk-${hostname}-root";
bootDisk = "/dev/disk/by-partlabel/disk-${hostname}-ESP";
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-partlabel/disk-stationette-root";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/disk/by-partlabel/disk-stationette-root /btrfs_tmp
mount ${rootDisk} /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date +%Y-%m-%d_%H-%M-%S)
@@ -42,22 +31,28 @@
umount /btrfs_tmp
'';
fileSystems."/" = {
device = rootDisk;
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/persist" = {
device = "/dev/disk/by-partlabel/disk-stationette-root";
device = rootDisk;
neededForBoot = true;
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-partlabel/disk-stationette-root";
device = rootDisk;
neededForBoot = true;
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-partlabel/disk-stationette-ESP";
device = bootDisk;
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" "umask=0077" ];
};
@@ -65,7 +60,4 @@
swapDevices = [ {
device = "/.swapvol/swapfile";
} ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,16 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -16,6 +16,7 @@
".config/nixos"
".config/sinew.in"
".config/chromium"
".config/superProductivity"
".local/share/direnv"
".local/share/nvim"
".local/share/voxtype"

View File

@@ -37,12 +37,14 @@
obsidian # Notes software
signal-desktop # Messaging
spotify # Music
super-productivity # Task app
sxiv # Minimal image viewer
tenacity # Audio software
try-cli.packages.${pkgs.system}.default # Try CLI tool
wally-cli # Keyboard flasher
wiremix # Audio mixer TUI
xournalpp # Handwriting note-taking software
zenity # For creating dialogs during install script
zathura # Minimal PDF viewer
];
}

View File

@@ -32,8 +32,8 @@
chromium = {
enable = true;
extensions = [
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
"kmcfomidfpdkfieipokbalgegidffkal"
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
"kmcfomidfpdkfieipokbalgegidffkal" # Enpass
];
};
firefox = {
@@ -62,7 +62,7 @@
/* ---- EXTENSIONS ---- */
ExtensionSettings = {
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below
# Enpass
# Enpass
"firefox-enpass@enpass.io" = {
install_url = "https://dl.enpass.io/stable/extensions/firefox/versions/v6.11.10.2/enpass_password_manager-6.11.10.2.xpi";
installation_mode = "force_installed";
@@ -70,7 +70,6 @@
};
/* ---- PREFERENCES ---- */
# Set preferences shared by all profiles.
Preferences = {
"browser.contentblocking.category" = { Value = "strict"; Status = "locked"; };
"extensions.pocket.enabled" = lock-false;

View File

@@ -1,15 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
fileSystems."/persist" = {
device = "/dev/disk/by-partlabel/disk-station-root";
neededForBoot = true;
fsType = "btrfs";
options = [ "subvol=persist" ];
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -1,5 +1,14 @@
{ pkgs, hostname, ... }:
let
# Found by running sudo btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
hibernateBootOffsets = {
stationette = "533760";
station = "533760";
};
resumeOffset = hibernateBootOffsets."${hostname}" or "0";
in
{
boot = {
loader = {
@@ -26,8 +35,9 @@
'';
};
efi.canTouchEfiVariables = true;
# timeout = 0;
# timeout = 0; # Skips the menu and uses default entry
};
# Creates a cool animation for booting
plymouth = {
enable = true;
theme = "black_hud";
@@ -39,9 +49,8 @@
};
initrd.verbose = false;
# Found by running sudo btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
kernelParams = [
"resume_offset=533760"
"resume_offset=${hibernateBootOffset}"
"quiet"
"udev.log_level=3"
"systemd.show_status=auto"

View File

@@ -1,5 +1,6 @@
{ impermanence, ... }:
# Define which files and directories should persist between boots
{
imports = [ impermanence.nixosModules.impermanence ];
@@ -10,9 +11,9 @@
"/var/lib/bluetooth"
"/var/lib/networkmanager"
"/var/lib/nixos"
"/etc/ssh"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
"/etc/ssh"
];
files = [
"/etc/machine-id"