refactor: stop using inputs.self

This commit is contained in:
arcnmx 2024-05-21 14:28:34 -07:00
parent 213430704f
commit 8601560f7d
27 changed files with 111 additions and 130 deletions

View file

@ -1,13 +1,13 @@
{ {
inputs,
config, config,
gensokyo-zone,
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.modules) mkIf mkDefault mkForce; inherit (lib.modules) mkIf mkDefault mkForce;
inherit (lib.attrsets) attrNames attrValues filterAttrs mapAttrs' nameValuePair; inherit (lib.attrsets) attrNames attrValues filterAttrs mapAttrs' nameValuePair;
inherit (inputs.self.lib.lib) unmerged; inherit (gensokyo-zone.lib) unmerged;
cfg = config.services.github-runners; cfg = config.services.github-runners;
nixosConfig = config; nixosConfig = config;
enabledRunners = filterAttrs (_: runner: runner.enable) cfg; enabledRunners = filterAttrs (_: runner: runner.enable) cfg;

View file

@ -1,12 +1,12 @@
{ {
inputs,
lib,
config, config,
gensokyo-zone,
lib,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkBaseDn; inherit (gensokyo-zone.lib) mkBaseDn;
inherit (lib) mkIf mkMerge mkBefore mkDefault mkOptionDefault mkEnableOption mkOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.strings) splitString concatMapStringsSep; inherit (lib.modules) mkIf mkMerge mkBefore mkDefault mkOptionDefault;
inherit (config.lib.access) mkSnakeOil; inherit (config.lib.access) mkSnakeOil;
cfg = config.services.kanidm; cfg = config.services.kanidm;
in { in {

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapListToAttrs; inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapListToAttrs;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkOptionDefault; inherit (lib.modules) mkOptionDefault;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;

View file

@ -1,11 +1,11 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
pkgs, pkgs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mapOptionDefaults; inherit (gensokyo-zone.lib) mapOptionDefaults;
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkOptionDefault;
inherit (lib.attrsets) attrValues; inherit (lib.attrsets) attrValues;

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) unmerged mkAlmostOptionDefault; inherit (gensokyo-zone.lib) unmerged mkAlmostOptionDefault;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkOptionDefault; inherit (lib.modules) mkIf mkOptionDefault;
inherit (lib.attrsets) filterAttrs mapAttrsToList nameValuePair; inherit (lib.attrsets) filterAttrs mapAttrsToList nameValuePair;

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapOptionDefaults mapListToAttrs; inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapOptionDefaults mapListToAttrs;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkOptionDefault;
inherit (lib.attrsets) attrNames mapAttrs mapAttrsToList; inherit (lib.attrsets) attrNames mapAttrs mapAttrsToList;

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapListToAttrs; inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapListToAttrs;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkOptionDefault; inherit (lib.modules) mkIf mkOptionDefault;
inherit (lib.attrsets) mapAttrs mapAttrsToList; inherit (lib.attrsets) mapAttrs mapAttrsToList;

View file

@ -1,7 +1,7 @@
{ {
inputs,
config, config,
pkgs, pkgs,
gensokyo-zone,
lib, lib,
utils, utils,
... ...
@ -12,7 +12,7 @@
inherit (lib.lists) singleton optional filter concatMap; inherit (lib.lists) singleton optional filter concatMap;
inherit (lib.strings) concatStringsSep escapeShellArg; inherit (lib.strings) concatStringsSep escapeShellArg;
inherit (utils) escapeSystemdExecArg; inherit (utils) escapeSystemdExecArg;
inherit (inputs.self.lib.lib) unmerged; inherit (gensokyo-zone.lib) unmerged;
inherit (config) networking; inherit (config) networking;
inherit (networking) access; inherit (networking) access;
enabledNamespaces = filter (ns: ns.enable) (attrValues networking.namespaces); enabledNamespaces = filter (ns: ns.enable) (attrValues networking.namespaces);

View file

@ -1,21 +1,19 @@
{ let
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;
listenModule = { listenModule = {
nixosConfig,
config, config,
virtualHost, virtualHost,
listenKind, 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; { options = with lib.types; {
enable = enable =
mkEnableOption "this port" mkEnableOption "this port"
@ -108,19 +106,19 @@
listenDirectives = mkMerge (map (conf: mkOptionDefault "listen ${conf};") config.listenConfigs); listenDirectives = mkMerge (map (conf: mkOptionDefault "listen ${conf};") config.listenConfigs);
}; };
}; };
listenType = {
specialArgs,
modules ? [],
}:
lib.types.submoduleWith {
inherit specialArgs;
modules = [listenModule] ++ modules;
};
hostModule = { hostModule = {
nixosConfig, nixosConfig,
config, config,
gensokyo-zone,
lib,
... ...
}: let }: 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'; cfg = attrValues config.listen';
enabledCfg = filter (port: port.enable) cfg; enabledCfg = filter (port: port.enable) cfg;
mkListen = listen: addr: let mkListen = listen: addr: let
@ -134,9 +132,10 @@
in { in {
options = with lib.types; { options = with lib.types; {
listen' = mkOption { listen' = mkOption {
type = attrsOf (listenType { type = attrsOf (submoduleWith {
modules = [listenModule];
specialArgs = { specialArgs = {
inherit nixosConfig; inherit nixosConfig gensokyo-zone;
virtualHost = config; virtualHost = config;
listenKind = "virtualHost"; listenKind = "virtualHost";
}; };
@ -164,15 +163,23 @@
streamServerModule = { streamServerModule = {
nixosConfig, nixosConfig,
config, config,
gensokyo-zone,
lib,
... ...
}: let }: 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); enabledListen = filter (port: port.enable) (attrValues config.listen);
in { in {
options = with lib.types; { options = with lib.types; {
listen = mkOption { listen = mkOption {
type = attrsOf (listenType { type = attrsOf (submoduleWith {
modules = [listenModule];
specialArgs = { specialArgs = {
inherit nixosConfig; inherit nixosConfig gensokyo-zone;
virtualHost = config; virtualHost = config;
streamServer = config; streamServer = config;
listenKind = "streamServer"; listenKind = "streamServer";
@ -208,6 +215,9 @@
)); ));
}; };
}; };
in
{lib, ...}: let
inherit (lib.options) mkOption;
in { in {
options.services.nginx = with lib.types; { options.services.nginx = with lib.types; {
virtualHosts = mkOption { virtualHosts = mkOption {

View file

@ -1,16 +1,16 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
pkgs, pkgs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkAlmostOptionDefault; inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkBefore mkAfter mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkBefore mkAfter mkOptionDefault;
inherit (lib.attrsets) mapAttrs' mapAttrsToList listToAttrs nameValuePair; inherit (lib.attrsets) mapAttrs' mapAttrsToList listToAttrs nameValuePair;
inherit (lib.lists) concatLists; inherit (lib.lists) concatLists;
inherit (lib.strings) toUpper hasPrefix concatMapStringsSep concatStringsSep; inherit (lib.strings) toUpper hasPrefix concatMapStringsSep;
inherit (lib.trivial) flip; inherit (lib.trivial) flip;
inherit (config.services) samba-wsdd; inherit (config.services) samba-wsdd;
cfg = config.services.samba; cfg = config.services.samba;

View file

@ -1,11 +1,11 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
pkgs, pkgs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkWinPath userIs; inherit (gensokyo-zone.lib) mkWinPath userIs;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (lib.attrsets) filterAttrs mapAttrsToList listToAttrs nameValuePair; inherit (lib.attrsets) filterAttrs mapAttrsToList listToAttrs nameValuePair;

View file

@ -1,11 +1,11 @@
{ {
config, config,
pkgs, pkgs,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) userIs; inherit (gensokyo-zone.lib) userIs;
inherit (config.lib.steam) mkSharePath; inherit (config.lib.steam) mkSharePath;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;

View file

@ -1,11 +1,11 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
pkgs, pkgs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) unmerged; inherit (gensokyo-zone.lib) unmerged;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (lib.strings) match concatStringsSep escapeShellArg optionalString; inherit (lib.strings) match concatStringsSep escapeShellArg optionalString;

View file

@ -1,14 +1,14 @@
{ {
name, name,
config, config,
lib,
access, access,
inputs, gensokyo-zone,
lib,
... ...
}: let }: let
inherit (inputs.self) nixosConfigurations; inherit (gensokyo-zone) systems;
inherit (inputs.self.lib) systems; inherit (gensokyo-zone.self) nixosConfigurations;
inherit (inputs.self.lib.lib) domain mkAddress6; inherit (gensokyo-zone.lib) domain mkAddress6;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
inherit (lib.attrsets) mapAttrs attrValues; inherit (lib.attrsets) mapAttrs attrValues;

View file

@ -1,13 +1,9 @@
{ {
name,
config, config,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) domain;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkOptionDefault;
in { in {
options.ci = with lib.types; { options.ci = with lib.types; {
enable = enable =
@ -20,26 +16,4 @@ in {
default = false; 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;
};
};
};
} }

View file

@ -1,15 +1,15 @@
{ {
name, name,
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) domain; inherit (gensokyo-zone.lib) domain;
inherit (lib.modules) mkIf mkOptionDefault; inherit (lib.modules) mkIf mkOptionDefault;
in { in {
options = let options = let
inherit (inputs.self.lib.lib) json; inherit (gensokyo-zone.lib) json;
inherit (lib.types) nullOr; inherit (lib.types) nullOr;
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
in { in {
@ -33,7 +33,7 @@ in {
profiles.system = { profiles.system = {
user = "root"; user = "root";
path = let path = let
inherit (inputs.self.legacyPackages.${config.system}.deploy-rs) activate; inherit (gensokyo-zone.self.legacyPackages.${config.system}.deploy-rs) activate;
in in
activate.nixos nixos; activate.nixos nixos;
}; };

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) eui64; inherit (gensokyo-zone.lib) eui64;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkOptionDefault; inherit (lib.modules) mkIf mkOptionDefault;
inherit (lib.trivial) mapNullable; inherit (lib.trivial) mapNullable;

View file

@ -1,23 +1,21 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
pkgs, pkgs,
... ...
}: let }: {
inherit (lib.modules) mkDefault;
in {
services.nginx.virtualHosts.gensokyoZone = { services.nginx.virtualHosts.gensokyoZone = {
serverName = config.networking.domain; serverName = config.networking.domain;
locations = { locations = {
"/" = { "/" = {
root = inputs.website.packages.${pkgs.system}.gensokyoZone; root = gensokyo-zone.inputs.website.packages.${pkgs.system}.gensokyoZone;
}; };
"/docs" = { "/docs" = {
root = pkgs.linkFarm "genso-docs-wwwroot" [ root = pkgs.linkFarm "genso-docs-wwwroot" [
{ {
name = "docs"; name = "docs";
path = inputs.self.packages.${pkgs.system}.docs; path = gensokyo-zone.self.packages.${pkgs.system}.docs;
} }
]; ];
}; };

View file

@ -1,12 +1,12 @@
{ {
inputs,
name, name,
config, config,
gensokyo-zone,
lib, lib,
... ...
}: let }: let
inherit (lib.modules) mkIf mkOrder mkDefault mkOverride; inherit (lib.modules) mkIf mkOrder mkDefault mkOverride;
inherit (inputs.self.lib.lib) domain; inherit (gensokyo-zone.lib) domain;
in { in {
networking = { networking = {
nftables.enable = true; nftables.enable = true;

View file

@ -2,7 +2,6 @@
config, config,
options, options,
lib, lib,
inputs,
gensokyo-zone, gensokyo-zone,
... ...
}: let }: let

View file

@ -1,9 +1,9 @@
{inputs, ...}: let {gensokyo-zone, ...}: let
inherit (inputs.self) overlays; inherit (gensokyo-zone.self) overlays;
in { in {
nixpkgs = { nixpkgs = {
overlays = [ overlays = [
inputs.arcexprs.overlays.default gensokyo-zone.inputs.arcexprs.overlays.default
overlays.default overlays.default
]; ];
config = { config = {

View file

@ -1,14 +1,14 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.modules) mkIf mkMerge mkDefault;
inherit (lib.attrsets) listToAttrs nameValuePair; inherit (lib.attrsets) listToAttrs nameValuePair;
inherit (lib.lists) genList; inherit (lib.lists) genList;
inherit (inputs.self.lib.lib) unmerged; inherit (gensokyo-zone.lib) unmerged;
cfg = config.services.github-runner-zone; cfg = config.services.github-runner-zone;
genZone = f: genList f cfg.count; genZone = f: genList f cfg.count;
genZoneAttrs = prefix: f: listToAttrs (genZone (i: nameValuePair "${prefix}${toString i}" (f i))); genZoneAttrs = prefix: f: listToAttrs (genZone (i: nameValuePair "${prefix}${toString i}" (f i)));

View file

@ -1,8 +1,8 @@
{ {
inputs,
system, system,
access, access,
config, config,
gensokyo-zone,
lib, lib,
... ...
}: let }: let
@ -15,7 +15,7 @@
}; };
hostname = "sso.${config.networking.domain}"; hostname = "sso.${config.networking.domain}";
hostname-strict = false; hostname-strict = false;
inherit (inputs.self.legacyPackages.${system.system}) patchedNixpkgs; inherit (gensokyo-zone.self.legacyPackages.${system.system}) patchedNixpkgs;
keycloakModulePath = "services/web-apps/keycloak.nix"; keycloakModulePath = "services/web-apps/keycloak.nix";
in { in {
# upstream keycloak makes an incorrect assumption in its assertions, so we patch it # upstream keycloak makes an incorrect assumption in its assertions, so we patch it

View file

@ -1,12 +1,12 @@
{ {
inputs,
pkgs, pkgs,
config, config,
access, access,
gensokyo-zone,
lib, lib,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkAlmostOptionDefault mapAlmostOptionDefaults; inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapAlmostOptionDefaults;
inherit (lib.modules) mkIf mkMerge mkBefore mkDefault mkOptionDefault; inherit (lib.modules) mkIf mkMerge mkBefore mkDefault mkOptionDefault;
inherit (lib.strings) replaceStrings; inherit (lib.strings) replaceStrings;
inherit (config.security) ipa; inherit (config.security) ipa;

View file

@ -1,10 +1,10 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (inputs.self.lib.lib) userIs mkAlmostOptionDefault; inherit (gensokyo-zone.lib) userIs mkAlmostOptionDefault;
inherit (lib.modules) mkMerge mkDefault; inherit (lib.modules) mkMerge mkDefault;
inherit (lib.attrsets) mapAttrs filterAttrs; inherit (lib.attrsets) mapAttrs filterAttrs;
ldapUsers = filterAttrs (_: userIs "peeps") config.users.users; ldapUsers = filterAttrs (_: userIs "peeps") config.users.users;

View file

@ -1,12 +1,12 @@
{ {
inputs,
config, config,
access,
system, system,
access,
gensokyo-zone,
lib, lib,
... ...
}: let }: let
inherit (inputs.self.lib.lib) mkBaseDn; inherit (gensokyo-zone.lib) mkBaseDn;
inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.modules) mkIf mkMerge mkDefault;
inherit (lib.strings) toUpper removeSuffix; inherit (lib.strings) toUpper removeSuffix;
cfg = config.services.samba; cfg = config.services.samba;

View file

@ -1,11 +1,11 @@
{ {
config, config,
gensokyo-zone,
lib, lib,
inputs,
... ...
}: let }: let
inherit (lib.attrsets) filterAttrs mapAttrsToList; inherit (lib.attrsets) filterAttrs mapAttrsToList;
inherit (inputs.self.lib.lib) userIs; inherit (gensokyo-zone.lib) userIs;
in { in {
users.groups = { users.groups = {
peeps = { peeps = {