1 ===============================================================================
2 Nix OS Module nixCats.module
3 nixCats.module.mkNixosModules
4 nixCats.module.mkHomeModules
5
6 We can create modules based on a configuration
7 by exporting the following in our flake outputs.
8
9 <mkNixosModules> {
10 defaultPackageName = "nixCats";
11 moduleNamespace = [ "nixCats" ];
12 luaPath = "${./.}";
13 inherit nixpkgs dependencyOverlays
14 categoryDefinitions packageDefinitions extra_pkg_config;
15 };
16
17 <mkHomeModules> {
18 defaultPackageName = "nixCats";
19 moduleNamespace = [ "nixCats" ];
20 luaPath = "${./.}";
21 inherit nixpkgs dependencyOverlays
22 categoryDefinitions packageDefinitions extra_pkg_config;
23 };
24
25 If moduleNamespace is omitted, it will default to [ defaultPackageName ].
26
27 moduleNamespace controls the namespace for the module options.
28
29 This means if moduleNamespace = [ "my_mods" "nixCats" ];
30
31 Then you would my_mods.nixCats.enable = true;
32 and my_mods.nixCats.packageNames = [ "package" "names" "toinstall" ];
33
34 More specifically, the options will be here:
35
36 options = with lib; lib.setAttrByPath moduleNamespace ({ });
37
38
39 If you do not have a luaPath, you may pass it a keepLua builder.
40
41 IMPORTANT
42 By default, the module inherits pkgs.config from the system's pkgs object,
43 and its overlays AND the flake's overlays and nixCats config,
44 as well as the flake's nixpkgs source (by default).
45 It will inherit things from your system,
46 but your system will not inherit things from nixCats,
47 other than the packages themselves in config.${defaultPackageName}.out
48
49 -------------------------------------------------------------------------------
50 Module Options
51
52 Home-Manager https://nixcats.org/nixCats_hm_options.html
53
54 NixOS and nix-darwin https://nixcats.org/nixCats_nixos_options.html
55 Same options as home manager but also has the same options defineable per user
56
57 -------------------------------------------------------------------------------
58 Accessing the finished packages for running via nix run
59
60 The modules set read only config values containing the resulting packages
61 built by the module.
62
63 They can be grabbed in your flake.nix via the self variable.
64
65 Within your config that you grab from your self variable, the packages will be
66 here:
67
68
69 config.${defaultPackageName}.out.packages.<PACKAGE_NAME>
70
71 and if using the NixOS module there is ALSO
72
73 config.${defaultPackageName}.out.users.<USER_NAME>.packages.<PACKAGE_NAME>
74
75
76 To find your package from the self variable, it will look something like
77 this:
78
79
80 self.homeConfigurations."<home_config_name>".config."<defaultPackageName>".out.packages."<package_name>"
81
82
83 You can then export that from your flake as
84 packages.${system}.default or
85 packages.${system}.whatever
86
87 when creating modules with mkNixosModules or mkHomeModules you can also
88 set the moduleNamespace to whatever you want.
89 This will also change where you grab the package from.
90 The read-only config value will be in the same set your other options are declared in.
91
92 =================================================================================
93 vim:tw=78:ts=8:ft=help:norl: