Update modules/shared/syscfg/default.nix
This commit is contained in:
@@ -5,179 +5,9 @@ let
|
|||||||
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
(name: type: type == "directory" && builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
||||||
(builtins.readDir systemsDir));
|
(builtins.readDir systemsDir));
|
||||||
|
|
||||||
userOpt = with lib; {
|
|
||||||
username = mkOption { type = types.str; };
|
|
||||||
pubssh = mkOption { type = types.str; default=""; };
|
|
||||||
wm = mkOption {
|
|
||||||
type = types.enum [ "Wayland" "X11" "-" ];
|
|
||||||
default = "-";
|
|
||||||
};
|
|
||||||
git = {
|
|
||||||
username = mkOption { type = types.str; default = "Anonymous";};
|
|
||||||
email = mkOption { type = types.str; default = "anonymous@domain"; };
|
|
||||||
key = mkOption { type = types.nullOr types.str; default=null; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
netOpt = with lib; {
|
|
||||||
ble = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
wlp = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
nif = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
wg = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
ip4 = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
ip6 = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
pubkey = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
makeOpt = with lib; {
|
|
||||||
cli = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
gui = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
virt = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
power = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
game = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
develop = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
serverOpt = with lib; {
|
|
||||||
hostDomain = mkOption { type = types.str; };
|
|
||||||
mailDomain = mkOption { type = types.str; };
|
|
||||||
mailServer = mkOption { type = types.str; };
|
|
||||||
|
|
||||||
configPath = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "/media/config";
|
|
||||||
};
|
|
||||||
dataPath = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "/media/data";
|
|
||||||
};
|
|
||||||
|
|
||||||
colorScheme = mkOption {
|
|
||||||
#type = types.submodule {
|
|
||||||
# options = {
|
|
||||||
# slug = mkOption { type = types.str; };
|
|
||||||
# name = mkOption { type = types.str; };
|
|
||||||
# palette = mkOption {
|
|
||||||
type = types.attrs; #default = {};# };
|
|
||||||
#};
|
|
||||||
# };
|
|
||||||
default = (lib.evalModules { modules =[ { freeformType = with lib.types; attrsOf anything; } ../colors ];}).config.colorScheme ;
|
|
||||||
};
|
|
||||||
loadedContainers = lib.mkOption {
|
|
||||||
readOnly = true;
|
|
||||||
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
|
||||||
options = {
|
|
||||||
name = lib.mkOption {type = lib.types.str; default = name;};
|
|
||||||
sops = lib.mkOption {type = lib.types.bool; default = false;};
|
|
||||||
db = lib.mkOption {type = lib.types.bool; default = false;};
|
|
||||||
|
|
||||||
paths = lib.mkOption {type = lib.types.listOf lib.types.attrs; default = [ ];};
|
|
||||||
containers = lib.mkOption {type = lib.types.attrsOf lib.types.attrs; default = { };};
|
|
||||||
cron = lib.mkOption {type = lib.types.listOf lib.types.str; default = [ ];};
|
|
||||||
|
|
||||||
setup = {
|
|
||||||
trigger = lib.mkOption {type = lib.types.str; default = "";};
|
|
||||||
script = lib.mkOption {type = lib.types.nullOr lib.types.package; default = null;};
|
|
||||||
envFile = lib.mkOption {type = lib.types.nullOr lib.types.str; default = null;};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
|
|
||||||
};
|
|
||||||
containers = mkOption {
|
|
||||||
type = types.attrsOf (types.submodule {
|
|
||||||
options = {
|
|
||||||
subdomain = mkOption { type = types.nullOr types.str; default=null;};
|
|
||||||
subpath = mkOption { type = types.nullOr types.str; default=null;};
|
|
||||||
port = mkOption { type = types.nullOr types.port; default = null; };
|
|
||||||
extra = mkOption { type = types.attrs; default = {}; };
|
|
||||||
};
|
|
||||||
});
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
openssh = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
wireguard = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
web = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
ipfw = {
|
|
||||||
enable = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
ifs = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
ports = mkOption {
|
|
||||||
type = types.listOf (types.listOf (types.oneOf [ types.str types.int ]));
|
|
||||||
default = [];
|
|
||||||
description = "Forwarding rules: [ [srcInterface dstAddr srcPort dstPort] ... ]";
|
|
||||||
example = [
|
|
||||||
[ "ens3" "10.10.1.2" "IPV6" 22 2222 ]
|
|
||||||
[ "ens3" "10.10.1.2" "IPV6" 80 80 ]
|
|
||||||
[ "ens3" "10.10.1.2" "IPV6" 443 443 ]
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
db = mkOption {
|
|
||||||
type = types.listOf (types.str);
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
in with lib; {
|
in with lib; {
|
||||||
options.usercfg = userOpt;
|
options.usercfg = import ./user.nix {inherit lib;};
|
||||||
options.syscfg = {
|
options.syscfg = {
|
||||||
hostname = mkOption { type = types.str; };
|
hostname = mkOption { type = types.str; };
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
@@ -189,20 +19,17 @@ in with lib; {
|
|||||||
default = "x86_64-linux";
|
default = "x86_64-linux";
|
||||||
};
|
};
|
||||||
defaultUser = mkOption { type = types.str; };
|
defaultUser = mkOption { type = types.str; };
|
||||||
make = makeOpt;
|
make = import ./make.nix {inherit lib;};
|
||||||
net = netOpt;
|
net = import ./net.nix {inherit lib;};
|
||||||
users = mkOption {
|
users = mkOption {
|
||||||
type = types.listOf (types.submodule { options = userOpt; });
|
type = types.listOf (types.submodule { options = import ./user.nix {inherit lib;}; });
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
peers = mkOption {
|
peers = mkOption {
|
||||||
default = map (name: import (systemsDir + "/${name}/cfg.nix")) systemNames;
|
default = map (name: import (systemsDir + "/${name}/cfg.nix")) systemNames;
|
||||||
};
|
};
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
type = types.oneOf [
|
type = types.oneOf [ types.bool (types.submodule { options = import ./server.nix {inherit lib;}; }) ];
|
||||||
types.bool
|
|
||||||
(types.submodule { options = serverOpt; })
|
|
||||||
];
|
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user