From 8abb006edb7d7e0e442f00c0bf705bc86ca7a88e Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Sun, 22 Dec 2024 12:53:57 +0100 Subject: [PATCH 1/6] generate small index --- .github/workflows/update.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index e1b610c7..8d1a6d5e 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -55,6 +55,10 @@ jobs: x86_64-darwin-hash: ${{ steps.hashes.outputs.x86_64-darwin }} aarch64-linux-hash: ${{ steps.hashes.outputs.aarch64-linux }} aarch64-darwin-hash: ${{ steps.hashes.outputs.aarch64-darwin }} + x86_64-linux-small-hash: ${{ steps.hashes.outputs.x86_64-linux-small }} + x86_64-darwin-small-hash: ${{ steps.hashes.outputs.x86_64-darwin-small }} + aarch64-linux-small-hash: ${{ steps.hashes.outputs.aarch64-linux-small }} + aarch64-darwin-small-hash: ${{ steps.hashes.outputs.aarch64-darwin-small }} steps: - uses: actions/checkout@v4 - name: Swap space report before modification @@ -95,19 +99,26 @@ jobs: with: name: mic92 signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - - name: run nix-index + - name: generate full nix-index database run: | - nix shell --inputs-from .# nixpkgs#nix-index -c nix-index --db ./${{ matrix.system }}-index --system ${{matrix.system}} 2>&1 | grep -v '+ generating index:' + nix shell --inputs-from .# nixpkgs#nix-index -c nix-index --db ./${{ matrix.system }}-index --system ${{matrix.system}} 2>&1 | grep -v '+ generating full index:' mv ./${{ matrix.system }}-index/files ./index-${{ matrix.system }} + - name: generate small nix-index database + run: | + nix shell --inputs-from .# nixpkgs#nix-index -c nix-index --db ./${{ matrix.system }}-bin-index --system ${{matrix.system}} --filter-prefix '/bin/' 2>&1 | grep -v '+ generating bin index:' + mv ./${{ matrix.system }}-bin-index/files ./bin-index-${{ matrix.system }} - name: hash index id: hashes run: | echo "${{ matrix.system }}=$(nix store prefetch-file "file://$PWD/index-${{ matrix.system }}" --json | jq -r .hash)" >> "$GITHUB_OUTPUT" - - name: Add to release + echo "${{ matrix.system }}-small=$(nix store prefetch-file "file://$PWD/bin-index-${{ matrix.system }}" --json | jq -r .hash)" >> "$GITHUB_OUTPUT" + - name: add to release uses: softprops/action-gh-release@v2 with: tag_name: ${{ needs.create-release.outputs.release_name }} - files: index-${{ matrix.system }} + files: | + bin-index-${{ matrix.system }} + index-${{ matrix.system }} update-generated: @@ -131,6 +142,10 @@ jobs: aarch64-linux = "${{ needs.index.outputs.aarch64-linux-hash }}"; x86_64-darwin = "${{ needs.index.outputs.x86_64-darwin-hash }}"; aarch64-darwin = "${{ needs.index.outputs.aarch64-darwin-hash }}"; + x86_64-linux-small = "${{ needs.index.outputs.x86_64-linux-small-hash }}"; + aarch64-linux-small = "${{ needs.index.outputs.aarch64-linux-small-hash }}"; + x86_64-darwin-small = "${{ needs.index.outputs.x86_64-darwin-small-hash }}"; + aarch64-darwin-small = "${{ needs.index.outputs.aarch64-darwin-small-hash }}"; }; } EOF From e2f645c6bdd50f7767f3e90f41a59abdde77288f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Dec 2024 12:11:00 +0000 Subject: [PATCH 2/6] update generated.nix to release 2024-12-22-115534 --- generated.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/generated.nix b/generated.nix index 5162bffb..c130eb41 100644 --- a/generated.nix +++ b/generated.nix @@ -1,10 +1,14 @@ # this file is autogenerated by .github/workflows/update.yml { - url = "https://github.com/nix-community/nix-index-database/releases/download/2024-12-22-031612/index-"; + url = "https://github.com/gvolpe/nix-index-database/releases/download/2024-12-22-115534/index-"; hashes = { - x86_64-linux = "sha256-nUJ/IwfqFkuMTrfG2lYgqZ1R4hJ2r6ssGp1QSCqjOF4="; - aarch64-linux = "sha256-D1xCnRENaBgbjQe6+YPo2zbA1o3uHDgzRo3RFy7cXcg="; - x86_64-darwin = "sha256-OCdPm+dGVCL1y5DKH40eTlVN53pwNY+x11YpqNmy0QQ="; - aarch64-darwin = "sha256-XH+9FHZpKZlYq988uUW5MPzYh/u5zJEYv7+DDRm6ca8="; + x86_64-linux = "sha256-azY0e4atL4VoAm1ZqxMV/njbM7WiauINlQr7aBkPqfU="; + aarch64-linux = "sha256-zQCWC2e/g024yZe2DRuPhGx3womW90VOK1/AcN4W+3Y="; + x86_64-darwin = "sha256-IOdB9dqr9gFwJv/zYiWdU8q7b30AsHFBUNblf+Hnxyk="; + aarch64-darwin = "sha256-o7KtZcRRHJb3n+VOo2UUw0WserCdjxs0TXUOdBp3TH4="; + x86_64-linux-small = "sha256-UpXpoxVc1dn85/C1iGE239zJ5FAS7mVHXsVQvB/XV3c="; + aarch64-linux-small = "sha256-4t8TN0Lyk+g/lJYMjYmYb9kaSLHhgmk+NAkGzH+SCWg="; + x86_64-darwin-small = "sha256-u05f923VCSnhf2A4khHrSyCg9HcALzhorHVT88hNQjg="; + aarch64-darwin-small = "sha256-r3TWuyqwuPDu4qBH1XqrTRH5I+yF/6Z1hQya0D9lZ7M="; }; } From e6926650c0a6fcb7a7e80b963002c5e1403dea0e Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Sun, 22 Dec 2024 17:33:21 +0100 Subject: [PATCH 3/6] expose small db and nix-index package with it --- .github/workflows/update.yml | 8 ++++---- flake.nix | 14 ++++++++++++++ nix-index-wrapper.nix | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 8d1a6d5e..fa799271 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -105,19 +105,19 @@ jobs: mv ./${{ matrix.system }}-index/files ./index-${{ matrix.system }} - name: generate small nix-index database run: | - nix shell --inputs-from .# nixpkgs#nix-index -c nix-index --db ./${{ matrix.system }}-bin-index --system ${{matrix.system}} --filter-prefix '/bin/' 2>&1 | grep -v '+ generating bin index:' - mv ./${{ matrix.system }}-bin-index/files ./bin-index-${{ matrix.system }} + nix shell --inputs-from .# nixpkgs#nix-index -c nix-index --db ./${{ matrix.system }}-index-small --system ${{matrix.system}} --filter-prefix '/bin/' 2>&1 | grep -v '+ generating small index:' + mv ./${{ matrix.system }}-index-small/files ./index-${{ matrix.system }}-small - name: hash index id: hashes run: | echo "${{ matrix.system }}=$(nix store prefetch-file "file://$PWD/index-${{ matrix.system }}" --json | jq -r .hash)" >> "$GITHUB_OUTPUT" - echo "${{ matrix.system }}-small=$(nix store prefetch-file "file://$PWD/bin-index-${{ matrix.system }}" --json | jq -r .hash)" >> "$GITHUB_OUTPUT" + echo "${{ matrix.system }}-small=$(nix store prefetch-file "file://$PWD/index-${{ matrix.system }}-small" --json | jq -r .hash)" >> "$GITHUB_OUTPUT" - name: add to release uses: softprops/action-gh-release@v2 with: tag_name: ${{ needs.create-release.outputs.release_name }} files: | - bin-index-${{ matrix.system }} + index-${{ matrix.system }}-small index-${{ matrix.system }} diff --git a/flake.nix b/flake.nix index add586d8..b76b3cc8 100644 --- a/flake.nix +++ b/flake.nix @@ -32,11 +32,25 @@ __structuredAttrs = true; unsafeDiscardReferences.out = true; }; + + nix-index-small-database = + (pkgs.fetchurl { + url = generated.url + pkgs.stdenv.system + "-small"; + hash = generated.hashes."${pkgs.stdenv.system}-small"; + }).overrideAttrs + { + __structuredAttrs = true; + unsafeDiscardReferences.out = true; + }; in { inherit nix-index-database; nix-index-with-db = pkgs.callPackage ./nix-index-wrapper.nix { inherit nix-index-database; }; + nix-index-with-small-db = pkgs.callPackage ./nix-index-wrapper.nix { + nix-index-database = nix-index-small-database; + db-type = "small"; + }; comma-with-db = pkgs.callPackage ./comma-wrapper.nix { inherit nix-index-database; }; }; in diff --git a/nix-index-wrapper.nix b/nix-index-wrapper.nix index 58dd90c2..aa27759e 100644 --- a/nix-index-wrapper.nix +++ b/nix-index-wrapper.nix @@ -1,12 +1,12 @@ { - lib, symlinkJoin, makeBinaryWrapper, nix-index-unwrapped, nix-index-database, + db-type ? "full" }: symlinkJoin { - name = "nix-index-with-db-${nix-index-unwrapped.version}"; + name = "nix-index-with-${db-type}-db-${nix-index-unwrapped.version}"; paths = [ nix-index-unwrapped ]; nativeBuildInputs = [ makeBinaryWrapper ]; postBuild = '' From 2ad40f1b4cf5512681509bb4ff79e87084888f10 Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Sun, 22 Dec 2024 17:38:25 +0100 Subject: [PATCH 4/6] expose nix-index-small-database --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b76b3cc8..d33d93b4 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ }; in { - inherit nix-index-database; + inherit nix-index-database nix-index-small-database; nix-index-with-db = pkgs.callPackage ./nix-index-wrapper.nix { inherit nix-index-database; }; nix-index-with-small-db = pkgs.callPackage ./nix-index-wrapper.nix { From 07f7fcb8de6ee50a472a119a02616fb1ed67a25f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Dec 2024 16:50:05 +0000 Subject: [PATCH 5/6] update generated.nix to release 2024-12-22-163440 --- generated.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/generated.nix b/generated.nix index c130eb41..480cf6f6 100644 --- a/generated.nix +++ b/generated.nix @@ -1,14 +1,14 @@ # this file is autogenerated by .github/workflows/update.yml { - url = "https://github.com/gvolpe/nix-index-database/releases/download/2024-12-22-115534/index-"; + url = "https://github.com/gvolpe/nix-index-database/releases/download/2024-12-22-163440/index-"; hashes = { - x86_64-linux = "sha256-azY0e4atL4VoAm1ZqxMV/njbM7WiauINlQr7aBkPqfU="; - aarch64-linux = "sha256-zQCWC2e/g024yZe2DRuPhGx3womW90VOK1/AcN4W+3Y="; - x86_64-darwin = "sha256-IOdB9dqr9gFwJv/zYiWdU8q7b30AsHFBUNblf+Hnxyk="; - aarch64-darwin = "sha256-o7KtZcRRHJb3n+VOo2UUw0WserCdjxs0TXUOdBp3TH4="; - x86_64-linux-small = "sha256-UpXpoxVc1dn85/C1iGE239zJ5FAS7mVHXsVQvB/XV3c="; - aarch64-linux-small = "sha256-4t8TN0Lyk+g/lJYMjYmYb9kaSLHhgmk+NAkGzH+SCWg="; - x86_64-darwin-small = "sha256-u05f923VCSnhf2A4khHrSyCg9HcALzhorHVT88hNQjg="; - aarch64-darwin-small = "sha256-r3TWuyqwuPDu4qBH1XqrTRH5I+yF/6Z1hQya0D9lZ7M="; + x86_64-linux = "sha256-zGIz7V0Av4uK3ISg2zod2vyUMiSeK0NBQ1EX8z4FqXo="; + aarch64-linux = "sha256-9qNYYHYGwMQ6MsHFhSzZwe0cVhkiqq1Au/mJ9wFA8xo="; + x86_64-darwin = "sha256-oMt/V1yP2s8OTBWdox8Ca15rD2qS+alqsbP7Fidobx0="; + aarch64-darwin = "sha256-cXaOosdDyNlJLOjSRfmapN6GgMTx8GoORZk8tvit7C8="; + x86_64-linux-small = "sha256-et7uzQBa0fCqSDTYep6FI1nMwUQT6DKRJ7jFvaFWg4c="; + aarch64-linux-small = "sha256-y8hNFVuw7tqULXcF2zd5KdNEVjeYtXahP/E/N2tdzlA="; + x86_64-darwin-small = "sha256-HVuO+au5ExhituREiUYpa4MRlsZNkpshWQ6NpOa1BIQ="; + aarch64-darwin-small = "sha256-/MiwMo6Ju/Aj4762t0Xe/lj+19qPEFh9qRGrpM7iDGU="; }; } From f3ea8bd11b980aefb1324b0d71d7aee09db1c0a8 Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Mon, 23 Dec 2024 11:16:06 +0100 Subject: [PATCH 6/6] set small db as default for comma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d33d93b4..01bcd543 100644 --- a/flake.nix +++ b/flake.nix @@ -51,7 +51,7 @@ nix-index-database = nix-index-small-database; db-type = "small"; }; - comma-with-db = pkgs.callPackage ./comma-wrapper.nix { inherit nix-index-database; }; + comma-with-db = pkgs.callPackage ./comma-wrapper.nix { nix-index-database = nix-index-small-database; }; }; in {