From f4464732e3e74ea5c0497490cb365c117143eb37 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Sun, 20 Jul 2025 00:48:11 +0200 Subject: [PATCH] tooling: switch from alejandra to nixfmt Signed-off-by: Bloxx12 Change-Id: I6a6a696436b90e48895139b7e0b59b75c0e64cae --- flake.nix | 24 +----------------------- hosts/common.nix | 6 ++++-- hosts/hermit/programs.nix | 1 - npins/sources.json | 16 ++++++++++++++++ packages/default.nix | 1 + packages/helix/default.nix | 4 ++-- packages/helix/languages.nix | 12 +++++++----- 7 files changed, 31 insertions(+), 33 deletions(-) diff --git a/flake.nix b/flake.nix index 5824ff6..df55b43 100644 --- a/flake.nix +++ b/flake.nix @@ -6,22 +6,18 @@ outputs = _: let sources = import ./npins; nixpkgs = (import sources.flake-compat {src = sources.nixpkgs;}).outputs; - inherit (nixpkgs) lib; - eachSystem = lib.genAttrs (import sources.systems); pkgsFor = nixpkgs.legacyPackages; inputs = sources; in { nixosConfigurations = import ./default.nix; - formatter = eachSystem (system: pkgsFor.${system}.alejandra); - packages = lib.mapAttrs ( _: pkgs: { inherit (import ./packages { - inherit inputs pkgs; + inherit inputs pkgs sources; }) fish helix @@ -44,24 +40,6 @@ ) pkgsFor; - apps = eachSystem (system: let - inherit (inputs.self.packages.${system}) fish helix nushell; - in { - default = inputs.self.apps.${system}.nushell; - helix = { - type = "app"; - program = "${helix}/bin/hx"; - }; - nushell = { - type = "app"; - program = "${nushell}/bin/nu"; - }; - fish = { - type = "app"; - program = "${fish}/bin/fish"; - }; - }); - templates = import ./templates; }; } diff --git a/hosts/common.nix b/hosts/common.nix index 34a0269..850d677 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -6,11 +6,13 @@ lib, self, pkgs, + sources, ... }: let inherit (lib.meta) hiPrioSet; - helix = pkgs.callPackage (self + "/packages/helix") {}; - fish = pkgs.callPackage (self + "/packages/fish") {}; + helix = pkgs.callPackage (self + "/packages/helix") {inherit sources;}; + + fish = pkgs.callPackage (self + "/packages/fish") {inherit sources;}; in { environment.systemPackages = builtins.attrValues { diff --git a/hosts/hermit/programs.nix b/hosts/hermit/programs.nix index bc0b7ea..bcded7f 100644 --- a/hosts/hermit/programs.nix +++ b/hosts/hermit/programs.nix @@ -23,7 +23,6 @@ in { (pkgs) abook aerc - alejandra aichat alsa-utils anki diff --git a/npins/sources.json b/npins/sources.json index c8cebe0..006c756 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -84,6 +84,22 @@ "url": "https://github.com/nix-community/nh/archive/a90e3124111d9c3eb64e97a5334db09a8e2a4bae.tar.gz", "hash": "sha256-KKaUEg1/ntHVsG61CkKFr2mfdsoK9Nj5FM/W1PBhe5o=" }, + "nixfmt": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "nixos", + "repo": "nixfmt" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v1.0.0", + "revision": "1f2589cb7198529c6c1eec9699eccd4d507d3600", + "url": "https://api.github.com/repos/nixos/nixfmt/tarball/refs/tags/v1.0.0", + "hash": "sha256-d8SYpFoCpi1GrqlKwxxq9qhyjDANeLgr8WWJNRK6wkc=" + }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", diff --git a/packages/default.nix b/packages/default.nix index 5b24cff..7d10d8d 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,6 +1,7 @@ { inputs, pkgs, + sources, }: let inherit (pkgs) lib; helix = pkgs.callPackage ./helix {}; diff --git a/packages/helix/default.nix b/packages/helix/default.nix index 4be0954..d1f0938 100644 --- a/packages/helix/default.nix +++ b/packages/helix/default.nix @@ -1,5 +1,5 @@ { - alejandra, + sources, basedpyright, bash-language-server, callPackage, @@ -61,7 +61,7 @@ toml = formats.toml {}; - helix-languages = callPackage ./languages.nix {inherit lib;}; + helix-languages = callPackage ./languages.nix {inherit lib sources;}; colorscheme = toml.generate "colorscheme.toml" (import ./colorscheme.nix); helix-config = { diff --git a/packages/helix/languages.nix b/packages/helix/languages.nix index 1f45c96..6e5d1b3 100644 --- a/packages/helix/languages.nix +++ b/packages/helix/languages.nix @@ -1,21 +1,22 @@ { - fetchFromGitHub, - rustPlatform, - alejandra, + sources, basedpyright, bash-language-server, + callPackage, clang-tools, cmake-format, cmake-language-server, deadnix, deno, dprint, + fetchFromGitHub, formats, gdb, kdePackages, lib, nil, ruff, + rustPlatform, shfmt, typescript-language-server, vscode-langservers-extracted, @@ -26,6 +27,8 @@ toml = formats.toml {}; + nixfmt = callPackage "${sources.nixfmt}/default.nix" {}; + # a newer nil version, for pipes support. new-nil = nil.overrideAttrs (_: { version = "unstable-18-07-2025"; @@ -233,9 +236,8 @@ nil = { command = getExe new-nil; - # alejandro config.nil = { - formatting.command = ["${getExe alejandra}" "-q"]; + formatting.command = ["${getExe nixfmt}"]; diagnostics = { bindingEndHintMinLines = 3; };