Skip to content

Commit db97f4e

Browse files
committed
refactor: replace fetchTarball with flake input for nixpkgs-oldstable
Improves reproducibility and avoids evaluation-time network access by using a proper flake input instead of fetchTarball for the older nixpkgs needed by pg_net and plv8.
1 parent 8484d0c commit db97f4e

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
nix2container.inputs.nixpkgs.follows = "nixpkgs";
2323
nix2container.url = "github:nlewo/nix2container";
2424
nixpkgs-go124.url = "github:Nixos/nixpkgs/d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0";
25+
nixpkgs-oldstable.url = "github:NixOS/nixpkgs/a76c4553d7e741e17f289224eda135423de0491d";
2526
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
2627
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
2728
rust-overlay.url = "github:oxalica/rust-overlay";

nix/ext/pg_net.nix

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77
libuv,
88
makeWrapper,
99
switch-ext-version,
10+
nixpkgs-oldstable,
1011
}:
1112

1213
let
13-
olderPkgs = import (fetchTarball {
14-
url = "https://github.com/nixos/nixpkgs/archive/a76c4553d7e741e17f289224eda135423de0491d.tar.gz";
15-
sha256 = "0rwdzp942b8ay625lqgra83qrp64b3wqm6w9a0i4z593df8x822v";
16-
}) { system = stdenv.system; };
17-
curl = olderPkgs.curl;
14+
curl = nixpkgs-oldstable.curl;
1815
in
1916
let
2017
pname = "pg_net";

nix/ext/plv8.nix

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
clang,
1111
xcbuild,
1212
patchelf,
13+
nixpkgs-oldstable,
1314
}:
1415
let
1516
# plv8 3.1 requires an older version of v8 (we cannot use nodejs.libv8)
16-
node_pkgs = import (fetchTarball {
17-
url = "https://github.com/nixos/nixpkgs/archive/a76c4553d7e741e17f289224eda135423de0491d.tar.gz";
18-
sha256 = "0rwdzp942b8ay625lqgra83qrp64b3wqm6w9a0i4z593df8x822v";
19-
}) { system = stdenv.system; };
20-
inherit (node_pkgs) v8;
17+
inherit (nixpkgs-oldstable) v8;
2118
in
2219
stdenv.mkDerivation (finalAttrs: {
2320
pname = "plv8";

nix/ext/plv8/default.nix

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
buildEnv,
1515
nodejs_20,
1616
libcxx,
17+
nixpkgs-oldstable,
1718
}:
1819

1920
let
@@ -36,11 +37,7 @@ let
3637
);
3738

3839
# plv8 3.1 requires an older version of v8 (we cannot use nodejs.libv8)
39-
node_pkgs = import (fetchTarball {
40-
url = "https://github.com/nixos/nixpkgs/archive/a76c4553d7e741e17f289224eda135423de0491d.tar.gz";
41-
sha256 = "0rwdzp942b8ay625lqgra83qrp64b3wqm6w9a0i4z593df8x822v";
42-
}) { system = stdenv.system; };
43-
inherit (node_pkgs) v8;
40+
inherit (nixpkgs-oldstable) v8;
4441

4542
# Build function for individual versions
4643
build =

nix/nixpkgs.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
overlays = [
1111
(import inputs.rust-overlay)
1212
self.overlays.default
13+
(_final: _prev: {
14+
nixpkgs-oldstable = import inputs.nixpkgs-oldstable {
15+
inherit system;
16+
config.allowUnfree = true;
17+
};
18+
})
1319
];
1420
};
1521
};

0 commit comments

Comments
 (0)