Conversation
|
hi @vic 👋 i'm trying to play around with ❯ nix repl
Nix 2.31.3
Type :? for help.
nix-repl> sources = import ./lon.nix
nix-repl> sources
{
ndg = "/nix/store/l115h1xyaacyaac0j08id7srd2wwpjl1-source";
nixpkgs = "/nix/store/s08d9f5avsqs69r1y2gyivxgfwv4a88c-source";
}
nix-repl> with-inputs = import ./with-inputs.nix sources { }
nix-repl> outputs = inputs: { }
nix-repl> (with-inputs outputs).inputs
{
__functor = «lambda __functor @ /home/aaron/nix/framework/with-inputs.nix:136:5»;
ndg = «error: expected a set but found a string with context: "/nix/store/l115h1xyaacyaac0j08id7srd2wwpjl1-source"»;
nixpkgs = «error: expected a set but found a string with context: "/nix/store/s08d9f5avsqs69r1y2gyivxgfwv4a88c-source"»;
self = { ... };
}any advice you can provide would be greatly appreciated 🙇♂️ |
|
Hey, @aanderse. I did not know of Lon, thanks for pointing to it. From your code, looks like sources = mapAttrs (_: outPath: { inherit outPath; }) (import ./lon.nix);I will also try to add another example at with-inputs using lon, we currently have examples for npins, unflake, and nixlock. |
|
Yep, with-inputs sources follows outputsFnTry using: with-inputs sources { } lib.idthat would be like |
|
thanks for your help so far @vic - and apologies for the delay, i am traveling so a little bit slower to respond than i would like i didn't know about if i have a dependency on flake |
Not necessarily, that is the point of not using flakes (for me), I don't want all inputs of my dependencies to be downloaded, for example, some flakes like So if I have a pinned So if you have no flake with-inputs sources { a.inputs.b.follows = ""; } outputs;that one explicitly disables |
|
right, understood. but my question was about scenarios where flake |
|
Oh yes, in that case # follows.nix
inputs:
{
a.inputs = {
b.follows = "b-with-other-name-at-sources";
# or directly implement a shim for it
b.lib = n: n + 1;
# or provide an alternative outPath (eg, another fetcher)
b = if pathExists /my/b then { outPath = /my/b; } else inputs.nixpkgs.lib.fetchFromFoo { ... };
# or adapt the `b` from source
b = source: source // { rev = "HEAD"; };
};
}In my personal infra I use |
|
amazing. i want to try and port my config to this. i will do so once i get a chance. |
|
i am very happy to recommend this project. great work @vic ! |

with-inputs is related (alternative to nix flakes) in the sense that it allows flake-like inputs for projects using npins or other non-flake locking mechanism.