From a4402a935d12068894c71991d93140fc93f39641 Mon Sep 17 00:00:00 2001 From: eum3l <77971322+eum3l@users.noreply.github.com> Date: Mon, 1 Jul 2024 03:44:59 +0200 Subject: [PATCH] fix(workflows): enable submodules, remove upstream cachix action (#4) --- .github/workflows/cargo-build.yml | 15 ++---- .github/workflows/cargo-update.yml | 14 ++---- .github/workflows/nix-build.yml | 64 -------------------------- .github/workflows/nix-cache.yml | 73 ------------------------------ .github/workflows/nix-check.yml | 38 ++++++++++++++++ flake.nix | 19 +++----- nix/plugins/default.nix | 11 ++--- 7 files changed, 59 insertions(+), 175 deletions(-) delete mode 100644 .github/workflows/nix-build.yml delete mode 100644 .github/workflows/nix-cache.yml create mode 100644 .github/workflows/nix-check.yml diff --git a/.github/workflows/cargo-build.yml b/.github/workflows/cargo-build.yml index 57ed5eb..8c24e82 100644 --- a/.github/workflows/cargo-build.yml +++ b/.github/workflows/cargo-build.yml @@ -20,12 +20,10 @@ jobs: with: submodules: recursive - - uses: cachix/install-nix-action@v26 - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Install dependencies - run: nix profile install --inputs-from .# - + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: actions-rs/toolchain@v1 name: Install rust toolchain with: @@ -35,8 +33,5 @@ jobs: - uses: Swatinem/rust-cache@v2 name: Add caching - - uses: actions-rs/cargo@v1 + - run: nix develop .?submodules=1#anyrun --command cargo build --verbose name: Build crate - with: - command: build - args: --verbose diff --git a/.github/workflows/cargo-update.yml b/.github/workflows/cargo-update.yml index c5fd40a..7a1bbf2 100644 --- a/.github/workflows/cargo-update.yml +++ b/.github/workflows/cargo-update.yml @@ -11,9 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Checkout uses: actions/checkout@v4 with: @@ -22,13 +23,8 @@ jobs: - name: Bump nix run: nix flake update - - name: Install dependencies - run: nix profile install --inputs-from . nixpkgs#cargo-bump nixpkgs#cargo - - name: Bump rust - run: | - cargo bump patch - cargo update + run: nix shell nixpkgs#cargo --command cargo update - name: Create Pull Request uses: peter-evans/create-pull-request@v4 diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml deleted file mode 100644 index 62f8aee..0000000 --- a/.github/workflows/nix-build.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: "Check flake & Build packages" - -on: - workflow_call: - workflow_dispatch: - pull_request: - branches: ["master"] - -jobs: - check-flake: - name: "Check flake validity" - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - logger: pretty - - - name: Check Flake - run: nix flake check --accept-flake-config - - build: - name: "Build Exposed Packages" - runs-on: ubuntu-latest - needs: check-flake - strategy: - matrix: - package: - - anyrun - - applications - - dictionary - - kidex - - randr - - rink - - shell - - stdin - - symbols - - websearch - steps: - - uses: easimon/maximize-build-space@v8 - with: - overprovision-lvm: true - remove-android: true - remove-dotnet: true - remove-haskell: true - remove-docker-images: true - remove-codeql: true - - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: cachix/install-nix-action@v26 - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Build anyrun from the defined matrix - run: nix build .#${{ matrix.package }} --print-build-logs --extra-substituters "https://anyrun.cachix.org" diff --git a/.github/workflows/nix-cache.yml b/.github/workflows/nix-cache.yml deleted file mode 100644 index bc05608..0000000 --- a/.github/workflows/nix-cache.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: "Check flake & Push built packages to cache" - -on: - workflow_call: - workflow_dispatch: - push: - branches: - - master - paths-ignore: - - .gitignore - - README.md - -jobs: - check-flake: - name: "Check flake validity" - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - logger: pretty - - - name: Check Flake - run: nix flake check --accept-flake-config - - cachix: - name: "Build & Cache Exposed Packages" - runs-on: ubuntu-latest - needs: check-flake - strategy: - matrix: - package: - - anyrun - - applications - - dictionary - - kidex - - randr - - rink - - shell - - stdin - - symbols - - websearch - steps: - - uses: easimon/maximize-build-space@v8 - with: - overprovision-lvm: true - remove-android: true - remove-dotnet: true - remove-haskell: true - remove-docker-images: true - remove-codeql: true - - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - uses: cachix/install-nix-action@v26 - - uses: DeterminateSystems/magic-nix-cache-action@main - - - uses: cachix/cachix-action@v14 - with: - authToken: ${{ secrets.CACHIX_TOKEN }} - name: anyrun - - - name: Build anyrun from the defined matrix - run: nix build .#${{ matrix.package }} --print-build-logs --extra-substituters "https://anyrun.cachix.org" diff --git a/.github/workflows/nix-check.yml b/.github/workflows/nix-check.yml new file mode 100644 index 0000000..daaf090 --- /dev/null +++ b/.github/workflows/nix-check.yml @@ -0,0 +1,38 @@ +name: "Check flake" + +on: + workflow_call: + workflow_dispatch: + push: + branches: + - master + paths-ignore: + - .gitignore + - README.md + - install.sh + - screenshots/** + - examples/** + - docs/** + + pull_request: + branches: + - master + +jobs: + check: + name: "nix flake check" + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: Check Flake + run: nix flake check .?submodules=1# + diff --git a/flake.nix b/flake.nix index 8cf3b79..4cc5b2d 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,7 @@ ... }: let inherit (pkgs) callPackage; - in { + in rec { # provide the formatter for nix fmt formatter = pkgs.alejandra; @@ -46,30 +46,23 @@ clippy # opinionated rust formatter ]; }; - + + checks = packages; packages = let lockFile = ./Cargo.lock; - - # Since all plugin derivations are called with the exact same arguments - # it is possible to streamline calling packages with a single function - # that takes name as an argument, and handles default inherits. mkPlugin = name: callPackage ./nix/plugins/default.nix { - inherit inputs lockFile; - inherit name; + inherit lockFile name; }; in rec { default = anyrun; - anyrun = callPackage ./nix/default.nix {inherit inputs lockFile;}; + anyrun = callPackage ./nix/default.nix {inherit lockFile;}; anyrun-with-all-plugins = pkgs.callPackage ./nix/default.nix { - inherit inputs lockFile; + inherit lockFile; dontBuildPlugins = false; }; - # Expose each plugin as a separate package. This uses the mkPlugin function - # to call the same derivation with same default inherits and the name of the - # plugin every time. applications = mkPlugin "applications"; dictionary = mkPlugin "dictionary"; kidex = mkPlugin "kidex"; diff --git a/nix/plugins/default.nix b/nix/plugins/default.nix index cca1f64..ccc7a5d 100644 --- a/nix/plugins/default.nix +++ b/nix/plugins/default.nix @@ -4,11 +4,10 @@ makeWrapper, rustPlatform, atk, - gtk3, - gtk-layer-shell, + gtk4, + gtk4-layer-shell, pkg-config, librsvg, - inputs, name, lockFile, ... @@ -19,7 +18,7 @@ in pname = cargoToml.package.name; version = cargoToml.package.version; - src = "${inputs.self}"; + src = ../../.; cargoLock = { inherit lockFile; }; @@ -27,9 +26,9 @@ in buildInputs = [ glib atk - gtk3 librsvg - gtk-layer-shell + gtk4 + gtk4-layer-shell ]; nativeBuildInputs = [