Silvan Mosberger 667d42c00d treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 57b193d8ddeaf4f5219d2bae1d23b081e4906e57
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00

92 lines
2.0 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
jdk,
maven,
which,
}:
let
pname = "jnr-posix";
version = "3.1.18";
src = fetchFromGitHub {
owner = "jnr";
repo = "jnr-posix";
rev = "jnr-posix-${version}";
hash = "sha256-zx8I9rsu9Kjef+LatDA1WIuO7Vgo0/JM5nGi3pSWch4=";
};
deps = stdenv.mkDerivation {
name = "${pname}-${version}-deps";
inherit src;
nativeBuildInputs = [
jdk
maven
];
buildPhase = ''
runHook preBuild
mvn package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000
runHook postBuild
'';
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
runHook preInstall
find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete
find $out/.m2 -type f -iname '*.pom' -exec sed -i -e 's/\r\+$//' {} \;
runHook postInstall
'';
outputHashMode = "recursive";
outputHash = "sha256-gOw0KUFyZEMONwLwlHSiV+ZZ7JQhjZwg708Q1IciUfo=";
doCheck = false;
};
in
stdenv.mkDerivation rec {
inherit version pname src;
nativeBuildInputs = [
maven
which
];
postPatch = ''
sed -i "s/\/usr\/bin\/id/$(which id | sed 's#/#\\/#g')/g" src/main/java/jnr/posix/JavaPOSIX.java
'';
buildPhase = ''
runHook preBuild
mvn package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -D target/jnr-posix-${version}.jar $out/share/java/jnr-posix-${version}.jar
runHook postInstall
'';
meta = with lib; {
description = "jnr-posix is a lightweight cross-platform POSIX emulation layer for Java, written in Java and is part of the JNR project";
homepage = "https://github.com/jnr/jnr-posix";
license = with licenses; [
epl20
gpl2Only
lgpl21Only
];
maintainers = with lib.maintainers; [ rhysmdnz ];
};
}