dotfiles/modules/config/devices/default.nix

46 lines
1 KiB
Nix
Raw Normal View History

2025-06-26 21:20:09 -05:00
{ moduleFunctions }:
2025-03-29 23:08:26 -05:00
let
2025-06-26 21:20:09 -05:00
2025-03-29 23:08:26 -05:00
configPath = ./config;
printerPath = configPath + /printers;
deviceswithFunctions = builtins.listToAttrs (
map
(name: {
name = builtins.substring 0 (builtins.stringLength name - 4) name;
value = import (configPath + "/${name}") {
inherit
2025-06-26 21:20:09 -05:00
moduleFunctions
2025-03-29 23:08:26 -05:00
;
};
})
(
builtins.filter (name: builtins.match ".*\\.nix$" name != null) (
builtins.attrNames (builtins.readDir configPath)
)
)
);
devicesPrinters = builtins.listToAttrs (
map
(name: {
name = builtins.substring 0 (builtins.stringLength name - 4) name;
value = import (printerPath + "/${name}") {
inherit
2025-06-26 21:20:09 -05:00
moduleFunctions
2025-03-29 23:08:26 -05:00
;
};
})
(
builtins.filter (name: builtins.match ".*\\.nix$" name != null) (
builtins.attrNames (builtins.readDir printerPath)
)
)
);
devices = deviceswithFunctions // devicesPrinters;
in
{
devices = devices;
}