Previously we effectively had some projects smooshed together. This normally worked fine but for any repeated attributes (e.g. default) both copies would break.
Instead, we now have a new naming scheme:
Projects are given a "name" attribute in their config
# foo/project.nix:
{
config.name = "foo";
}
Any packages, shells, systems or homes defined in that project start with that name followed by a dash
# foo/packages.nix:
{
config.packages.foo-package = {
...
};
config.packages.foo-package2 = {
...
};
}
# bar/packages.nix
{
config.packages.bar-package3 = {
...
};
}
Because of the naming convention, you'll still be able to refer to the package even if another one is named the same
# baz/packages.nix
{
config.packages.baz-package2 = {
...
};
}
For the default package, the project name alone should be used for the attribute
# foo/packages.nix:
{
config.packages.foo = {
...
};
}
To refer to a package elsewhere in the project, you must use the fully qualified name
# foo/packageReference.nix:
{ config, ... }: {
config.something = [
config.packages.foo-package
config.packages.baz-package2
config.packages.foo
config.packages.package # fails - "package" does not exist
config.packages.default # fails - "default" does not exist
];
}
When using patisserie on the command line or from another project, however, there are aliases for your convenience...
patisserie$ nilla build foo-package # works
patisserie$ nilla build package # also works
...but only if the package is unique
patisserie$ nilla build package2 # fails because there ore two packages called package2 (foo-package2 and baz-package2)
patisserie$ nilla build foo-package2 # still works
pasisserie$ nilla build baz-package2 # also still works
When using Josh to clone down part of the monorepo, only the current project will be aliased, even if other pieces are included as dependencies...
foo$ ls dependencies/
bar baz
foo$ nilla build foo-package # works
foo$ nilla build package # works
foo$ nilla build package2 # works - referring to foo-package2
foo$ nilla build bar-package2 # works - you can still use the full name of a package
foo$ nilla build package3 # fails - even though bar-package3 doesn't conflict, it isn't aliased in the foo project
...you may also use the default attribute to refer to the package with the name of the cloned project...
foo$ nilla build foo # works
foo$ nilla build default # works
foo$ nilla build # works - since as nilla by default uses "default" if you don't specify an attribute