Your one-stop-cake-shop for everything Freshly Baked has to offer

refactor!(*): use attributes that match projects #179

merged opened by a.starrysky.fyi targeting main from private/minion/push-smklqylmuplo

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
Labels

None yet.

requested-reviewers

None yet.

tested-working

None yet.

rejected

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:uuyqs6y3pwtbteet4swt5i5y/sh.tangled.repo.pull/3md43bs53df22
+2 -2
Interdiff #2 #3
.tangled/workflows/packetmix-treefmt.yaml

This file has not been changed.

ci.nix

This file has not been changed.

menu/project.nix

This file has not been changed.

nilla.nix

This file has not been changed.

packetmix/homes/coded/games.nix

This file has not been changed.

packetmix/homes/collabora/gtimelog.nix

This file has not been changed.

packetmix/homes/common/helix.nix

This file has not been changed.

packetmix/homes/default.nix

This file has not been changed.

packetmix/homes/minion/misc.nix

This file has not been changed.

packetmix/homes/scriptfs/scriptfs.nix

This file has not been changed.

packetmix/modules/ingredients.nix

This file has not been changed.

packetmix/packages/OpenLinkHub/default.nix

This file has not been changed.

packetmix/packages/beancount-autobean/default.nix

This file has not been changed.

packetmix/packages/beancount-beancount_plugin_utils/default.nix

This file has not been changed.

packetmix/packages/beancount-beancount_share/default.nix

This file has not been changed.

packetmix/packages/beancount-smart_importer/default.nix

This file has not been changed.

packetmix/packages/bluesky-pds/default.nix

This file has not been changed.

packetmix/packages/collabora-gtimelog/default.nix

This file has not been changed.

packetmix/packages/headscale/default.nix

This file has not been changed.

packetmix/packages/josh/default.nix

This file has not been changed.

packetmix/packages/kavita/default.nix

This file has not been changed.

packetmix/packages/lua-multipart/default.nix

This file has not been changed.

packetmix/packages/opensearch/default.nix

This file has not been changed.

packetmix/packages/scriptfs/default.nix

This file has not been changed.

packetmix/packages/treefmt/default.nix

This file has not been changed.

packetmix/packages/vs-launcher/default.nix

This file has not been changed.

packetmix/project.nix

This file has not been changed.

packetmix/systems/corsair/openlinkhub.nix

This file has not been changed.

packetmix/systems/default.nix

This file has not been changed.

packetmix/systems/teal/copyparty.nix

This file has not been changed.

packetmix/systems/teal/fava.nix

This file has not been changed.

packetmix/systems/teal/headscale.nix

This file has not been changed.

packetmix/systems/teal/josh.nix

This file has not been changed.

packetmix/systems/teal/kavita.nix

This file has not been changed.

packetmix/systems/teal/pds.nix

This file has not been changed.

packetmix/systems/wiki/wiki.nix

This file has not been changed.

+2 -2
projects/menu/workspace.josh
··· 1 1 ::LICENSES/ 2 - dependencies/packetmix = :/packetmix 3 2 ::npins/ 4 - ::nilla.nix=projects/nilla.nix 3 + dependencies/packetmix = :/packetmix 5 4 ::workspace.josh.license=projects/menu/workspace.josh.license 5 + ::nilla.nix=projects/nilla.nix 6 6 :/menu
projects/nilla.nix

This file has not been changed.

sprinkles/project.nix

This file has not been changed.

History

4 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
refactor!(*): use attributes that match projects
expand 0 comments
pull request successfully merged
1 commit
expand
refactor!(*): use attributes that match projects
expand 0 comments
1 commit
expand
refactor!(*): use attributes that match projects
expand 0 comments
1 commit
expand
refactor!(*): use attributes that match projects
expand 0 comments