blob: a10d3f5d35cda8ce606d2542142db35eb0532954 (
plain)
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
|
{
gitMinimal,
lib,
runCommand,
}:
{
# Add packages to a Python environment. Works if you pass something like either
# a) python3
# b) python3.withPackages (ps: [...])
# See https://github.com/NixOS/nixpkgs/pull/97467#issuecomment-689315186
addPackagesToPython =
python: packages:
# TODO: this stopped working because "env" ended up being a key of the base
# derivation like "python3" as well. Is there a robust way to determine if
# this Python is already wrapped?
if python ? "env" && lib.isDerivation python.env then
python.override (old: {
extraLibs = old.extraLibs ++ packages;
})
else
python.withPackages (ps: packages);
# Convert an ordinary source checkout into a repo with a single commit
repoifySimple =
name: path:
runCommand "${name}-repoified" { buildInputs = [ gitMinimal ]; } ''
mkdir -p $out
cp -r ${path}/. $out
cd $out
chmod -R u+w .
rm -rf .git
git init
git add . -f
git config user.email "julia2nix@localhost"
git config user.name "julia2nix"
git commit -m "Dummy commit"
'';
# Convert an dependency source info into a repo with a single commit
repoifyInfo =
uuid: info:
runCommand "julia-${info.name}-${info.version}" { buildInputs = [ gitMinimal ]; } ''
mkdir -p $out
cp -r ${info.src}/. $out
cd $out
chmod -R u+w .
rm -rf .git
git init
git add . -f
git config user.email "julia2nix@localhost"
git config user.name "julia2nix"
git commit -m "Dummy commit"
'';
}
|