[Backport release-26.05] nixfmt: 1.2.0 → 1.3.1 (#526674)

This commit is contained in:
Matt Sturgeon 2026-06-01 13:22:29 +00:00 committed by GitHub
commit 3283f34ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 15 deletions

View file

@ -24,10 +24,10 @@
}:
mkDerivation {
pname = "nixfmt";
version = "1.2.0";
version = "1.3.1";
src = fetchzip {
url = "https://github.com/nixos/nixfmt/archive/v1.2.0.tar.gz";
sha256 = "1qvj1sddh7bgggqnj7cnhvfh4iz1pwzc9a9awc1g7y349yvpwad3";
url = "https://github.com/nixos/nixfmt/archive/v1.3.1.tar.gz";
sha256 = "1c0iz6hrzafld8vkldcmall7fvby6xgzzqgap8c3bxwhaxhq86hm";
};
isLibrary = true;
isExecutable = true;
@ -58,6 +58,6 @@ mkDerivation {
jailbreak = true;
homepage = "https://github.com/NixOS/nixfmt";
description = "Official formatter for Nix code";
license = lib.licenses.mpl20;
license = lib.meta.getLicenseFromSpdxId "MPL-2.0";
mainProgram = "nixfmt";
}

View file

@ -2,27 +2,32 @@
haskell,
haskellPackages,
lib,
runCommand,
nixfmt,
stdenv,
versionCheckHook,
}:
let
inherit (haskell.lib.compose) overrideCabal justStaticExecutables;
overrides = {
cabalOverrides = drv: {
passthru.updateScript = ./update.sh;
teams = [ lib.teams.formatter ];
# These tests can be run with the following command.
#
# $ nix-build -A nixfmt.tests
passthru.tests = runCommand "nixfmt-tests" { nativeBuildInputs = [ nixfmt ]; } ''
nixfmt --version > $out
'';
changelog = "https://github.com/NixOS/nixfmt/releases/tag/v${drv.version}";
};
# haskellPackages.mkDerivation and haskell.lib.compose.overrideCabal
# do not allow access to `doInstallCheck` or `nativeInstallCheckInputs`,
# so we override directly with `.overrideAttrs`.
lateOverrides = finalAttrs: prevAttrs: {
doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
nativeInstallCheckInputs = prevAttrs.nativeInstallCheckInputs or [ ] ++ [
versionCheckHook
];
};
raw-pkg = haskellPackages.callPackage ./generated-package.nix { };
in
lib.pipe raw-pkg [
(overrideCabal overrides)
(overrideCabal cabalOverrides)
justStaticExecutables
(drv: drv.overrideAttrs lateOverrides)
]