Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add github action to evaluate nixos options #360876

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/nixos-options.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Evaluate NixOS options"

permissions:
contents: read

on:
pull_request_target:
paths:
- 'nixos/**'

jobs:
nixos:
name: nixos-options
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# pull_request_target checks out the base branch by default
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
with:
# explicitly enable sandbox
extra_nix_config: sandbox = true
- name: Building NixOS options
run: |
nix-build ./nixos/release.nix \
-I ./. \
--option restrict-eval true \
--option allow-import-from-derivation false \
-A options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what that builds:

options = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux;

I do wish that line were hoisted here, rather than being referred to as "option". It's more clear that we're building the NixOS manual's JSON representation as a proxy for loading all the modules and evaluating them.

Known things it misses: evaluating all the expressions that trigger when the module's enable option is set, for instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NixOS manual's JSON representation as a proxy

Isn't that practically the same as building the nixos manual? We already have a gh action for it I believe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnRTitor there is one difference I believe. We could have optionsJSON also in staging because it doesn't require stdenv, whereas the manual might causes long rebuilds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but can we also build the aarch64-linux ones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure if this is possible on x86_64. Does this make a big difference?

Loading