about summary refs log tree commit diff
path: root/release.nix
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-15 19:01:26 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-19 01:30:58 +0100
commit05cb73f4525b8bfc2d71ca6809bfe0a10e054d68 (patch)
tree8a691d3ef9e00e54b02d97571114e6880fed0f4c /release.nix
parent6603cf3240e9b24245e6d28c2fbd2e566db01ada (diff)
release.nix: inject programs.sqlite from a nixos channel
programs.command-not-found requires a database containing an index of
all of nixpkgs. Since this is pretty expensive to create we fetch the
database from the nixos-unstable channel. Unfortunately it is not
available via git, so we need to use the tarball which also means hydra
can't automatically update it.

One improvement to this change that would be possible is to also index
vuizvui and merge that with the database from upstream. This should
probably be investigated in the future, but probably affects less people
as the nix tool will only be usable with vuizvui packages as
commond-not-found suggests if vuizvui.modifyNixPath = true.
Diffstat (limited to 'release.nix')
-rw-r--r--release.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/release.nix b/release.nix
index 21fc1e6e..b82cf0ce 100644
--- a/release.nix
+++ b/release.nix
@@ -14,6 +14,20 @@ let
   vuizvuiShortRev = vuizvuiSrc.shortRev or "abcdefg";
   vuizvuiVersion = "pre${toString vuizvuiRevCount}.${vuizvuiShortRev}";
 
+  # version of the nixos-unstable channel to get programs.sqlite from.
+  # Use pkgs.sternenseemann.vuizvui-update-programs-sqlite to update.
+  programsSqliteVersion = "21.05pre270709.6b1057b452c";
+  programsSqliteSha256 = "1qa3jir0r4mqijw694hi3dba34n1chisha01fzmvsfk4bgc98xqc";
+  programsSqlite = pkgsUpstream.fetchurl {
+    name = "programs.sqlite-${programsSqliteVersion}";
+    url = "https://releases.nixos.org/nixos/unstable/nixos-${programsSqliteVersion}/nixexprs.tar.xz";
+    sha256 = programsSqliteSha256;
+    downloadToTemp = true;
+    postFetch = ''
+      tar -xOJf $downloadedFile nixos-${programsSqliteVersion}/programs.sqlite > "$out"
+    '';
+  };
+
   vuizvui = let
     patchedVuizvui = (import nixpkgs {}).stdenv.mkDerivation {
       name = "vuizvui-${vuizvuiVersion}";
@@ -23,6 +37,12 @@ let
       installPhase = ''
         cp -r --no-preserve=ownership "${nixpkgs}/" nixpkgs
         chmod -R u+w nixpkgs
+        # since we fetch nixpkgsSrc using git, we don't get programs.sqlite
+        # for programs.command-not-found which is normally included in the
+        # channel. Building this ourselves is not desireable as it requires
+        # to build and index the whole of nixpkgs. Therefore we just inject
+        # it from a nixos channel (which possibly is a different version).
+        cp --no-preserve=ownership "${programsSqlite}" nixpkgs/programs.sqlite
         echo -n "$nixpkgsVersion" > nixpkgs/.version-suffix
         echo "echo '$nixpkgsVersion'" \
           > nixpkgs/nixos/modules/installer/tools/get-version-suffix