diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5a8f181..7eda317 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,14 +20,14 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build package - run: "nix build .# -L --fallback" + run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - name: Upload a Build Artifact uses: actions/upload-artifact@v3.1.2 with: # Artifact name name: magic-nix-cache-ARM64-macOS - path: result/bin/magic-nix-cache + path: magic-nix-cache.closure.xz retention-days: 1 build-artifacts-X64-macOS: @@ -47,14 +47,14 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build package - run: "nix build .# -L --fallback" + run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - name: Upload a Build Artifact uses: actions/upload-artifact@v3.1.2 with: # Artifact name name: magic-nix-cache-X64-macOS - path: result/bin/magic-nix-cache + path: magic-nix-cache.closure.xz retention-days: 1 build-artifacts-X64-Linux: @@ -71,15 +71,15 @@ jobs: - uses: DeterminateSystems/nix-installer-action@main - - uses: DeterminateSystems/magic-nix-cache-action-priv@main + - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build package - run: "nix build .# -L --fallback" + run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - name: Upload a Build Artifact uses: actions/upload-artifact@v3.1.2 with: # Artifact name name: magic-nix-cache-X64-Linux - path: result/bin/magic-nix-cache + path: magic-nix-cache.closure.xz retention-days: 1 diff --git a/.github/workflows/release-branches.yml b/.github/workflows/release-branches.yml index 0672ebf..7a29d79 100644 --- a/.github/workflows/release-branches.yml +++ b/.github/workflows/release-branches.yml @@ -37,21 +37,21 @@ jobs: name: magic-nix-cache-ARM64-macOS path: cache-binary-ARM64-macOS - name: Persist the cache binary - run: cp ./cache-binary-ARM64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-ARM64-macOS + run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-macOS path: cache-binary-X64-macOS - name: Persist the cache binary - run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS + run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-Linux path: cache-binary-X64-Linux - name: Persist the cache binary - run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux + run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux - name: Publish Release (Branch) env: diff --git a/.github/workflows/release-prs.yml b/.github/workflows/release-prs.yml index 0d87add..42d6252 100644 --- a/.github/workflows/release-prs.yml +++ b/.github/workflows/release-prs.yml @@ -41,21 +41,21 @@ jobs: name: magic-nix-cache-ARM64-macOS path: cache-binary-ARM64-macOS - name: Persist the cache binary - run: cp ./cache-binary-ARM64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-ARM64-macOS + run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-macOS path: cache-binary-X64-macOS - name: Persist the cache binary - run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS + run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-Linux path: cache-binary-X64-Linux - name: Persist the cache binary - run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux + run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index 881ef9b..1e5b5d4 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -29,21 +29,21 @@ jobs: name: magic-nix-cache-ARM64-macOS path: cache-binary-ARM64-macOS - name: Persist the cache binary - run: cp ./cache-binary-ARM64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-ARM64-macOS + run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-macOS path: cache-binary-X64-macOS - name: Persist the cache binary - run: cp ./cache-binary-X64-macOS/magic-nix-cache ./artifacts/magic-nix-cache-X64-macOS + run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS - uses: actions/download-artifact@v3 with: name: magic-nix-cache-X64-Linux path: cache-binary-X64-Linux - name: Persist the cache binary - run: cp ./cache-binary-X64-Linux/magic-nix-cache ./artifacts/magic-nix-cache-X64-Linux + run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 diff --git a/Cargo.lock b/Cargo.lock index 01cc7ff..c85e45a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1782,9 +1782,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.100.1" +version = "0.100.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +checksum = "5f6a5fc258f1c1276dfe3016516945546e2d5383911efc0fc4f1cdc5df3a4ae3" dependencies = [ "ring 0.16.20", "untrusted 0.7.1", diff --git a/flake.lock b/flake.lock index 8c25828..b79b4af 100644 --- a/flake.lock +++ b/flake.lock @@ -160,16 +160,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1701615100, - "narHash": "sha256-7VI84NGBvlCTduw2aHLVB62NvCiZUlALLqBe5v684Aw=", - "rev": "e9f06adb793d1cca5384907b3b8a4071d5d7cb19", - "revCount": 492472, + "lastModified": 1704420045, + "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", + "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", + "revCount": 553958, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2305.492472%2Brev-e9f06adb793d1cca5384907b3b8a4071d5d7cb19/018c3e8e-bc66-7f34-9054-4564bf44b6f8/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.553958%2Brev-c1be43e8e837b8dbee2b3665a007e761680f0c3d/018cdf41-5b79-7317-9544-bd9c236b12d2/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2305.tar.gz" + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz" } }, "root": { diff --git a/flake.nix b/flake.nix index ddf39b7..ab044a1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "GitHub Actions-powered Nix binary cache"; inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2305.tar.gz"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz"; rust-overlay = { url = "github:oxalica/rust-overlay"; @@ -41,27 +41,7 @@ in { packages = forEachSupportedSystem ({ pkgs, cranePkgs, ... }: rec { - magic-nix-cache = (pkgs.pkgsStatic.callPackage ./package.nix { - rustPlatform = pkgs.pkgsStatic.rustPackages_1_70.rustPlatform; - nix = pkgs.pkgsStatic.nix.overrideAttrs (old: { - patches = (old.patches or []) ++ [ ./nix.patch ]; - }); - }).overrideAttrs (old: { - nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ - pkgs.nukeReferences - ]; - - # Read by pkg_config crate (do some autodetection in build.rs?) - PKG_CONFIG_ALL_STATIC = "1"; - - "NIX_CFLAGS_LINK_${pkgs.pkgsStatic.stdenv.cc.suffixSalt}" = "-lc"; - RUSTFLAGS = "-C relocation-model=static"; - - postFixup = (old.postFixup or "") + '' - rm -f $out/nix-support/propagated-build-inputs - nuke-refs $out/bin/magic-nix-cache - ''; - }); + magic-nix-cache = pkgs.callPackage ./package.nix { }; #inherit (cranePkgs) magic-nix-cache; default = magic-nix-cache; }); diff --git a/package.nix b/package.nix index 0f22583..d0e27b5 100644 --- a/package.nix +++ b/package.nix @@ -36,6 +36,13 @@ in rustPlatform.buildRustPackage rec { ATTIC_DISTRIBUTOR = "attic"; + # Hack to fix linking on macOS. + NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin "-lc++abi"; + # Recursive Nix is not stable yet doCheck = false; + + postFixup = '' + rm -f $out/nix-support/propagated-build-inputs + ''; }