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

refactor!(*): use attributes that match projects

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

authored by a.starrysky.fyi and committed by tangled.org 8f3ba42a 3c75fd05

+232 -82
+1 -1
.tangled/workflows/packetmix-treefmt.yaml
··· 42 42 set -e 43 43 44 44 treefmt=$(nix build \ 45 - -f ./ci.nix packages.treefmt.result.x86_64-linux \ 45 + -f ./ci.nix packages.packetmix-treefmt.result.x86_64-linux \ 46 46 --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 47 47 --eval-store auto \ 48 48 --show-trace --print-out-paths)
+1 -1
ci.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 5 5 let 6 - base = import ./nilla.nix; 6 + base = (import ./nilla.nix).unalias; 7 7 project = base.extend { 8 8 modules = [ 9 9
+4 -4
menu/project.nix
··· 5 5 { config, lib }: 6 6 { 7 7 config = { 8 - packages.default = config.packages.menu; 8 + name = "menu"; 9 + 9 10 packages.menu = { 10 11 systems = [ 11 12 "x86_64-linux" ··· 40 41 }; 41 42 }; 42 43 43 - shells.default = config.shells.menu; 44 44 shells.menu = { 45 45 systems = [ "x86_64-linux" ]; 46 46 ··· 62 62 bacon 63 63 config.inputs.nilla-cli.result.packages.nilla-cli.result.${stdenv.hostPlatform.system} 64 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} 65 + config.packages.packetmix-nilla-fmt.result.${stdenv.hostPlatform.system} 66 + config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system} 67 67 (config.inputs.npins.result { 68 68 inherit pkgs; 69 69 inherit (stdenv.hostPlatform) system;
+64 -5
nilla.nix
··· 26 26 ( 27 27 { config, ... }: 28 28 { 29 - config.inputs = builtins.mapAttrs (name: value: { 30 - src = value; 31 - settings = (settings config).${name} or config.lib.constants.undefined; 32 - }) pins; 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 + }; 33 46 } 34 47 ) 35 48 ]; ··· 38 51 inherit nilla pins; # pins needs to be a static arg for us to import from it... 39 52 }; 40 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 + }; 41 97 in 42 - result.config 98 + (result.config.lib.attrs.mergeRecursive aliases result.config) 43 99 // { 44 100 extend = result.extend; 101 + unalias = result.config // { 102 + extend = result.extend; 103 + }; 45 104 }
+1 -1
packetmix/homes/coded/games.nix
··· 4 4 5 5 { project, ... }: 6 6 { 7 - home.packages = [ project.packages.vs-launcher.result."x86_64-linux" ]; 7 + home.packages = [ project.packages.packetmix-vs-launcher.result."x86_64-linux" ]; 8 8 }
+1 -1
packetmix/homes/collabora/gtimelog.nix
··· 6 6 { project, system, ... }: 7 7 { 8 8 home.packages = [ 9 - project.packages.collabora-gtimelog.result.${system} 9 + project.packages.packetmix-collabora-gtimelog.result.${system} 10 10 ]; 11 11 12 12 clicks.storage.impermanence.persist.directories = [
+1 -1
packetmix/homes/common/helix.nix
··· 12 12 programs.helix = { 13 13 enable = true; 14 14 15 - package = project.packages.helix.result.${system}; 15 + package = project.packages.packetmix-helix.result.${system}; 16 16 17 17 settings = { 18 18 editor = {
+4 -4
packetmix/homes/default.nix
··· 4 4 # SPDX-License-Identifier: MIT 5 5 6 6 { 7 - config.homes."maya:x86_64-linux" = { 7 + config.homes."packetmix-maya:x86_64-linux" = { 8 8 modules = [ 9 9 { 10 10 home.stateVersion = "24.11"; ··· 25 25 system = "x86_64-linux"; 26 26 }; 27 27 }; 28 - config.homes."minion:x86_64-linux" = { 28 + config.homes."packetmix-minion:x86_64-linux" = { 29 29 modules = [ 30 30 { 31 31 home.stateVersion = "24.11"; ··· 46 46 system = "x86_64-linux"; 47 47 }; 48 48 }; 49 - config.homes."minion@redhead:x86_64-linux" = { 49 + config.homes."packetmix-minion@redhead:x86_64-linux" = { 50 50 modules = [ 51 51 { 52 52 home.stateVersion = "24.11"; ··· 68 68 system = "x86_64-linux"; 69 69 }; 70 70 }; 71 - config.homes."coded:x86_64-linux" = { 71 + config.homes."packetmix-coded:x86_64-linux" = { 72 72 modules = [ 73 73 { 74 74 home.stateVersion = "25.05";
+6 -1
packetmix/homes/minion/misc.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 5 - { pkgs, ... }: 5 + { 6 + project, 7 + pkgs, 8 + system, 9 + ... 10 + }: 6 11 { 7 12 # Miscellaneous package installs that aren't really big enough to get their own folder 8 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 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 18 "${pkgs.coreutils}/bin/mkdir -p %t/scriptfs" 19 19 ]; 20 - ExecStart = "${project.packages.scriptfs.result.${system}}/bin/scriptfs -f /nix/store %t/scriptfs"; 20 + ExecStart = "${ 21 + project.packages.packetmix-scriptfs.result.${system} 22 + }/bin/scriptfs -f /nix/store %t/scriptfs"; 21 23 }; 22 24 }; 23 25 }
+6
packetmix/modules/ingredients.nix
··· 25 25 ] 26 26 ++ (if ingredientExists submodule.name then [ submodule.name ] else [ ]) 27 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 + ++ ( 28 34 let 29 35 homeNames = builtins.attrNames submodule.config.homes; 30 36 homeNamesParts = map (
+1 -1
packetmix/packages/OpenLinkHub/default.nix
··· 2 2 # 3 3 # SPDX-License-Identifier: MIT 4 4 { 5 - config.packages.openlinkhub = { 5 + config.packages.packetmix-openlinkhub = { 6 6 systems = [ "x86_64-linux" ]; 7 7 package = 8 8 { openlinkhub, ... }:
+1 -1
packetmix/packages/beancount-autobean/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.beancount-autobean = { 7 + config.packages.packetmix-beancount-autobean = { 8 8 systems = [ "x86_64-linux" ]; 9 9 package = 10 10 {
+1 -1
packetmix/packages/beancount-beancount_plugin_utils/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.beancount-beancount_plugin_utils = { 7 + config.packages.packetmix-beancount-beancount_plugin_utils = { 8 8 systems = [ "x86_64-linux" ]; 9 9 package = 10 10 {
+2 -2
packetmix/packages/beancount-beancount_share/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.beancount-beancount_share = { 7 + config.packages.packetmix-beancount-beancount_share = { 8 8 systems = [ "x86_64-linux" ]; 9 9 package = 10 10 { ··· 25 25 26 26 propagatedBuildInputs = [ 27 27 python3.pkgs.beancount 28 - config.packages.beancount-beancount_plugin_utils.result.${stdenv.hostPlatform.system} 28 + config.packages.packetmix-beancount-beancount_plugin_utils.result.${stdenv.hostPlatform.system} 29 29 ]; 30 30 31 31 buildInputs = [
+1 -1
packetmix/packages/beancount-smart_importer/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.beancount-smart_importer = { 7 + config.packages.packetmix-beancount-smart_importer = { 8 8 systems = [ "x86_64-linux" ]; 9 9 package = 10 10 {
+3 -3
packetmix/packages/bluesky-pds/default.nix
··· 5 5 6 6 { config, ... }: 7 7 { 8 - config.packages.bluesky-atproto-pds = { 8 + config.packages.packetmix-bluesky-atproto-pds = { 9 9 systems = [ "x86_64-linux" ]; 10 10 package = 11 11 { ··· 74 74 ''; 75 75 }); 76 76 }; 77 - config.packages.bluesky-pds = { 77 + config.packages.packetmix-bluesky-pds = { 78 78 systems = [ "x86_64-linux" ]; 79 79 package = 80 80 { ··· 88 88 rm -r $atproto_pds_dir 89 89 mkdir -p $atproto_pds_dir 90 90 ln -s ${ 91 - config.packages.bluesky-atproto-pds.result.${stdenv.hostPlatform.system} 91 + config.packages.packetmix-bluesky-atproto-pds.result.${stdenv.hostPlatform.system} 92 92 }/lib $atproto_pds_dir/node_modules 93 93 ''; 94 94 };
+1 -1
packetmix/packages/collabora-gtimelog/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.collabora-gtimelog = { 7 + config.packages.packetmix-collabora-gtimelog = { 8 8 systems = [ "x86_64-linux" ]; 9 9 10 10 settings.pkgs = config.inputs.nixos-prev.result;
+1 -1
packetmix/packages/headscale/default.nix
··· 5 5 6 6 { config, ... }: 7 7 { 8 - config.packages.headscale = { 8 + config.packages.packetmix-headscale = { 9 9 systems = [ "x86_64-linux" ]; 10 10 package = 11 11 {
+1 -1
packetmix/packages/josh/default.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 { config, ... }: 5 5 { 6 - config.packages.josh = { 6 + config.packages.packetmix-josh = { 7 7 systems = [ "x86_64-linux" ]; 8 8 package = 9 9 { stdenv, rustPlatform, ... }:
+1 -1
packetmix/packages/kavita/default.nix
··· 3 3 # 4 4 # SPDX-License-Identifier: MIT 5 5 { 6 - config.packages.kavita = { 6 + config.packages.packetmix-kavita = { 7 7 systems = [ "x86_64-linux" ]; 8 8 package = 9 9 {
+1 -1
packetmix/packages/lua-multipart/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.lua-multipart = { 7 + config.packages.packetmix-lua-multipart = { 8 8 systems = [ "x86_64-linux" ]; 9 9 10 10 package =
+1 -1
packetmix/packages/opensearch/default.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 { config, ... }: 5 5 { 6 - config.packages.opensearch = { 6 + config.packages.packetmix-opensearch = { 7 7 systems = [ "x86_64-linux" ]; 8 8 package = 9 9 {
+1 -1
packetmix/packages/scriptfs/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.scriptfs = { 7 + config.packages.packetmix-scriptfs = { 8 8 systems = [ "x86_64-linux" ]; 9 9 10 10 package =
+3 -3
packetmix/packages/treefmt/default.nix
··· 4 4 5 5 { config, ... }: 6 6 { 7 - config.packages.treefmt = { 7 + config.packages.packetmix-treefmt = { 8 8 systems = [ "x86_64-linux" ]; 9 9 10 10 package = ··· 25 25 }; 26 26 }; 27 27 28 - config.packages.nilla-fmt = { 28 + config.packages.packetmix-nilla-fmt = { 29 29 systems = [ "x86_64-linux" ]; 30 30 31 31 package = ··· 33 33 stdenv.mkDerivation { 34 34 name = "nilla-fmt"; 35 35 36 - src = config.packages.treefmt.result.${stdenv.hostPlatform.system}; 36 + src = config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system}; 37 37 38 38 dontBuild = true; 39 39
+1 -1
packetmix/packages/vs-launcher/default.nix
··· 3 3 # SPDX-License-Identifier: MIT 4 4 { config, ... }: 5 5 { 6 - config.packages.vs-launcher = { 6 + config.packages.packetmix-vs-launcher = { 7 7 systems = [ "x86_64-linux" ]; 8 8 9 9 package =
+7 -9
packetmix/project.nix
··· 19 19 ]; 20 20 21 21 config = { 22 - packages.allNixOSSystems = { 22 + name = "packetmix"; 23 + 24 + packages.packetmix-allNixOSSystems = { 23 25 systems = [ "x86_64-linux" ]; 24 26 25 27 package = ··· 40 42 }; 41 43 }; 42 44 43 - packages.allHomes = { 45 + packages.packetmix-allHomes = { 44 46 systems = [ "x86_64-linux" ]; 45 47 46 48 package = ··· 62 64 }; 63 65 }; 64 66 65 - packages.helix = { 67 + packages.packetmix-helix = { 66 68 systems = [ "x86_64-linux" ]; 67 69 68 70 package = ··· 79 81 ); 80 82 }; 81 83 82 - # With a package set defined, we can create a shell. 83 - shells.default = config.shells.packetmix; 84 84 shells.packetmix = { 85 - # Declare what systems the shell can be used on. 86 85 systems = [ "x86_64-linux" ]; 87 86 88 - # Define our shell environment. 89 87 shell = 90 88 { 91 89 pkgs, ··· 113 111 config.inputs.nilla-nixos.result.packages.nilla-nixos.result.${stdenv.hostPlatform.system} 114 112 config.inputs.nixos-unstable.result.${stdenv.hostPlatform.system}.quickshell 115 113 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} 114 + config.packages.packetmix-nilla-fmt.result.${stdenv.hostPlatform.system} 115 + config.packages.packetmix-treefmt.result.${stdenv.hostPlatform.system} 118 116 (config.inputs.npins.result { 119 117 inherit pkgs; 120 118 inherit (stdenv.hostPlatform) system;
+1 -1
packetmix/systems/corsair/openlinkhub.nix
··· 19 19 20 20 config = 21 21 let 22 - pkg = project.packages.openlinkhub.result.${system}; 22 + pkg = project.packages.packetmix-openlinkhub.result.${system}; 23 23 in 24 24 { 25 25 users.groups.openlinkhub = { };
+24 -13
packetmix/systems/default.nix
··· 11 11 nixpkgs = config.inputs.nixpkgs.result; 12 12 in 13 13 { 14 - config.systems.nixos."redhead" = { 14 + config.systems.nixos."packetmix-redhead" = { 15 15 pkgs = nixpkgs.x86_64-linux; 16 16 ingredients = [ 17 17 "javelin" ··· 22 22 system = "x86_64-linux"; 23 23 project = config; 24 24 }; 25 - homes = { inherit (config.homes) "minion@redhead:x86_64-linux"; }; 25 + homes = { 26 + "minion@redhead:x86_64-linux" = config.homes."packetmix-minion@redhead:x86_64-linux"; 27 + }; 26 28 }; 27 - config.systems.nixos."emden" = { 29 + config.systems.nixos."packetmix-emden" = { 28 30 pkgs = nixpkgs.x86_64-linux; 29 31 ingredients = [ 30 32 "javelin" ··· 34 36 system = "x86_64-linux"; 35 37 project = config; 36 38 }; 37 - homes = { inherit (config.homes) "minion:x86_64-linux"; }; 39 + homes = { 40 + "minion:x86_64-linux" = config.homes."packetmix-minion:x86_64-linux"; 41 + }; 38 42 }; 39 - config.systems.nixos."marbled" = { 43 + config.systems.nixos."packetmix-marbled" = { 40 44 pkgs = nixpkgs.x86_64-linux; 41 45 ingredients = [ 42 46 "javelin" ··· 47 51 system = "x86_64-linux"; 48 52 project = config; 49 53 }; 50 - homes = { inherit (config.homes) "maya:x86_64-linux" "minion:x86_64-linux"; }; 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 + }; 51 58 }; 52 - config.systems.nixos."ocicat" = { 59 + config.systems.nixos."packetmix-ocicat" = { 53 60 pkgs = nixpkgs.x86_64-linux; 54 61 ingredients = [ 55 62 "personal" ··· 59 66 system = "x86_64-linux"; 60 67 project = config; 61 68 }; 62 - homes = { inherit (config.homes) "coded:x86_64-linux"; }; 69 + homes = { 70 + "coded:x86_64-linux" = config.homes."packetmix-coded:x86_64-linux"; 71 + }; 63 72 }; 64 - config.systems.nixos."shorthair" = { 73 + config.systems.nixos."packetmix-shorthair" = { 65 74 pkgs = nixpkgs.x86_64-linux; 66 75 ingredients = [ 67 76 "corsair" ··· 71 80 system = "x86_64-linux"; 72 81 project = config; 73 82 }; 74 - homes = { inherit (config.homes) "coded:x86_64-linux"; }; 83 + homes = { 84 + "coded:x86_64-linux" = config.homes."packetmix-coded:x86_64-linux"; 85 + }; 75 86 }; 76 - config.systems.nixos."midnight" = { 87 + config.systems.nixos."packetmix-midnight" = { 77 88 pkgs = nixpkgs.x86_64-linux; 78 89 ingredients = [ 79 90 "freshlybakedcake" ··· 85 96 project = config; 86 97 }; 87 98 }; 88 - config.systems.nixos."teal" = { 99 + config.systems.nixos."packetmix-teal" = { 89 100 pkgs = nixpkgs.x86_64-linux; 90 101 ingredients = [ 91 102 "freshlybakedcake" ··· 97 108 project = config; 98 109 }; 99 110 }; 100 - config.systems.nixos."umber" = { 111 + config.systems.nixos."packetmix-umber" = { 101 112 pkgs = nixpkgs.x86_64-linux; 102 113 ingredients = [ 103 114 "freshlybakedcake"
+1 -1
packetmix/systems/teal/copyparty.nix
··· 158 158 lua_package_path "${ 159 159 "${pkgs.luaPackages.lua-resty-core}/lib/lua/5.2/?.lua;" 160 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;;" 161 + + "${project.packages.packetmix-lua-multipart.result.x86_64-linux}/share/lua/5.2/?.lua;;" 162 162 }"; # The double-semicolon makes the default search paths also be included 163 163 ''; 164 164 services.nginx.virtualHosts."files.freshly.space" = {
+3 -3
packetmix/systems/teal/fava.nix
··· 151 151 let 152 152 fava = pkgs.fava.overrideAttrs (prevAttrs: { 153 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} 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 157 ]; 158 158 }); 159 159 in
+1 -1
packetmix/systems/teal/headscale.nix
··· 95 95 services.headscale = { 96 96 enable = true; 97 97 98 - package = project.packages.headscale.result.x86_64-linux; 98 + package = project.packages.packetmix-headscale.result.x86_64-linux; 99 99 100 100 address = "127.0.0.1"; 101 101 port = 1024;
+1 -1
packetmix/systems/teal/josh.nix
··· 10 10 ... 11 11 }: 12 12 let 13 - josh = project.packages.josh.result.${pkgs.stdenv.hostPlatform.system}; 13 + josh = project.packages.packetmix-josh.result.${pkgs.stdenv.hostPlatform.system}; 14 14 in 15 15 { 16 16 users.users.git = {
+1 -1
packetmix/systems/teal/kavita.nix
··· 16 16 17 17 services.kavita = { 18 18 enable = true; 19 - package = project.packages.kavita.result."x86_64-linux"; 19 + package = project.packages.packetmix-kavita.result."x86_64-linux"; 20 20 tokenKeyFile = "/secrets/kavita/tokenKeyFile"; 21 21 settings = { 22 22 Port = 1034;
+1 -1
packetmix/systems/teal/pds.nix
··· 10 10 { 11 11 services.bluesky-pds = { 12 12 enable = true; 13 - package = project.packages.bluesky-pds.result.${system}; 13 + package = project.packages.packetmix-bluesky-pds.result.${system}; 14 14 settings = { 15 15 PDS_HOSTNAME = "pds.freshly.space"; 16 16 PDS_PORT = 1033;
+1 -1
packetmix/systems/wiki/wiki.nix
··· 340 340 services.opensearch = { 341 341 # needed for cirrussearch 342 342 enable = true; 343 - package = project.packages.opensearch.result.${system}; 343 + package = project.packages.packetmix-opensearch.result.${system}; 344 344 settings = { 345 345 "http.port" = 1037; 346 346 "path.data" = "/var/lib/private/opensearch/data";
+2 -1
projects/menu/workspace.josh
··· 1 1 ::LICENSES/ 2 2 ::npins/ 3 + dependencies/packetmix = :/packetmix 4 + ::workspace.josh.license=projects/menu/workspace.josh.license 3 5 ::nilla.nix=projects/nilla.nix 4 - ::workspace.josh.license=projects/menu/workspace.josh.license 5 6 :/menu
+72 -5
projects/nilla.nix
··· 18 18 nixos-unstable = (settings config).nixpkgs; 19 19 }; 20 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 + 21 39 result = (nilla.create [ ]).extend { 22 40 modules = [ 23 41 ./project.nix 24 42 ( 25 43 { config, ... }: 26 44 { 27 - config.inputs = builtins.mapAttrs (name: value: { 28 - src = value; 29 - settings = (settings config).${name} or config.lib.constants.undefined; 30 - }) pins; 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 + }; 31 62 } 32 63 ) 33 64 ] ··· 47 78 inherit nilla pins; # pins needs to be a static arg for us to import from it... 48 79 }; 49 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 + }; 50 114 in 51 - result.config 115 + (result.config.lib.attrs.mergeRecursive aliases result.config) 52 116 // { 53 117 extend = result.extend; 118 + unalias = result.config // { 119 + extend = result.extend; 120 + }; 54 121 }
+5 -4
sprinkles/project.nix
··· 9 9 }: 10 10 { 11 11 config = { 12 - packages.default = config.packages.sprinkles; 12 + name = "sprinkles"; 13 + 13 14 packages.sprinkles = { 14 15 systems = [ 15 16 "x86_64-linux" ··· 49 50 }; 50 51 }; 51 52 52 - shells.default = config.shells.sprinkles; 53 53 shells.sprinkles = { 54 54 systems = [ 55 55 "x86_64-linux" ··· 102 102 ]; 103 103 }; 104 104 }; 105 - shells.testing = { 105 + 106 + shells.sprinkles-testing = { 106 107 systems = [ 107 108 "x86_64-linux" 108 109 "aarch64-linux" ··· 121 122 packages = [ 122 123 libnotify 123 124 sqlitebrowser 124 - config.packages.default.result.${system} 125 + config.packages.sprinkles.result.${system} 125 126 (config.inputs.quickshell.result.packages.${system}.default.override { 126 127 gitRev = pins.quickshell.revision; 127 128 })