-
Notifications
You must be signed in to change notification settings - Fork 68
/
flake.nix
57 lines (50 loc) · 1.81 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
description = "A script/library to create, launch and remove an Scylla / Apache Cassandra cluster on
localhost.";
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
prepare_python_requirements = python: python.withPackages (ps: with ps; [ pytest ruamel-yaml psutil six requests packaging boto3 tqdm setuptools ]);
make_ccm_package = {python, jdk, pkgs}: python.pkgs.buildPythonApplication {
pname = "scylla_ccm";
version = "0.1";
src = ./. ;
checkInputs = with python.pkgs; [ pytestCheckHook ];
buildInputs = [ pkgs.makeWrapper ];
propagatedBuildInputs = [ (prepare_python_requirements python) jdk];
doCheck = false;
disabledTestPaths = [ "old_tests/*.py" ];
# Make `nix run` aware that the binary is called `ccm`.
meta.mainProgram = "ccm";
postInstall = ''
wrapProgram $out/bin/ccm \
--set JAVA_HOME "${jdk}"
'';
};
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
packages = rec {
scylla_ccm = python: make_ccm_package { inherit python pkgs ; jdk = pkgs.jdk8; };
default = scylla_ccm pkgs.python311;
};
devShell =
pkgs.mkShell {
buildInputs = [ pkgs.poetry pkgs.glibcLocales (prepare_python_requirements pkgs.python39) (prepare_python_requirements pkgs.python311) pkgs.jdk8];
shellHook = ''
set JAVA_HOME ${pkgs.jdk8}
'';
};
}
) // rec {
overlays.default = final: prev: {
scylla_ccm = python: make_ccm_package { inherit python; jdk = final.jdk8; pkgs = final; };
};
};
}