Files
nixconfig/modules/shared/syscfg/default.nix

37 lines
1.2 KiB
Nix

{ inputs, lib, ... }:
let
systemsDir = ../../../systems;
systemNames = lib.attrNames (lib.filterAttrs
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
(builtins.readDir systemsDir));
in with lib; {
options.usercfg = import ./user.nix {inherit lib;};
options.syscfg = {
hostname = mkOption { type = types.str; };
type = mkOption {
type = types.enum [ "nixos" "macos" "home" ];
default = "nixos";
};
system = mkOption {
type = types.enum [ "x86_64-linux" "x86_64-darwin" "-" ];
default = "x86_64-linux";
};
defaultUser = mkOption { type = types.str; };
make = import ./make.nix {inherit lib;};
net = import ./net.nix {inherit lib;};
users = mkOption {
type = types.listOf (types.submodule { options = import ./user.nix {inherit lib;}; });
default = [ ];
};
peers = mkOption {
default = map (name: import (systemsDir + "/${name}/cfg.nix")) systemNames;
};
server = mkOption {
type = types.oneOf [ types.bool (types.submodule { options = import ./server.nix {inherit lib;}; }) ];
default = false;
};
};
}