mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-16 22:51:24 +01:00
66 lines
1.3 KiB
Nix
66 lines
1.3 KiB
Nix
{ alcotest
|
|
, bintools
|
|
, bisect_ppx
|
|
, buildDunePackage
|
|
, core
|
|
, core_unix
|
|
, lib
|
|
, nix-filter
|
|
, ppx_yojson_conv
|
|
, ppx_yojson_conv_lib
|
|
, re
|
|
, reason
|
|
, sha
|
|
, upx
|
|
,
|
|
}:
|
|
buildDunePackage {
|
|
pname = "flake_env";
|
|
version = "0.1";
|
|
src = nix-filter {
|
|
root = ./.;
|
|
include = [
|
|
"bin"
|
|
"lib"
|
|
"tests"
|
|
./dune-project
|
|
./flake.nix
|
|
./default.nix
|
|
./flake.lock
|
|
./flake_env.opam
|
|
./direnvrc
|
|
];
|
|
};
|
|
duneVersion = "3";
|
|
doCheck = true;
|
|
# We strip by hand before packing
|
|
dontStrip = true;
|
|
# patchELF can't handle UPX'd binaries
|
|
# We produce a static OCaml binary that
|
|
dontPatchELF = true;
|
|
postPatch = ''
|
|
substituteInPlace direnvrc --replace-fail "@flake_env@" "$out/bin/flake_env"
|
|
'';
|
|
postInstall = ''
|
|
${bintools}/bin/strip --strip-unneeded $out/bin/flake_env
|
|
${upx}/bin/upx $out/bin/flake_env
|
|
install -m444 -D direnvrc $out/share/flake_env/direnvrc
|
|
'';
|
|
buildInputs = [
|
|
core
|
|
core_unix
|
|
ppx_yojson_conv
|
|
ppx_yojson_conv_lib
|
|
re
|
|
sha
|
|
];
|
|
checkInputs = [ alcotest bisect_ppx ];
|
|
nativeBuildInputs = [ reason ];
|
|
|
|
meta = with lib; {
|
|
description = "Yet another flake plugin for direnv";
|
|
homepage = "https://git.sr.ht/~bryan_bennett/flake_env";
|
|
license = licenses.mit;
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|