Skip to content

Building nixos-wsl image from CI / CD (github actions) #622

Closed Answered by mhemeryck
mhemeryck asked this question in Q&A
Discussion options

You must be logged in to vote

OK, took some more time changing the setup, and now I have something that works for me. The key ingredient is obviously the separate build (without sudo) and run step (with sudo).

See

name: "Build NixOS-WSL"
on:
  workflow_dispatch: # Allow manual trigger
  pull_request:
  push:
    branches:
      - master

jobs:
  test:
    defaults:
      run:
        working-directory: ./hosts/tinkerbell
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: cachix/install-nix-action@v27
      with:
        github_access_token: ${{ secrets.GITHUB_TOKEN }}
    - name: Run nix flake check
      run: nix flake check

  build:
    if: github.event_name == 'workflow_dispatch' || …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@mhemeryck
Comment options

@nzbr
Comment options

nzbr Feb 14, 2025
Maintainer

Comment options

You must be logged in to vote
0 replies
Answer selected by mhemeryck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants