mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-12-03 07:31:10 +01:00
* fix deprecation warnings * define dependencies once * expose all supported nix versions in nixpkgs for test * use ruff for both check and format, dropping black
56 lines
1.3 KiB
Nix
56 lines
1.3 KiB
Nix
{ stdenv, lib, nix, gnugrep, runCommand, shellcheck, direnv, ruff, mypy, python3 }:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
name = "nix-direnv";
|
|
|
|
src = builtins.path {
|
|
inherit (finalAttrs) name;
|
|
path = ./.;
|
|
};
|
|
|
|
postPatch = ''
|
|
sed -i "2iNIX_BIN_PREFIX=${nix}/bin/" direnvrc
|
|
'';
|
|
|
|
installPhase = ''
|
|
install -m400 -D direnvrc $out/share/nix-direnv/direnvrc
|
|
'';
|
|
|
|
passthru.tests = {
|
|
lint = runCommand "lint-${finalAttrs.name}" {
|
|
nativeBuildInputs = [shellcheck ruff mypy];
|
|
} ''
|
|
set -eu
|
|
cd ${finalAttrs.src}
|
|
export RUFF_CACHE_DIR=$TMP/ruff
|
|
echo run shellcheck
|
|
shellcheck direnvrc
|
|
echo run ruff format
|
|
ruff format --check tests
|
|
echo run ruff check
|
|
ruff check tests
|
|
echo run mypy
|
|
mypy tests
|
|
touch $out
|
|
'';
|
|
test = finalAttrs.overrideAttrs {
|
|
name = "test-${finalAttrs.name}-${nix.name}";
|
|
nativeBuildInputs = [
|
|
direnv
|
|
nix
|
|
] ++ (with python3.pkgs; [
|
|
pytestCheckHook
|
|
pytest-cov
|
|
pytest-randomly
|
|
pytest-sugar
|
|
]);
|
|
};
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "A fast, persistent use_nix implementation for direnv";
|
|
homepage = "https://github.com/nix-community/nix-direnv";
|
|
license = licenses.mit;
|
|
platforms = platforms.unix;
|
|
};
|
|
})
|