diff --git a/flake.lock b/flake.lock index bba4979c6..04ce37803 100644 --- a/flake.lock +++ b/flake.lock @@ -352,7 +352,9 @@ "flake-compat": "flake-compat", "flake-parts": [], "git-hooks-nix": [], - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "nixpkgs-regression": [] }, "locked": { @@ -442,26 +444,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726871744, - "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1730293612, - "narHash": "sha256-Fo55ceEblQsxXcg1xGXkuREUOiz2CAIn6A5HL4sdigM=", + "lastModified": 1730543270, + "narHash": "sha256-tum4kS12v9s/A1Kp6jIZS2wHBadk9QX+fJTlFvLBRi8=", "ref": "refs/heads/main", - "rev": "aed993733203b1b403e7ce8a4ab8255f9a1db456", + "rev": "c2a2344b69164098adfac97b1ed554cf5a8001d9", "shallow": true, "type": "git", "url": "https://github.com/Mic92/nixpkgs" @@ -527,7 +513,7 @@ "nix-index-database": "nix-index-database", "nixos-facter-modules": "nixos-facter-modules", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "nur-packages": "nur-packages", "retiolum": "retiolum", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index 56681156e..b5202df64 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,7 @@ nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; nix.url = "github:Mic92/nix-1"; + nix.inputs.nixpkgs.follows = "nixpkgs"; nix.inputs.flake-parts.follows = ""; nix.inputs.nixpkgs-regression.follows = ""; nix.inputs.git-hooks-nix.follows = ""; diff --git a/home/.zshrc b/home/.zshrc index 392b1af46..19774dbd7 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -427,7 +427,7 @@ nix-fmt() { toplevel=$(command git rev-parse --show-toplevel) buildArgs=() fmt="$toplevel/.git/nix-fmt" - if [[ ! -f "$toplevel/.git/nix-fmt/bin/treefmt" ]]; then + if [[ ! -d "$toplevel/.git/nix-fmt" ]]; then needsUpdate=1 elif [[ -n "$toplevel" ]]; then buildArgs+=("-o" "$toplevel"/.git/nix-fmt) @@ -442,8 +442,17 @@ nix-fmt() { if [[ "$needsUpdate" == 1 ]]; then fmt=$(command nix build --builders '' "${buildArgs[@]}" ".#formatter.${currentSystem}" --print-out-paths) fi + ln -sf "$fmt" "$toplevel/.git/nix-fmt" - "$fmt/bin/"* + # treefmt has multiple outputs + if [[ -x "$fmt/bin/treefmt" ]]; then + "$fmt/bin/treefmt" "$@" + return + fi + for file in "$fmt/bin/"*; do + "$file" "$@" + return + done } nix-call-package() {