Skip to content

Commit

Permalink
Fix up flake
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed May 29, 2024
1 parent 459f691 commit b8e38d3
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@
);
};

nodejs_base = pkgs.nodejs_22;

# This one isn't in Nix, so do it manually.
ast = pkgs.buildNpmPackage rec {
pname = "abstract-syntax-tree";
version = "2.22.0";

nodejs = nodejs_base;

src = pkgs.fetchFromGitHub {
owner = "buxlabs";
repo = pname;
Expand All @@ -71,7 +75,7 @@
(pkgs.haskell.packages.ghc96.ghcWithPackages (p: [ p.aeson ]))
pkgs.hlint
];
node-deps = [ pkgs.nodejs_22 pkgs.nodePackages.eslint ast ];
node-deps = [ nodejs_base pkgs.nodePackages.eslint ast ];
bash-deps = [ pkgs.shellcheck ];
c-deps = [ pkgs.cppcheck pkgs.gcc13 ];
java-deps = [ pkgs.openjdk21 pkgs.checkstyle ];
Expand All @@ -94,18 +98,23 @@
inherit (python-base-env) projectDir python overrides;
propagatedBuildInputs = all-other-dependencies;
};
poetry-package = (pkgs.poetry.override {python3 = python;}).overridePythonAttrs {
doCheck = false;
};
in {
checks = rec {
default = simple-tests;
simple-tests = pkgs.stdenvNoCC.mkDerivation {
name = "simple-tests";
src = self;
doCheck = true;
checkInputs = [ python-dev-env pkgs.poetry ] ++ all-other-dependencies;
checkInputs = [ python-dev-env poetry-package ] ++ all-other-dependencies;
checkPhase = ''
DOTNET_CLI_HOME="$(mktemp -d)"
export DOTNET_CLI_HOME
poetry run pytest -n auto --cov=tested --cov-report=xml tests/
NODE_PATH=${ast}/lib/node_modules
export NODE_PATH
poetry run pytest -n auto --cov=tested --cov-report=xml tests/test_functionality.py
'';
installPhase = ''
touch $out # it worked!
Expand All @@ -119,6 +128,10 @@
inherit (tested-env)
projectDir python overrides propagatedBuildInputs;
doCheck = false;
postInstall = ''
wrapProgram "$out/bin/tested" \
--prefix NODE_PATH : ${ast}/lib/node_modules
'';
};
devShell = self.outputs.devShells.${system}.default;
};
Expand All @@ -128,7 +141,7 @@
tested = pkgs.devshell.mkShell {
name = "TESTed";

packages = [ python-dev-env pkgs.nodePackages.pyright pkgs.poetry ]
packages = [ python-dev-env pkgs.nodePackages.pyright poetry-package ]
++ all-other-dependencies;

devshell.startup.link.text = ''
Expand All @@ -139,24 +152,32 @@
env = [
{
name = "DOTNET_ROOT";
eval = "${pkgs.dotnetCorePackages.sdk_6_0}";
eval = "${pkgs.dotnetCorePackages.sdk_8_0}";
}
{
name = "NODE_PATH";
prefix = "$(npm get prefix)";
prefix = "${ast}/lib/node_modules";
}
];
commands = [
{
name = "run-intergation-tests";
command = "poetry run pytest -x -n auto tests/test_integration_javascript.py";
help = "Run JavaScript integration tests";
category = "tests";
}
{
name = "run-tests";
command = "poetry run pytest -n auto tests/";
help = "Run unit tests";
category = "tests";
}
];
};
types = pkgs.mkShell {
packages = [ python-dev-env pkgs.nodePackages.pyright ];
};
format = pkgs.mkShell { packages = [ python-dev-env pkgs.poetry ]; };
format = pkgs.mkShell { packages = [ python-dev-env poetry-package ]; };
};
});
}
Expand Down

0 comments on commit b8e38d3

Please sign in to comment.