From 9edc913a1d205e047c8390af67578eb4367d689f Mon Sep 17 00:00:00 2001 From: serenity-F Date: Mon, 2 Mar 2026 20:15:43 +1000 Subject: [PATCH] formatting/commenting `flake.nix` and `core/` --- core/audio.nix | 8 +-- core/default.nix | 50 ++++++--------- core/display.nix | 15 ++--- core/gaming.nix | 68 ++++++++++---------- core/packages.nix | 39 ++++++------ core/regreet.nix | 8 +-- core/zfs.nix | 21 +++--- flake.nix | 158 ++++++++++++++++++++++++---------------------- 8 files changed, 176 insertions(+), 191 deletions(-) diff --git a/core/audio.nix b/core/audio.nix index 27ab350..fb4d83d 100755 --- a/core/audio.nix +++ b/core/audio.nix @@ -58,7 +58,7 @@ ''; }; - ## Musnix for audio production + # Musnix for audio production musnix = { enable = true; rtcqs.enable = true; @@ -66,10 +66,10 @@ kernel.realtime = true; }; - ## Pipewire baybee + # Pipewire baybee services = { - ## Not using pulse directly + # Not using pulse directly pulseaudio = { enable = false; }; pipewire = { @@ -82,7 +82,7 @@ support32Bit = true; }; - ## Low latency config + # Low latency config extraConfig = { pipewire."92-low-latency" = { "context.properties" = { diff --git a/core/default.nix b/core/default.nix index 7092e9a..b6d450e 100755 --- a/core/default.nix +++ b/core/default.nix @@ -4,30 +4,28 @@ imports = [ - ## Not sure wei need the home-manager import here + # Not sure we need the home-manager import here inputs.home-manager.nixosModules.home-manager - ## Semi-modularised config - ../home # user-level packages in ../home/programs/ + # Semi-modularised config + ../home # user-level/additional packages - ## Shared modules to import - ./audio.nix - ./display.nix - ./regreet.nix - ./packages.nix + # Shared modules to import + ./audio.nix # musnix and audio options + ./display.nix # base display and output options + ./regreet.nix # login manager + ./packages.nix # core/essential packages ]; - ## Core security options + # Core security options security = { sudo.execWheelOnly = true; # sets sudo auth to @wheel only - #soteria.enable = true; # enables soteria polkit - # - disabled forNow:tm: - https://github.com/NixOS/nixpkgs/issues/379104 polkit = { # enables system polkit ??? enable = true; - #extraConfig = '' ''; }; - ## Increasing max open files - needed for my huge ass bloaty flake + ## Temporarily ncreasing max open files + ## needed for my huge ass bloaty flake pam.loginLimits = [{ domain = "*"; type = "soft"; @@ -36,9 +34,8 @@ }]; }; systemd.settings.Manager = { DefaultLimitNOFILE = "8192:524288"; }; - ## test line - ## Settings for the nix package manager and daemon + # Settings for the nix package manager and daemon nix = { settings = { cores = 6; # sets nix to use most available cores during rebuild @@ -61,7 +58,8 @@ "flakes" # flakes are vv important nya ]; }; - gc = { # garbage collection + # Garbage collection + gc = { automatic = true; # do garbage collection automagically dates = "daily"; # every day options = "--delete-older-than 3d"; # and clear junk older than x days @@ -69,7 +67,7 @@ }; }; - ## Hardware settings + # Hardware settings hardware = { enableAllFirmware = true; # enables all firmware modules sensor.hddtemp = { # enables temperature readings for mechanical drives @@ -80,7 +78,7 @@ usbStorage.manageShutdown = true; # shrugge }; - ## Manual pages and caching + # Manual pages and caching environment.systemPackages = with pkgs; [ man-pages ]; # adds manual pages to system packages for ease of access documentation = { @@ -90,19 +88,7 @@ #nixos.includeAllModules = true; }; - ## SystemD tweaks - systemd = { - # extraConfig = "DefaultTimeoutStopSec=10s"; # apparently prevents getting stuck at shutdown - # settings.Manager = ""; - services = { # Disable these cuz they cause problems (thx sasha) - # see: https://github.com/NixOS/nixpkgs/issues/180175 - networkManager-wait-online.enable = lib.mkForce false; - systemd-networkd-wait-online.enable = lib.mkForce false; - }; - }; - - ## Crikey ! - ## Don't forget to set your& locale settings ! + # Locale settings time.timeZone = "Australia/Brisbane"; i18n = { defaultLocale = "en_AU.UTF-8"; @@ -118,7 +104,7 @@ }; }; - ## Make sure this is set ! + # Make sure this is set ! system = { stateVersion = "24.11"; }; } diff --git a/core/display.nix b/core/display.nix index 2f87c56..029b6ae 100755 --- a/core/display.nix +++ b/core/display.nix @@ -8,7 +8,7 @@ }; }; - ## Boot/GRUB options + # Boot/GRUB options boot = { #bootspec.enable = true; #consoleLogLevel = 0; @@ -52,7 +52,7 @@ }; }; - ## Display related options + # Display related options xdg.mime.enable = true; # may be unneeded here as already declared in `home/desktop/xdg-mime.nix` services.xserver.enable = true; # xserver still needed for xwayland stuff @@ -132,22 +132,21 @@ ## Dunno if i did this right, but possible needed for keyring/polkit stuff ? security.pam.services.serenity.enableGnomeKeyring = true; + ## Move this programs = { - gnome-disks.enable = true; # For when bimbo needs to manage disks seahorse.enable = true; # GTK secrets management droidcam.enable = true; # Use android device as a webcam obs-studio = { # screen capture, recording, and sharing enable = true; enableVirtualCamera = true; # virtual webcam - plugins = with pkgs.obs-studio-plugins; - [ - #droidcam-obs # enables droidcam integration - ]; + plugins = with pkgs.obs-studio-plugins; [ + #droidcam-obs # enables droidcam integration + ]; }; - }; + ## Move these services = { libinput.enable = true; # don't think we NEED this tbh - unsure #gvfs.enable = true; # virtual filesystem, needed this for ... something diff --git a/core/gaming.nix b/core/gaming.nix index 118a655..d14eda3 100755 --- a/core/gaming.nix +++ b/core/gaming.nix @@ -1,7 +1,7 @@ { pkgs, inputs, ... }: { - ## Open tablet driver, for Osu!, mainly. + # Open tablet driver, for Osu!, mainly. hardware.opentabletdriver = { enable = true; # Enables the driver lol daemon.enable = true; # Enables the daemon via systemd @@ -15,19 +15,18 @@ environment = { - ## Games and misc. - systemPackages = with pkgs; - [ - piper # Mouse config - vassal # FOSSy board game sim - cockatrice # Magical the gathering, but free - prismlauncher # Modded Minecraft client - osu-lazer-bin # Rhythm is just a click away! - inputs.nix-gaming.packages.${pkgs.system}.osu-mime - #inputs.nix-gaming.packages.${pkgs.system}.osu-lazer-bin # Not using this one but still want it here lol - ]; + # Games and misc. + systemPackages = with pkgs; [ + piper # Mouse config + vassal # FOSSy board game sim + cockatrice # Magical the gathering, but free + prismlauncher # Modded Minecraft client + osu-lazer-bin # Rhythm is just a click away! + inputs.nix-gaming.packages.${pkgs.system}.osu-mime + #inputs.nix-gaming.packages.${pkgs.system}.osu-lazer-bin # Not using this one but still want it here lol + ]; - ## These are important apparently :uh: + # These are important apparently :uh: sessionVariables = { XDG_CACHE_HOME = "$HOME/.cache"; XDG_CONFIG_HOME = "$HOME/.config"; @@ -46,17 +45,17 @@ programs = { - ## Java, just in case i guess ? + # Java, just in case i guess ? java.enable = true; - ## This should help games run more betterer + # This should help games run more betterer gamescope = { enable = true; capSysNice = true; }; - ## "GameMode" - https://nixos.wiki/wiki/Gamemode - ## (config copy-pasted from mynixos) + # "GameMode" - https://nixos.wiki/wiki/Gamemode + # (config copy-pasted from mynixos) gamemode = { enable = false; settings = { @@ -74,32 +73,31 @@ }; }; - ## Steam itself + # Steam itself steam = { - ## Enables steam itself + # Enables steam itself enable = true; - ## Enables protontricks + # Enables protontricks protontricks.enable = true; - ## This should help games run more betterer + # This should help games run more betterer gamescopeSession.enable = true; ## No clue what this is doing #package = pkgs.steam.override { - # extraLibraries = pkgs: [ pkgs.xorg.libxcb ]; - # ## No clue what this shit does - # extraPkgs = pkgs: - # with pkgs; - # [ - # libpng - # libpulseaudio - # libvorbis - # stdenv.cc.cc.lib - # libkrb5 - # keyutils - # #gamemode - # ] ++ (with pkgs.xorg; [ libXi libXcursor libXinerama libXScrnSaver ]); + #extraLibraries = pkgs: [ pkgs.xorg.libxcb ]; + ## No clue what this shit does + #extraPkgs = pkgs: + #with pkgs; [ + #libpng + #libpulseaudio + #libvorbis + #stdenv.cc.cc.lib + #libkrb5 + #keyutils + #gamemode + #] ++ (with pkgs.xorg; [ libXi libXcursor libXinerama libXScrnSaver ]); #}; #extraPackages = with pkgs; [ ]; - ## Gotta have the glorious eggroll + # Gotta have the glorious eggroll extraCompatPackages = with pkgs; [ proton-ge-bin ]; }; diff --git a/core/packages.nix b/core/packages.nix index 4ebda60..a4f3b5d 100755 --- a/core/packages.nix +++ b/core/packages.nix @@ -4,11 +4,10 @@ imports = [ ]; - ## Activation Scripts - ## - these run after using `sudo nixos-rebuild switch` + # Activation Scripts - runs after using `sudo nixos-rebuild switch` system.activationScripts.diff = { supportsDryActivation = true; - ## Prints diff of the nix store and a cute message if rebuild successful + # Prints diff of the nix store and a cute message if rebuild successful text = '' ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff \ /run/current-system "$systemConfig" @@ -20,22 +19,23 @@ ## Nixpkgs Settings nixpkgs = { config = { - ## Not doing full-FOSS lol + + # Not doing full-FOSS lol allowUnfree = true; allowBroken = true; - ## Place insecure packages here + # Place insecure packages here #permittedInsecurePackages = [ #"olm-3.2.16" #]; - ## Place package overrides here + # Place package overrides here #packageOverrides = pkgs: { #sygil-plymouth = pkgs.callPackage /home/serenity/repos/sygil-plymouth/package.nix { }; #}; }; - ## Place package overlays here + # Place package overlays here overlays = [ niri.overlays.niri #inputs.tidalcycles.overlays.default @@ -68,57 +68,58 @@ ## System-level Programs programs = { + # Core terminal suite git = { enable = true; }; # Mandatory version control fish = { enable = true; }; # A catgirls favourite shell neovim = { enable = true; }; # Neovim declared here too, just in case - ## NixOS CLI helper + # NixOS CLI helper nh = { enable = true; flake = "${flakePath}"; # Declared in flake.nix }; - ## For handling encryption keys + # For handling encryption keys gnupg.agent = { enable = true; enableSSHSupport = true; #pinentryPackage = [ ]; }; - ## For running unpackaged binaries + # For running unpackaged binaries nix-ld = { enable = true; #libraries = with pkgs; [ ]; }; - ## To run "normal" linux applications seamlessly + # To run "normal" linux applications seamlessly appimage = { enable = true; binfmt = true; }; }; - ## Flatpak, just in case + # Flatpak, just in case services.flatpak.enable = true; environment = { - ## Environment Variables + # Environment Variables variables = { # sets neovim to default editor in other apps EDITOR = "nvim"; VISUAL = "nvim"; SYSTEMD_EDITOR = "nvim"; }; - ## Install a stub ELF loader to print an informative - ## error message in the event that a user attempts - ## to run an ELF binary not compiled for NixOS. + # Install a stub ELF loader to print an informative + # error message in the event that a user attempts + # to run an ELF binary not compiled for NixOS. stub-ld.enable = true; ## System-level Packages systemPackages = with pkgs; [ - ## Nix specific tools + # Nix specific tools #cabal2nix nix-tree # Dependency tree viewer for nix store nix-init # Generate nix packages from URLs @@ -126,13 +127,13 @@ nix-prefetch # provides info on a url nix-output-monitor # Shows extra information on nix commands - ## Filsesystem utilities + # Filsesystem utilities ddrutility # Set of tools for HDD rescure exfatprogs # ExFAT filesystem btrfs-progs # BTRFS filesystem ntfs3g # NTFS filesystem - ## CLI tools & utilities + # CLI tools & utilities fd # Find, but faster bc # Calculator zip # What it says on the tin diff --git a/core/regreet.nix b/core/regreet.nix index 96b3f25..ddb6f1b 100755 --- a/core/regreet.nix +++ b/core/regreet.nix @@ -1,6 +1,6 @@ { pkgs, primaryUser, homeDirectory, flakePath, ... }: -## Allows regreet to be bootstrapped by sway +# Allows regreet to be bootstrapped by sway let swayConfig = pkgs.writeText "greetd-sway-config" '' exec "${pkgs.regreet}/bin/regreet; swaymsg exit" @@ -30,12 +30,12 @@ in { ''; }; - ## ReGreet specific configuration and theme + # ReGreet specific configuration and theme programs.regreet = { enable = true; #package = [ ]; - ## Appearance + # Appearance font = { name = "Spleen-32x64"; size = 16; @@ -80,7 +80,7 @@ in { label_width = 150; # will need adjustment }; - ## Other + # Other commands = { reboot = [ "systemctl" "reboot" ]; poweroff = [ "systemctl" "poweroff" ]; diff --git a/core/zfs.nix b/core/zfs.nix index 33ff2ee..c6bf937 100755 --- a/core/zfs.nix +++ b/core/zfs.nix @@ -1,9 +1,10 @@ -# # ZFS Support NixOS module +# ZFS Support NixOS module { config, lib, pkgs, ... }: -## Black magic wizardry from https://wiki.nixos.org/wiki/ZFS -## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - let + + ## Black magic wizardry from https://wiki.nixos.org/wiki/ZFS + ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - zfsCompatibleKernelPackages = lib.filterAttrs (name: kernelPackages: (builtins.match "linux_[0-9]+_[0-9]+" name) != null && (builtins.tryEval kernelPackages).success @@ -12,27 +13,23 @@ let latestKernelPackage = lib.last (lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) (builtins.attrValues zfsCompatibleKernelPackages)); -in { ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Enable zfs in kernel and boot +in { + + # Enable zfs in kernel and boot boot = { - ## Sets system to use the kernel specified in the let binding above + # Sets system to use the kernel specified in the let binding above kernelPackages = lib.mkForce latestKernelPackage; supportedFilesystems = [ "zfs" ]; zfs = { - ## uhhh #extraPools = [ "orcus" ]; - ## uhhh #forceImportRoot = false; }; }; - networking = { hostId = "603b0c8b"; }; # Unsure why this is here actually ? - ## Adding ZFS package to system just in case environment.systemPackages = with pkgs; [ zfs ]; - - ## Enable trim for ZFS SSDs + networking = { hostId = "603b0c8b"; }; # Unsure why this is here actually ? services = { zfs = { #trim.enable = true; # zfs trim service for SSDS diff --git a/flake.nix b/flake.nix index 96418d7..e286cd2 100755 --- a/flake.nix +++ b/flake.nix @@ -11,137 +11,131 @@ # # :D # +# Formatting example: # -# Oh also, code-commenting is done like so: -# -# - To mark a new SECTION of code, use two hashes (#) -# and a space on the line BEFORE but with the same -# indentation as the relevant code. -# -# - A hash BEFORE the code is the standard for -# temporarily disabling a segment. -# -# - A hash one space AFTER but on the same line -# as the code lets you add any thoughts. -# -# -# Example: -# -# ## Section Heading - +# ## +# ## Section Heading - +# # +# # - # nixos.module = { # needed for x thing -# option = true; +# option = true; ## URGENT MESSAGE # #otherOption = [ "$string" ]; # disabled for z reason # differentOption = '' # needed to make y thing work -# text_config1 = auto -# text_config2 = yes +# text_config1 = auto; # does b +# text_config2 = yes; # does d # ''; # }; # # - - - - - - - - - - - - - - - - - - - - - - - - # { + description = "SerenityOS"; - ## Latest features:p - ## - Exposed large portions of `home/` import path - ## - Abandoned multi-user support for now - ## - Work on commenting and reformating flake is ongoing inputs = { ## NixOS Core and Utilities - # - Nixpkgs version - https://github.com/NixOS/nixpkgs + + # Nixpkgs version - https://github.com/NixOS/nixpkgs nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; }; - # - NixOS hardware - https://github.com/NixOS/nixos-hardware + + # NixOS hardware - https://github.com/NixOS/nixos-hardware hardware = { url = "github:nixos/nixos-hardware"; }; - # - Flake utils - https://github.com/numtide/flake-utils + + # Flake utils - https://github.com/numtide/flake-utils flake-utils = { url = "github:numtide/flake-utils"; }; - # - Flake parts - https://github.com/hercules-ci/flake-parts + + # Flake parts - https://github.com/hercules-ci/flake-parts flake-parts = { url = "github:hercules-ci/flake-parts"; }; - ## Secrets management & Synchronisation - # - https://github.com/Mic92/sops-nix + # Secrets management - https://github.com/Mic92/sops-nix sops-nix = { url = "github:Mic92/sops-nix"; }; ## Window Management & Desktop - # Niri window manager - # - https://github.com/YaLTeR/niri + + # Niri window manager - https://github.com/YaLTeR/niri # - https://github.com/sodiboo/niri-flake/ niri = { url = "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; - # Hassle free desktop shell - # - https://docs.noctalia.dev/getting-started/nixos/ + + # Hassle free desktop shell - https://docs.noctalia.dev/getting-started/nixos/ noctalia = { url = "github:noctalia-dev/noctalia-shell"; inputs.nixpkgs.follows = "nixpkgs"; }; - # Zoomer text editor - # - https://github.com/nix-community/nixvim + + ## Dotfiles & Theme Management + + # Declarative dots - https://github.com/nix-community/home-manager + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Zoomer text editor - https://github.com/nix-community/nixvim nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; - ## Sound & Multimedia - # Sound driver optimisations - # - https://github.com/musnix/musnix - musnix = { url = "github:musnix/musnix"; }; - # Programmatic music language - # - https://github.com/mitchmindtree/tidalcycles.nix - tidalcycles = { - url = "github:mitchmindtree/tidalcycles.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # Nice-to-haves for gaming - # - https://github.com/fufexan/nix-gaming - nix-gaming = { url = "github:fufexan/nix-gaming"; }; - - ## Dotfiles & Theme management - # Declarative dots - # - https://github.com/nix-community/home-manager - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; # Easy themeing (Switch to stylix) - # - https://github.com/nix-community/stylix # - https://github.com/Misterio77/nix-colors stylix = { url = "github:danth/stylix"; }; nix-colors = { url = "github:misterio77/nix-colors"; }; - # Custom 'Sygil' plymouth boot theme [WIP] - # - https://codeberg.org/serenity-F/sygil-plymouth + + # Custom 'Sygil' plymouth boot theme [WIP] - https://codeberg.org/serenity-F/sygil-plymouth sygil-plymouth = { url = "git+https://codeberg.org/serenity-F/sygil-plymouth"; }; + ## Sound & Multimedia + + # Sound driver optimisations - https://github.com/musnix/musnix + musnix = { url = "github:musnix/musnix"; }; + + # Nice-to-haves for gaming - https://github.com/fufexan/nix-gaming + nix-gaming = { url = "github:fufexan/nix-gaming"; }; + + # Programmatic music language - https://github.com/mitchmindtree/tidalcycles.nix + tidalcycles = { + url = "github:mitchmindtree/tidalcycles.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; - outputs = - { self, nixpkgs, sops-nix, home-manager, musnix, niri, noctalia, stylix, ... } + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + outputs = + ## THIS IS DEFINITELY + { self, nixpkgs, sops-nix, home-manager, musnix, niri, noctalia, stylix, ... } + ## A WEIRD WAY @inputs: let - + ## TO DO THIS inherit (self) outputs; - ## Universal variable declarations - label = "SerenityOS"; + # Universal variable declarations + label = "SerenityOS"; # used for theming user = "serenity"; # used for admin purposes - userDescription = "Serenity"; + userDescription = "Serenity"; # your name homeDirectory = "/home/${user}"; # for easy configuration disksPath = "${homeDirectory}/Disks"; # for easy disk navigation flakePath = "${homeDirectory}/${label}"; # unused currently - wallpapersPath = "${homeDirectory}/Pictures/Wallpapers"; - wallpaper = "${wallpapersPath}/almondBlossoms-VanGogh.jpg"; - avatarsPath = "${homeDirectory}/Pictures/Avatars"; - avatar = "${avatarsPath}/avatar.jpg"; + wallpapersPath = "${homeDirectory}/Pictures/Wallpapers"; # where to store wallpapers + wallpaper = "${wallpapersPath}/almondBlossoms-VanGogh.jpg"; # current wallpaper + avatarsPath = "${homeDirectory}/Pictures/Avatars"; # where to store wallpapers + avatar = "${avatarsPath}/avatar.jpg"; # current avatar in { ## Available through 'nixos-rebuild --flake /path/to/flake/directory#yourhostname' nixosConfigurations = { - ## Desktop - primary config + ## Desktop hades = nixpkgs.lib.nixosSystem { + # Inerhiting variables specialArgs = { inherit inputs outputs; inherit niri noctalia; @@ -151,21 +145,31 @@ inherit wallpapersPath wallpaper; inherit avatarsPath avatar; }; + # Importing modules modules = [ - ./core/hosts/hades - sops-nix.nixosModules.sops - musnix.nixosModules.musnix - stylix.nixosModules.stylix - home-manager.nixosModules.home-manager + ./core/hosts/hades # core config + sops-nix.nixosModules.sops # secrets module + musnix.nixosModules.musnix # audio driver module + stylix.nixosModules.stylix # universal theme module + home-manager.nixosModules.home-manager # home-manager { home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; + useGlobalPkgs = true; # keeps hm pkgs pinned to system + useUserPackages = true; # keeps hm pkgs pinned to user + backupFileExtension = "backup"; # for emergencies only }; } ]; }; + + ## Laptop + + ## Home server + + ## Remote server + + ## Installer ISO + }; }; }