Refactoring
This commit is contained in:
@@ -57,8 +57,7 @@
|
|||||||
|
|
||||||
mkHost = hostname: nixpkgs.lib.nixosSystem {
|
mkHost = hostname: nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/${hostname}/hardware-configuration.nix
|
./hardware
|
||||||
./hosts/${hostname}/disko.nix
|
|
||||||
./system
|
./system
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{ ... }:
|
{ hostname, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./disko.nix
|
./disko.nix
|
||||||
|
./filesystem.nix
|
||||||
|
./${hostname}-hardware-configuration.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,61 @@
|
|||||||
{ disko, ... }:
|
{ 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
|
let
|
||||||
{
|
mkDisk = { hostname, drive }: {
|
||||||
imports = [ disko.nixosModules.disko ];
|
type = "disk";
|
||||||
disko.devices = {
|
# Check this with lsblk
|
||||||
disk = {
|
device = drive;
|
||||||
stationette = {
|
content = {
|
||||||
type = "disk";
|
type = "gpt";
|
||||||
# Check this with lsblk
|
partitions = {
|
||||||
device = "/dev/sda";
|
ESP = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "filesystem";
|
||||||
partitions = {
|
format = "vfat";
|
||||||
ESP = {
|
mountpoint = "/boot";
|
||||||
size = "512M";
|
mountOptions = [ "fmask=0022" "dmask=0022" "umask=0077" ];
|
||||||
type = "EF00";
|
};
|
||||||
content = {
|
};
|
||||||
type = "filesystem";
|
root = {
|
||||||
format = "vfat";
|
size = "100%";
|
||||||
mountpoint = "/boot";
|
content = {
|
||||||
mountOptions = [ "fmask=0022" "dmask=0022" "umask=0077" ];
|
type = "btrfs";
|
||||||
};
|
# Force overwrite
|
||||||
|
extraArgs = [ "-f" ];
|
||||||
|
subvolumes = {
|
||||||
|
"/root" = {
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [ "compress=zstd" "noatime" ];
|
||||||
};
|
};
|
||||||
root = {
|
"/nix" = {
|
||||||
size = "100%";
|
mountpoint = "/nix";
|
||||||
content = {
|
mountOptions = [ "compress=zstd" "noatime" ];
|
||||||
type = "btrfs";
|
};
|
||||||
# Force overwrite
|
"/persist" = {
|
||||||
extraArgs = [ "-f" ];
|
mountpoint = "/persist";
|
||||||
subvolumes = {
|
mountOptions = [ "compress=zstd" "noatime" ];
|
||||||
"/root" = {
|
};
|
||||||
mountpoint = "/";
|
"/swap" = {
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
mountpoint = "/.swapvol";
|
||||||
};
|
swap.swapfile.size = "8G";
|
||||||
"/nix" = {
|
|
||||||
mountpoint = "/nix";
|
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
"/persist" = {
|
|
||||||
mountpoint = "/persist";
|
|
||||||
mountOptions = [ "compress=zstd" "noatime" ];
|
|
||||||
};
|
|
||||||
"/swap" = {
|
|
||||||
mountpoint = "/.swapvol";
|
|
||||||
swap.swapfile.size = "8G";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
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"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
{ config, lib, pkgs, modulesPath, hostname, ... }:
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
let
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
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 ''
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||||
mkdir /btrfs_tmp
|
mkdir /btrfs_tmp
|
||||||
mount /dev/disk/by-partlabel/disk-stationette-root /btrfs_tmp
|
mount ${rootDisk} /btrfs_tmp
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
if [[ -e /btrfs_tmp/root ]]; then
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
timestamp=$(date +%Y-%m-%d_%H-%M-%S)
|
timestamp=$(date +%Y-%m-%d_%H-%M-%S)
|
||||||
@@ -42,22 +31,28 @@
|
|||||||
umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = rootDisk;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=root" ];
|
||||||
|
};
|
||||||
|
|
||||||
fileSystems."/persist" = {
|
fileSystems."/persist" = {
|
||||||
device = "/dev/disk/by-partlabel/disk-stationette-root";
|
device = rootDisk;
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=persist" ];
|
options = [ "subvol=persist" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" = {
|
||||||
device = "/dev/disk/by-partlabel/disk-stationette-root";
|
device = rootDisk;
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "subvol=nix" ];
|
options = [ "subvol=nix" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/boot" = {
|
||||||
device = "/dev/disk/by-partlabel/disk-stationette-ESP";
|
device = bootDisk;
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
options = [ "fmask=0022" "dmask=0022" "umask=0077" ];
|
options = [ "fmask=0022" "dmask=0022" "umask=0077" ];
|
||||||
};
|
};
|
||||||
@@ -65,7 +60,4 @@
|
|||||||
swapDevices = [ {
|
swapDevices = [ {
|
||||||
device = "/.swapvol/swapfile";
|
device = "/.swapvol/swapfile";
|
||||||
} ];
|
} ];
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
}
|
||||||
16
hardware/stationette-hardware-configuration.nix
Normal file
16
hardware/stationette-hardware-configuration.nix
Normal 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;
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
".config/nixos"
|
".config/nixos"
|
||||||
".config/sinew.in"
|
".config/sinew.in"
|
||||||
".config/chromium"
|
".config/chromium"
|
||||||
|
".config/superProductivity"
|
||||||
".local/share/direnv"
|
".local/share/direnv"
|
||||||
".local/share/nvim"
|
".local/share/nvim"
|
||||||
".local/share/voxtype"
|
".local/share/voxtype"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
permittedInsecurePackages = [
|
permittedInsecurePackages = [
|
||||||
"electron-25.9.0" # Obsidian
|
"electron-25.9.0" # Obsidian
|
||||||
"beekeeper-studio-5.3.4"
|
"beekeeper-studio-5.3.4"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -37,12 +37,14 @@
|
|||||||
obsidian # Notes software
|
obsidian # Notes software
|
||||||
signal-desktop # Messaging
|
signal-desktop # Messaging
|
||||||
spotify # Music
|
spotify # Music
|
||||||
|
super-productivity # Task app
|
||||||
sxiv # Minimal image viewer
|
sxiv # Minimal image viewer
|
||||||
tenacity # Audio software
|
tenacity # Audio software
|
||||||
try-cli.packages.${pkgs.system}.default # Try CLI tool
|
try-cli.packages.${pkgs.system}.default # Try CLI tool
|
||||||
wally-cli # Keyboard flasher
|
wally-cli # Keyboard flasher
|
||||||
wiremix # Audio mixer TUI
|
wiremix # Audio mixer TUI
|
||||||
xournalpp # Handwriting note-taking software
|
xournalpp # Handwriting note-taking software
|
||||||
|
zenity # For creating dialogs during install script
|
||||||
zathura # Minimal PDF viewer
|
zathura # Minimal PDF viewer
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
chromium = {
|
chromium = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extensions = [
|
extensions = [
|
||||||
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
|
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
|
||||||
"kmcfomidfpdkfieipokbalgegidffkal"
|
"kmcfomidfpdkfieipokbalgegidffkal" # Enpass
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
firefox = {
|
firefox = {
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
/* ---- EXTENSIONS ---- */
|
/* ---- EXTENSIONS ---- */
|
||||||
ExtensionSettings = {
|
ExtensionSettings = {
|
||||||
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below
|
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below
|
||||||
# Enpass
|
# Enpass
|
||||||
"firefox-enpass@enpass.io" = {
|
"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";
|
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";
|
installation_mode = "force_installed";
|
||||||
@@ -70,7 +70,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* ---- PREFERENCES ---- */
|
/* ---- PREFERENCES ---- */
|
||||||
# Set preferences shared by all profiles.
|
|
||||||
Preferences = {
|
Preferences = {
|
||||||
"browser.contentblocking.category" = { Value = "strict"; Status = "locked"; };
|
"browser.contentblocking.category" = { Value = "strict"; Status = "locked"; };
|
||||||
"extensions.pocket.enabled" = lock-false;
|
"extensions.pocket.enabled" = lock-false;
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
{ pkgs, hostname, ... }:
|
{ 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 = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
@@ -26,22 +35,22 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
# timeout = 0;
|
# timeout = 0; # Skips the menu and uses default entry
|
||||||
};
|
};
|
||||||
|
# Creates a cool animation for booting
|
||||||
plymouth = {
|
plymouth = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = "black_hud";
|
theme = "black_hud";
|
||||||
themePackages = with pkgs; [
|
themePackages = with pkgs; [
|
||||||
(adi1090x-plymouth-themes.override {
|
(adi1090x-plymouth-themes.override {
|
||||||
selected_themes = [ "black_hud" ];
|
selected_themes = [ "black_hud" ];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
initrd.verbose = false;
|
initrd.verbose = false;
|
||||||
|
|
||||||
# Found by running sudo btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
|
|
||||||
kernelParams = [
|
kernelParams = [
|
||||||
"resume_offset=533760"
|
"resume_offset=${hibernateBootOffset}"
|
||||||
"quiet"
|
"quiet"
|
||||||
"udev.log_level=3"
|
"udev.log_level=3"
|
||||||
"systemd.show_status=auto"
|
"systemd.show_status=auto"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
fonts = {
|
fonts = {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
nerd-fonts.jetbrains-mono
|
nerd-fonts.jetbrains-mono
|
||||||
nerd-fonts.fira-code
|
nerd-fonts.fira-code
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{ impermanence, ... }:
|
{ impermanence, ... }:
|
||||||
|
|
||||||
|
# Define which files and directories should persist between boots
|
||||||
{
|
{
|
||||||
imports = [ impermanence.nixosModules.impermanence ];
|
imports = [ impermanence.nixosModules.impermanence ];
|
||||||
|
|
||||||
@@ -7,12 +8,12 @@
|
|||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
"/var/log"
|
"/var/log"
|
||||||
"/var/lib/bluetooth"
|
"/var/lib/bluetooth"
|
||||||
"/var/lib/networkmanager"
|
"/var/lib/networkmanager"
|
||||||
"/var/lib/nixos"
|
"/var/lib/nixos"
|
||||||
"/etc/ssh"
|
"/var/lib/systemd/coredump"
|
||||||
"/var/lib/systemd/coredump"
|
"/etc/NetworkManager/system-connections"
|
||||||
"/etc/NetworkManager/system-connections"
|
"/etc/ssh"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"chris"
|
"chris"
|
||||||
"wheel"
|
"wheel"
|
||||||
"networkmanager"
|
"networkmanager"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user