mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
...depot, without readtree
This commit is contained in:
parent
d8b3918a8f
commit
fbaacf54ed
15 changed files with 42 additions and 46 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, profiles, ... }: with lib; {
|
||||
{ depot, lib, config, ... }: with lib; {
|
||||
config = {
|
||||
deploy.targets.infra = {
|
||||
tf = {
|
||||
|
|
@ -15,7 +15,7 @@ config = {
|
|||
network.nodes.athame = {
|
||||
imports = lib.hostImport {
|
||||
hostName = "athame";
|
||||
inherit profiles;
|
||||
inherit (depot) profiles;
|
||||
};
|
||||
networking = {
|
||||
hostName = "athame";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{ config, users, lib, pkgs, profiles, services, ... }:
|
||||
{ depot, config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Imports
|
||||
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
profiles.hardware.hcloud-imperative
|
||||
users.kat.server
|
||||
services.fail2ban
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, profiles, ... }: with lib; {
|
||||
{ lib, config, depot, ... }: with lib; {
|
||||
config = {
|
||||
deploy.targets.beltane = {
|
||||
tf = {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
network.nodes.beltane = {
|
||||
imports = lib.hostImport {
|
||||
hostName = "beltane";
|
||||
inherit profiles;
|
||||
inherit (depot) profiles;
|
||||
};
|
||||
networking = {
|
||||
hostName = "beltane";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{ config, lib, pkgs, profiles, services, users, tf, ... }:
|
||||
{ depot, tf, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Imports
|
||||
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
profiles.hardware.rm-310
|
||||
profiles.gui
|
||||
users.kat.guiFull
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, profiles, ... }: with lib; {
|
||||
{ lib, config, depot, ... }: with lib; {
|
||||
config = {
|
||||
deploy.targets.ostara = {
|
||||
tf = {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
network.nodes.ostara = {
|
||||
imports = lib.hostImport {
|
||||
hostName = "ostara";
|
||||
inherit profiles;
|
||||
inherit (depot) profiles;
|
||||
};
|
||||
networking = {
|
||||
hostName = "ostara";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{ lib, config, users, pkgs, profiles, services, ... }:
|
||||
{ depot, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Imports
|
||||
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
profiles.hardware.eeepc-1015pem
|
||||
profiles.laptop
|
||||
services.kattv
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, profiles, ... }: with lib; {
|
||||
{ lib, config, depot, ... }: with lib; {
|
||||
config = {
|
||||
deploy.targets.personal = {
|
||||
tf = {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
network.nodes.samhain = {
|
||||
imports = lib.hostImport {
|
||||
hostName = "samhain";
|
||||
inherit profiles;
|
||||
inherit (depot) profiles;
|
||||
};
|
||||
networking = {
|
||||
hostName = "samhain";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ tf, config, users, pkgs, lib, profiles, sources, services, ... }:
|
||||
{ depot, tf, config, pkgs, lib, sources, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ let
|
|||
in {
|
||||
# Imports
|
||||
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
profiles.hardware.ms-7b86
|
||||
profiles.gui
|
||||
profiles.vfio
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, config, profiles, ... }: with lib; {
|
||||
{ lib, config, depot, ... }: with lib; {
|
||||
config = {
|
||||
deploy.targets.personal = {
|
||||
tf = {
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
network.nodes.yule = {
|
||||
imports = lib.hostImport {
|
||||
hostName = "yule";
|
||||
inherit profiles;
|
||||
inherit (depot) profiles;
|
||||
};
|
||||
networking = {
|
||||
hostName = "yule";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
{ config, users, pkgs, lib, profiles, services, ... }:
|
||||
{ depot, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Imports
|
||||
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
profiles.hardware.v330-14arr
|
||||
profiles.gui
|
||||
profiles.laptop
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, sources, users, profiles, services, lib, config, ... }:
|
||||
{ pkgs, sources, depot, lib, config, ... }:
|
||||
|
||||
/*
|
||||
This module:
|
||||
|
|
@ -59,7 +59,7 @@ with lib;
|
|||
];
|
||||
specialArgs = {
|
||||
inherit (config.network) nodes;
|
||||
inherit sources profiles users services;
|
||||
inherit sources depot;
|
||||
meta = config;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{ config, users, lib, pkgs, ... }:
|
||||
{ config, depot, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
imports = with depot; [
|
||||
users.kat.base
|
||||
# users.kairi.base TODO
|
||||
users.arc
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
tf = { config, ... }: {
|
||||
dns.records.ygg_grimoire = {
|
||||
tld = config.kw.dns.tld;
|
||||
domain = "grimoire.${config.kw.dns.ygg_prefix}";
|
||||
domain = "grimoire.net";
|
||||
aaaa.address = "200:c87d:7960:916:bf0e:a0e1:3da7:4fc6";
|
||||
};
|
||||
|
||||
dns.records.ygg_boline = {
|
||||
tld = config.kw.dns.tld;
|
||||
domain = "boline.${config.kw.dns.ygg_prefix}";
|
||||
domain = "boline.net";
|
||||
aaaa.address = "200:474d:14f7:1d21:f171:4e85:a3fa:9393";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
31
default.nix
31
default.nix
|
|
@ -10,23 +10,16 @@ let
|
|||
|
||||
/*
|
||||
This is used to generate specialArgs + the like. It works as such:
|
||||
* A <argGenName> can exist at config/<argGenName>.
|
||||
* A <argGenName> can exist at config/trusted/<argGenName>.
|
||||
* A <depotName> can exist at config/<depotName>.
|
||||
* A <depotName> can exist at config/trusted/<depotName>.
|
||||
If only one exists, the path for that one is returned.
|
||||
Otherwise a module is generated which contains both import paths.
|
||||
*/
|
||||
argGenNames = [ "profiles" "users" "targets" "services" ];
|
||||
argGen = lib.mapListToAttrs (folder: lib.nameValuePair folder (lib.domainMerge { inherit folder; })) argGenNames;
|
||||
|
||||
/*
|
||||
This produces an attrSet of hosts based upon:
|
||||
* hosts being located within config/hosts/<hostname>
|
||||
* hosts having an entrypoint of meta.nix
|
||||
*/
|
||||
hosts = lib.domainMerge {
|
||||
folder = "hosts";
|
||||
defaultFile = "meta.nix";
|
||||
};
|
||||
filterAttrNamesToList = filter: set:
|
||||
lib.foldl' (a: b: a ++ b) [ ]
|
||||
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (lib.attrNames set));
|
||||
depotNames = lib.unique ((filterAttrNamesToList (name: type: name != "trusted" && type == "directory") (builtins.readDir ./config)) ++ (filterAttrNamesToList (name: type: name != "trusted" && name != "pkgs" && type == "directory") (builtins.readDir ./config/trusted)));
|
||||
depot = lib.mapListToAttrs (folder: lib.nameValuePair folder (lib.domainMerge { inherit folder; })) depotNames;
|
||||
|
||||
/*
|
||||
We use this to make the meta runner use this file and to use `--show-trace` on nix-builds.
|
||||
|
|
@ -39,14 +32,14 @@ let
|
|||
# This is where the meta config is evaluated.
|
||||
eval = lib.evalModules {
|
||||
modules = lib.singleton metaConfig
|
||||
++ lib.attrValues (removeAttrs argGen.targets ["common"])
|
||||
++ lib.attrValues hosts
|
||||
++ lib.attrValues (removeAttrs depot.targets ["common"])
|
||||
++ lib.attrValues depot.hosts
|
||||
++ lib.optional (builtins.pathExists ./config/trusted/meta.nix) ./config/trusted/meta.nix
|
||||
++ lib.singleton ./config/modules/meta/default.nix;
|
||||
|
||||
specialArgs = {
|
||||
inherit sources;
|
||||
inherit (argGen) profiles users services;
|
||||
inherit depot;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +48,7 @@ let
|
|||
|
||||
/*
|
||||
Please note all specialArg generated specifications use the folder common to both import paths.
|
||||
Those import paths are as mentioned above next to `argGenNames`.
|
||||
Those import paths are as mentioned above next to `depotNames`.
|
||||
|
||||
This provides us with a ./. that contains (most relevantly):
|
||||
* deploy.targets -> a mapping of target name to host names
|
||||
|
|
@ -66,4 +59,4 @@ let
|
|||
* do not use common, it is tf-nix specific config ingested at line 66 of config/modules/meta/deploy.nix for every target.
|
||||
* services -> the specialArg generated from services/
|
||||
*/
|
||||
in config // { inherit pkgs hosts sourceCache sources; } // argGen
|
||||
in config // { inherit pkgs lib sourceCache sources; } // depot
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
{ lib }: { folder, defaultFile ? "default.nix" }: with lib; let
|
||||
folderNames = [ (../../config + "/${folder}") (../../config/trusted + "/${folder}") ];
|
||||
defaultFileFinal = if (defaultFile == "default.nix" && folder == "hosts") then
|
||||
"meta.nix"
|
||||
else defaultFile;
|
||||
folderModLists = map (folderName: modList {
|
||||
modulesDir = folderName;
|
||||
inherit defaultFile;
|
||||
defaultFile = defaultFileFinal;
|
||||
}) (filter builtins.pathExists folderNames);
|
||||
in foldl modListMerge { } folderModLists
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue