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

Test Nix functionality #1238

Closed
wants to merge 2 commits into from
Closed

Conversation

alerque
Copy link
Member

@alerque alerque commented Sep 18, 2021

As a follow up to #1231, setup a CI workflow to test that the Nix Flake and other features stay in working order.

@alerque
Copy link
Member Author

alerque commented Sep 18, 2021

@doronbehar This error has be baffled. The default.nx in nixpkgs is only marked as broken for Darwin. I get the same error locally by the way. Any ideas?

error: Package ‘sile-0.11.1-dirty-flake’ in /nix/store/2c1s0cbii0v7gqxyklknp32ya3xa3nr6-source/pkgs/tools/typesetting/sile/default.nix:100 is marked as broken, refusing to evaluate.

@doronbehar
Copy link
Contributor

@doronbehar This error has be baffled. The default.nx in nixpkgs is only marked as broken for Darwin. I get the same error locally by the way. Any ideas?

error: Package ‘sile-0.11.1-dirty-flake’ in /nix/store/2c1s0cbii0v7gqxyklknp32ya3xa3nr6-source/pkgs/tools/typesetting/sile/default.nix:100 is marked as broken, refusing to evaluate.

No idea at all.. Perhaps it would help to print the Nixpkgs revision used, as explained in here:

https://github.com/cachix/install-nix-action/#how-do-i-print-nixpkgs-version-i-have-configured

And perhaps we can print similar stuff to debug why it evaluates as broken:

- name: Print whether nixpkgs' stdenv is darwin
  run: nix-instantiate --eval -E '(import <nixpkgs> {}).stdenv.isDarwin'

This might work and help:

- name: Evaluate nixpkgs' sile.meta
  run: nix eval --json nixpkgs#sile.meta

I also noticed you didn't specify a nix channel with nix_path, do you think it doesn't matter because you use the Nixpkgs flake?

@doronbehar
Copy link
Contributor

I'd try also:

- name: Evaluate nixpkgs' sile.meta
  run: nix eval --json .#sile.meta

when Inside the repository.

@alerque
Copy link
Member Author

alerque commented Sep 20, 2021

Thanks for the ideas. You can see the output of the debug info requested in this test run.

I also noticed you didn't specify a nix channel

I tried it with and without, it just happened to end on "without". It's back, but that isn't the (only?) problem.

Everything else looks as expected, including isDarwin being falsey.

@doronbehar
Copy link
Contributor

I found it, we just had to RTFM:

This command verifies that the flake specified by flake reference flake-url can be evaluated successfully (as detailed below), and that the derivations specified by the flake's checks output can be built successfully.

If the keep-going option is set to true, Nix will keep evaluating as much as it can and report the errors as it encounters them. Otherwise it will stop at the first error.

It failed because it evaluated the derivation for all systems. You have a few options:

  1. Remove the nix flake check
  2. Not use flake-utils.lib.eachDefaultSystem and use: flake-utils.lib.eachSystem [ "supported systems here as a list" ]
  3. Use nix flake check --keep-going but it will still exit with a non-zero code.

@alerque
Copy link
Member Author

alerque commented Sep 21, 2021

Thanks for the research! Is there a definitive list of supported systems we can use and just subtract Darwin?

@alerque
Copy link
Member Author

alerque commented Sep 22, 2021

I found the exact opposite of what I was looking for:

flake-utils.lib.eachSystem (
	flake-utils.lib.defaultSystems ++ ["x86_64-darwin"]
) (system:
	...

What I need is a list subtraction instead of a list concatenation operator.

@alerque
Copy link
Member Author

alerque commented Sep 22, 2021

lib.lists.subtractLists might do the job, or there may be a way to iterate defaultSystems and use stdenv.isDarwin to filter out the ones we don't want (similar to this but for systems not features), but I can't figure out an exact usage that works.

@doronbehar
Copy link
Contributor

lib.lists.subtractLists might do the job, or there may be a way to iterate defaultSystems and use stdenv.isDarwin to filter out the ones we don't want (similar to this but for systems not features), but I can't figure out an exact usage that works.

I guess we can do that, but in general, what value do you see in nix flake check? It only checks that the derivations evaluate.. If I were you, I'd run only nix build -L .#sile and perhaps test that the compiled binary can compile a sample document? Perhaps even that is not needed, since the derivation runs the tests of the build system during build.

@alerque alerque changed the title ci(actions): Test Nix functionality Test Nix functionality Apr 19, 2022
@alerque
Copy link
Member Author

alerque commented Jun 29, 2022

I believe this attempted work was obsoleted by 0ae6771 and we've been test building the flake in CI since before tagging v0.13.0.

@alerque alerque closed this Jun 29, 2022
@alerque alerque added this to the v0.13.0 milestone Jun 29, 2022
@alerque alerque added the ci Continuous integration pipelines label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration pipelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants