nix-community / nix-unit

Unit testing for Nix code [maintainer=@adisbladis]
https://nix-community.github.io/nix-unit/
GNU General Public License v3.0
64 stars 7 forks source link

Support for Lix? #156

Closed Ma27 closed 1 month ago

Ma27 commented 1 month ago

Trying to inject Lix into nix-unit from nixpkgs (2.23.0 from ac2ff9a5d346dd2c5962ea4e6157046041135180) fails like this:

Found pkg-config: YES (/nix/store/02vzklfgfpaf457rq927fq3jj5hn133f-pkg-config-wrapper-0.29.2/bin/pkg-config) 0.29.2
Found CMake: /nix/store/yzi080r2c1zn2jzrhcfdv7dmr92yw07l-cmake-3.29.6/bin/cmake (3.29.6)
Run-time dependency nix-main found: NO (tried pkgconfig and cmake)

meson.build:6:15: ERROR: Dependency "nix-main" not found, tried pkgconfig and cmake

A full log can be found at /build/source/build/meson-logs/meson-log.txt

The use-case I have is that running tests from a flake of mine fails like this:

warning: unknown setting 'allowed-users'
warning: unknown setting 'extra-allowed-users'
warning: unknown setting 'trusted-users'
warning: `--gc-roots-dir' not specified
warning: Git tree '/home/ma27/Projects/infra' is dirty
error:
       … while updating the lock file of flake 'git+file:///home/ma27/Projects/infra'

       … while updating the flake input 'hydra'

       … while updating the flake input 'hydra/nix-eval-jobs'

       error: cannot update unlocked flake input 'hydra/nix-eval-jobs' in pure mode

The input is correctly locked, however it's declared like this:

{
  inputs = {
    /* ... */
    hydra.inputs.nix-eval-jobs.inputs.flake-parts.follows = "flake-parts";
    hydra.inputs.nix-eval-jobs.inputs.lix.follows = "lix";
    hydra.inputs.nix-eval-jobs.inputs.nix-github-actions.follows = "authentik-nix/poetry2nix/nix-github-actions";
    hydra.inputs.nix-eval-jobs.inputs.nixpkgs.follows = "nixpkgs";
    hydra.inputs.nix-eval-jobs.inputs.treefmt-nix.follows = "nix-direnv/treefmt-nix";
  };
}

Recursive follows isn't in Nix 2.23, so this is most likely the issue here.

adisbladis commented 1 month ago

It's not tenable to maintain a code base that supports both. The changes to the C++ API has been significant in Lix.

I've forked nix-unit into lix-unit here https://github.com/adisbladis/lix-unit.

adisbladis commented 1 month ago

Documented lix support in readme https://github.com/nix-community/nix-unit/commit/d5e5e7f1827a0deb213e5f07b71660b76b60caee