Importing variables from flake

Say I have two flakes:

  • foo/flake.nix
    {
      description = "Foo";
      inputs.bar.url = "path:/somepath/bar";
      outputs = { self, bar }:
           let in 
           packages.x86_64-linux = bar.somefun { somearg = "somearg"; };
    }
    
  • bar/flake.nix
    {
      description = "Bar";
      outputs = { self, bar }:
           let 
              somefun = { somearg, }: let in { <some body> };
           in 
           packages.x86_64-linux = somefun { somearg = "somearg"; };
    }
    

Unfortunately, it does not work as somefun is not accessible from Foo flake. So my question: is there any way to use somefun in Foo flake? Or in other words: is there any way to use variables from input flake?

1 Like

Bindings declared within a let are never usable from another scope.

You need to use the flakes output mechanisms to “export” it.

1 Like

Well, I hoped for a different answer :frowning: Nevertheless, thank you!