From 32af7c44bce57f23cf18c74705922e04076f81ec Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 28 Jan 2025 07:44:51 -0500 Subject: ci: use hydraJobs --- .github/workflows/ci.yaml | 49 ++++++++++-------------------------- flake.nix | 17 ++++++++++--- pkgs/flat-manager-client/package.nix | 4 +-- 3 files changed, 28 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c30bd3e..46e85f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [main] + branches: [ main ] pull_request: workflow_dispatch: @@ -38,45 +38,22 @@ jobs: name: getchoo authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - name: Evaluate flake + - name: Run Flake checks + if: ${{ matrix.system == 'x86_64-linux' }} run: | - nix flake check \ - --no-build \ - --show-trace + nix flake check --show-trace - - name: Run build + - name: Build all packages + env: + SYSTEM: ${{ matrix.system }} run: | - nix run \ - github:Mic92/nix-fast-build -- \ - --no-nom \ - --skip-cached \ - --systems '${{ matrix.system }}' \ - --option accept-flake-config true \ - --option allow-import-from-derivation false \ - --flake '.#packages.${{ matrix.system }}' + nix build \ + --fallback --print-build-logs --show-trace \ + ".#hydraJobs.$SYSTEM.all-packages" - check: - name: Check flake - - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v16 - - - name: Run check - run: | - nix flake check \ - --accept-flake-config \ - --print-build-logs \ - --show-trace - - build-gate: - name: Build gate - needs: build + release-gate: + name: Release gate + needs: [ build ] if: ${{ always() }} diff --git a/flake.nix b/flake.nix index 7ca0e0c..01fa364 100644 --- a/flake.nix +++ b/flake.nix @@ -15,9 +15,9 @@ inherit (nixpkgs) lib; # Support all systems exported by Nixpkgs - systems = lib.systems.flakeExposed; + systems = lib.intersectLists lib.systems.flakeExposed (with lib.platforms; darwin ++ linux); # But separate our primarily supported systems - tier1Systems = with lib.platforms; lib.intersectLists (aarch64 ++ x86_64) (darwin ++ linux); + tier1Systems = lib.intersectLists systems (with lib.platforms; aarch64 ++ x86_64); forAllSystems = lib.genAttrs systems; forTier1Systems = lib.genAttrs tier1Systems; @@ -32,11 +32,14 @@ mkCheck = name: deps: script: - pkgs.runCommand name { nativeBuildInputs = deps; } script; + pkgs.runCommand name { nativeBuildInputs = deps; } '' + ${script} + touch $out + ''; in { deadnix = mkCheck "check-deadnix" [ pkgs.deadnix ] "deadnix --fail ${self}"; - nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] "nixfmt --check ${self}"; + nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] "nixfmt --check ${self}/**.nix"; statix = mkCheck "check-statix" [ pkgs.statix ] "statix check ${self}"; } ); @@ -86,5 +89,11 @@ standard = "Minimal boilerplate for my Flakes"; nixos = "Minimal boilerplate for a Flake-based NixOS configuration"; }; + + hydraJobs = forTier1Systems (system: { + all-packages = nixpkgsFor.${system}.linkFarm "all-packages" ( + lib.mapAttrs (lib.const (deriv: deriv.outPath or deriv)) self.packages.${system} + ); + }); }; } diff --git a/pkgs/flat-manager-client/package.nix b/pkgs/flat-manager-client/package.nix index 2e401cf..3741bd1 100644 --- a/pkgs/flat-manager-client/package.nix +++ b/pkgs/flat-manager-client/package.nix @@ -7,7 +7,7 @@ wrapGAppsNoGuiHook, }: -stdenvNoCC.mkDerivation (finalAttrs: { +stdenvNoCC.mkDerivation { pname = "flat-manager-client"; inherit (flat-manager) version src; @@ -48,4 +48,4 @@ stdenvNoCC.mkDerivation (finalAttrs: { description = flat-manager.meta.description + " (Client)"; mainProgram = "flat-manager-client"; }; -}) +} -- cgit v1.2.3