aux-search/import-scripts/default.nix

44 lines
1.2 KiB
Nix
Raw Normal View History

2020-06-18 22:41:01 +00:00
{ pkgs ? import <nixpkgs> { }
2020-07-02 12:27:49 +00:00
, version ? pkgs.lib.removeSuffix "\n" (builtins.readFile ./../VERSION)
2020-06-18 22:41:01 +00:00
}:
let
inherit (pkgs.poetry2nix) mkPoetryApplication overrides;
in
mkPoetryApplication {
projectDir = ./.;
overrides = overrides.withDefaults (self: super: {
pypandoc = super.pypandoc.overridePythonAttrs (old: {
postPatch = ''
sed -i '/^__pandoc_path = None$/c__pandoc_path = "${pkgs.pandoc}/bin/pandoc"' pypandoc/__init__.py
'';
});
});
2021-01-23 16:25:43 +00:00
preferLocalBuild = true;
nativeBuildInputs = with pkgs; [
poetry
fd
entr
2021-01-23 16:25:43 +00:00
nixStable
2020-07-02 12:27:49 +00:00
];
2020-06-18 22:41:01 +00:00
checkPhase = ''
2020-07-02 12:27:49 +00:00
export PYTHONPATH=$PWD:$PYTHONPATH
black --diff --check import_scripts/ tests/
flake8 --ignore W503,E501,E265,E203 import_scripts/ tests/
mypy import_scripts/ tests/
pytest -vv tests/
2020-06-18 22:41:01 +00:00
'';
postInstall = ''
2021-01-23 16:25:43 +00:00
wrapProgram $out/bin/import-channel \
--set INDEX_SCHEMA_VERSION "${version}" \
--prefix PATH : "${pkgs.nixStable}/bin"
wrapProgram $out/bin/channel-diff \
--set INDEX_SCHEMA_VERSION "${version}" \
--prefix PATH : "${pkgs.nixStable}/bin"
2020-06-18 22:41:01 +00:00
'';
2020-07-02 12:27:49 +00:00
shellHook = ''
cd import-scripts/
export PYTHONPATH=$PWD:$PYTHONPATH
'';
2020-06-18 22:41:01 +00:00
}