Refactoring

This commit is contained in:
2026-03-09 20:27:18 +00:00
parent 3c76981dc6
commit 6d89b0c685
10 changed files with 266 additions and 221 deletions

222
flake.nix
View File

@@ -58,111 +58,10 @@
stationette = nixpkgs.lib.nixosSystem {
modules = [
./hardware-configuration.nix
disko.nixosModules.disko
impermanence.nixosModules.impermanence
./hardware
./system
home-manager.nixosModules.home-manager
{
# 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
disko.devices = {
disk = {
stationette = {
type = "disk";
device = "/dev/sda"; # Check this with lsblk
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Force overwrite
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
};
};
boot = {
loader = {
limine = {
enable = true;
extraConfig = ''
timeout: 3
default_entry: 2
interface_branding: Station Bootloader
interface_branding_color: 2
hash_mismatch_panic: no
term_background: 1a1b26
backdrop: 1a1b26
# Tokyo Night palette
term_palette: 15161e;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;a9b1d6
term_palette_bright: 414868;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;c0caf5
term_foreground: c0caf5
term_foreground_bright: c0caf5
term_background_bright: 24283b
'';
};
efi.canTouchEfiVariables = true;
# timeout = 0;
};
plymouth = {
enable = true;
theme = "black_hud";
themePackages = with pkgs; [
(adi1090x-plymouth-themes.override {
selected_themes = [ "black_hud" ];
})
];
};
initrd.verbose = false;
# Found by running sudo btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
kernelParams = [
"resume_offset=533760"
"quiet"
"udev.log_level=3"
"systemd.show_status=auto"
"splash"
];
bootspec.enable = true;
resumeDevice = "/dev/disk/by-partlabel/disk-stationette-root";
};
swapDevices = [ {
device = "/.swapvol/swapfile";
} ];
powerManagement.enable = true;
systemd = {
packages = with pkgs; [
@@ -178,95 +77,6 @@
pathsToLink = [
"/share/uwsm"
];
persistence."/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/lib/networkmanager"
"/var/lib/nixos"
"/etc/ssh"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
};
systemPackages = with pkgs; [
# hyprland-preview-share-picker.packages.${system}.default
swaybg
imagemagick
makima
fcitx5
pywal16
uwsm
v4l-utils
brightnessctl
satty
hyprpaper
libnotify
mako
qt6.qtwayland
grim
gnome-calculator
hypridle
hyprlock
hyprpicker
wlogout
wl-clipboard
waybar
bat
highlight
btop
eza
fzf
neovim
ripgrep
tldr
unzip
openssl
wget
zip
zoxide
jq
git
lazygit
less
tree
tmux
tmuxinator
wget
zenity
gum
pkgs-unstable.yazi
rsync
p7zip
impala
xdg-terminal-exec
rustc
cargo
gcc
rustfmt
clippy
];
};
networking = {
hostName = "stationette";
networkmanager.enable = true;
wireless = {
iwd.enable = true;
networks = {
ssid = "Outskirt Stable";
psk = "SidonPhlegm";
};
};
firewall = {
enable = true;
# Ports used by Local Send
allowedTCPPorts = [ 53317 ];
allowedUDPPorts = [ 53317 ];
};
};
users.users.chris = {
uid = 1000;
@@ -304,34 +114,6 @@
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
};
};
services = {
openssh.enable = true;
dbus.enable = true;
envfs.enable = true; # This ensures normal shebangs work (#!/bin/bash)
expressvpn.enable = true;
locate.enable = true;
fwupd.enable = true;
"power-profiles-daemon".enable = true;
upower = {
enable = true;
percentageLow = 20;
percentageCritical = 5;
percentageAction = 3;
criticalPowerAction = "Hibernate";
};
displayManager = {
sddm = {
enable = true;
wayland.enable = true;
theme = "maya";
};
autoLogin.enable = true;
autoLogin.user = "chris";
defaultSession = "hyprland-uwsm";
};
};
system.stateVersion = "25.11";
home-manager = {
users.chris = { pkgs, lib, ... }: {

View File

@@ -62,7 +62,9 @@
options = [ "fmask=0022" "dmask=0022" "umask=0077" ];
};
swapDevices = [ ];
swapDevices = [ {
device = "/.swapvol/swapfile";
} ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

7
hardware/default.nix Normal file
View File

@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./disko.nix
];
}

56
hardware/disko.nix Normal file
View File

@@ -0,0 +1,56 @@
{ 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 = {
type = "disk";
# Check this with lsblk
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
# Force overwrite
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
};
};
}

54
system/boot.nix Normal file
View File

@@ -0,0 +1,54 @@
{ impermanence, ... }:
{
boot = {
loader = {
limine = {
enable = true;
extraConfig = ''
timeout: 3
default_entry: 2
interface_branding: Station Bootloader
interface_branding_color: 2
hash_mismatch_panic: no
term_background: 1a1b26
backdrop: 1a1b26
# Tokyo Night palette
term_palette: 15161e;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;a9b1d6
term_palette_bright: 414868;f7768e;9ece6a;e0af68;7aa2f7;bb9af7;7dcfff;c0caf5
term_foreground: c0caf5
term_foreground_bright: c0caf5
term_background_bright: 24283b
'';
};
efi.canTouchEfiVariables = true;
# timeout = 0;
};
plymouth = {
enable = true;
theme = "black_hud";
themePackages = with pkgs; [
(adi1090x-plymouth-themes.override {
selected_themes = [ "black_hud" ];
})
];
};
initrd.verbose = false;
# Found by running sudo btrfs inspect-internal map-swapfile -r /.swapvol/swapfile
kernelParams = [
"resume_offset=533760"
"quiet"
"udev.log_level=3"
"systemd.show_status=auto"
"splash"
];
bootspec.enable = true;
resumeDevice = "/dev/disk/by-partlabel/disk-stationette-root";
};
}

11
system/default.nix Normal file
View File

@@ -0,0 +1,11 @@
{ ... }:
{
imports = [
./boot.nix
./impermanence.nix
./networking.nix
./packages.nix
./services.nix
]
}

22
system/impermanence.nix Normal file
View File

@@ -0,0 +1,22 @@
{ impermanence, ... }:
{
imports = [ impermanence.nixosModules.impermanence ];
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/lib/networkmanager"
"/var/lib/nixos"
"/etc/ssh"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
};
}

21
system/networking.nix Normal file
View File

@@ -0,0 +1,21 @@
{ ... }:
{
networking = {
hostName = "stationette";
networkmanager.enable = true;
wireless = {
iwd.enable = true;
networks = {
ssid = "Outskirt Stable";
psk = "SidonPhlegm";
};
};
firewall = {
enable = true;
# Ports used by Local Send
allowedTCPPorts = [ 53317 ];
allowedUDPPorts = [ 53317 ];
};
};
}

59
system/packages.nix Normal file
View File

@@ -0,0 +1,59 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
bat # Better cat
brightnessctl # Backlight control
btop # Resource monitor
cargo # Rust build tool
clippy # Rust linter
eza # Better ls
fcitx5 # Input method framework TODO: Figure out and configure
fzf # Fuzzy file finder
gcc # C compiler
git # Git
gnome-calculator # Calculator TODO: Find a better TUI calculator
grim # Screenshot tool TODO: Figure out and configure
gum # Terminal UI tool
highlight # Syntax highlighting tool TODO: Hook up to ZSH
hypridle # Idle daemon for Hyprland
hyprlock # Screen locker for Hyprland
hyprpaper # Wallpaper utility for Hyprland TODO: Check if necessary with swaybg
hyprpicker # Hyprland colour picker
# hyprland-preview-share-picker.packages.${system}.default # Hyprland share picker TODO: Figure out and configure
imagemagick # Image manipulation tool
impala # Wifi TUI
jq # CLI JSON processor
lazygit # Git TUI
less # Pager
libnotify # Notification daemon
makima # Key remapper for Linux TODO: Figure out and configure
mako # Notification daemon
neovim # Editor
openssl # SSL/TLS toolkit
p7zip # 7-Zip archiver
pkgs-unstable.yazi # Terminal file manager
pywal16 # Image colorscheme generator
qt6.qtwayland # qtwayland support
ripgrep # Better grep
rsync # Remote file sync
rustc # Rust compiler
rustfmt # Rust formatter
satty # Screenshot editor TODO: Figure out and configure
swaybg # Wayland wallpaper utility
tldr # Simplified man pages
tmux # Terminal multiplexer
tmuxinator # Tmux configurator
tree # Tree structure viewing Tool
unzip # Compressing tool
uwsm # Universal Wayland Session Manager
v4l-utils # Video4Linux utilities TODO: Figure out why I need this
waybar # Status bar for Hyprland
wget # Download tool
wl-clipboard # Wayland clipboard manager
wlogout # Wayland logout menu
xdg-terminal-exec # XDG terminal execution utility
zip # Archiver tool
zoxide # Better cd
];
}

31
system/services.nix Normal file
View File

@@ -0,0 +1,31 @@
{ ... }:
{
services = {
openssh.enable = true;
dbus.enable = true;
envfs.enable = true; # This ensures normal shebangs work (#!/bin/bash)
expressvpn.enable = true;
locate.enable = true;
fwupd.enable = true;
"power-profiles-daemon".enable = true;
upower = {
enable = true;
percentageLow = 20;
percentageCritical = 5;
percentageAction = 3;
criticalPowerAction = "Hibernate";
};
displayManager = {
sddm = {
enable = true;
wayland.enable = true;
theme = "maya";
};
autoLogin.enable = true;
autoLogin.user = "chris";
defaultSession = "hyprland-uwsm";
};
};
}