From 689a0cdfa84bd364aed275fc27491df7e88c886c Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 18:29:15 +0000 Subject: [PATCH 01/10] aaaaaaaaaaaaaaaaaaaaa --- modules/graphical.nix | 7 +------ modules/yazi.nix | 25 +++++++++++-------------- systems/vm/configuration.nix | 5 +---- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/modules/graphical.nix b/modules/graphical.nix index e930b25..3a5aa27 100644 --- a/modules/graphical.nix +++ b/modules/graphical.nix @@ -2,17 +2,13 @@ let cfg = config.modules.graphical; - quickshell-packages = lib.mkIf cfg.quickshell (with pkgs; [quickshell]); in { options = { modules.graphical = { enable = lib.mkEnableOption "Enable the GUI"; - waybar = lib.mkEnableOption "Enable waybar"; - - quickshell = lib.mkEnableOption "Enable quickshell"; }; }; @@ -23,9 +19,8 @@ in environment.systemPackages = with pkgs; [ alacritty wl-clipboard - + quickshell ] - ++ quickshell-packages; programs.waybar.enable = lib.mkIf cfg.waybar true; }; diff --git a/modules/yazi.nix b/modules/yazi.nix index 53fc5ca..6a00088 100644 --- a/modules/yazi.nix +++ b/modules/yazi.nix @@ -2,23 +2,10 @@ let cfg = config.modules.yazi; - optional-packages = lib.mkIf cfg.optional-programs (with pkgs; [ - ffmpeg_7 - p7zip - jq - poppler - fd - ripgrep - fzf - zoxide - resvg - imagemagick - ]); in { options.modules.yazi = { enable = lib.mkEnableOption "Enable Yazi file manager"; - optional-programs = lib.mkEnableOption "Enable optional extra packages"; }; config = lib.mkIf cfg.enable { @@ -29,6 +16,16 @@ in environment.systemPackages = with pkgs; [ nerd-fonts.ubuntu nerd-fonts.ubuntu-mono - ] ++ optional-packages; + ffmpeg_7 + p7zip + jq + poppler + fd + ripgrep + fzf + zoxide + resvg + imagemagick + ]; }; } \ No newline at end of file diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix index 5377647..aeae578 100644 --- a/systems/vm/configuration.nix +++ b/systems/vm/configuration.nix @@ -18,10 +18,7 @@ waybar = true; }; - modules.yazi = { - enable = true; - optional-programs = true; - }; + modules.yazi.enable = true; system.stateVersion = "25.11"; } \ No newline at end of file From e997971190e19452b128de7e9baa091bbac67c46 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 18:29:32 +0000 Subject: [PATCH 02/10] a --- modules/graphical.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/graphical.nix b/modules/graphical.nix index 3a5aa27..0510ce0 100644 --- a/modules/graphical.nix +++ b/modules/graphical.nix @@ -20,7 +20,7 @@ in alacritty wl-clipboard quickshell - ] + ]; programs.waybar.enable = lib.mkIf cfg.waybar true; }; From eb444b55a13ea665c858169238037d4299c0a6be Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 18:39:47 +0000 Subject: [PATCH 03/10] fixed fonts --- modules/yazi.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/yazi.nix b/modules/yazi.nix index 6a00088..3061174 100644 --- a/modules/yazi.nix +++ b/modules/yazi.nix @@ -13,9 +13,9 @@ in yazi.enable = true; }; + fonts.packages = [ "JetBrains Mono" ] ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts); + environment.systemPackages = with pkgs; [ - nerd-fonts.ubuntu - nerd-fonts.ubuntu-mono ffmpeg_7 p7zip jq From d722be4d55e40ee0fa83a87259abf13eee8ea4d0 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 18:42:10 +0000 Subject: [PATCH 04/10] aaaaaa --- modules/yazi.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/yazi.nix b/modules/yazi.nix index 3061174..ee8991c 100644 --- a/modules/yazi.nix +++ b/modules/yazi.nix @@ -13,7 +13,7 @@ in yazi.enable = true; }; - fonts.packages = [ "JetBrains Mono" ] ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts); + fonts.packages = builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts); environment.systemPackages = with pkgs; [ ffmpeg_7 From 2e6f7e41c1bc2e74df2dad66f3a913cbe44727e3 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 18:58:48 +0000 Subject: [PATCH 05/10] disable waybar --- systems/vm/configuration.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix index aeae578..7d1db62 100644 --- a/systems/vm/configuration.nix +++ b/systems/vm/configuration.nix @@ -13,10 +13,7 @@ networking.hostName = "vm"; - modules.graphical = { - enable = true; - waybar = true; - }; + modules.graphical.enable = true; modules.yazi.enable = true; From b9bfb819072c58cbe7344358b670ab25a0ea45c2 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 19:36:05 +0000 Subject: [PATCH 06/10] enable extra graphical stuff --- systems/vm/configuration.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix index 7d1db62..e908b79 100644 --- a/systems/vm/configuration.nix +++ b/systems/vm/configuration.nix @@ -13,7 +13,11 @@ networking.hostName = "vm"; - modules.graphical.enable = true; + modules.graphical = { + enable = true; + waybar = true; + quickshell = true; + }; modules.yazi.enable = true; From 67fcb2c7bc94e75663c9ad6de83bfb74fbdf34e9 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 19:38:57 +0000 Subject: [PATCH 07/10] made quickshell optional --- modules/graphical.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/graphical.nix b/modules/graphical.nix index 0510ce0..b29b61f 100644 --- a/modules/graphical.nix +++ b/modules/graphical.nix @@ -9,6 +9,7 @@ in modules.graphical = { enable = lib.mkEnableOption "Enable the GUI"; waybar = lib.mkEnableOption "Enable waybar"; + quickshell = lib.mkEnableOption "Enable quickshell"; }; }; @@ -19,8 +20,8 @@ in environment.systemPackages = with pkgs; [ alacritty wl-clipboard - quickshell - ]; + ] + ++ lib.optional cfg.quickshell quickshell; programs.waybar.enable = lib.mkIf cfg.waybar true; }; From 7ec36e8a2b2121f803bc14a909867e73fda3f2ee Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 19:59:52 +0000 Subject: [PATCH 08/10] added dev shell --- shell.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c305f39 --- /dev/null +++ b/shell.nix @@ -0,0 +1,9 @@ +{pkgs ? import {}}: +pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ + deadnix + statix + treefmt + nixfmt-rfc-style + ]; +} \ No newline at end of file From d8dd32193db4f05e448caa3c17fe833f4ab9e4bc Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sat, 28 Feb 2026 20:03:22 +0000 Subject: [PATCH 09/10] fixed formatting --- all-modules.nix | 6 +-- flake.nix | 14 +++--- modules/boot.nix | 4 +- modules/default-packages.nix | 4 +- modules/graphical.nix | 37 +++++++++------- modules/k3s.nix | 13 +++--- modules/kubernetes.nix | 11 +++-- modules/locale.nix | 7 ++- modules/networkManager.nix | 4 +- modules/prismLauncher.nix | 15 ++++--- modules/yazi.nix | 9 +++- shell.nix | 6 ++- systems/vm/configuration.nix | 24 +++++------ systems/vm/hardware-configuration.nix | 28 ++++++++---- treefmt.toml | 61 +++++++++++++++++++++++++++ 15 files changed, 167 insertions(+), 76 deletions(-) create mode 100644 treefmt.toml diff --git a/all-modules.nix b/all-modules.nix index a92e2a0..ca68789 100644 --- a/all-modules.nix +++ b/all-modules.nix @@ -1,5 +1,5 @@ -{lib, ...}: +{ lib, ... }: { - imports = lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./modules); -} \ No newline at end of file + imports = lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./modules); +} diff --git a/flake.nix b/flake.nix index 6f523a3..42af1f5 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,12 @@ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; }; - outputs = { self, nixpkgs }: { - # hydraJobs = nixpkgs.lib.mapAttrs (_: value: value.config.system.build.toplevel) self.nixosConfigurations; - nixosConfigurations = { - vm = nixpkgs.lib.nixosSystem { - modules = [ - ./systems/vm/configuration.nix - ]; + outputs = + { self, nixpkgs }: + { + # hydraJobs = nixpkgs.lib.mapAttrs (_: value: value.config.system.build.toplevel) self.nixosConfigurations; + nixosConfigurations = { + vm = nixpkgs.lib.nixosSystem { modules = [ ./systems/vm/configuration.nix ]; }; }; }; - }; } diff --git a/modules/boot.nix b/modules/boot.nix index 814ff37..7181c0f 100644 --- a/modules/boot.nix +++ b/modules/boot.nix @@ -1,7 +1,7 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/vda"; boot.loader.grub.useOSProber = true; -} \ No newline at end of file +} diff --git a/modules/default-packages.nix b/modules/default-packages.nix index 3fcb9f9..1eb713f 100644 --- a/modules/default-packages.nix +++ b/modules/default-packages.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { programs = { @@ -10,4 +10,4 @@ acpi wget ]; -} \ No newline at end of file +} diff --git a/modules/graphical.nix b/modules/graphical.nix index b29b61f..6620151 100644 --- a/modules/graphical.nix +++ b/modules/graphical.nix @@ -1,28 +1,35 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let - cfg = config.modules.graphical; + cfg = config.modules.graphical; in { - options = { - modules.graphical = { + options = { + modules.graphical = { enable = lib.mkEnableOption "Enable the GUI"; waybar = lib.mkEnableOption "Enable waybar"; quickshell = lib.mkEnableOption "Enable quickshell"; }; - }; + }; - config = lib.mkIf cfg.enable { - programs.niri.enable = true; - services.displayManager.ly.enable = true; + config = lib.mkIf cfg.enable { + programs.niri.enable = true; + services.displayManager.ly.enable = true; - environment.systemPackages = with pkgs; [ - alacritty - wl-clipboard - ] - ++ lib.optional cfg.quickshell quickshell; + environment.systemPackages = + with pkgs; + [ + alacritty + wl-clipboard + ] + ++ lib.optional cfg.quickshell quickshell; programs.waybar.enable = lib.mkIf cfg.waybar true; - }; -} \ No newline at end of file + }; +} diff --git a/modules/k3s.nix b/modules/k3s.nix index ba69020..0df95ff 100644 --- a/modules/k3s.nix +++ b/modules/k3s.nix @@ -1,4 +1,9 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.modules.k3s; @@ -7,7 +12,5 @@ in { options.modules.k3s.enable = lib.mkEnableOption "Enable the k3s service"; - config = lib.mkIf cfg.enable { - services.k3s.enable = true; - }; -} \ No newline at end of file + config = lib.mkIf cfg.enable { services.k3s.enable = true; }; +} diff --git a/modules/kubernetes.nix b/modules/kubernetes.nix index 3f10a7d..819dceb 100644 --- a/modules/kubernetes.nix +++ b/modules/kubernetes.nix @@ -1,11 +1,16 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.modules.kubernetes; in { - options.modules.kubernetes.enable = lib.mkEnableOption "Enable MiniKube and Kubectl"; + options.modules.kubernetes.enable = lib.mkEnableOption "Enable MiniKube and Kubectl"; config = lib.mkIf cfg.enable { environment.systemPackages = with pkgs; [ @@ -13,4 +18,4 @@ in kubectl ]; }; -} \ No newline at end of file +} diff --git a/modules/locale.nix b/modules/locale.nix index 88ecdcd..1d3a479 100644 --- a/modules/locale.nix +++ b/modules/locale.nix @@ -1,5 +1,4 @@ -_: -{ +_: { services.automatic-timezoned.enable = true; i18n.defaultLocale = "en_GB.UTF-8"; i18n.extraLocaleSettings = { @@ -13,5 +12,5 @@ _: LC_TELEPHONE = "en_GB.UTF-8"; LC_TIME = "en_GB.UTF-8"; }; - console.keyMap = "uk"; -} \ No newline at end of file + console.keyMap = "uk"; +} diff --git a/modules/networkManager.nix b/modules/networkManager.nix index dca6ad0..34b6b7c 100644 --- a/modules/networkManager.nix +++ b/modules/networkManager.nix @@ -1,5 +1,5 @@ -{config, pkgs, ...}: +{ config, pkgs, ... }: { networking.networkmanager.enable = true; -} \ No newline at end of file +} diff --git a/modules/prismLauncher.nix b/modules/prismLauncher.nix index 98acfbb..1cab5d6 100644 --- a/modules/prismLauncher.nix +++ b/modules/prismLauncher.nix @@ -1,4 +1,9 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.modules.prismLauncher; @@ -6,9 +11,5 @@ in { options.modules.prismLauncher.enable = lib.mkEnableOption "Enables the prism minecraft launcher"; - config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - prismlauncher - ]; - }; -} \ No newline at end of file + config = lib.mkIf cfg.enable { environment.systemPackages = with pkgs; [ prismlauncher ]; }; +} diff --git a/modules/yazi.nix b/modules/yazi.nix index ee8991c..55aa448 100644 --- a/modules/yazi.nix +++ b/modules/yazi.nix @@ -1,4 +1,9 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.modules.yazi; @@ -28,4 +33,4 @@ in imagemagick ]; }; -} \ No newline at end of file +} diff --git a/shell.nix b/shell.nix index c305f39..1b9bf5d 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,6 @@ -{pkgs ? import {}}: +{ + pkgs ? import { }, +}: pkgs.mkShell { nativeBuildInputs = with pkgs.buildPackages; [ deadnix @@ -6,4 +8,4 @@ pkgs.mkShell { treefmt nixfmt-rfc-style ]; -} \ No newline at end of file +} diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix index e908b79..61fec7c 100644 --- a/systems/vm/configuration.nix +++ b/systems/vm/configuration.nix @@ -1,19 +1,19 @@ -{ config, pkgs, ...}: +{ config, pkgs, ... }: { - imports = [ - ../../all-modules.nix - ./hardware-configuration.nix - ]; + imports = [ + ../../all-modules.nix + ./hardware-configuration.nix + ]; - users.users.riley = { - isNormalUser = true; - extraGroups = ["wheel"]; - }; + users.users.riley = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; networking.hostName = "vm"; - modules.graphical = { + modules.graphical = { enable = true; waybar = true; quickshell = true; @@ -21,5 +21,5 @@ modules.yazi.enable = true; - system.stateVersion = "25.11"; -} \ No newline at end of file + system.stateVersion = "25.11"; +} diff --git a/systems/vm/hardware-configuration.nix b/systems/vm/hardware-configuration.nix index 3b2f28b..23f42df 100644 --- a/systems/vm/hardware-configuration.nix +++ b/systems/vm/hardware-configuration.nix @@ -1,19 +1,29 @@ -{ config, lib, pkgs, modulesPath, ...}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; - boot.initrd.kernelModules = []; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "sr_mod" + "virtio_blk" + ]; + boot.initrd.kernelModules = [ ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/ed56e12e-55cc-42e0-b94f-9a6d6bb2bdad"; fsType = "ext4"; }; - swapDevices = []; + swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} \ No newline at end of file +} diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 0000000..c883b33 --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,61 @@ +# One CLI to format the code tree - https://github.com/numtide/treefmt + +# Do not exit with error if a configured formatter is missing +# Env $TREEFMT_ALLOW_MISSING_FORMATTER +# allow-missing-formatter = true + +# The file into which a cpu profile will be written +# Env $TREEFMT_CPU_PROFILE +# cpu-profile = ./cpu.pprof + +# Exclude files or directories matching the specified globs +# Env $TREEFMT_EXCLUDES +# excludes = ["*.md", "*.gif"] + +# Exit with error if any changes were made during execution +# Useful for CI +# Env $TREEFMT_FAIL_ON_CHANGE +# fail-on-change = true + +# A list of formatters to apply +# Defaults to all configured formatters +# Env $TREEFMT_FORMATTERS +# formatters = ["gofmt", "prettier"] + +# Log paths that did not match any formatters at the specified log level +# Possible values are +# Env $TREEFMT_ON_UNMATCHED +# on-unmatched = "info" + +# The root directory from which treefmt will start walking the filesystem +# Defaults to the directory containing the config file +# Env $TREEFMT_TREE_ROOT +# tree-root = "/tmp/foo" + +# File to search for to find the tree root (if tree-root is not set) +# Env $TREEFMT_TREE_ROOT_FILE +# tree-root-file = ".git/config" + +# Set the verbosity of logs +# 0 = warn, 1 = info, 2 = debug +# Env $TREEFMT_VERBOSE +# verbose = 2 + +# The method used to traverse the files within the tree root +# Currently, we support 'auto', 'git' or 'filesystem' +# Env $TREEFMT_WALK +# walk = "filesystem" + +[formatter.mylanguage] +# Command to execute +command = "nixfmt" +# Command-line arguments for the command +options = ["-s", "-v", "-w150"] +# Glob pattern of files to include +includes = ["*.nix"] +# Glob patterns of files to exclude +excludes = [] +# Controls the order of application when multiple formatters match the same file +# Lower the number, the higher the precedence +# Default is 0 +priority = 0 From 81f128265cbf81a64870b03883db34a33da0d797 Mon Sep 17 00:00:00 2001 From: Fishandchips321 Date: Sun, 1 Mar 2026 15:33:24 +0000 Subject: [PATCH 10/10] added checks and formatting pre-commit hooks --- .gitignore | 1 + flake.lock | 100 ++++++++++++++++++++++++-- flake.nix | 48 ++++++++++++- modules/boot.nix | 10 +-- modules/default-packages.nix | 2 +- modules/k3s.nix | 7 +- modules/networkManager.nix | 6 +- systems/vm/configuration.nix | 2 +- systems/vm/hardware-configuration.nix | 30 ++++---- treefmt.toml | 2 +- 10 files changed, 166 insertions(+), 42 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c6f3fa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.pre-commit-config.yaml \ No newline at end of file diff --git a/flake.lock b/flake.lock index 82d8ab7..931cd7f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,24 +1,114 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1772024342, + "narHash": "sha256-+eXlIc4/7dE6EcPs9a2DaSY3fTA9AE526hGqkNID3Wg=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "6e34e97ed9788b17796ee43ccdbaf871a5c2b476", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1771848320, - "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "lastModified": 1770073757, + "narHash": "sha256-Vy+G+F+3E/Tl+GMNgiHl9Pah2DgShmIUBJXmbiQPHbI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "47472570b1e607482890801aeaf29bfb749884f6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1772047000, + "narHash": "sha256-7DaQVv4R97cii/Qdfy4tmDZMB2xxtyIvNGSwXBBhSmo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "rev": "1267bb4920d0fc06ea916734c11b0bf004bbe17e", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixos-25.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs_2", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 42af1f5..137b540 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,54 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11"; + systems.url = "github:nix-systems/default"; + git-hooks.url = "github:cachix/git-hooks.nix"; }; outputs = - { self, nixpkgs }: { - # hydraJobs = nixpkgs.lib.mapAttrs (_: value: value.config.system.build.toplevel) self.nixosConfigurations; + self, + systems, + nixpkgs, + ... + }@inputs: + let + forEachSystem = inputs.nixpkgs.lib.genAttrs (import systems); + in + { + formatter = forEachSystem ( + system: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + pkgs.treefmt + ); + + checks = forEachSystem (system: { + pre-commit-check = inputs.git-hooks.lib.${system}.run { + src = ./.; + hooks = { + treefmt.enable = true; + treefmt.settings.formatters = [ inputs.nixpkgs.legacyPackages.${system}.nixfmt ]; + statix.enable = true; + deadnix.enable = true; + nil.enable = true; + }; + }; + }); + + devShells = forEachSystem (system: { + default = + let + pkgs = nixpkgs.legacyPackages.${system}; + inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages; + in + pkgs.mkShell { + inherit shellHook; + buildInputs = enabledPackages; + }; + }); + nixosConfigurations = { vm = nixpkgs.lib.nixosSystem { modules = [ ./systems/vm/configuration.nix ]; }; }; diff --git a/modules/boot.nix b/modules/boot.nix index 7181c0f..6640b39 100644 --- a/modules/boot.nix +++ b/modules/boot.nix @@ -1,7 +1,9 @@ -{ config, pkgs, ... }: +_: { - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/vda"; - boot.loader.grub.useOSProber = true; + boot.loader.grub = { + enable = true; + device = "/dev/vda"; + useOSProber = true; + }; } diff --git a/modules/default-packages.nix b/modules/default-packages.nix index 1eb713f..ff957ba 100644 --- a/modules/default-packages.nix +++ b/modules/default-packages.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: { programs = { diff --git a/modules/k3s.nix b/modules/k3s.nix index 0df95ff..781da73 100644 --- a/modules/k3s.nix +++ b/modules/k3s.nix @@ -1,9 +1,4 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.modules.k3s; diff --git a/modules/networkManager.nix b/modules/networkManager.nix index 34b6b7c..c576060 100644 --- a/modules/networkManager.nix +++ b/modules/networkManager.nix @@ -1,5 +1 @@ -{ config, pkgs, ... }: - -{ - networking.networkmanager.enable = true; -} +_: { networking.networkmanager.enable = true; } diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix index 61fec7c..0ed30cc 100644 --- a/systems/vm/configuration.nix +++ b/systems/vm/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +_: { imports = [ diff --git a/systems/vm/hardware-configuration.nix b/systems/vm/hardware-configuration.nix index 23f42df..000e8b6 100644 --- a/systems/vm/hardware-configuration.nix +++ b/systems/vm/hardware-configuration.nix @@ -1,22 +1,20 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: +{ lib, modulesPath, ... }: { imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = [ - "ahci" - "xhci_pci" - "virtio_pci" - "sr_mod" - "virtio_blk" - ]; - boot.initrd.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot = { + initrd = { + availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "sr_mod" + "virtio_blk" + ]; + kernelModules = [ ]; + }; + extraModulePackages = [ ]; + }; fileSystems."/" = { device = "/dev/disk/by-uuid/ed56e12e-55cc-42e0-b94f-9a6d6bb2bdad"; diff --git a/treefmt.toml b/treefmt.toml index c883b33..4d63807 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -46,7 +46,7 @@ # Env $TREEFMT_WALK # walk = "filesystem" -[formatter.mylanguage] +[formatter.nixfmt] # Command to execute command = "nixfmt" # Command-line arguments for the command