mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor: stop using inputs.self
This commit is contained in:
parent
213430704f
commit
8601560f7d
27 changed files with 111 additions and 130 deletions
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault mkForce;
|
||||
inherit (lib.attrsets) attrNames attrValues filterAttrs mapAttrs' nameValuePair;
|
||||
inherit (inputs.self.lib.lib) unmerged;
|
||||
inherit (gensokyo-zone.lib) unmerged;
|
||||
cfg = config.services.github-runners;
|
||||
nixosConfig = config;
|
||||
enabledRunners = filterAttrs (_: runner: runner.enable) cfg;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkBaseDn;
|
||||
inherit (lib) mkIf mkMerge mkBefore mkDefault mkOptionDefault mkEnableOption mkOption;
|
||||
inherit (lib.strings) splitString concatMapStringsSep;
|
||||
inherit (gensokyo-zone.lib) mkBaseDn;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkDefault mkOptionDefault;
|
||||
inherit (config.lib.access) mkSnakeOil;
|
||||
cfg = config.services.kanidm;
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapListToAttrs;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapListToAttrs;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkOptionDefault;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mapOptionDefaults;
|
||||
inherit (gensokyo-zone.lib) mapOptionDefaults;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkOptionDefault;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) unmerged mkAlmostOptionDefault;
|
||||
inherit (gensokyo-zone.lib) unmerged mkAlmostOptionDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrsToList nameValuePair;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapOptionDefaults mapListToAttrs;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapOptionDefaults mapListToAttrs;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkOptionDefault;
|
||||
inherit (lib.attrsets) attrNames mapAttrs mapAttrsToList;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapListToAttrs;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapListToAttrs;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
inherit (lib.attrsets) mapAttrs mapAttrsToList;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
utils,
|
||||
...
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
inherit (lib.lists) singleton optional filter concatMap;
|
||||
inherit (lib.strings) concatStringsSep escapeShellArg;
|
||||
inherit (utils) escapeSystemdExecArg;
|
||||
inherit (inputs.self.lib.lib) unmerged;
|
||||
inherit (gensokyo-zone.lib) unmerged;
|
||||
inherit (config) networking;
|
||||
inherit (networking) access;
|
||||
enabledNamespaces = filter (ns: ns.enable) (attrValues networking.namespaces);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,19 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mkAddress6;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkOptionDefault mkForce;
|
||||
inherit (lib.attrsets) attrValues mapAttrs;
|
||||
inherit (lib.lists) optional filter concatMap;
|
||||
inherit (config.services) nginx;
|
||||
let
|
||||
listenModule = {
|
||||
nixosConfig,
|
||||
config,
|
||||
virtualHost,
|
||||
listenKind,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault mkAddress6;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkOptionDefault mkForce;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (nixosConfig.services) nginx;
|
||||
in {
|
||||
options = with lib.types; {
|
||||
enable =
|
||||
mkEnableOption "this port"
|
||||
|
|
@ -108,19 +106,19 @@
|
|||
listenDirectives = mkMerge (map (conf: mkOptionDefault "listen ${conf};") config.listenConfigs);
|
||||
};
|
||||
};
|
||||
listenType = {
|
||||
specialArgs,
|
||||
modules ? [],
|
||||
}:
|
||||
lib.types.submoduleWith {
|
||||
inherit specialArgs;
|
||||
modules = [listenModule] ++ modules;
|
||||
};
|
||||
hostModule = {
|
||||
nixosConfig,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkOptionDefault mkForce;
|
||||
inherit (lib.attrsets) attrValues mapAttrs;
|
||||
inherit (lib.lists) filter concatMap;
|
||||
inherit (nixosConfig.services) nginx;
|
||||
cfg = attrValues config.listen';
|
||||
enabledCfg = filter (port: port.enable) cfg;
|
||||
mkListen = listen: addr: let
|
||||
|
|
@ -134,9 +132,10 @@
|
|||
in {
|
||||
options = with lib.types; {
|
||||
listen' = mkOption {
|
||||
type = attrsOf (listenType {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [listenModule];
|
||||
specialArgs = {
|
||||
inherit nixosConfig;
|
||||
inherit nixosConfig gensokyo-zone;
|
||||
virtualHost = config;
|
||||
listenKind = "virtualHost";
|
||||
};
|
||||
|
|
@ -164,15 +163,23 @@
|
|||
streamServerModule = {
|
||||
nixosConfig,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkOptionDefault mkForce;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
inherit (lib.lists) filter;
|
||||
inherit (nixosConfig.services) nginx;
|
||||
enabledListen = filter (port: port.enable) (attrValues config.listen);
|
||||
in {
|
||||
options = with lib.types; {
|
||||
listen = mkOption {
|
||||
type = attrsOf (listenType {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [listenModule];
|
||||
specialArgs = {
|
||||
inherit nixosConfig;
|
||||
inherit nixosConfig gensokyo-zone;
|
||||
virtualHost = config;
|
||||
streamServer = config;
|
||||
listenKind = "streamServer";
|
||||
|
|
@ -208,19 +215,22 @@
|
|||
));
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.services.nginx = with lib.types; {
|
||||
virtualHosts = mkOption {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [hostModule];
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
});
|
||||
in
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
in {
|
||||
options.services.nginx = with lib.types; {
|
||||
virtualHosts = mkOption {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [hostModule];
|
||||
shorthandOnlyDefinesConfig = true;
|
||||
});
|
||||
};
|
||||
stream.servers = mkOption {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [streamServerModule];
|
||||
shorthandOnlyDefinesConfig = false;
|
||||
});
|
||||
};
|
||||
};
|
||||
stream.servers = mkOption {
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [streamServerModule];
|
||||
shorthandOnlyDefinesConfig = false;
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkAlmostOptionDefault;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkAfter mkOptionDefault;
|
||||
inherit (lib.attrsets) mapAttrs' mapAttrsToList listToAttrs nameValuePair;
|
||||
inherit (lib.lists) concatLists;
|
||||
inherit (lib.strings) toUpper hasPrefix concatMapStringsSep concatStringsSep;
|
||||
inherit (lib.strings) toUpper hasPrefix concatMapStringsSep;
|
||||
inherit (lib.trivial) flip;
|
||||
inherit (config.services) samba-wsdd;
|
||||
cfg = config.services.samba;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) mkWinPath userIs;
|
||||
inherit (gensokyo-zone.lib) mkWinPath userIs;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrsToList listToAttrs nameValuePair;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) userIs;
|
||||
inherit (gensokyo-zone.lib) userIs;
|
||||
inherit (config.lib.steam) mkSharePath;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) unmerged;
|
||||
inherit (gensokyo-zone.lib) unmerged;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
|
||||
inherit (lib.strings) match concatStringsSep escapeShellArg optionalString;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
name,
|
||||
config,
|
||||
lib,
|
||||
access,
|
||||
inputs,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self) nixosConfigurations;
|
||||
inherit (inputs.self.lib) systems;
|
||||
inherit (inputs.self.lib.lib) domain mkAddress6;
|
||||
inherit (gensokyo-zone) systems;
|
||||
inherit (gensokyo-zone.self) nixosConfigurations;
|
||||
inherit (gensokyo-zone.lib) domain mkAddress6;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
|
||||
inherit (lib.attrsets) mapAttrs attrValues;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
{
|
||||
name,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) domain;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
in {
|
||||
options.ci = with lib.types; {
|
||||
enable =
|
||||
|
|
@ -20,26 +16,4 @@ in {
|
|||
default = false;
|
||||
};
|
||||
};
|
||||
config = {
|
||||
deploy = let
|
||||
nixos = config.built;
|
||||
in {
|
||||
sshUser = mkOptionDefault "root";
|
||||
user = mkOptionDefault "root";
|
||||
sshOpts = mkIf (config.type == "NixOS") (
|
||||
mkOptionDefault ["-p" "${builtins.toString (builtins.head nixos.config.services.openssh.ports)}"]
|
||||
);
|
||||
autoRollback = mkOptionDefault true;
|
||||
magicRollback = mkOptionDefault true;
|
||||
fastConnection = mkOptionDefault false;
|
||||
hostname = mkOptionDefault "${name}.local.${domain}";
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
path = let
|
||||
inherit (inputs.self.legacyPackages.${config.system}.deploy-rs) activate;
|
||||
in
|
||||
activate.nixos nixos;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
name,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) domain;
|
||||
inherit (gensokyo-zone.lib) domain;
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
in {
|
||||
options = let
|
||||
inherit (inputs.self.lib.lib) json;
|
||||
inherit (gensokyo-zone.lib) json;
|
||||
inherit (lib.types) nullOr;
|
||||
inherit (lib.options) mkOption;
|
||||
in {
|
||||
|
|
@ -33,7 +33,7 @@ in {
|
|||
profiles.system = {
|
||||
user = "root";
|
||||
path = let
|
||||
inherit (inputs.self.legacyPackages.${config.system}.deploy-rs) activate;
|
||||
inherit (gensokyo-zone.self.legacyPackages.${config.system}.deploy-rs) activate;
|
||||
in
|
||||
activate.nixos nixos;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.self.lib.lib) eui64;
|
||||
inherit (gensokyo-zone.lib) eui64;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
inherit (lib.trivial) mapNullable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue