Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions nix/packages/treefmt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,19 @@ in

passthru = let
inherit (perSystem.self) treefmt;

# Inherits an attr from pkgs.treefmt, overriding the `treefmt` arg if possible
inheritFromNixpkgs = name: let
error = "Accessing `${name}` requires a nixpkgs revision that has `treefmt.${name}`.";
attr = pkgs.treefmt.${name} or (throw error);
in
if attr.override.__functionArgs.treefmt or null != null
then attr.override {inherit treefmt;}
else attr;
in {
withConfig = inheritFromNixpkgs "withConfig";
buildConfig = inheritFromNixpkgs "buildConfig";

no-vendor-hash = treefmt.overrideAttrs {
vendorHash = "";
};
Expand Down