BirdeeHub / nixCats-nvim

A framework for configuring neovim like neovim via nix, and having multiple config profiles. (with example config(s) and in-editor help)
https://nixcats.org/nixCats_installation.html
MIT License
267 stars 11 forks source link

nix flake check does not work #19

Closed chrishrb closed 7 months ago

chrishrb commented 7 months ago

I have the following error if I try to run the nix flake check command:

nix flake check .

warning: creating lock file '/Users/chrishrb/dev/home/bla/flake.lock'
warning: unknown flake output 'utils'
warning: unknown flake output 'dependencyOverlays'
warning: unknown flake output 'categoryDefinitions'
warning: unknown flake output 'packageDefinitions'
warning: unknown flake output 'baseBuilder'
warning: unknown flake output 'customPackager'
error:
       … while checking flake output 'overlays'

         at /nix/store/na7sykizsgkzh9i3wc8m8pz5xfqib2rv-source/lib.nix:39:17:

           38|               {
           39|                 ${key} = (attrs.${key} or { })
             |                 ^
           40|                   // { ${system} = ret.${key}; };

       … while checking the overlay 'overlays.x86_64-linux'

         at /nix/store/na7sykizsgkzh9i3wc8m8pz5xfqib2rv-source/lib.nix:40:24:

           39|                 ${key} = (attrs.${key} or { })
           40|                   // { ${system} = ret.${key}; };
             |                        ^
           41|               }

       error: overlay is not a function, but a set instead

To reproduce:

mkdir nix-cats && cd nix-cats
nix flake init -t github:BirdeeHub/nixCats-nvim
nix flake check .
BirdeeHub commented 7 months ago

Hmmmm....

So, it appears this is because the overlays from nixCats are at overlays.${system}.packageName

I will need to look into this, but it's possible that this is simply due to the need to use flake-utils.eachSystem?

I actually did not know about this command

I'm not at home right now. I think if you delete the overlays output it should pass?

BirdeeHub commented 7 months ago

hmmmm Yep its because the overlays are output from within flake-utils.

The overlays just contain the final package. they are at overlays.${system}.packagename instead of at overlays.packagename

I can rework that output. I am not sure many people are using it, as its usually easier to just pass the package where you want yourself. Seems worthwile, hopefully I can do it in a way that isnt messy.

BirdeeHub commented 7 months ago

this is currently how the overlays output works. Very simple.

and where it gets exported

the issue is, these functions assume you already told the builder what system it was building for....

So it gets output behind flake-utils so that its outputs.overlays.${pkgs.system}.packagename

So to change it, I would need to do a little bit of messing around.

I dont want to break anything other than the overlays output when I do so, so that people can just put the 1 new line into their flake.nix for the overlays output and be done with it when i make the change but we shall see what ends up being cleanest, it might be a couple lines instead idk

TBH i might want to just delete the output altogether or make it do more things because right now it doesnt really make sense why people cant just make an overlay with the package in it if they wanted to.

chrishrb commented 7 months ago

yes, as you mentioned for me it's no problem to just delete this line because I don‘t use overlays here and then everything works just fine 👍

BirdeeHub commented 7 months ago
    # choose your package for devShell
    # and add whatever else you want in it.
    devShells = {
      default = pkgs.mkShell {
        name = defaultPackageName;
        packages = [ (nixCatsBuilder defaultPackageName) ];
        inputsFrom = [ ];
        shellHook = ''
        '';
      };
    };

I also need to change the devShell output to the above. because the current one is deprecated, fyi

the older one was

    # choose your package for devShell
    # and add whatever else you want in it.
    devShell = pkgs.mkShell {
      name = defaultPackageName;
      packages = [ (nixCatsBuilder defaultPackageName) ];
      inputsFrom = [ ];
      shellHook = ''
      '';
    };

Currently it does technically still pass tho haha

BirdeeHub commented 7 months ago

https://github.com/BirdeeHub/nixCats-nvim/tree/overlaysCheckFix

I have a working utils.makeOverlays function and a (maybe working?) depreciation warning for the old utils.mkOverlays one in this branch.

Still need to update the help and stuff, and test that I actually did the depreciation warning correctly before I merge it, but the main flake and the templates are all updated and work with nix flake check . in that branch.

Will close this issue when I merge it sometime in the next day or 2.

BirdeeHub commented 7 months ago

Lmao I think I made someone mad cause someone unstarred. That's ok. It's a better project now that that issue is fixed.