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

Violation of the flake schema #1525

Closed
Gerg-L opened this issue May 15, 2024 · 7 comments
Closed

Violation of the flake schema #1525

Gerg-L opened this issue May 15, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Gerg-L
Copy link

Gerg-L commented May 15, 2024

Was trying to demonstrate to a newer nix user how to figure what method to use for configuration of a nix project without documentation (all of them) and nix flake show does not work on your flake making this much harder

$ nix flake show github:nix-community/nixvim
github:nix-community/nixvim/6be28a941b39a7cbe4d34b577bd095548f5d1e15?narHash=sha256-3kL4E0Ff9TCvRNxwINzklupY7dcTpl89jTg0PGfBCJc%3D
├───checks
│   ├───aarch64-darwin
error: 'checks.aarch64-darwin' is not an attribute set
@Gerg-L Gerg-L added the bug Something isn't working label May 15, 2024
@Gerg-L
Copy link
Author

Gerg-L commented May 15, 2024

# Test that all packages build fine when running `nix flake check`.
checks = config.packages;

found the culprit

@MattSturgeon
Copy link
Member

The wiki documents the schema as

checks."<system>"."<name>" = derivation;

Which is what the code you linked should be doing.

config.packages is the (per-system) result of calling docs/default.nix, which is an attr set containing options-json, man-docs, & docs.

Which should result in the flake output:

checks.<system>
  - options-json
  - man-docs
  - docs

@Gerg-L
Copy link
Author

Gerg-L commented May 16, 2024

So the packages. Output is wrong too

@traxys
Copy link
Member

traxys commented May 16, 2024

This seems strange, because for example it is correct for x86_64-linux:

nix repl .
nix-repl> :lf .
nix-repl> builtins.typeOf checks.x86_64-linux
"set"

I am not using a darwin machine, so I am not able to show the schema for it. What machine are you using?

@traxys
Copy link
Member

traxys commented May 16, 2024

The error I encounter is:

nix flake show
warning: Git tree '/home/traxys/Documents/nixvim' is dirty
git+file:///home/traxys/Documents/nixvim
├───allSystems: unknown
├───checks
│   ├───aarch64-darwin
error:
       … while evaluating the attribute 'optionalValue.value'
         at /nix/store/pfc56yr7y3wflvbgnrpscf2n1m4j3xd7-source/lib/modules.nix:856:5:
          855|
          856|     optionalValue =
             |     ^
          857|       if isDefined then { value = mergedValue; }

       … while evaluating a branch condition
         at /nix/store/pfc56yr7y3wflvbgnrpscf2n1m4j3xd7-source/lib/modules.nix:857:7:
          856|     optionalValue =
          857|       if isDefined then { value = mergedValue; }
             |       ^
          858|       else {};

       … while evaluating definitions from `/nix/store/br885sqy62q1bblwi2bslcfg2193ly75-source/modules/transposition.nix':

       … while evaluating the option `perSystem.aarch64-darwin.checks':

       … while evaluating definitions from `/nix/store/2c7rsdzy5dvz0iqps6qdw3ybvbakfk51-source/flake-modules/packages.nix, via option perSystem':

       … while evaluating the option `perSystem.aarch64-darwin.packages':

       … while evaluating definitions from `/nix/store/2c7rsdzy5dvz0iqps6qdw3ybvbakfk51-source/flake-modules/packages.nix, via option perSystem':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: cannot build '/nix/store/m8xlvjq8j0ggqw885q9rcskxydqmrlir-nixpkgs-nixvim-doc.drv^out' during evaluation because the option 'allow-import-from-derivation' is disabled

Which is a known issue #1154 but there is not much we can do here, we would need something like NixOS/nix#6530

@Gerg-L
Copy link
Author

Gerg-L commented May 16, 2024

nixvim/docs/default.nix

Lines 7 to 17 in 72ff148

pkgsDoc =
import
(pkgs.applyPatches {
name = "nixpkgs-nixvim-doc";
src = pkgs.path;
patches = [ ./either_recursive.patch ];
})
{
inherit (pkgs) system;
config.allowUnfree = true;
};

here's the IFD

@Gerg-L Gerg-L closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
@traxys
Copy link
Member

traxys commented May 17, 2024

Yeah we know about it, but the alternative is not desirable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants