diff --git a/default.nix b/default.nix index 92cf3748..8f6ebb6a 100644 --- a/default.nix +++ b/default.nix @@ -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 diff --git a/depot/hosts/athame/meta.nix b/depot/hosts/athame/meta.nix index fc1838c8..aa1666ba 100644 --- a/depot/hosts/athame/meta.nix +++ b/depot/hosts/athame/meta.nix @@ -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"; }; } diff --git a/depot/hosts/beltane/meta.nix b/depot/hosts/beltane/meta.nix index 042dfffe..db79e8f7 100644 --- a/depot/hosts/beltane/meta.nix +++ b/depot/hosts/beltane/meta.nix @@ -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"; }; }; } diff --git a/depot/hosts/dummy/meta.nix b/depot/hosts/dummy/meta.nix index 39cd6685..a3504a20 100644 --- a/depot/hosts/dummy/meta.nix +++ b/depot/hosts/dummy/meta.nix @@ -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"; }; }; diff --git a/depot/hosts/ostara/meta.nix b/depot/hosts/ostara/meta.nix index 9bb5aabe..4a4eea69 100644 --- a/depot/hosts/ostara/meta.nix +++ b/depot/hosts/ostara/meta.nix @@ -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"; }; }; } diff --git a/depot/hosts/ostara/nixos.nix b/depot/hosts/ostara/nixos.nix index e0a8a9c6..fa8c05e8 100644 --- a/depot/hosts/ostara/nixos.nix +++ b/depot/hosts/ostara/nixos.nix @@ -36,6 +36,7 @@ with lib; # Networking networking = { + hostName = "ostara"; hostId = "9f89b327"; useDHCP = false; interfaces.enp1s0.ipv4.addresses = singleton { diff --git a/depot/hosts/samhain/meta.nix b/depot/hosts/samhain/meta.nix index 9731afeb..91320e5c 100644 --- a/depot/hosts/samhain/meta.nix +++ b/depot/hosts/samhain/meta.nix @@ -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"; }; }; } diff --git a/depot/hosts/yule/meta.nix b/depot/hosts/yule/meta.nix index a1c3cb24..17ee8c48 100644 --- a/depot/hosts/yule/meta.nix +++ b/depot/hosts/yule/meta.nix @@ -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"; }; }; } diff --git a/depot/modules/home/default.nix b/depot/modules/home/default.nix index 00564855..9a03e82b 100644 --- a/depot/modules/home/default.nix +++ b/depot/modules/home/default.nix @@ -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 diff --git a/depot/modules/meta/default.nix b/depot/modules/meta/default.nix index b71fe2ed..43df4768 100644 --- a/depot/modules/meta/default.nix +++ b/depot/modules/meta/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./imports.nix ./deploy.nix ./network.nix ]; diff --git a/depot/modules/meta/imports.nix b/depot/modules/meta/imports.nix new file mode 100644 index 00000000..84fb00ae --- /dev/null +++ b/depot/modules/meta/imports.nix @@ -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; }; + }; +} diff --git a/depot/modules/nixos/default.nix b/depot/modules/nixos/default.nix index 0e049f79..d087bdda 100644 --- a/depot/modules/nixos/default.nix +++ b/depot/modules/nixos/default.nix @@ -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 diff --git a/depot/profiles/base/net.nix b/depot/profiles/base/net.nix index 82019926..18b5b072 100644 --- a/depot/profiles/base/net.nix +++ b/depot/profiles/base/net.nix @@ -2,4 +2,6 @@ { network.nftables.enable = lib.mkDefault true; + network.enable = true; + network.dns.enable = true; } diff --git a/depot/users/kat/base/default.nix b/depot/users/kat/base/default.nix index 048cf81c..42b2c17a 100644 --- a/depot/users/kat/base/default.nix +++ b/depot/users/kat/base/default.nix @@ -5,7 +5,6 @@ ./vim ./zsh.nix ./git.nix - ./kitty.nix ./tmux.nix ./base16.nix ./xdg.nix diff --git a/depot/users/kat/base/kitty.nix b/depot/users/kat/base/kitty.nix deleted file mode 100644 index bcea5f5a..00000000 --- a/depot/users/kat/base/kitty.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, pkgs, ... }: - -{ -# home.sessionVariables.TERMINFO_DIRS = -# "${pkgs.kitty.terminfo.outPath}/share/terminfo"; -} diff --git a/nix/sources.json b/nix/sources.json index 9f936260..c235dd7a 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -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///archive/.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///archive/.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///archive/.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///archive/.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///archive/.tar.gz" } }