From 7c2c96e276f5550c4a78192a4c1e3fe7e9735699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 09:41:31 +0100 Subject: [PATCH 01/14] Add jobsets script --- hydra/default.nix | 9 +++++ hydra/jobsets.nix | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 hydra/default.nix create mode 100644 hydra/jobsets.nix diff --git a/hydra/default.nix b/hydra/default.nix new file mode 100644 index 0000000..a328ace --- /dev/null +++ b/hydra/default.nix @@ -0,0 +1,9 @@ +{ + nix-packages, + nixpkgs, + system, +}: let + pkgs = import nixpkgs {inherit system;}; + ci = import "${nix-packages}/ci.nix" {inherit pkgs;}; +in + ci.buildPkgs diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix new file mode 100644 index 0000000..0f48c8d --- /dev/null +++ b/hydra/jobsets.nix @@ -0,0 +1,85 @@ +{ + prsJSON, + nixpkgs, +}: let + pkgs = import nixpkgs {}; + prs = builtins.fromJSON (builtins.readFile prsJSON); + systems = ["x86_64-linux" "aarch64-linux" "riscv64-linux"]; + nixpkgs_version = ["master" "nixos-22.05"]; + mkJobsets = system: version: + (pkgs.lib.mapAttrs ( + num: info: { + enabled = 1; + hidden = false; + description = "PR ${num} (${system}-${version}): ${info.title}"; + nixexprinput = "nix-packages"; + nixexprpath = "hydra/default.nix"; + checkinterval = 60; + schedulingshares = 100; + enableemail = false; + emailoverride = ""; + keepnr = 1; + inputs = { + nix-packages = { + type = "git"; + value = "https://github.com/${info.head.repo.owner.login}/${info.head.repo.name}.git ${info.head.ref}"; + emailresponsible = false; + }; + nixpkgs = { + type = "git"; + value = "https://github.com/NixOS/nixpkgs.git ${version}"; + emailresponsible = false; + }; + system = { + type = "string"; + value = system; + }; + }; + } + ) + prs) + // { + main = { + enabled = 1; + hidden = false; + description = "nix-packages ${system}-${version}"; + nixexprinput = "nix-packages"; + nixexprpath = "hydra/default.nix"; + checkinterval = 60; + schedulingshares = 100; + enableemail = false; + emailoverride = ""; + keepnr = 1; + inputs = { + nix-packages = { + type = "git"; + value = "https://github.com/DarkKirb/nix-packages.git main"; + emailresponsible = false; + }; + nixpkgs = { + type = "git"; + value = "https://github.com/NixOS/nixpkgs.git ${version}"; + emailresponsible = false; + }; + system = { + type = "string"; + value = system; + }; + }; + }; + }; + + mapToAttrs = f: list: pkgs.listToAttrs (map f list); + + jobsets = + mapToAttrs (system: { + name = system; + value = + mapToAttrs (version: { + name = version; + value = mkJobsets system version; + }) + nixpkgs_version; + }) + systems; +in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);} From 5889bf347b7f2f9222c3afa5fb6225e282cefc53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 09:53:39 +0100 Subject: [PATCH 02/14] Add declarative spec file --- hydra/spec.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 hydra/spec.json diff --git a/hydra/spec.json b/hydra/spec.json new file mode 100644 index 0000000..86f6158 --- /dev/null +++ b/hydra/spec.json @@ -0,0 +1,29 @@ +{ + "enabled": 1, + "hidden": false, + "description": "jobsets", + "nixexprinput": "nix-packages", + "nixexprpath": "hydra/jobsets.nix", + "checkinterval": 60, + "schedulingshares": 100, + "enableemail": false, + "emailoverride": "", + "keepnr": 1, + "inputs": { + "nix-packages": { + "type": "git", + "value": "https://github.com/DarkKirb/nix-packages.git main", + "emailresponsible": false + }, + "nixpkgs": { + "type": "git", + "value": "https://github.com/NixOS/nixpkgs.git", + "emailresponsible": false + }, + "prsJSON": { + "type": "githubpulls", + "value": "https://api.github.com/repos/DarkKirb/nix-packages/pulls", + "emailresponsible": false + } + } +} From 33d4bd9e6e7269b7fe45f04ba7c356e42a2eb5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 10:00:32 +0100 Subject: [PATCH 03/14] temp --- hydra/spec.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra/spec.json b/hydra/spec.json index 86f6158..7a44d01 100644 --- a/hydra/spec.json +++ b/hydra/spec.json @@ -12,7 +12,7 @@ "inputs": { "nix-packages": { "type": "git", - "value": "https://github.com/DarkKirb/nix-packages.git main", + "value": "https://github.com/DarkKirb/nix-packages.git switch-to-hydra", "emailresponsible": false }, "nixpkgs": { From 78ca6583b336e7ecc005f75f63d22a2081147518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 10:53:11 +0100 Subject: [PATCH 04/14] Fix githubpulls value --- hydra/spec.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra/spec.json b/hydra/spec.json index 7a44d01..37cae5e 100644 --- a/hydra/spec.json +++ b/hydra/spec.json @@ -22,7 +22,7 @@ }, "prsJSON": { "type": "githubpulls", - "value": "https://api.github.com/repos/DarkKirb/nix-packages/pulls", + "value": "DarkKirb nixos-config", "emailresponsible": false } } From 511964d74fc2c553ef08309b6b5f6c000c1044f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 10:55:41 +0100 Subject: [PATCH 05/14] fix typo --- hydra/jobsets.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix index 0f48c8d..013d97f 100644 --- a/hydra/jobsets.nix +++ b/hydra/jobsets.nix @@ -69,7 +69,7 @@ }; }; - mapToAttrs = f: list: pkgs.listToAttrs (map f list); + mapToAttrs = f: list: pkgs.lib.listToAttrs (map f list); jobsets = mapToAttrs (system: { From 1d1046fbdab168ebb8fb01286ed6df41f5e87ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 11:06:21 +0100 Subject: [PATCH 06/14] =?UTF-8?q?don=E2=80=99t=20nest=20jobsets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hydra/jobsets.nix | 69 +++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix index 013d97f..c94126b 100644 --- a/hydra/jobsets.nix +++ b/hydra/jobsets.nix @@ -7,39 +7,42 @@ systems = ["x86_64-linux" "aarch64-linux" "riscv64-linux"]; nixpkgs_version = ["master" "nixos-22.05"]; mkJobsets = system: version: - (pkgs.lib.mapAttrs ( + (pkgs.lib.mapAttrs' ( num: info: { - enabled = 1; - hidden = false; - description = "PR ${num} (${system}-${version}): ${info.title}"; - nixexprinput = "nix-packages"; - nixexprpath = "hydra/default.nix"; - checkinterval = 60; - schedulingshares = 100; - enableemail = false; - emailoverride = ""; - keepnr = 1; - inputs = { - nix-packages = { - type = "git"; - value = "https://github.com/${info.head.repo.owner.login}/${info.head.repo.name}.git ${info.head.ref}"; - emailresponsible = false; - }; - nixpkgs = { - type = "git"; - value = "https://github.com/NixOS/nixpkgs.git ${version}"; - emailresponsible = false; - }; - system = { - type = "string"; - value = system; + name = "${system}-${version}-pr${num}"; + value = { + enabled = 1; + hidden = false; + description = "PR ${num} (${system}-${version}): ${info.title}"; + nixexprinput = "nix-packages"; + nixexprpath = "hydra/default.nix"; + checkinterval = 60; + schedulingshares = 100; + enableemail = false; + emailoverride = ""; + keepnr = 1; + inputs = { + nix-packages = { + type = "git"; + value = "https://github.com/${info.head.repo.owner.login}/${info.head.repo.name}.git ${info.head.ref}"; + emailresponsible = false; + }; + nixpkgs = { + type = "git"; + value = "https://github.com/NixOS/nixpkgs.git ${version}"; + emailresponsible = false; + }; + system = { + type = "string"; + value = system; + }; }; }; } ) prs) // { - main = { + "${system}-${version}" = { enabled = 1; hidden = false; description = "nix-packages ${system}-${version}"; @@ -69,17 +72,7 @@ }; }; - mapToAttrs = f: list: pkgs.lib.listToAttrs (map f list); + concatAttrs = pkgs.lib.foldr (a: b: a // b) {}; - jobsets = - mapToAttrs (system: { - name = system; - value = - mapToAttrs (version: { - name = version; - value = mkJobsets system version; - }) - nixpkgs_version; - }) - systems; + jobsets = concatAttrs (pkgs.lib.concatMap (system: map (version: mkJobsets system version) nixpkgs_version) systems); in {jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets);} From d77894c204f4ab0776b29ece74ae470dcc9c2fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 11:17:10 +0100 Subject: [PATCH 07/14] fix spec --- hydra/spec.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra/spec.json b/hydra/spec.json index 37cae5e..a6999e3 100644 --- a/hydra/spec.json +++ b/hydra/spec.json @@ -22,7 +22,7 @@ }, "prsJSON": { "type": "githubpulls", - "value": "DarkKirb nixos-config", + "value": "DarkKirb nix-packages", "emailresponsible": false } } From b4530a17cb6a9f622386d0d9eb47f8f33c4d766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 11:25:00 +0100 Subject: [PATCH 08/14] Fix hydra build --- hydra/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hydra/default.nix b/hydra/default.nix index a328ace..d629c69 100644 --- a/hydra/default.nix +++ b/hydra/default.nix @@ -4,6 +4,7 @@ system, }: let pkgs = import nixpkgs {inherit system;}; - ci = import "${nix-packages}/ci.nix" {inherit pkgs;}; + ci = import nix-packages {inherit pkgs;}; + isReserved = n: n == "lib" || n == "overlays" || n == "modules"; in - ci.buildPkgs + pkgs.lib.filterAttrs (name: _: !(isReserved name)) From a64a1c769809e4495b370343d8568141ab053524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 11:57:41 +0100 Subject: [PATCH 09/14] Make it work maybe --- hydra/jobsets.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hydra/jobsets.nix b/hydra/jobsets.nix index c94126b..dd58f08 100644 --- a/hydra/jobsets.nix +++ b/hydra/jobsets.nix @@ -16,7 +16,7 @@ description = "PR ${num} (${system}-${version}): ${info.title}"; nixexprinput = "nix-packages"; nixexprpath = "hydra/default.nix"; - checkinterval = 60; + checkinterval = 300; schedulingshares = 100; enableemail = false; emailoverride = ""; @@ -48,7 +48,7 @@ description = "nix-packages ${system}-${version}"; nixexprinput = "nix-packages"; nixexprpath = "hydra/default.nix"; - checkinterval = 60; + checkinterval = 300; schedulingshares = 100; enableemail = false; emailoverride = ""; From 99cebc8faf441a0d9da7dc75c40d8c89f2a2beb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 12:03:25 +0100 Subject: [PATCH 10/14] actually fix hydra --- hydra/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra/default.nix b/hydra/default.nix index d629c69..7f6c6a2 100644 --- a/hydra/default.nix +++ b/hydra/default.nix @@ -7,4 +7,4 @@ ci = import nix-packages {inherit pkgs;}; isReserved = n: n == "lib" || n == "overlays" || n == "modules"; in - pkgs.lib.filterAttrs (name: _: !(isReserved name)) + pkgs.lib.filterAttrs (name: _: !(isReserved name)) ci From 76a5ad1af318fdbbb26bb5f27c359514672fc7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 12:14:25 +0100 Subject: [PATCH 11/14] allow unfree and unsupported CPUs --- hydra/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hydra/default.nix b/hydra/default.nix index 7f6c6a2..93f39c8 100644 --- a/hydra/default.nix +++ b/hydra/default.nix @@ -3,7 +3,13 @@ nixpkgs, system, }: let - pkgs = import nixpkgs {inherit system;}; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + allowUnsupportedSystem = true; + }; + }; ci = import nix-packages {inherit pkgs;}; isReserved = n: n == "lib" || n == "overlays" || n == "modules"; in From 2887dd9fb7486317b6bd123e34a89bca166a65a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 12:14:38 +0100 Subject: [PATCH 12/14] remove build workflow --- .github/workflows/build.yml | 103 ------------------------------------ 1 file changed, 103 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c5b91bd..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: build -on: - pull_request: - branches: - - main -jobs: - build: - strategy: - matrix: - package: - - akkoma - - pleroma-fe - - admin-fe - - emoji-lotte - - emoji-volpeon-blobfox - - emoji-volpeon-blobfox-flip - - emoji-volpeon-bunhd - - emoji-volpeon-bunhd-flip - - emoji-volpeon-drgn - - emoji-volpeon-fox - - emoji-volpeon-gphn - - emoji-volpeon-raccoon - - emoji-volpeon-vlpn - - emoji-caro - - lotte-art - - drone-runner-docker - - alco-sans - - constructium - - fairfax - - fairfax-hd - - kreative-square - - nasin-nanpa - - matrix-media-repo - - mautrix-discord - - mautrix-whatsapp - - mautrix-signal - - mautrix-telegram - - python-mautrix - - python-tulir-telethon - - papermc - - python-plover-stroke - - python-rtf-tokenize - - plover - - plover-plugins-manager - - python-simplefuzzyset - - plover-plugin-emoji - - plover-plugin-tapey-tape - - plover-plugin-yaml-dictionary - - plover-plugin-machine-hid - - plover-plugin-rkb1-hid - - plover-dict-didoesdigital - - miifox-net - - old-homepage - - clean-s3-cache - - python-instagram - - moa - - nix-s3-dedup - - attic - - attic-client - - attic-server - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Nix - uses: cachix/install-nix-action@v18 - with: - nix_path: nixpkgs=channel:nixos-unstable - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= cache:6tx18bfuH66LOfrn37EmN2YxwNZI3qNk3lKHoz/XlXI= - experimental-features = nix-command flakes ca-derivations - post-build-hook = ${{ github.workspace }}/scripts/post-build-hook - substituters = https://cache.chir.rs/ https://cache.nixos.org/ https://attic.chir.rs/cache - - name: Download patched nix - run: nix build github:DarkKirb/nix-packages#nix-s3-dedup - - name: Download attic - run: nix build github:DarkKirb/nix-packages#attic-client - - name: Set up secrets - run: | - echo "$NIX_CACHE_KEY" > ~/cache.key - sudo mkdir /root/.aws - echo "$AWS_CREDENTIALS" | sudo tee /root/.aws/credentials > /dev/null - nix run github:DarkKirb/nix-packages#attic-client -- login attic-server https://attic.chir.rs/ "$ATTIC_TOKEN" - env: - NIX_CACHE_KEY: ${{secrets.NIX_CACHE_KEY}} - AWS_CREDENTIALS: ${{secrets.AWS_CREDENTIALS}} - ATTIC_TOKEN: ${{secrets.ATTIC_TOKEN}} - - name: install jq - run: sudo apt install jq - - name: Build ${{ matrix.package }} - run: | - DRV_PATH=$(nix-instantiate -E '(import ./. {}).${{ matrix.package }}') - OUT_PATH=$(nix show-derivation $DRV_PATH | jq -r ".\"$DRV_PATH\".outputs.out.path") - # check if we already built it - NARINFO=$(echo $OUT_PATH | sed 's|/| |g' | sed 's|-| |g' | awk '{print $3}') - if curl --output /dev/null --silent --fail "https://cache.chir.rs/$NARINFO.narinfo"; then - echo "${{ matrix.package }} already built. Skipping" - else - sudo /nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#attic-client' -- push cache $(nix-store -r $DRV_PATH) - fi - env: - NIXPKGS_ALLOW_UNFREE: 1 From 3fc18d98bc0c82be050210473df7d83fe0257aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 16:34:11 +0100 Subject: [PATCH 13/14] Update update.yml --- .github/workflows/update.yml | 10 +++++----- scripts/post-build-hook | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index a8e3bea..9bc3234 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -15,12 +15,12 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= chir-rs:AnwyFacopHSkprD6aXY4/R3J9JYzTbV2rosJCBPaB28= experimental-features = nix-command flakes ca-derivations post-build-hook = ${{ github.workspace }}/scripts/post-build-hook - substituters = https://cache.chir.rs/ https://cache.nixos.org/ - - name: Download patched nix - run: nix build github:DarkKirb/nix-packages#nix-s3-dedup + substituters = https://attic.chir.rs/chir-rs/ https://cache.nixos.org/ + - name: Download attic + run: nix build github:DarkKirb/nix-packages#attic-client - name: Set up secrets run: | echo "$NIX_CACHE_KEY" > ~/cache.key @@ -47,4 +47,4 @@ jobs: title: Automated updates for nix-packages body: Automated updates assignees: darkkirb - reviewers: darkkirb \ No newline at end of file + reviewers: darkkirb diff --git a/scripts/post-build-hook b/scripts/post-build-hook index ad828f5..2e800de 100755 --- a/scripts/post-build-hook +++ b/scripts/post-build-hook @@ -1,6 +1,4 @@ #!/bin/sh set -euf export IFS=' ' -/nix/var/nix/profiles/default/bin/nix store sign --key-file /home/runner/cache.key $DRV_PATH -/nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#nix-s3-dedup' -- copy --to 's3://cache-chir-rs?scheme=https&endpoint=s3.us-west-000.backblazeb2.com&secret-key=/home/runner/cache.key&multipart-upload=true&compression=zstd&compression-level=15' $DRV_PATH /nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#attic-client' -- push cache $OUT_PATHS From b212a7acc0f416a73d6bd80f56432ed91162b9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 21 Jan 2023 16:34:47 +0100 Subject: [PATCH 14/14] Decommission patched nix --- default.nix | 1 - nix/dedupNixCache.patch | 54 ----------------------------------------- nix/default.nix | 8 ------ 3 files changed, 63 deletions(-) delete mode 100644 nix/dedupNixCache.patch delete mode 100644 nix/default.nix diff --git a/default.nix b/default.nix index 3e59059..5abeef6 100644 --- a/default.nix +++ b/default.nix @@ -63,6 +63,5 @@ in { clean-s3-cache = pkgs.python3Packages.callPackage ./scripts/clean-s3-cache.nix {}; python-instagram = pkgs.python3Packages.callPackage ./python/instagram.nix {}; moa = pkgs.python3Packages.callPackage ./moa {}; - nix-s3-dedup = pkgs.callPackage ./nix {}; inherit (attic.defaultNix.packages.${pkgs.system}) attic attic-client attic-server; } diff --git a/nix/dedupNixCache.patch b/nix/dedupNixCache.patch deleted file mode 100644 index 3994ed0..0000000 --- a/nix/dedupNixCache.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc -index 844553ad3..a7a9cd702 100644 ---- a/src/libstore/s3-binary-cache-store.cc -+++ b/src/libstore/s3-binary-cache-store.cc -@@ -214,6 +214,14 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual - Stats stats; - - S3Helper s3Helper; -+ ref mNixosCache; -+ -+ BinaryCacheStore * nixosCache() { -+ auto * casted = dynamic_cast(&*this->mNixosCache); -+ if (!casted) -+ throw UsageError("cache.nixos.org is not a BinaryCacheStore"); -+ return casted; -+ } - - S3BinaryCacheStoreImpl( - const std::string & uriScheme, -@@ -227,6 +235,7 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual - , S3BinaryCacheStore(params) - , bucketName(bucketName) - , s3Helper(profile, region, scheme, endpoint) -+ , mNixosCache(openStore("https://cache.nixos.org/")) - { - diskCache = getNarInfoDiskCache(); - } -@@ -268,6 +277,8 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual - - bool fileExists(const std::string & path) override - { -+ if(this->nixosCache()->fileExists(path)) -+ return true; - stats.head++; - - auto res = s3Helper.client->HeadObject( -@@ -389,6 +400,8 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual - std::shared_ptr> istream, - const std::string & mimeType) override - { -+ if(this->nixosCache()->fileExists(path)) -+ return; - auto compress = [&](std::string compression) - { - auto compressed = nix::compress(compression, StreamToSourceAdapter(istream).drain()); -@@ -407,6 +420,8 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStoreConfig, public virtual - - void getFile(const std::string & path, Sink & sink) override - { -+ if(this->nixosCache()->fileExists(path)) -+ return this->nixosCache()->getFile(path, sink); - stats.get++; - - // FIXME: stream output to sink. diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index 7ee0351..0000000 --- a/nix/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{nix}: -nix.overrideAttrs (super: { - patches = - (super.patches or []) - ++ [ - ./dedupNixCache.patch - ]; -})