From 637def6ca34cbd761c35dfa57699c7d527f4bd27 Mon Sep 17 00:00:00 2001 From: Cookiez Date: Thu, 19 Feb 2026 15:40:15 +0100 Subject: [PATCH] Add alejandra nix formatter and integrate into NixOS flake --- flake.lock | 79 +++++++++++++++++++++++++++++++++ flake.nix | 8 +++- modules/packages/essentials.nix | 3 +- 3 files changed, 88 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index d5c7a23..2e8c900 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "alejandra": { + "inputs": { + "fenix": "fenix", + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744324181, + "narHash": "sha256-Oi1n2ncF4/AWeY6X55o2FddIRICokbciqFYK64XorYk=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "3e2a85506627062313e131bf8a85315f3387c8e0", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "ref": "4.0.0", + "repo": "alejandra", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -68,6 +91,28 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "alejandra", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1730615655, + "narHash": "sha256-2HBR3zLn57LXKNRtxBb+O+uDqHM4n0pz51rPayMl4cg=", + "owner": "nix-community", + "repo": "fenix", + "rev": "efeb50e2535b17ffd4a135e6e3e5fd60a525180c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -126,6 +171,22 @@ "type": "github" } }, + "flakeCompat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -449,6 +510,7 @@ }, "root": { "inputs": { + "alejandra": "alejandra", "grub2-themes": "grub2-themes", "home-manager": "home-manager", "niri": "niri", @@ -462,6 +524,23 @@ "zen-browser": "zen-browser" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1730555913, + "narHash": "sha256-KNHZUlqsEibg3YtfUyOFQSofP8hp1HKoY+laoesBxRM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f17a5bbfd0969ba2e63a74505a80e55ecb174ed9", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", diff --git a/flake.nix b/flake.nix index 9e6cc16..2bf4098 100644 --- a/flake.nix +++ b/flake.nix @@ -37,12 +37,17 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + alejandra = { + url = "github:kamadorueda/alejandra/4.0.0"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-flatpak.url = "github:gmodena/nix-flatpak"; grub2-themes.url = "github:vinceliuice/grub2-themes"; }; - outputs = inputs@{ nixpkgs, home-manager, plasma-manager, nixos-hardware, stylix, niri, zen-browser, grub2-themes, nix-flatpak, ... }: + outputs = inputs@{ nixpkgs, alejandra, home-manager, plasma-manager, nixos-hardware, stylix, niri, zen-browser, grub2-themes, nix-flatpak, ... }: let username = "cookiez"; hostname = "nixos"; @@ -63,6 +68,7 @@ inherit version; inherit system; inherit project; + inherit alejandra; host = hostname; }; modules = [ diff --git a/modules/packages/essentials.nix b/modules/packages/essentials.nix index 790e590..ed9b80d 100644 --- a/modules/packages/essentials.nix +++ b/modules/packages/essentials.nix @@ -1,4 +1,4 @@ -{config, pkgs, libs, inputs, nix-flatpak, ...}: +{config, pkgs, libs, inputs, system, alejandra, ...}: { environment.systemPackages = with pkgs; [ #Essentials (CLI Only) @@ -45,5 +45,6 @@ kdePackages.ksshaskpass ntfs3g appimage-run + alejandra.defaultPackage.${system} ]; }