hercules-ci / gitignore.nix

Nix functions for filtering local git sources
The Unlicense
242 stars 19 forks source link

Can't use my nixpkgs #62

Closed deemp closed 1 year ago

deemp commented 1 year ago

It seems like it doesn't work with modern nixpkgs. At least when I use follows, I get

nix-repl> inputs.gitignore.lib.gitignoreSource
error: attribute 'lib' missing

       at /nix/store/qjw6nq34h4s78573nh70gsl2a2qz76mz-source/flake.nix:5:33:

            4|   outputs = { self, nixpkgs }: {
            5|     lib = import ./default.nix {
             |                                 ^
            6|       inherit (nixpkgs) lib;

       … while evaluating the attribute 'gitignore.lib.gitignoreSource'

       at /nix/store/qjw6nq34h4s78573nh70gsl2a2qz76mz-source/default.nix:36:10:

           35|     ;
           36|   inherit
             |          ^
           37|     gitignoreSource

Could you please fix it, @roberth?

roberth commented 1 year ago

I can't reproduce this with

$ cd path/to/gitignore.nix/
$ # update to latest master
$ nix flake lock --recreate-lock-file
warning: updating lock file '/home/user/h/gitignore.nix/flake.lock':
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2b71ddd869ad592510553d09fe89c9709fa26b2b' (2021-09-28)
  → 'github:NixOS/nixpkgs/074da18a72269cc5a6cf444dce42daea5649b2fe' (2022-10-24)
warning: Git tree '/home/user/h/gitignore.nix' is dirty
$ echo 'builtins.getFlake ("git+file://" + toString ./.)' >repl.nix
$ nix repl repl.nix
nix-repl> (lib.gitignoreSource ./.).outPath
"/nix/store/7lm233wbmsrqn1fsbb80wqk7acxxpcdr-source"

Maybe the lock file was corrupted; perhaps by a merge conflict or rebase? Did you try nix flake lock --recreate-lock-file? If that doesn't solve the problem, I'll need a minimal but complete reproducing example.

roberth commented 1 year ago

Also, are you sure you need this? It seems that you're using flakes, so unless you're using path-based flakes with repos inside, you shouldn't need gitignore.nix.

deemp commented 1 year ago

Thanks! I figured out I wrongly used follows