mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 20:39:18 -08:00
65 lines
1.9 KiB
Nix
65 lines
1.9 KiB
Nix
{ config, lib, meta, root, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
options = {
|
|
lib = mkOption {
|
|
type = types.attrsOf (types.attrsOf types.unspecified);
|
|
};
|
|
network.importing = {
|
|
nixosImports = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
darwinImports = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
esphomeImports = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
homeImports = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
users = mkOption {
|
|
type = types.listOf types.str;
|
|
};
|
|
};
|
|
};
|
|
config = {
|
|
network.importing = {
|
|
nixosImports = mkDefault (map (path: toString path) [
|
|
(root + "/nixos/systems/HN.nix")
|
|
(root + "/nixos/systems/HN/nixos.nix")
|
|
]);
|
|
esphomeImports = mkDefault (map (path: toString path) [
|
|
(root + "/esphome/boards/HN.nix")
|
|
(root + "/esphome/boards/HN/esphome.nix")
|
|
]);
|
|
darwinImports = mkDefault (map (path: toString path) [
|
|
(root + "/darwin/systems/HN.nix")
|
|
(root + "/darwin/systems/HN/darwin.nix")
|
|
]);
|
|
homeImports = [];
|
|
users = mkDefault (singleton "kat");
|
|
};
|
|
lib.nixfiles.nixosImport = hostName: lib.nodeImport {
|
|
inherit (config.network.importing) nixosImports homeImports users;
|
|
profiles = meta.nixos;
|
|
inherit hostName;
|
|
};
|
|
lib.nixfiles.esphomeImport = hostName: lib.nodeImport {
|
|
nixosImports = config.network.importing.esphomeImports;
|
|
homeImports = [];
|
|
users = [];
|
|
profiles = { base = { }; };
|
|
inherit hostName;
|
|
};
|
|
lib.nixfiles.darwinImport = hostName: lib.nodeImport {
|
|
nixosImports = config.network.importing.darwinImports;
|
|
profiles = meta.darwin;
|
|
inherit (config.network.importing) homeImports users;
|
|
inherit hostName;
|
|
};
|
|
_module.args = { inherit (config.lib) nixfiles; };
|
|
};
|
|
}
|