-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
94 lines (87 loc) · 2.77 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
description = "Julia2Nix development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
julia2nix.url = "github:JuliaCN/Julia2Nix.jl";
};
outputs = inputs @ {
self,
julia2nix,
...
}:
(
inputs.flake-utils.lib.eachDefaultSystem
(system: let
pkgs = inputs.nixpkgs.legacyPackages.${system}.appendOverlays [
inputs.devshell.overlays.default
self.overlays.default
];
julia-wrapped = inputs.julia2nix.lib.${system}.julia-wrapped {
# package = pkgs.julia_17-bin;
package = julia2nix.packages.${system}.julia_19-bin;
enable = {
# only x86_64-linux is supported
GR = true;
python =
pkgs.python3.buildEnv.override
{
extraLibs = with pkgs.python3Packages; [xlrd matplotlib pyqt5];
# ignoreCollisions = true;
};
};
};
# run this command in your project: nix run github:JuliaCN/Julia2Nix.jl#packages.x86_64-linux.julia2nix
# we need to generate the julia2nix.toml first
project = inputs.julia2nix.lib.${system}.buildProject {
src = ./.;
name = "your julia project";
package = julia-wrapped;
};
in {
packages = {
# make sure you have generated the julia2nix.toml
# default = project;
};
devShells.default = pkgs.devshell.mkShell {
imports = [
# you can keep either one of them devshellProfiles.packages or julia-wrapped
# inputs.julia2nix.${pkgs.system}.julia2nix.devshellProfiles.packages
# add dev-tools in your devshell
inputs.julia2nix.${pkgs.system}.julia2nix.devshellProfiles.dev
# add nightly julia
# inputs.julia2nix.${pkgs.system}.julia2nix.devshellProfiles.nightly
];
commands = [
{
package = julia-wrapped;
help = julia2nix.packages.${pkgs.system}.julia_19-bin.meta.description;
}
{
package = pkgs.python3;
}
{
package = pkgs.poetry;
}
];
devshell.packages = with pkgs; [
gfortran9
graphviz
xcodebuild6
];
env = [
{
name = "LD_LIBRARY_PATH";
eval = "${pkgs.stdenv.cc.cc.lib}/lib";
}
];
};
})
)
// {
overlays.default = final: prev: {};
};
}