diff --git a/.forgejo/workflows/verify.yaml b/.forgejo/workflows/verify.yaml index abf6c70..1370061 100644 --- a/.forgejo/workflows/verify.yaml +++ b/.forgejo/workflows/verify.yaml @@ -4,12 +4,10 @@ on: - '*' paths: - src/** - - static/graph* - - static/welcome.toml + - static/* - .forgejo/** - .justfile - - Cargo.toml - - Cargo.lock + - Cargo.* jobs: verify: @@ -17,57 +15,41 @@ jobs: timeout-minutes: 20 container: image: rust:slim - env: - RUSTUP_HOME: /rust/rustup - CARGO_HOME: /rust/cargo steps: - name: Install action dependencies - run: > - apt-get install --no-install-recommends --update -y - nodejs git curl xz-utils + run: | + apt-get install --no-install-recommends --update -y \ + nodejs git nix - name: Checkout code uses: actions/checkout@v6 with: fetch-tags: true - - name: Set up Rust toolchain - run: | - mkdir -p "$RUSTUP_HOME" - mkdir -p "$CARGO_HOME" - - rust_version=$( - grep '^rust-version = "' Cargo.toml \ - | cut -d '"' -f 2 - ) - - rustup default "$rust_version" - rustup toolchain install nightly - rustup component add llvm-tools - rustup component add --toolchain nightly rustfmt clippy - rustup target add x86_64-unknown-linux-musl x86_64-unknown-linux-gnu + - name: Cleanup checkout action dependencies + run: apt-get purge -y nodejs git - name: Set up CI user - run: | - useradd -m ci - mkdir /nix - chown -R ci:ci "$RUSTUP_HOME" "$CARGO_HOME" "$PWD" /nix - printf '[safe]\ndirectory = %s\n' "$PWD" > /etc/gitconfig + run: useradd -m ci && chown -R ci /nix . - - name: Set up Nix + - name: Set up Rust toolchain run: | - mkdir /etc/nix - echo experimental-features = nix-command flakes \ - >> /etc/nix/nix.conf + rust_version=$(sed -nE 's/^rust-version = "(.*)"$/\1/p' Cargo.toml) + su ci -c " - sh -c 'curl -L https://nixos.org/nix/install | - bash -s -- --no-daemon' \ + rustup default '$rust_version' + rustup toolchain install nightly + rustup component add llvm-tools + rustup component add --toolchain nightly rustfmt clippy + rustup target add \ + x86_64-unknown-linux-musl \ + x86_64-unknown-linux-gnu " - name: Assess run: | - su ci -lc " - export RUSTUP_HOME=$RUSTUP_HOME CARGO_HOME=$CARGO_HOME - nix develop path:$FORGEJO_WORKSPACE -c \ - just -f $FORGEJO_WORKSPACE/.justfile verify + ENV_PATH=$PATH su ci -c " + nix --experimental-features 'nix-command flakes' \ + develop path:$PWD \ + -c just -f $PWD/.justfile verify " diff --git a/flake.nix b/flake.nix index 8434a06..0c4f0aa 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ cargo-deny cargo-llvm-cov cargo-msrv + git just rustup taplo @@ -60,7 +61,6 @@ dev = [ cargo-mutants watchexec - git ]; edit = dev ++ [ neovim @@ -78,7 +78,7 @@ ); - nixosModules.bot = { config, lib, system, ... }: { + nixosModules.en = { config, lib, system, ... }: { options.within.services.en.enable = lib.mkEnableOption "enable en server";