gomod2nix icon indicating copy to clipboard operation
gomod2nix copied to clipboard

Remove usage of filterSource in gomod2nix import

Open ifross89 opened this issue 11 months ago • 0 comments

When running gomod2nix import, the calls to nix-instantiate fail with the following error:

error:
       … while calling the 'filterSource' builtin
         at «string»:2:1:
            1|
            2| builtins.filterSource (name: type: baseNameOf name != ".DS_Store") (
             | ^
            3|   builtins.path {

       … while adding path '/nix/store/aiskw3qix131gdmdjnsywqcqpn7jjr6a-aws-sdk-go_v1.50.27'

       error: path '/nix/store/aiskw3qix131gdmdjnsywqcqpn7jjr6a-aws-sdk-go_v1.50.27' is not valid
/nix/var/nix/profiles/default/bin/nix-instantiate --eval --expr
builtins.filterSource (name: type: baseNameOf name != ".DS_Store") (
  builtins.path {
    path = "/home/ianwork/go/pkg/mod/github.com/aws/[email protected]";
    name = "aws-sdk-go_v1.50.27";
  }
)

When looking at the docs, it appears the 'builtins.path' can take a 'filter', which also seems to be the preferred way: there are warnings about using 'filterSource' in the docs:

https://nixos.org/manual/nix/stable/language/builtins.html#builtins-filterSource

After making this change, I no longer get the previous error on my machine"

ifross89 avatar Mar 21 '24 22:03 ifross89