nix-direnv/default.nix

61 lines
1.4 KiB
Nix
Raw Normal View History

2023-12-14 05:01:10 +03:00
{ resholve, lib, coreutils, direnv, nix }:
2020-04-01 17:25:32 +03:00
2023-12-14 05:01:10 +03:00
# resholve does not yet support `finalAttrs` call pattern hence `rec`
# https://github.com/abathur/resholve/issues/107
resholve.mkDerivation rec {
pname = "nix-direnv";
2024-01-03 00:46:30 +03:00
version = "3.0.4";
2020-04-01 17:25:32 +03:00
2023-12-14 05:01:10 +03:00
src = builtins.path {
path = ./.;
name = pname;
};
2020-04-01 17:25:32 +03:00
2023-12-19 22:47:34 +03:00
# skip min version checks which are redundant when built with nix
2023-12-15 16:52:55 +03:00
postPatch = ''
2023-12-19 22:47:34 +03:00
sed -i 1iNIX_DIRENV_SKIP_VERSION_CHECK=1 direnvrc
2023-12-15 16:52:55 +03:00
'';
2020-04-01 17:25:32 +03:00
installPhase = ''
2023-12-14 05:01:10 +03:00
install -m400 -D direnvrc $out/share/${pname}/direnvrc
2020-04-01 17:25:32 +03:00
'';
2023-12-14 05:01:10 +03:00
solutions = {
default = {
scripts = [ "share/${pname}/direnvrc" ];
interpreter = "none";
2023-12-19 22:43:10 +03:00
inputs = [ coreutils nix ];
2023-12-14 05:01:10 +03:00
fake = {
builtin = [
"PATH_add"
"direnv_layout_dir"
"has"
"log_error"
"log_status"
"watch_file"
];
function = [
# not really a function - this is in an else branch for macOS/homebrew that
# cannot be reached when built with nix
"shasum"
];
};
2023-12-19 22:43:10 +03:00
keep = {
"$cmd" = true;
"$direnv" = true;
};
2023-12-14 05:01:10 +03:00
execer = [
"cannot:${direnv}/bin/direnv"
"cannot:${nix}/bin/nix"
];
};
};
meta = with lib; {
2020-04-01 17:25:32 +03:00
description = "A fast, persistent use_nix implementation for direnv";
2022-10-08 02:44:43 +03:00
homepage = "https://github.com/nix-community/nix-direnv";
license = licenses.mit;
platforms = platforms.unix;
2020-04-01 17:25:32 +03:00
};
}