-
Notifications
You must be signed in to change notification settings - Fork 14
/
module.nix
68 lines (63 loc) · 1.81 KB
/
module.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
66
67
68
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.programs.scientific-fhs;
in
{
options.programs.scientific-fhs = {
enable = mkEnableOption "an FHS for science!";
juliaVersions = mkOption {
type = types.listOf (types.submodule {
options = {
version = mkOption {
type = types.str;
};
default = mkOption {
type = types.bool;
default = false;
};
};
});
default = [{
version = "1.9.3";
default = true;
}];
};
enableNVIDIA = mkOption {
type = types.bool;
default = false;
};
enableGraphical = mkOption {
type = types.bool;
default = false;
};
enablePython = mkOption {
type = types.bool;
default = false;
};
};
config = {
home.packages = builtins.concatMap
(version-spec:
let
scientific-fhs = pkgs.callPackage ./fhs.nix {
enableNVIDIA = cfg.enableNVIDIA;
enableGraphical = cfg.enableGraphical;
juliaVersion = version-spec.version;
};
fhsCommand = commandName: commandScript:
scientific-fhs.override { inherit commandName; inherit commandScript; };
name = "julia" + (if version-spec.default then "" else "-" + version-spec.version);
python =
if cfg.enablePython && version-spec.default then [
(fhsCommand "python3" "python3")
(fhsCommand "python" "python3")
(fhsCommand "poetry" "poetry")
] else
[ ];
quarto = if version-spec.default then [ (fhsCommand "quarto" "quarto") ] else [];
in
[ (fhsCommand name "julia") (fhsCommand "${name}-bash" "bash") ]
++ python ++ quarto)
cfg.juliaVersions;
};
}