Skip to content

Commit 517508f

Browse files
committed
Upgrade versions and simplify setup.nix
1 parent a7cb3e3 commit 517508f

21 files changed

+2838
-2709
lines changed

Makefile

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,6 @@ requirements-$(PYTHON)-$(ROBOTFRAMEWORK).txt: requirements-$(ROBOTFRAMEWORK).txt
6363
nix-shell setup.nix $(NIX_OPTIONS) -A pip2nix --run "pip2nix generate -r requirements-$(ROBOTFRAMEWORK).txt --output=requirements-$(PYTHON)-$(ROBOTFRAMEWORK).nix"
6464
@grep "pname =\|version =" requirements-$(PYTHON)-$(ROBOTFRAMEWORK).nix|awk "ORS=NR%2?FS:RS"|sed 's|.*"\(.*\)";.*version = "\(.*\)".*|\1==\2|' > requirements-$(PYTHON)-$(ROBOTFRAMEWORK).txt
6565

66-
.PHONY: upgrade
67-
upgrade:
68-
nix-shell --pure -p cacert curl gnumake jq nix --run "make setup.nix"
69-
70-
.PHONY: setup.nix
71-
setup.nix:
72-
@set -e pipefail; \
73-
echo "Updating nixpkgs @ setup.nix using $(REF_NIXPKGS)"; \
74-
rev=$$(curl https://api.github.com/repos/NixOS/nixpkgs-channels/$(firstword $(REF_NIXPKGS)) \
75-
| jq -er '.[]|select(.name == "$(lastword $(REF_NIXPKGS))").commit.sha'); \
76-
echo "Latest commit sha: $$rev"; \
77-
sha=$$(nix-prefetch-url --unpack https://github.com/NixOS/nixpkgs-channels/archive/$$rev.tar.gz); \
78-
sed -i \
79-
-e "2s|.*| # $(REF_NIXPKGS)|" \
80-
-e "3s|.*| url = \"https://github.com/NixOS/nixpkgs-channels/archive/$$rev.tar.gz\";|" \
81-
-e "4s|.*| sha256 = \"$$sha\";|" \
82-
setup.nix
83-
84-
8566
examples/JupyterLab.html: examples/JupyterLab.ipynb
8667
jupyter nbconvert \
8768
--to html \

nix/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://github.com/nmattia/niv
22
{ sources ? import ./sources.nix
3-
, nixpkgs ? sources."nixpkgs"
3+
, nixpkgs ? sources."nixpkgs-22.05"
44
}:
55

66
let

nix/sources.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55
"homepage": "https://github.com/nmattia/niv",
66
"owner": "nmattia",
77
"repo": "niv",
8-
"rev": "9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a",
9-
"sha256": "1ajyqr8zka1zlb25jx1v4xys3zqmdy3prbm1vxlid6ah27a8qnzh",
8+
"rev": "82e5cd1ad3c387863f0545d7591512e76ab0fc41",
9+
"sha256": "090l219mzc0gi33i3psgph6s2pwsc8qy4lyrqjdj4qzkvmaj65a7",
1010
"type": "tarball",
11-
"url": "https://github.com/nmattia/niv/archive/9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a.tar.gz",
11+
"url": "https://github.com/nmattia/niv/archive/82e5cd1ad3c387863f0545d7591512e76ab0fc41.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
14-
"nixpkgs": {
15-
"branch": "release-21.11",
14+
"nixpkgs-20.09": {
15+
"branch": "nixos-20.09",
1616
"description": "Nix Packages collection",
1717
"homepage": "",
18-
"owner": "NixOS",
18+
"owner": "nixos",
1919
"repo": "nixpkgs",
20-
"rev": "4afca382d80b68bff9e154a97210e5a7bf5df8b3",
21-
"sha256": "0yf9g5bd69fz8h3ij83481pwhq8nsjddxr010bd8ya3hi1kn6w25",
20+
"rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361",
21+
"sha256": "0f2nvdijyxfgl5kwyb4465pppd5vkhqxddx6v40k2s0z9jfhj0xl",
2222
"type": "tarball",
23-
"url": "https://github.com/NixOS/nixpkgs/archive/4afca382d80b68bff9e154a97210e5a7bf5df8b3.tar.gz",
23+
"url": "https://github.com/nixos/nixpkgs/archive/1c1f5649bb9c1b0d98637c8c365228f57126f361.tar.gz",
2424
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2525
},
26-
"nixpkgs-20.09": {
27-
"branch": "nixos-20.09",
26+
"nixpkgs-22.05": {
27+
"branch": "nixos-22.05",
2828
"description": "Nix Packages collection",
2929
"homepage": "",
3030
"owner": "nixos",
3131
"repo": "nixpkgs",
32-
"rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361",
33-
"sha256": "0f2nvdijyxfgl5kwyb4465pppd5vkhqxddx6v40k2s0z9jfhj0xl",
32+
"rev": "bf014cad818ecd1b28e68c1e7138fb988f504fdc",
33+
"sha256": "0xdf1xclck8j8zxlnhkjgci4a4405rh9n6wx9c3vmk0dvb31lvi9",
3434
"type": "tarball",
35-
"url": "https://github.com/nixos/nixpkgs/archive/1c1f5649bb9c1b0d98637c8c365228f57126f361.tar.gz",
35+
"url": "https://github.com/nixos/nixpkgs/archive/bf014cad818ecd1b28e68c1e7138fb988f504fdc.tar.gz",
3636
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
3737
},
3838
"nixpkgs-unstable": {
@@ -41,10 +41,10 @@
4141
"homepage": "",
4242
"owner": "NixOS",
4343
"repo": "nixpkgs",
44-
"rev": "03b52fe38897fc5705a9045ab04be68d6d49f702",
45-
"sha256": "0pv0770bnnlpd3m9x92kgc5zl0vaq0qx46wair4i536p88n2d1aq",
44+
"rev": "9608ace7009ce5bc3aeb940095e01553e635cbc7",
45+
"sha256": "0fvq6b913dz67jp71nl0sgy6l4vwgzpw6n6k1rqn9qn9by813lkh",
4646
"type": "tarball",
47-
"url": "https://github.com/NixOS/nixpkgs/archive/03b52fe38897fc5705a9045ab04be68d6d49f702.tar.gz",
47+
"url": "https://github.com/NixOS/nixpkgs/archive/9608ace7009ce5bc3aeb940095e01553e635cbc7.tar.gz",
4848
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
4949
}
5050
}

nix/sources.nix

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,28 @@ let
3131
if spec ? branch then "refs/heads/${spec.branch}" else
3232
if spec ? tag then "refs/tags/${spec.tag}" else
3333
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
34+
submodules = if spec ? submodules then spec.submodules else false;
35+
submoduleArg =
36+
let
37+
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
38+
emptyArgWithWarning =
39+
if submodules == true
40+
then
41+
builtins.trace
42+
(
43+
"The niv input \"${name}\" uses submodules "
44+
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
45+
+ "does not support them"
46+
)
47+
{}
48+
else {};
49+
in
50+
if nixSupportsSubmodules
51+
then { inherit submodules; }
52+
else emptyArgWithWarning;
3453
in
35-
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
54+
builtins.fetchGit
55+
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
3656

3757
fetch_local = spec: spec.path;
3858

0 commit comments

Comments
 (0)