about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-11-10T13·41+0100
committerclbot <clbot@tvl.fyi>2022-11-12T21·56+0000
commit69475a651c0daf200e77aeb7fb3a5e33e68d134b (patch)
tree6f86a0b16d1515cf8d9f546c98641147cd8db868
parent28dacca91daab22fe27b9a849b7a21e07712579a (diff)
fix(3p): use nixpkgs nix_2_3 expr and tarball job for our Nix fork r/5281
By re-using the nix_2_3 expression from nixpkgs we are no longer stuck
with the 2021 expression from Nix's release.nix and the resulting
derivation has a shape that other expressions in nixpkgs expect (e.g.
nix-serve), so we can actually overlay our fork into the nix_2_3
attribute. This should reduce duplication on e.g. whitby.

Since there is no nixUnstable expression in nixpkgs anymore, it expects
a Nix release tarball which we produle using the appropriate release.nix
job from the repository. Sadly there is some trickery involved in
getting it to respect localSystem, since the tarball job is not based on
the passed in systems list.

Change-Id: Ib49f298334d166327f91559a06b0a37b2488bc63
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7262
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
-rw-r--r--third_party/overlays/tvl.nix23
1 files changed, 17 insertions, 6 deletions
diff --git a/third_party/overlays/tvl.nix b/third_party/overlays/tvl.nix
index d0a0d5581c..71c46b86d1 100644
--- a/third_party/overlays/tvl.nix
+++ b/third_party/overlays/tvl.nix
@@ -18,6 +18,19 @@ let
         inherit rev;
         hash = "sha256:0rwyrh471c5y64axyd8vzzzmzlscg97fsrjbgbm1a93wnzxcvnvk";
       } // { revCount = 0; shortRev = builtins.substring 0 7 rev; };
+
+  nixTarball = (scopedImport
+    {
+      # The tarball job always uses currentSystem which we need to purify
+      builtins = builtins // { currentSystem = localSystem; };
+    }
+    "${nixSrc}/release.nix"
+    {
+      nix = nixSrc;
+      nixpkgs = self.path;
+      systems = [ ];
+    }
+  ).tarball;
 in
 {
   buf = super.buf.overrideAttrs (old: {
@@ -27,12 +40,10 @@ in
     ] ++ old.patches or [ ];
   });
 
-  nix = (import "${nixSrc}/release.nix" {
-    nix = nixSrc;
-    nixpkgs = super.path;
-    systems = [ localSystem ];
-  }).build."${localSystem}";
-
+  nix_2_3 = super.nix_2_3.overrideAttrs (_: {
+    src = "${nixTarball}/tarballs/nix-${nixTarball.version}.tar.xz";
+  });
+  nix = self.nix_2_3;
   nix_latest = super.nix;
 
   nvd = super.nvd.overrideAttrs (old: {