Import overhaul!

This commit is contained in:
kat witch 2021-08-18 00:31:04 +01:00
parent 1e53ee9d2e
commit 8a32942d0e
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
16 changed files with 95 additions and 93 deletions

View file

@ -20,7 +20,7 @@ let
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 (lib.folderList ./depot ["trusted"] ++ lib.folderList ./depot/trusted ["pkgs"]);
depotNames = lib.unique (lib.folderList ./depot ["trusted"] ++ lib.folderList ./depot/trusted ["pkgs" "tf"]);
depot = lib.mapListToAttrs (folder: lib.nameValuePair folder (lib.domainMerge {
inherit folder;
folderPaths = [ (./depot + "/${folder}") (./depot/trusted + "/${folder}") ];
@ -64,5 +64,5 @@ 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/
*/
self = config // { inherit pkgs lib sourceCache sources; } // depot;
self = config // { inherit pkgs lib sourceCache sources; } // depot;
in self

View file

@ -1,25 +1,17 @@
{ profiles, lib, root, config, ... }: with lib; {
config = {
deploy.targets.infra = {
tf = {
resources.athame = {
provider = "null";
type = "resource";
connection = {
port = 62954;
host = config.network.nodes.athame.network.addresses.public.ipv4.address;
};
{ config, lib, kw, ... }: with lib; {
deploy.targets.infra = {
tf = {
resources.athame = {
provider = "null";
type = "resource";
connection = {
port = head config.network.nodes.athame.services.openssh.ports;
host = config.network.nodes.athame.network.addresses.public.ipv4.address;
};
};
};
network.nodes.athame = {
imports = lib.hostImport {
hostName = "athame";
inherit profiles root;
};
networking = {
hostName = "athame";
};
};
};
network.nodes.athame = {
imports = kw.nodeImport "athame";
};
}

View file

@ -1,4 +1,4 @@
{ profiles, config, root, lib, ... }: with lib; {
{ config, lib, kw, ... }: with lib; {
config = {
deploy.targets.beltane = {
tf = {
@ -6,20 +6,14 @@
provider = "null";
type = "resource";
connection = {
port = 62954;
port = head config.network.nodes.beltane.services.openssh.ports;
host = config.network.nodes.beltane.network.addresses.private.ipv4.address;
};
};
};
};
network.nodes.beltane = {
imports = lib.hostImport {
hostName = "beltane";
inherit profiles root;
};
networking = {
hostName = "beltane";
};
imports = kw.nodeImport "beltane";
};
};
}

View file

@ -1,11 +1,7 @@
{ lib, config, root, profiles, ... }: with lib; {
{ config, lib, kw, ... }: with lib; {
deploy.targets.dummy.enable = false;
network.nodes.dummy = {
imports = lib.hostImport {
hostName = "dummy";
inherit profiles root;
};
networking = {
imports = kw.nodeImport {
hostName = "dummy";
};
};

View file

@ -1,4 +1,4 @@
{ meta, profiles, root, config, lib, ... }: with lib; {
{ config, lib, kw, ... }: with lib; {
config = {
deploy.targets.ostara = {
tf = {
@ -6,20 +6,14 @@
provider = "null";
type = "resource";
connection = {
port = 62954;
host = meta.network.nodes.ostara.network.addresses.private.ipv4.address;
port = head config.network.nodes.ostara.services.openssh.ports;
host = config.network.nodes.ostara.network.addresses.private.ipv4.address;
};
};
};
};
network.nodes.ostara = {
imports = lib.hostImport {
hostName = "ostara";
inherit profiles root;
};
networking = {
hostName = "ostara";
};
imports = kw.nodeImport "ostara";
};
};
}

View file

@ -36,6 +36,7 @@ with lib;
# Networking
networking = {
hostName = "ostara";
hostId = "9f89b327";
useDHCP = false;
interfaces.enp1s0.ipv4.addresses = singleton {

View file

@ -1,4 +1,4 @@
{ lib, config, root, profiles, ... }: with lib; {
{ config, lib, kw, ... }: with lib; {
config = {
deploy.targets.personal = {
tf = {
@ -6,20 +6,14 @@
provider = "null";
type = "resource";
connection = {
port = 62954;
host = "192.168.1.135";
port = head config.network.nodes.samhain.services.openssh.ports;
host = config.network.nodes.samhain.network.addresses.private.ipv4.address;
};
};
};
};
network.nodes.samhain = {
imports = lib.hostImport {
hostName = "samhain";
inherit profiles root;
};
networking = {
hostName = "samhain";
};
imports = kw.nodeImport "samhain";
};
};
}

View file

@ -1,4 +1,4 @@
{ meta, profiles, config, root, lib, ... }: with lib; {
{ config, lib, kw, ... }: with lib; {
config = {
deploy.targets.personal = {
tf = {
@ -6,20 +6,14 @@
provider = "null";
type = "resource";
connection = {
port = 62954;
host = meta.network.nodes.yule.network.addresses.private.ipv4.address;
port = head config.network.nodes.yule.services.openssh.ports;
host = config.network.nodes.yule.network.addresses.private.ipv4.address;
};
};
};
};
network.nodes.yule = {
imports = lib.hostImport {
hostName = "yule";
inherit profiles root;
};
networking = {
hostName = "yule";
};
imports = kw.nodeImport "yule";
};
};
}

View file

@ -2,8 +2,8 @@
{
disabledModules = [ "programs/vim.nix" ];
imports = with (import (sources.arcexprs + "/modules")).home-manager; [ base16 syncplay konawall i3gopher weechat shell ]
++ [
imports = [
(import (sources.arcexprs + "/modules")).home-manager
(import (sources.katexprs + "/modules")).home
./vim.nix
./fvwm.nix

View file

@ -2,6 +2,7 @@
{
imports = [
./imports.nix
./deploy.nix
./network.nix
];

View file

@ -0,0 +1,41 @@
{ config, lib, profiles, root, ... }:
with lib;
{
options = {
lib = mkOption {
type = types.attrsOf (types.attrsOf types.unspecified);
};
network.importing = {
nixosImports = mkOption {
type = types.listOf types.str;
};
homeImports = mkOption {
type = types.listOf types.str;
};
users = mkOption {
type = types.listOf types.str;
};
};
};
config = {
network.importing = {
nixosImports = mkDefault (map (path: toString path) [
(root + "/depot/hosts/HN/nixos.nix")
(root + "/depot/trusted/hosts/HN/nixos.nix")
]);
homeImports = mkDefault (map (path: toString path) [
(root + "/depot/hosts/HN/home.nix")
(root + "/depot/trusted/hosts/HN/home.nix")
]);
users = mkDefault (singleton "kat");
};
lib.kw.nodeImport = hostName: lib.nodeImport {
inherit (config.network.importing) nixosImports homeImports users;
inherit profiles hostName;
};
_module.args = { inherit (config.lib) kw; };
};
}

View file

@ -2,8 +2,8 @@
{
imports =
with (import (sources.arcexprs + "/modules")).nixos; [ base16 base16-shared modprobe ]
++ [
[
(import (sources.arcexprs + "/modules")).nixos
(import (sources.katexprs + "/modules")).nixos
./deploy.nix
./dyndns.nix

View file

@ -2,4 +2,6 @@
{
network.nftables.enable = lib.mkDefault true;
network.enable = true;
network.dns.enable = true;
}

View file

@ -5,7 +5,6 @@
./vim
./zsh.nix
./git.nix
./kitty.nix
./tmux.nix
./base16.nix
./xdg.nix

View file

@ -1,6 +0,0 @@
{ config, pkgs, ... }:
{
# home.sessionVariables.TERMINFO_DIRS =
# "${pkgs.kitty.terminfo.outPath}/share/terminfo";
}

View file

@ -5,10 +5,10 @@
"homepage": null,
"owner": "arcnmx",
"repo": "nixexprs",
"rev": "822807052f3aaee25216f457eb638a67df40a440",
"sha256": "13ypw9z869j1vh4mjqjd6c3g69mxi7zhwy4v9ydrrvn2mxrdckw3",
"rev": "36030e4a634792f9a9f3b029151148f3153839ab",
"sha256": "0hgfl2k03gs1rzippkmvqaw7knp87p9yplr9ivn7l25a2nb42g7s",
"type": "tarball",
"url": "https://github.com/arcnmx/nixexprs/archive/822807052f3aaee25216f457eb638a67df40a440.tar.gz",
"url": "https://github.com/arcnmx/nixexprs/archive/36030e4a634792f9a9f3b029151148f3153839ab.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ci": {
@ -41,10 +41,10 @@
"homepage": "https://nix-community.github.io/home-manager/",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ad0fc085c7b954d5813a950cf0db7143e6b049e3",
"sha256": "1m5fprdnbl38hfvj65m67nqpajjs3ngz92flx9zfzwpkj8nhvcvf",
"rev": "72394f6d6b1cee26021c3e319fa249122ad33d82",
"sha256": "1hnkc81p50qq3zmk75bb132ks9w62mssy76xf2xamqlm6y0k0425",
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/ad0fc085c7b954d5813a950cf0db7143e6b049e3.tar.gz",
"url": "https://github.com/nix-community/home-manager/archive/72394f6d6b1cee26021c3e319fa249122ad33d82.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"katexprs": {
@ -53,10 +53,10 @@
"homepage": null,
"owner": "kittywitch",
"repo": "nixexprs",
"rev": "87128f86cdcb18a558fe69a6f944b12c9bf9d1d2",
"sha256": "1pjqshaspgmj8iq40s2krr30q5knmfwkvdrp1php0ck168nrvw50",
"rev": "d651a2cabe9b9b6cee505aefdd6df1a2d2fdfef6",
"sha256": "11apd0jdzlwa0xf4kq5d2gizb83w70im5hgi7n1x0jbvyimxw9dp",
"type": "tarball",
"url": "https://github.com/kittywitch/nixexprs/archive/87128f86cdcb18a558fe69a6f944b12c9bf9d1d2.tar.gz",
"url": "https://github.com/kittywitch/nixexprs/archive/d651a2cabe9b9b6cee505aefdd6df1a2d2fdfef6.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
@ -99,10 +99,10 @@
"homepage": "https://nur.nix-community.org/",
"owner": "nix-community",
"repo": "NUR",
"rev": "44fa56b415dcb37566e686c32b0877a0f8ab9829",
"sha256": "1alf0yy0yarbzpq48176bad0zby4slq6ya6nfisx38hf14djhpr1",
"rev": "500f9f4002243ac3d7478348495d830abb6721e0",
"sha256": "1plvb4byi2y4l6l4v501hb45s1kqhnz37raba476q4zkv82x6qi7",
"type": "tarball",
"url": "https://github.com/nix-community/NUR/archive/44fa56b415dcb37566e686c32b0877a0f8ab9829.tar.gz",
"url": "https://github.com/nix-community/NUR/archive/500f9f4002243ac3d7478348495d830abb6721e0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"tf-nix": {
@ -111,10 +111,10 @@
"homepage": null,
"owner": "arcnmx",
"repo": "tf-nix",
"rev": "bc910bd03053db59e5023eaea96e746a5391a4f9",
"sha256": "0x5hi75lsqqs9ppi1095g9y2jsm1r47y110wj1j9652cksykqhis",
"rev": "389de5b7a2843eea2208b056ed6a36d73260f2b0",
"sha256": "0p2z5w61g404sin2pb6vwq83dm1d1kkrfpwwc7q2jc7zgpwb3plv",
"type": "tarball",
"url": "https://github.com/arcnmx/tf-nix/archive/bc910bd03053db59e5023eaea96e746a5391a4f9.tar.gz",
"url": "https://github.com/arcnmx/tf-nix/archive/389de5b7a2843eea2208b056ed6a36d73260f2b0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}