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
+232 -82
Diff #3
+1 -1
.tangled/workflows/packetmix-treefmt.yaml
··· 42 set -e 43 44 treefmt=$(nix build \ 45 - -f ./ci.nix packages.treefmt.result.x86_64-linux \ 46 --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 47 --eval-store auto \ 48 --show-trace --print-out-paths)
··· 42 set -e 43 44 treefmt=$(nix build \ 45 + -f ./ci.nix packages.packetmix-treefmt.result.x86_64-linux \ 46 --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 47 --eval-store auto \ 48 --show-trace --print-out-paths)
+1 -1
ci.nix
··· 3 # SPDX-License-Identifier: MIT 4 5 let 6 - base = import ./nilla.nix; 7 project = base.extend { 8 modules = [ 9
··· 3 # SPDX-License-Identifier: MIT 4 5 let 6 + base = (import ./nilla.nix).unalias; 7 project = base.extend { 8 modules = [ 9
+4 -4
menu/project.nix
··· 5 { config, lib }: 6 { 7 config = { 8 - packages.default = config.packages.menu; 9 packages.menu = { 10 systems = [ 11 "x86_64-linux" ··· 40 }; 41 }; 42 43 - shells.default = config.shells.menu; 44 shells.menu = { 45 systems = [ "x86_64-linux" ]; 46 ··· 62 bacon 63 config.inputs.nilla-cli.result.packages.nilla-cli.result.${stdenv.hostPlatform.system} 64 config.inputs.nixpkgs.result.${stdenv.hostPlatform.system}.deadnix 65 - # config.packages.nilla-fmt.result.${stdenv.hostPlatform.system} 66 - # config.packages.treefmt.result.${stdenv.hostPlatform.system} 67 (config.inputs.npins.result { 68 inherit pkgs; 69 inherit (stdenv.hostPlatform) system;
··· 5 { config, lib }: 6 { 7 config = { 8 + name = "menu"; 9 + 10 packages.menu = { 11 systems = [ 12 "x86_64-linux" ··· 41 }; 42 }; 43 44 shells.menu = { 45 systems = [ "x86_64-linux" ]; 46 ··· 62 bacon 63 config.inputs.nilla-cli.result.packages.nilla-cli.result.${stdenv.hostPlatform.system} 64 config.inputs.nixpkgs.result.${stdenv.hostPlatform.system}.deadnix 65 + config.packages.packetmix-nilla-fmt.result.${stdenv.hostPlatform.system} 66 + config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system} 67 (config.inputs.npins.result { 68 inherit pkgs; 69 inherit (stdenv.hostPlatform) system;
+64 -5
nilla.nix
··· 26 ( 27 { config, ... }: 28 { 29 - config.inputs = builtins.mapAttrs (name: value: { 30 - src = value; 31 - settings = (settings config).${name} or config.lib.constants.undefined; 32 - }) pins; 33 } 34 ) 35 ]; ··· 38 inherit nilla pins; # pins needs to be a static arg for us to import from it... 39 }; 40 }; 41 in 42 - result.config 43 // { 44 extend = result.extend; 45 }
··· 26 ( 27 { config, ... }: 28 { 29 + config.inputs = 30 + config.lib.attrs.generate (builtins.filter (name: name != "__functor") (builtins.attrNames pins)) 31 + (name: { 32 + src = pins.${name}; 33 + settings = (settings config).${name} or config.lib.constants.undefined; 34 + }); 35 + } 36 + ) 37 + ( 38 + { config, ... }: 39 + { 40 + options.name = config.lib.options.create { 41 + description = "The names of all included subprojects"; 42 + type = config.lib.types.coerce config.lib.types.string (val: [ val ]) ( 43 + config.lib.types.list.of config.lib.types.string 44 + ); 45 + }; 46 } 47 ) 48 ]; ··· 51 inherit nilla pins; # pins needs to be a static arg for us to import from it... 52 }; 53 }; 54 + 55 + aliases = 56 + let 57 + ## Get all attrs with a prefix, returning a new attrset without that prefix. For example: 58 + ## selectPrefixedAttrs "abcd" { abcdefg = "adcdefg"; abcd = "abcd"; different = "different"; fooabcd = "fooabcd"; } 59 + ## -> { efg = "abcdefg"; "" = "abcd"; } 60 + selectPrefixedAttrs = 61 + lib: prefix: attrs: 62 + let 63 + attrNames = builtins.attrNames attrs; 64 + validNames = builtins.filter (lib.strings.hasPrefix prefix) attrNames; 65 + unprefixedNames = map (lib.strings.removePrefix prefix) validNames; 66 + in 67 + lib.attrs.generate unprefixedNames (name: attrs.${prefix + name}); 68 + 69 + ## Given a list of attrsets, return a new attrset where any attributes that conflict with explicitly-specified attributes are removed, anything which is already defined is removed, and everything else is merged 70 + mergeNonduplicateAttrs = 71 + lib: attrsets: conflict: 72 + let 73 + attrCounts = builtins.foldl' ( 74 + acc: elem: acc // (builtins.mapAttrs (name: _: (acc.${name} or 0) + 1) elem) 75 + ) { } attrsets; 76 + preservedAttrNames = builtins.filter (name: attrCounts.${name} == 1) ( 77 + builtins.attrNames attrCounts 78 + ); 79 + nonconflictingPreservedAttrNames = builtins.filter ( 80 + name: !(builtins.hasAttr name conflict) 81 + ) preservedAttrNames; 82 + updatedAttrset = builtins.foldl' (acc: elem: acc // elem) { } attrsets; 83 + in 84 + lib.attrs.generate nonconflictingPreservedAttrNames (name: updatedAttrset.${name}); 85 + aliased = 86 + config: old: 87 + mergeNonduplicateAttrs config.lib (builtins.map ( 88 + name: selectPrefixedAttrs config.lib "${name}-" old 89 + ) config.name) old; 90 + in 91 + { 92 + homes = aliased result.config result.config.homes; 93 + packages = aliased result.config result.config.packages; 94 + shells = aliased result.config result.config.shells; 95 + systems.nixos = aliased result.config result.config.systems.nixos; 96 + }; 97 in 98 + (result.config.lib.attrs.mergeRecursive aliases result.config) 99 // { 100 extend = result.extend; 101 + unalias = result.config // { 102 + extend = result.extend; 103 + }; 104 }
+1 -1
packetmix/homes/coded/games.nix
··· 4 5 { project, ... }: 6 { 7 - home.packages = [ project.packages.vs-launcher.result."x86_64-linux" ]; 8 }
··· 4 5 { project, ... }: 6 { 7 + home.packages = [ project.packages.packetmix-vs-launcher.result."x86_64-linux" ]; 8 }
+1 -1
packetmix/homes/collabora/gtimelog.nix
··· 6 { project, system, ... }: 7 { 8 home.packages = [ 9 - project.packages.collabora-gtimelog.result.${system} 10 ]; 11 12 clicks.storage.impermanence.persist.directories = [
··· 6 { project, system, ... }: 7 { 8 home.packages = [ 9 + project.packages.packetmix-collabora-gtimelog.result.${system} 10 ]; 11 12 clicks.storage.impermanence.persist.directories = [
+1 -1
packetmix/homes/common/helix.nix
··· 12 programs.helix = { 13 enable = true; 14 15 - package = project.packages.helix.result.${system}; 16 17 settings = { 18 editor = {
··· 12 programs.helix = { 13 enable = true; 14 15 + package = project.packages.packetmix-helix.result.${system}; 16 17 settings = { 18 editor = {
+4 -4
packetmix/homes/default.nix
··· 4 # SPDX-License-Identifier: MIT 5 6 { 7 - config.homes."maya:x86_64-linux" = { 8 modules = [ 9 { 10 home.stateVersion = "24.11"; ··· 25 system = "x86_64-linux"; 26 }; 27 }; 28 - config.homes."minion:x86_64-linux" = { 29 modules = [ 30 { 31 home.stateVersion = "24.11"; ··· 46 system = "x86_64-linux"; 47 }; 48 }; 49 - config.homes."minion@redhead:x86_64-linux" = { 50 modules = [ 51 { 52 home.stateVersion = "24.11"; ··· 68 system = "x86_64-linux"; 69 }; 70 }; 71 - config.homes."coded:x86_64-linux" = { 72 modules = [ 73 { 74 home.stateVersion = "25.05";
··· 4 # SPDX-License-Identifier: MIT 5 6 { 7 + config.homes."packetmix-maya:x86_64-linux" = { 8 modules = [ 9 { 10 home.stateVersion = "24.11"; ··· 25 system = "x86_64-linux"; 26 }; 27 }; 28 + config.homes."packetmix-minion:x86_64-linux" = { 29 modules = [ 30 { 31 home.stateVersion = "24.11"; ··· 46 system = "x86_64-linux"; 47 }; 48 }; 49 + config.homes."packetmix-minion@redhead:x86_64-linux" = { 50 modules = [ 51 { 52 home.stateVersion = "24.11"; ··· 68 system = "x86_64-linux"; 69 }; 70 }; 71 + config.homes."packetmix-coded:x86_64-linux" = { 72 modules = [ 73 { 74 home.stateVersion = "25.05";
+6 -1
packetmix/homes/minion/misc.nix
··· 2 # 3 # SPDX-License-Identifier: MIT 4 5 - { pkgs, ... }: 6 { 7 # Miscellaneous package installs that aren't really big enough to get their own folder 8 # Don't place any config that isn't directly adding lines to home.packages or clicks.storage.impermanence.persist.directories here...
··· 2 # 3 # SPDX-License-Identifier: MIT 4 5 + { 6 + project, 7 + pkgs, 8 + system, 9 + ... 10 + }: 11 { 12 # Miscellaneous package installs that aren't really big enough to get their own folder 13 # Don't place any config that isn't directly adding lines to home.packages or clicks.storage.impermanence.persist.directories here...
+3 -1
packetmix/homes/scriptfs/scriptfs.nix
··· 17 "-${pkgs.coreutils}/bin/ln -fns %t %S/run" # Useful for some dependents (jujutsu) which cannot expand %t themselves, but prefixed with - to stop a failure bringing down scriptfs 18 "${pkgs.coreutils}/bin/mkdir -p %t/scriptfs" 19 ]; 20 - ExecStart = "${project.packages.scriptfs.result.${system}}/bin/scriptfs -f /nix/store %t/scriptfs"; 21 }; 22 }; 23 }
··· 17 "-${pkgs.coreutils}/bin/ln -fns %t %S/run" # Useful for some dependents (jujutsu) which cannot expand %t themselves, but prefixed with - to stop a failure bringing down scriptfs 18 "${pkgs.coreutils}/bin/mkdir -p %t/scriptfs" 19 ]; 20 + ExecStart = "${ 21 + project.packages.packetmix-scriptfs.result.${system} 22 + }/bin/scriptfs -f /nix/store %t/scriptfs"; 23 }; 24 }; 25 }
+6
packetmix/modules/ingredients.nix
··· 24 "common" 25 ] 26 ++ (if ingredientExists submodule.name then [ submodule.name ] else [ ]) 27 ++ ( 28 let 29 homeNames = builtins.attrNames submodule.config.homes;
··· 24 "common" 25 ] 26 ++ (if ingredientExists submodule.name then [ submodule.name ] else [ ]) 27 + ++ ( 28 + if ingredientExists (nilla.lib.strings.removePrefix "packetmix-" submodule.name) then 29 + [ (nilla.lib.strings.removePrefix "packetmix-" submodule.name) ] 30 + else 31 + [ ] 32 + ) 33 ++ ( 34 let 35 homeNames = builtins.attrNames submodule.config.homes;
+1 -1
packetmix/packages/OpenLinkHub/default.nix
··· 2 # 3 # SPDX-License-Identifier: MIT 4 { 5 - config.packages.openlinkhub = { 6 systems = [ "x86_64-linux" ]; 7 package = 8 { openlinkhub, ... }:
··· 2 # 3 # SPDX-License-Identifier: MIT 4 { 5 + config.packages.packetmix-openlinkhub = { 6 systems = [ "x86_64-linux" ]; 7 package = 8 { openlinkhub, ... }:
+1 -1
packetmix/packages/beancount-autobean/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.beancount-autobean = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-beancount-autobean = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
+1 -1
packetmix/packages/beancount-beancount_plugin_utils/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.beancount-beancount_plugin_utils = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-beancount-beancount_plugin_utils = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
+2 -2
packetmix/packages/beancount-beancount_share/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.beancount-beancount_share = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 { ··· 25 26 propagatedBuildInputs = [ 27 python3.pkgs.beancount 28 - config.packages.beancount-beancount_plugin_utils.result.${stdenv.hostPlatform.system} 29 ]; 30 31 buildInputs = [
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-beancount-beancount_share = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 { ··· 25 26 propagatedBuildInputs = [ 27 python3.pkgs.beancount 28 + config.packages.packetmix-beancount-beancount_plugin_utils.result.${stdenv.hostPlatform.system} 29 ]; 30 31 buildInputs = [
+1 -1
packetmix/packages/beancount-smart_importer/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.beancount-smart_importer = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-beancount-smart_importer = { 8 systems = [ "x86_64-linux" ]; 9 package = 10 {
+3 -3
packetmix/packages/bluesky-pds/default.nix
··· 5 6 { config, ... }: 7 { 8 - config.packages.bluesky-atproto-pds = { 9 systems = [ "x86_64-linux" ]; 10 package = 11 { ··· 74 ''; 75 }); 76 }; 77 - config.packages.bluesky-pds = { 78 systems = [ "x86_64-linux" ]; 79 package = 80 { ··· 88 rm -r $atproto_pds_dir 89 mkdir -p $atproto_pds_dir 90 ln -s ${ 91 - config.packages.bluesky-atproto-pds.result.${stdenv.hostPlatform.system} 92 }/lib $atproto_pds_dir/node_modules 93 ''; 94 };
··· 5 6 { config, ... }: 7 { 8 + config.packages.packetmix-bluesky-atproto-pds = { 9 systems = [ "x86_64-linux" ]; 10 package = 11 { ··· 74 ''; 75 }); 76 }; 77 + config.packages.packetmix-bluesky-pds = { 78 systems = [ "x86_64-linux" ]; 79 package = 80 { ··· 88 rm -r $atproto_pds_dir 89 mkdir -p $atproto_pds_dir 90 ln -s ${ 91 + config.packages.packetmix-bluesky-atproto-pds.result.${stdenv.hostPlatform.system} 92 }/lib $atproto_pds_dir/node_modules 93 ''; 94 };
+1 -1
packetmix/packages/collabora-gtimelog/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.collabora-gtimelog = { 8 systems = [ "x86_64-linux" ]; 9 10 settings.pkgs = config.inputs.nixos-prev.result;
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-collabora-gtimelog = { 8 systems = [ "x86_64-linux" ]; 9 10 settings.pkgs = config.inputs.nixos-prev.result;
+1 -1
packetmix/packages/headscale/default.nix
··· 5 6 { config, ... }: 7 { 8 - config.packages.headscale = { 9 systems = [ "x86_64-linux" ]; 10 package = 11 {
··· 5 6 { config, ... }: 7 { 8 + config.packages.packetmix-headscale = { 9 systems = [ "x86_64-linux" ]; 10 package = 11 {
+1 -1
packetmix/packages/josh/default.nix
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 - config.packages.josh = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 { stdenv, rustPlatform, ... }:
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 + config.packages.packetmix-josh = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 { stdenv, rustPlatform, ... }:
+1 -1
packetmix/packages/kavita/default.nix
··· 3 # 4 # SPDX-License-Identifier: MIT 5 { 6 - config.packages.kavita = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 {
··· 3 # 4 # SPDX-License-Identifier: MIT 5 { 6 + config.packages.packetmix-kavita = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 {
+1 -1
packetmix/packages/lua-multipart/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.lua-multipart = { 8 systems = [ "x86_64-linux" ]; 9 10 package =
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-lua-multipart = { 8 systems = [ "x86_64-linux" ]; 9 10 package =
+1 -1
packetmix/packages/opensearch/default.nix
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 - config.packages.opensearch = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 {
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 + config.packages.packetmix-opensearch = { 7 systems = [ "x86_64-linux" ]; 8 package = 9 {
+1 -1
packetmix/packages/scriptfs/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.scriptfs = { 8 systems = [ "x86_64-linux" ]; 9 10 package =
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-scriptfs = { 8 systems = [ "x86_64-linux" ]; 9 10 package =
+3 -3
packetmix/packages/treefmt/default.nix
··· 4 5 { config, ... }: 6 { 7 - config.packages.treefmt = { 8 systems = [ "x86_64-linux" ]; 9 10 package = ··· 25 }; 26 }; 27 28 - config.packages.nilla-fmt = { 29 systems = [ "x86_64-linux" ]; 30 31 package = ··· 33 stdenv.mkDerivation { 34 name = "nilla-fmt"; 35 36 - src = config.packages.treefmt.result.${stdenv.hostPlatform.system}; 37 38 dontBuild = true; 39
··· 4 5 { config, ... }: 6 { 7 + config.packages.packetmix-treefmt = { 8 systems = [ "x86_64-linux" ]; 9 10 package = ··· 25 }; 26 }; 27 28 + config.packages.packetmix-nilla-fmt = { 29 systems = [ "x86_64-linux" ]; 30 31 package = ··· 33 stdenv.mkDerivation { 34 name = "nilla-fmt"; 35 36 + src = config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system}; 37 38 dontBuild = true; 39
+1 -1
packetmix/packages/vs-launcher/default.nix
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 - config.packages.vs-launcher = { 7 systems = [ "x86_64-linux" ]; 8 9 package =
··· 3 # SPDX-License-Identifier: MIT 4 { config, ... }: 5 { 6 + config.packages.packetmix-vs-launcher = { 7 systems = [ "x86_64-linux" ]; 8 9 package =
+7 -9
packetmix/project.nix
··· 19 ]; 20 21 config = { 22 - packages.allNixOSSystems = { 23 systems = [ "x86_64-linux" ]; 24 25 package = ··· 40 }; 41 }; 42 43 - packages.allHomes = { 44 systems = [ "x86_64-linux" ]; 45 46 package = ··· 62 }; 63 }; 64 65 - packages.helix = { 66 systems = [ "x86_64-linux" ]; 67 68 package = ··· 79 ); 80 }; 81 82 - # With a package set defined, we can create a shell. 83 - shells.default = config.shells.packetmix; 84 shells.packetmix = { 85 - # Declare what systems the shell can be used on. 86 systems = [ "x86_64-linux" ]; 87 88 - # Define our shell environment. 89 shell = 90 { 91 pkgs, ··· 113 config.inputs.nilla-nixos.result.packages.nilla-nixos.result.${stdenv.hostPlatform.system} 114 config.inputs.nixos-unstable.result.${stdenv.hostPlatform.system}.quickshell 115 config.inputs.nixpkgs.result.${stdenv.hostPlatform.system}.deadnix 116 - config.packages.nilla-fmt.result.${stdenv.hostPlatform.system} 117 - config.packages.treefmt.result.${stdenv.hostPlatform.system} 118 (config.inputs.npins.result { 119 inherit pkgs; 120 inherit (stdenv.hostPlatform) system;
··· 19 ]; 20 21 config = { 22 + name = "packetmix"; 23 + 24 + packages.packetmix-allNixOSSystems = { 25 systems = [ "x86_64-linux" ]; 26 27 package = ··· 42 }; 43 }; 44 45 + packages.packetmix-allHomes = { 46 systems = [ "x86_64-linux" ]; 47 48 package = ··· 64 }; 65 }; 66 67 + packages.packetmix-helix = { 68 systems = [ "x86_64-linux" ]; 69 70 package = ··· 81 ); 82 }; 83 84 shells.packetmix = { 85 systems = [ "x86_64-linux" ]; 86 87 shell = 88 { 89 pkgs, ··· 111 config.inputs.nilla-nixos.result.packages.nilla-nixos.result.${stdenv.hostPlatform.system} 112 config.inputs.nixos-unstable.result.${stdenv.hostPlatform.system}.quickshell 113 config.inputs.nixpkgs.result.${stdenv.hostPlatform.system}.deadnix 114 + config.packages.packetmix-nilla-fmt.result.${stdenv.hostPlatform.system} 115 + config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system} 116 (config.inputs.npins.result { 117 inherit pkgs; 118 inherit (stdenv.hostPlatform) system;
+1 -1
packetmix/systems/corsair/openlinkhub.nix
··· 19 20 config = 21 let 22 - pkg = project.packages.openlinkhub.result.${system}; 23 in 24 { 25 users.groups.openlinkhub = { };
··· 19 20 config = 21 let 22 + pkg = project.packages.packetmix-openlinkhub.result.${system}; 23 in 24 { 25 users.groups.openlinkhub = { };
+24 -13
packetmix/systems/default.nix
··· 11 nixpkgs = config.inputs.nixpkgs.result; 12 in 13 { 14 - config.systems.nixos."redhead" = { 15 pkgs = nixpkgs.x86_64-linux; 16 ingredients = [ 17 "javelin" ··· 22 system = "x86_64-linux"; 23 project = config; 24 }; 25 - homes = { inherit (config.homes) "minion@redhead:x86_64-linux"; }; 26 }; 27 - config.systems.nixos."emden" = { 28 pkgs = nixpkgs.x86_64-linux; 29 ingredients = [ 30 "javelin" ··· 34 system = "x86_64-linux"; 35 project = config; 36 }; 37 - homes = { inherit (config.homes) "minion:x86_64-linux"; }; 38 }; 39 - config.systems.nixos."marbled" = { 40 pkgs = nixpkgs.x86_64-linux; 41 ingredients = [ 42 "javelin" ··· 47 system = "x86_64-linux"; 48 project = config; 49 }; 50 - homes = { inherit (config.homes) "maya:x86_64-linux" "minion:x86_64-linux"; }; 51 }; 52 - config.systems.nixos."ocicat" = { 53 pkgs = nixpkgs.x86_64-linux; 54 ingredients = [ 55 "personal" ··· 59 system = "x86_64-linux"; 60 project = config; 61 }; 62 - homes = { inherit (config.homes) "coded:x86_64-linux"; }; 63 }; 64 - config.systems.nixos."shorthair" = { 65 pkgs = nixpkgs.x86_64-linux; 66 ingredients = [ 67 "corsair" ··· 71 system = "x86_64-linux"; 72 project = config; 73 }; 74 - homes = { inherit (config.homes) "coded:x86_64-linux"; }; 75 }; 76 - config.systems.nixos."midnight" = { 77 pkgs = nixpkgs.x86_64-linux; 78 ingredients = [ 79 "freshlybakedcake" ··· 85 project = config; 86 }; 87 }; 88 - config.systems.nixos."teal" = { 89 pkgs = nixpkgs.x86_64-linux; 90 ingredients = [ 91 "freshlybakedcake" ··· 97 project = config; 98 }; 99 }; 100 - config.systems.nixos."umber" = { 101 pkgs = nixpkgs.x86_64-linux; 102 ingredients = [ 103 "freshlybakedcake"
··· 11 nixpkgs = config.inputs.nixpkgs.result; 12 in 13 { 14 + config.systems.nixos."packetmix-redhead" = { 15 pkgs = nixpkgs.x86_64-linux; 16 ingredients = [ 17 "javelin" ··· 22 system = "x86_64-linux"; 23 project = config; 24 }; 25 + homes = { 26 + "minion@redhead:x86_64-linux" = config.homes."packetmix-minion@redhead:x86_64-linux"; 27 + }; 28 }; 29 + config.systems.nixos."packetmix-emden" = { 30 pkgs = nixpkgs.x86_64-linux; 31 ingredients = [ 32 "javelin" ··· 36 system = "x86_64-linux"; 37 project = config; 38 }; 39 + homes = { 40 + "minion:x86_64-linux" = config.homes."packetmix-minion:x86_64-linux"; 41 + }; 42 }; 43 + config.systems.nixos."packetmix-marbled" = { 44 pkgs = nixpkgs.x86_64-linux; 45 ingredients = [ 46 "javelin" ··· 51 system = "x86_64-linux"; 52 project = config; 53 }; 54 + homes = { 55 + "maya:x86_64-linux" = config.homes."packetmix-maya:x86_64-linux"; 56 + "minion:x86_64-linux" = config.homes."packetmix-minion:x86_64-linux"; 57 + }; 58 }; 59 + config.systems.nixos."packetmix-ocicat" = { 60 pkgs = nixpkgs.x86_64-linux; 61 ingredients = [ 62 "personal" ··· 66 system = "x86_64-linux"; 67 project = config; 68 }; 69 + homes = { 70 + "coded:x86_64-linux" = config.homes."packetmix-coded:x86_64-linux"; 71 + }; 72 }; 73 + config.systems.nixos."packetmix-shorthair" = { 74 pkgs = nixpkgs.x86_64-linux; 75 ingredients = [ 76 "corsair" ··· 80 system = "x86_64-linux"; 81 project = config; 82 }; 83 + homes = { 84 + "coded:x86_64-linux" = config.homes."packetmix-coded:x86_64-linux"; 85 + }; 86 }; 87 + config.systems.nixos."packetmix-midnight" = { 88 pkgs = nixpkgs.x86_64-linux; 89 ingredients = [ 90 "freshlybakedcake" ··· 96 project = config; 97 }; 98 }; 99 + config.systems.nixos."packetmix-teal" = { 100 pkgs = nixpkgs.x86_64-linux; 101 ingredients = [ 102 "freshlybakedcake" ··· 108 project = config; 109 }; 110 }; 111 + config.systems.nixos."packetmix-umber" = { 112 pkgs = nixpkgs.x86_64-linux; 113 ingredients = [ 114 "freshlybakedcake"
+1 -1
packetmix/systems/teal/copyparty.nix
··· 158 lua_package_path "${ 159 "${pkgs.luaPackages.lua-resty-core}/lib/lua/5.2/?.lua;" 160 + "${pkgs.luaPackages.lua-resty-lrucache}/lib/lua/5.2/?.lua;" 161 - + "${project.packages.lua-multipart.result.x86_64-linux}/share/lua/5.2/?.lua;;" 162 }"; # The double-semicolon makes the default search paths also be included 163 ''; 164 services.nginx.virtualHosts."files.freshly.space" = {
··· 158 lua_package_path "${ 159 "${pkgs.luaPackages.lua-resty-core}/lib/lua/5.2/?.lua;" 160 + "${pkgs.luaPackages.lua-resty-lrucache}/lib/lua/5.2/?.lua;" 161 + + "${project.packages.packetmix-lua-multipart.result.x86_64-linux}/share/lua/5.2/?.lua;;" 162 }"; # The double-semicolon makes the default search paths also be included 163 ''; 164 services.nginx.virtualHosts."files.freshly.space" = {
+3 -3
packetmix/systems/teal/fava.nix
··· 151 let 152 fava = pkgs.fava.overrideAttrs (prevAttrs: { 153 propagatedBuildInputs = prevAttrs.propagatedBuildInputs ++ [ 154 - project.packages.beancount-autobean.result.${system} 155 - project.packages.beancount-beancount_share.result.${system} 156 - project.packages.beancount-smart_importer.result.${system} 157 ]; 158 }); 159 in
··· 151 let 152 fava = pkgs.fava.overrideAttrs (prevAttrs: { 153 propagatedBuildInputs = prevAttrs.propagatedBuildInputs ++ [ 154 + project.packages.packetmix-beancount-autobean.result.${system} 155 + project.packages.packetmix-beancount-beancount_share.result.${system} 156 + project.packages.packetmix-beancount-smart_importer.result.${system} 157 ]; 158 }); 159 in
+1 -1
packetmix/systems/teal/headscale.nix
··· 95 services.headscale = { 96 enable = true; 97 98 - package = project.packages.headscale.result.x86_64-linux; 99 100 address = "127.0.0.1"; 101 port = 1024;
··· 95 services.headscale = { 96 enable = true; 97 98 + package = project.packages.packetmix-headscale.result.x86_64-linux; 99 100 address = "127.0.0.1"; 101 port = 1024;
+1 -1
packetmix/systems/teal/josh.nix
··· 10 ... 11 }: 12 let 13 - josh = project.packages.josh.result.${pkgs.stdenv.hostPlatform.system}; 14 in 15 { 16 users.users.git = {
··· 10 ... 11 }: 12 let 13 + josh = project.packages.packetmix-josh.result.${pkgs.stdenv.hostPlatform.system}; 14 in 15 { 16 users.users.git = {
+1 -1
packetmix/systems/teal/kavita.nix
··· 16 17 services.kavita = { 18 enable = true; 19 - package = project.packages.kavita.result."x86_64-linux"; 20 tokenKeyFile = "/secrets/kavita/tokenKeyFile"; 21 settings = { 22 Port = 1034;
··· 16 17 services.kavita = { 18 enable = true; 19 + package = project.packages.packetmix-kavita.result."x86_64-linux"; 20 tokenKeyFile = "/secrets/kavita/tokenKeyFile"; 21 settings = { 22 Port = 1034;
+1 -1
packetmix/systems/teal/pds.nix
··· 10 { 11 services.bluesky-pds = { 12 enable = true; 13 - package = project.packages.bluesky-pds.result.${system}; 14 settings = { 15 PDS_HOSTNAME = "pds.freshly.space"; 16 PDS_PORT = 1033;
··· 10 { 11 services.bluesky-pds = { 12 enable = true; 13 + package = project.packages.packetmix-bluesky-pds.result.${system}; 14 settings = { 15 PDS_HOSTNAME = "pds.freshly.space"; 16 PDS_PORT = 1033;
+1 -1
packetmix/systems/wiki/wiki.nix
··· 340 services.opensearch = { 341 # needed for cirrussearch 342 enable = true; 343 - package = project.packages.opensearch.result.${system}; 344 settings = { 345 "http.port" = 1037; 346 "path.data" = "/var/lib/private/opensearch/data";
··· 340 services.opensearch = { 341 # needed for cirrussearch 342 enable = true; 343 + package = project.packages.packetmix-opensearch.result.${system}; 344 settings = { 345 "http.port" = 1037; 346 "path.data" = "/var/lib/private/opensearch/data";
+2 -1
projects/menu/workspace.josh
··· 1 ::LICENSES/ 2 ::npins/ 3 - ::nilla.nix=projects/nilla.nix 4 ::workspace.josh.license=projects/menu/workspace.josh.license 5 :/menu
··· 1 ::LICENSES/ 2 ::npins/ 3 + dependencies/packetmix = :/packetmix 4 ::workspace.josh.license=projects/menu/workspace.josh.license 5 + ::nilla.nix=projects/nilla.nix 6 :/menu
+72 -5
projects/nilla.nix
··· 18 nixos-unstable = (settings config).nixpkgs; 19 }; 20 21 result = (nilla.create [ ]).extend { 22 modules = [ 23 ./project.nix 24 ( 25 { config, ... }: 26 { 27 - config.inputs = builtins.mapAttrs (name: value: { 28 - src = value; 29 - settings = (settings config).${name} or config.lib.constants.undefined; 30 - }) pins; 31 } 32 ) 33 ] ··· 47 inherit nilla pins; # pins needs to be a static arg for us to import from it... 48 }; 49 }; 50 in 51 - result.config 52 // { 53 extend = result.extend; 54 }
··· 18 nixos-unstable = (settings config).nixpkgs; 19 }; 20 21 + name = 22 + let 23 + lib = result.config.lib; 24 + 25 + imported = import ./project.nix; 26 + 27 + args = builtins.functionArgs imported; 28 + argNames = builtins.attrNames args; 29 + nonDefaultArgNames = builtins.filter (name: !args.${name}) argNames; 30 + 31 + nullArgs = lib.attrs.generate nonDefaultArgNames (_: null); 32 + 33 + calledProject = imported nullArgs; 34 + 35 + project = if builtins.isFunction imported then calledProject else imported; 36 + in 37 + project.config.name; 38 + 39 result = (nilla.create [ ]).extend { 40 modules = [ 41 ./project.nix 42 ( 43 { config, ... }: 44 { 45 + config.inputs = 46 + config.lib.attrs.generate (builtins.filter (name: name != "__functor") (builtins.attrNames pins)) 47 + (name: { 48 + src = pins.${name}; 49 + settings = (settings config).${name} or config.lib.constants.undefined; 50 + }); 51 + } 52 + ) 53 + ( 54 + { config, ... }: 55 + { 56 + options.name = config.lib.options.create { 57 + description = "The names of all included subprojects"; 58 + type = config.lib.types.coerce config.lib.types.string (val: [ val ]) ( 59 + config.lib.types.list.of config.lib.types.string 60 + ); 61 + }; 62 } 63 ) 64 ] ··· 78 inherit nilla pins; # pins needs to be a static arg for us to import from it... 79 }; 80 }; 81 + 82 + aliases = 83 + let 84 + ## Get all attrs with a prefix, returning a new attrset without that prefix. For example: 85 + ## selectPrefixedAttrs "abcd" { abcdefg = "adcdefg"; abcd = "abcd"; different = "different"; fooabcd = "fooabcd"; } 86 + ## -> { efg = "abcdefg"; "" = "abcd"; } 87 + selectPrefixedAttrs = 88 + lib: prefix: attrs: 89 + let 90 + attrNames = builtins.attrNames attrs; 91 + validNames = builtins.filter (lib.strings.hasPrefix prefix) attrNames; 92 + unprefixedNames = map (lib.strings.removePrefix prefix) validNames; 93 + in 94 + lib.attrs.generate unprefixedNames (name: attrs.${prefix + name}); 95 + aliased = 96 + config: old: 97 + old 98 + // ( 99 + if (builtins.hasAttr name old) then 100 + { 101 + default = old.${name}; 102 + } 103 + else 104 + { } 105 + ) 106 + // selectPrefixedAttrs config.lib "${name}-" old; 107 + in 108 + { 109 + homes = aliased result.config result.config.homes; 110 + packages = aliased result.config result.config.packages; 111 + shells = aliased result.config result.config.shells; 112 + systems.nixos = aliased result.config result.config.systems.nixos; 113 + }; 114 in 115 + (result.config.lib.attrs.mergeRecursive aliases result.config) 116 // { 117 extend = result.extend; 118 + unalias = result.config // { 119 + extend = result.extend; 120 + }; 121 }
+5 -4
sprinkles/project.nix
··· 9 }: 10 { 11 config = { 12 - packages.default = config.packages.sprinkles; 13 packages.sprinkles = { 14 systems = [ 15 "x86_64-linux" ··· 49 }; 50 }; 51 52 - shells.default = config.shells.sprinkles; 53 shells.sprinkles = { 54 systems = [ 55 "x86_64-linux" ··· 102 ]; 103 }; 104 }; 105 - shells.testing = { 106 systems = [ 107 "x86_64-linux" 108 "aarch64-linux" ··· 121 packages = [ 122 libnotify 123 sqlitebrowser 124 - config.packages.default.result.${system} 125 (config.inputs.quickshell.result.packages.${system}.default.override { 126 gitRev = pins.quickshell.revision; 127 })
··· 9 }: 10 { 11 config = { 12 + name = "sprinkles"; 13 + 14 packages.sprinkles = { 15 systems = [ 16 "x86_64-linux" ··· 50 }; 51 }; 52 53 shells.sprinkles = { 54 systems = [ 55 "x86_64-linux" ··· 102 ]; 103 }; 104 }; 105 + 106 + shells.sprinkles-testing = { 107 systems = [ 108 "x86_64-linux" 109 "aarch64-linux" ··· 122 packages = [ 123 libnotify 124 sqlitebrowser 125 + config.packages.sprinkles.result.${system} 126 (config.inputs.quickshell.result.packages.${system}.default.override { 127 gitRev = pins.quickshell.revision; 128 })

History

4 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
refactor!(*): use attributes that match projects
5/5 success
expand
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