-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnowblower.nix
65 lines (65 loc) · 2.05 KB
/
snowblower.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
58
59
60
61
62
63
64
65
topLevel @ {
inputs,
flake-parts-lib,
...
}: {
imports = [
./jobs.nix
./common.nix
inputs.flake-parts.flakeModules.flakeModules
];
flake.flakeModules.pythonEnvsPep508 = flakeModule: {
imports = [
topLevel.config.flake.flakeModules.jobs
topLevel.config.flake.flakeModules.common
];
options.perSystem = flake-parts-lib.mkPerSystemOption ({
lib,
system,
...
}: {
ml-ops.devcontainer.pythonEnvArgs.requirements = ''
${
lib.strings.optionalString
(builtins.pathExists "${flakeModule.self}/requirements.txt")
(builtins.readFile "${flakeModule.self}/requirements.txt")
}
${
lib.strings.optionalString
(builtins.pathExists "${flakeModule.self}/requirements-dev.txt")
(builtins.readFile "${flakeModule.self}/requirements-dev.txt")
}
'';
ml-ops.job.pythonEnvArgs.requirements =
lib.strings.optionalString
(builtins.pathExists "${flakeModule.self}/requirements.txt")
(builtins.readFile "${flakeModule.self}/requirements.txt");
ml-ops.common = {config, ...}: {
options.mkPython = lib.mkOption {
default =
(inputs.nixpkgs_22_05.legacyPackages.${system}.callPackage inputs.mach-nix {
pypiData = inputs.pypi-deps-db;
condaDataRev = inputs.conda-channels.rev;
condaDataSha256 = builtins.hashFile "sha256" "${inputs.conda-channels}/sha256.json";
})
.mkPython;
};
options.pythonEnvArgs = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
};
config.pythonEnvArgs = {
python = lib.mkDefault "python39";
ignoreCollisions = lib.mkDefault true;
};
options.pythonEnv = lib.mkOption {
type = lib.types.package;
default = config.mkPython config.pythonEnvArgs;
};
config.devenvShellModule.packages = [
config.pythonEnv
];
};
# options.pythonEnvs.pep508
});
};
}