Skip to content

Commit 98cd121

Browse files
authoredMar 21, 2025
fortran-fpm: modernize (#390225)
2 parents 551e707 + e0ba6aa commit 98cd121

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed
 
+26-14
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
{
22
lib,
3-
fetchurl,
4-
pkgs,
53
stdenv,
4+
fetchurl,
5+
gfortran,
6+
versionCheckHook,
7+
nix-update-script,
68
}:
79

8-
stdenv.mkDerivation rec {
10+
stdenv.mkDerivation (finalAttrs: {
911
pname = "fortran-fpm";
1012

1113
version = "0.11.0";
1214

1315
src = fetchurl {
14-
url = "https://github.com/fortran-lang/fpm/releases/download/v${version}/fpm-${version}.F90";
15-
sha256 = "sha256-mIozF+4kSO5yB9CilBDwinnIa92sMxSyoXWAGpz1jSc=";
16+
url = "https://github.com/fortran-lang/fpm/releases/download/v${finalAttrs.version}/fpm-${finalAttrs.version}.F90";
17+
hash = "sha256-mIozF+4kSO5yB9CilBDwinnIa92sMxSyoXWAGpz1jSc=";
1618
};
1719

1820
dontUnpack = true;
1921

20-
nativeBuildInputs = with pkgs; [ gfortran ];
22+
nativeBuildInputs = [ gfortran ];
2123

2224
buildPath = "build/bootstrap";
2325

2426
buildPhase = ''
2527
runHook preBuild
2628
27-
mkdir -p ${buildPath}
28-
gfortran -J ${buildPath} -o ${buildPath}/${pname} $src
29+
mkdir -p ${finalAttrs.buildPath}
30+
gfortran -J ${finalAttrs.buildPath} -o ${finalAttrs.buildPath}/fortran-fpm $src
2931
3032
runHook postBuild
3133
'';
@@ -34,17 +36,27 @@ stdenv.mkDerivation rec {
3436
runHook preInstall
3537
3638
mkdir -p $out/bin
37-
cp ${buildPath}/${pname} $out/bin
39+
cp ${finalAttrs.buildPath}/fortran-fpm $out/bin
3840
3941
runHook postInstall
4042
'';
4143

42-
meta = with lib; {
44+
nativeInstallCheckInputs = [
45+
versionCheckHook
46+
];
47+
versionCheckProgramArg = "--version";
48+
doInstallCheck = true;
49+
50+
passthru = {
51+
updateScript = nix-update-script { };
52+
};
53+
54+
meta = {
4355
description = "Fortran Package Manager (fpm)";
4456
homepage = "https://fpm.fortran-lang.org";
45-
maintainers = [ maintainers.proofconstruction ];
46-
license = licenses.mit;
47-
platforms = platforms.all;
57+
maintainers = [ lib.maintainers.proofconstruction ];
58+
license = lib.licenses.mit;
59+
platforms = lib.platforms.all;
4860
mainProgram = "fortran-fpm";
4961
};
50-
}
62+
})

0 commit comments

Comments
 (0)
Failed to load comments.