Skip to content

Commit

Permalink
Merge pull request #133 from gvolpe/main
Browse files Browse the repository at this point in the history
Generate small database
  • Loading branch information
Mic92 authored Dec 25, 2024
2 parents d583b2d + f3ea8bd commit b19e9c9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}-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"
- name: Add to release
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: index-${{ matrix.system }}
files: |
index-${{ matrix.system }}-small
index-${{ matrix.system }}
update-generated:
Expand All @@ -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
Expand Down
18 changes: 16 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@
__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;
inherit nix-index-database nix-index-small-database;

nix-index-with-db = pkgs.callPackage ./nix-index-wrapper.nix { inherit nix-index-database; };
comma-with-db = pkgs.callPackage ./comma-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 { nix-index-database = nix-index-small-database; };
};
in
{
Expand Down
14 changes: 9 additions & 5 deletions generated.nix
Original file line number Diff line number Diff line change
@@ -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-163440/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-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=";
};
}
4 changes: 2 additions & 2 deletions nix-index-wrapper.nix
Original file line number Diff line number Diff line change
@@ -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 = ''
Expand Down

0 comments on commit b19e9c9

Please sign in to comment.