Open vikanezrimaya opened 4 years ago
I marked this as stale due to inactivity. → More info
Might not be urgent, but still important for me.
I marked this as stale due to inactivity. → More info
Does this solve your problem? https://github.com/numtide/flake-utils/tree/master/examples/checks-utils
So what you'd do is compare the attribute type. To be fair more specific utilities for this use case should be defined
I marked this as stale due to inactivity. → More info
checks-utils
isn't a (proper) solution.
The problem is that nix flake check
gives messages like:
warning: unknown flake output 'deploy'
warning: unknown flake output 'lib'
warning: unknown flake output 'homeConfigurations'
Which, given that other tools may define their own flake outputs, is unhelpful. Adding in a form of plugins which lets you extend the flake definition would be ideal.
Using checks
(which checks-utils
definitely helps with) can give you most of what is wanted, though it somewhat muddles the output by having those sanity checks being a part of the general checks
attribute, instead of being in their own section.
(Ran into the issue as I've been trying to migrate my own projects to better make use of nix flake check
)
I feel the same. I believe there is better way instead of hard-coded like this https://github.com/nixos/nix/blob/master/src/nix/flake.cc#L773-L785
I'm patiently waiting https://github.com/NixOS/nix/pull/8892 would be merged but sadly it takes a lot of time than I expected.
Right now
nix flake check
checks sanity of a lot of common flake attributes, but it fails to consider that there are tools that might extend flakes' usability beyond what Nix and NixOS offers - e.g. home-manager. Currently in my personal flake (https://gitlab.com/vikanezrimaya/nix-flake) I use homeManagerModules and homeManagerConfigurations as additional flake outputs for home-manager and an attribute calledactivationPackage
, that for every machine deploys a NixOS configuration and my personal home-manager config. Nix warns me of existence of these attributes as if they're typos. I'd like to somehow extend Nix (maybe with a plugin somehow embedded in a flake?) that will type-check all of the custom attributes I designed.