Skip to content

Commit

Permalink
fix(workflows): enable submodules, remove upstream cachix action
Browse files Browse the repository at this point in the history
  • Loading branch information
eum3l committed Jun 30, 2024
1 parent c759818 commit 423341a
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 175 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/cargo-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
14 changes: 5 additions & 9 deletions .github/workflows/cargo-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/nix-build.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/nix-cache.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/nix-check.yml
Original file line number Diff line number Diff line change
@@ -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#

19 changes: 6 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
...
}: let
inherit (pkgs) callPackage;
in {
in rec {
# provide the formatter for nix fmt
formatter = pkgs.alejandra;

Expand All @@ -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";
Expand Down
11 changes: 5 additions & 6 deletions nix/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
makeWrapper,
rustPlatform,
atk,
gtk3,
gtk-layer-shell,
gtk4,
gtk4-layer-shell,
pkg-config,
librsvg,
inputs,
name,
lockFile,
...
Expand All @@ -19,17 +18,17 @@ in
pname = cargoToml.package.name;
version = cargoToml.package.version;

src = "${inputs.self}";
src = ../../.;
cargoLock = {
inherit lockFile;
};

buildInputs = [
glib
atk
gtk3
librsvg
gtk-layer-shell
gtk4
gtk4-layer-shell
];

nativeBuildInputs = [
Expand Down

0 comments on commit 423341a

Please sign in to comment.