-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hi, I started looking into organist and am pretty new. Here's my very simple project.ncl atm:
let inputs = import "./nickel.lock.ncl" in
let organist = inputs.organist in
{
shells = organist.shells.Bash,
shells.build = {
packages = {
gradle = organist.import_nix "nixpkgs#gradle",
jdk21 = organist.import_nix "nixpkgs#jdk21",
},
},
shells.dev = {
packages.hello = organist.import_nix "nixpkgs#hello",
},
}
| organist.OrganistExpression
I thought it was interesting for each package you need to define blah = organist.import_nix "nixpkgs#blah', for every single package which reduces readability and maintainability in projects with lots of dependencies to manage. Normally in nix we use with, so I looked a bit and found this article which lists some problems with how nix's with works: https://www.tweag.io/blog/2023-01-24-nix-with-with-nickel/
It was a good read, but it didn't really offer any insights on what we should do to eliminate some of this cruft. I think a good compromise would be something that looks like this instead:
...
{
shells = organist.shells.Bash,
shells.build = {
packages = {
nixpkgs = {
gradle, jdk21,
},
other_cachix_server = {
random_lib, random_lib2,
},
},
},
...
}
then we can define multiple sources and separate the resolving mechanism from the dependency declarations. Then the organist.import_nix resolver can be applied to all pkgs associates with the "nixpkgs" resolver. This will reduce boilerplate and allow external caches. In particular in the future I plan to maintain a repo separate from nixpkgs which packages java dependencies using nickel/nix instead of gradle/maven that can be use with organist.
Let me know if this makes sense or if I'm missing something that already exists.