Skip to content

Commit 50cd22e

Browse files
committed
Refactoring default.nix + remove activate call
1 parent 09c8294 commit 50cd22e

File tree

2 files changed

+31
-35
lines changed

2 files changed

+31
-35
lines changed

templates/common.nix

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
{
2-
callPackage,
3-
curl,
4-
fetchurl,
5-
git,
6-
cacert,
7-
fetchgit,
8-
jq,
9-
julia,
10-
lib,
11-
python3,
12-
runCommand,
13-
stdenv,
14-
writeText,
15-
makeWrapper,
1+
{ callPackage
2+
, curl
3+
, fetchurl
4+
, git
5+
, cacert
6+
, fetchgit
7+
, jq
8+
, julia
9+
, lib
10+
, python3
11+
, runCommand
12+
, stdenv
13+
, writeText
14+
, makeWrapper
1615

1716
# Arguments
18-
makeWrapperArgs ? "",
19-
precompile ? true,
20-
extraBuildInputs ? []
17+
, precompile ? true
18+
, extraLibs ? []
19+
, makeWrapperArgs ? ""
2120
}:
2221

2322
let
@@ -117,7 +116,7 @@ let
117116
'';
118117

119118
depot = runCommand "julia-depot" {
120-
buildInputs = [git curl julia] ++ extraBuildInputs;
119+
buildInputs = [git curl julia] ++ extraLibs;
121120
inherit registry precompile;
122121
} ''
123122
export HOME=$(pwd)
@@ -140,7 +139,6 @@ let
140139
import Pkg
141140
Pkg.Registry.add(Pkg.RegistrySpec(path="${registry}"))
142141
143-
Pkg.activate(".")
144142
Pkg.instantiate()
145143
146144
if "precompile" in keys(ENV) && ENV["precompile"] != "0"

templates/default.nix

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010
# add it here.
1111
, extraLibs ? []
1212

13+
# Python to put on Julia's PATH and in the PYTHON environment variable.
14+
# If one is not provided, Julia packages may try to use Conda to obtain their own.
1315
, python ? pkgs.python3
16+
17+
# Run Pkg.precompile() to precompile all packages?
18+
, precompile ? true
19+
20+
# Extra arguments to makeWrapper when creating the final Julia wrapper.
21+
# By default, it will just put the new depot at the end of JULIA_DEPOT_PATH.
22+
# You can add additional flags here.
23+
, makeWrapperArgs ? ""
1424
}:
1525

1626
with pkgs;
@@ -24,24 +34,12 @@ let
2434
mkdir -p $out/bin
2535
makeWrapper ${baseJulia}/bin/julia $out/bin/julia \
2636
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath extraLibs}" \
27-
--set PYTHON ${python}/bin/python
37+
--set PYTHON ${python}/bin/python \
38+
--suffix PATH : ${python}/bin/python
2839
'';
2940

3041
in
3142

3243
callPackage ./common.nix {
33-
inherit julia;
34-
35-
# Run Pkg.precompile() to precompile all packages?
36-
precompile = true;
37-
38-
# Extra arguments to makeWrapper when creating the final Julia wrapper.
39-
# By default, it will just put the new depot at the end of JULIA_DEPOT_PATH.
40-
# You can add additional flags here.
41-
makeWrapperArgs = "";
42-
43-
# Extra buildInputs for building the Julia depot. Useful if your packages have
44-
# additional build-time dependencies not managed through the Artifacts.toml system.
45-
# Defaults to extraLibs, but can be configured independently.
46-
extraBuildInputs = extraLibs;
44+
inherit julia extraLibs precompile makeWrapperArgs;
4745
}

0 commit comments

Comments
 (0)