Skip to content

Commit

Permalink
Merge pull request #20 from datsfilipe/add-flake-generation-workflow
Browse files Browse the repository at this point in the history
add flake generation workflow (test)
  • Loading branch information
datsfilipe authored Jan 9, 2025
2 parents 392d51d + ec05de7 commit 77fd587
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/generate-flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: generate flake

on:
push:
branches:
- main
pull_request:

jobs:
test-flake-generation:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Up Nix
uses: cachix/install-nix-action@v22
with:
nix_version: latest
extra_nix_config: |
experimental-features = nix-command flakes
- name: Test Flake Generation
run: |
if [ -f flake.nix ]; then
if ! command -v trash-cli &> /dev/null; then
rm flake.nix
else
trash-put flake.nix
fi
fi
nix eval --raw -f templates/flake.template.nix flake > flake.nix
- name: Verify Flake
run: |
if [ -f flake.nix ]; then
echo "flake.nix successfully generated"
else
echo "flake.nix generation failed" && exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run NixOS Tests
name: run tests

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion templates/flake.template.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
with builtins;
let
topretty = import ./scripts/topretty.nix;
topretty = import ../scripts/topretty.nix;
genFlake = thisFile: attrs:
let
standardizedAttrs = attrs // {
Expand Down

0 comments on commit 77fd587

Please sign in to comment.