diff --git a/flake.nix b/flake.nix index d653537..c723f51 100644 --- a/flake.nix +++ b/flake.nix @@ -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, ... }: { diff --git a/hardware-configuration.nix b/hardware-configuration.nix index d00d68b..6790eaa 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -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; diff --git a/hardware/default.nix b/hardware/default.nix new file mode 100644 index 0000000..4d20401 --- /dev/null +++ b/hardware/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./disko.nix + ]; +} diff --git a/hardware/disko.nix b/hardware/disko.nix new file mode 100644 index 0000000..72bdc6d --- /dev/null +++ b/hardware/disko.nix @@ -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"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/system/boot.nix b/system/boot.nix new file mode 100644 index 0000000..b751697 --- /dev/null +++ b/system/boot.nix @@ -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"; + }; +} + diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..d269b83 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + imports = [ + ./boot.nix + ./impermanence.nix + ./networking.nix + ./packages.nix + ./services.nix + ] +} diff --git a/system/impermanence.nix b/system/impermanence.nix new file mode 100644 index 0000000..ca76c7d --- /dev/null +++ b/system/impermanence.nix @@ -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" + ]; + }; +} + diff --git a/system/networking.nix b/system/networking.nix new file mode 100644 index 0000000..6a34b1e --- /dev/null +++ b/system/networking.nix @@ -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 ]; + }; + }; +} diff --git a/system/packages.nix b/system/packages.nix new file mode 100644 index 0000000..b9411d1 --- /dev/null +++ b/system/packages.nix @@ -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 + ]; +} diff --git a/system/services.nix b/system/services.nix new file mode 100644 index 0000000..b41ca29 --- /dev/null +++ b/system/services.nix @@ -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"; + }; + }; + +}