De-vendor nixfmt

Change-Id: I1a051be495318a507d07f6d0a6b157616e26774c
This commit is contained in:
V. 2024-07-22 21:09:58 +04:00
parent c74eb81356
commit 85e3b9b871
4 changed files with 4 additions and 72 deletions

View file

@ -140,10 +140,7 @@
system = crossSystem; system = crossSystem;
} }
// lib.optionalAttrs (crossSystem == "x86_64-freebsd") { useLLVM = true; }; // lib.optionalAttrs (crossSystem == "x86_64-freebsd") { useLLVM = true; };
overlays = [ overlays = [ (overlayFor (p: p.${stdenv})) ];
(overlayFor (p: p.${stdenv}))
(final: prev: { nixfmt = final.callPackage ./nix-support/nixfmt.nix { }; })
];
}; };
stdenvs = forAllStdenvs (make-pkgs null); stdenvs = forAllStdenvs (make-pkgs null);
native = stdenvs.stdenvPackages; native = stdenvs.stdenvPackages;

View file

@ -106,7 +106,7 @@ pre-commit-run {
}; };
treefmt = { treefmt = {
enable = true; enable = true;
settings.formatters = [ pkgs.nixfmt ]; settings.formatters = [ pkgs.nixfmt-rfc-style ];
}; };
}; };
} }

View file

@ -1,65 +0,0 @@
# Copy of `nixfmt-rfc-style` vendored from `nixpkgs` master:
# https://github.com/NixOS/nixpkgs/blob/ab6071eb54cc9b66dda436111d4f569e4e56cbf4/pkgs/by-name/ni/nixfmt-rfc-style/package.nix
{
haskell,
haskellPackages,
fetchFromGitHub,
}:
let
inherit (haskell.lib.compose) justStaticExecutables;
raw-pkg = haskellPackages.callPackage (
{
mkDerivation,
base,
cmdargs,
directory,
fetchzip,
filepath,
lib,
megaparsec,
mtl,
parser-combinators,
safe-exceptions,
scientific,
text,
transformers,
unix,
}:
mkDerivation {
pname = "nixfmt";
version = "0.6.0-unstable-2024-03-14";
src = fetchFromGitHub {
owner = "serokell";
repo = "nixfmt";
rev = "8d13b593fa8d8d6e5075f541f3231222a08e84df";
hash = "sha256-HtXvzmfN4wk45qiKZ7V+/5WBV7jnTHfd7iBwF4XGl64=";
};
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base
megaparsec
mtl
parser-combinators
scientific
text
transformers
];
executableHaskellDepends = [
base
cmdargs
directory
filepath
safe-exceptions
text
unix
];
jailbreak = true;
homepage = "https://github.com/serokell/nixfmt";
description = "An opinionated formatter for Nix";
license = lib.licenses.mpl20;
mainProgram = "nixfmt";
}
) { };
in
justStaticExecutables raw-pkg

View file

@ -396,7 +396,7 @@ stdenv.mkDerivation (finalAttrs: {
glibcLocales, glibcLocales,
just, just,
llvmPackages, llvmPackages,
nixfmt, nixfmt-rfc-style,
skopeo, skopeo,
xonsh, xonsh,
@ -457,7 +457,7 @@ stdenv.mkDerivation (finalAttrs: {
# docker image tool # docker image tool
skopeo skopeo
just just
nixfmt nixfmt-rfc-style
# Included above when internalApiDocs is true, but we set that to # Included above when internalApiDocs is true, but we set that to
# false intentionally to save dev build time. # false intentionally to save dev build time.
# To build them in a dev shell, you can set -Dinternal-api-docs=enabled when configuring. # To build them in a dev shell, you can set -Dinternal-api-docs=enabled when configuring.