Allow for autoloading modules

Autoloads files within modules/ and makes them available by their module
type and name, e.g. `mixins-zsh`, `editor-nvim` and `users-opdavies`
when imported with `inputs.self.nixosModules`.

Based on afab322e6d/modules/default.nix.

This assumes there will be a modules/*.nix file and currently doesn't
work with modules/*/default.nix. This is something I'd like to add in
the future.

I also want find a cleaner way to pass arguments into these shortcuts as
this also doesn't work in their implementation as far as I can see.
This commit is contained in:
Oliver Davies 2025-04-10 08:56:11 +01:00
parent 797d1206b0
commit eea806e0f8
16 changed files with 140 additions and 63 deletions

View file

@ -2,15 +2,19 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ inputs, ... }:
{
imports = [
imports = with inputs.self.nixosModules; [
./hardware-configuration.nix
./secrets.nix
./services.nix
../../modules/mixins/common
../../modules/mixins/docker.nix
../../modules/mixins/zsh
mixins-common
mixins-docker
mixins-zsh
users-opdavies
./modules/acme.nix
./modules/audiobookshelf.nix
@ -19,8 +23,6 @@
./modules/immich.nix
./modules/jellyfin.nix
./modules/paperless.nix
../../users/opdavies
];
nixosModules = {