From 05cb73f4525b8bfc2d71ca6809bfe0a10e054d68 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 15 Feb 2021 19:01:26 +0100 Subject: 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. --- release.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'release.nix') 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 -- cgit 1.4.1