From 017372b348e22698979b83e8dd7d8ccc31bd088e Mon Sep 17 00:00:00 2001 From: hexchen Date: Sun, 25 Apr 2021 19:41:46 +0000 Subject: [PATCH] modules: add hexchen's network thing --- hosts/dummy/home/default.nix | 5 +++++ hosts/dummy/nixos/default.nix | 36 +++++++++++++++++++++++++++++++++++ modules/nixos/default.nix | 11 +++++++++-- nix/sources.json | 7 +++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 hosts/dummy/home/default.nix create mode 100644 hosts/dummy/nixos/default.nix diff --git a/hosts/dummy/home/default.nix b/hosts/dummy/home/default.nix new file mode 100644 index 00000000..865d4690 --- /dev/null +++ b/hosts/dummy/home/default.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ... }: + +{ + +} diff --git a/hosts/dummy/nixos/default.nix b/hosts/dummy/nixos/default.nix new file mode 100644 index 00000000..22fe9530 --- /dev/null +++ b/hosts/dummy/nixos/default.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, sources, ... }: + +with lib; + +let + hexchen = (import sources.nix-hexchen) {}; + hexYgg = filterAttrs (_: c: c.enable) ( + mapAttrs (_: host: host.config.hexchen.network) hexchen.hosts + ); +in { + # stuff so dummy host is buildable (you probably don't want/need this???) + # but idk your config sooooo + boot.isContainer = true; + networking.useDHCP = false; + users.users.root.hashedPassword = ""; + + hexchen.network = { + enable = true; + pubkey = "0000000000000000000000000000000000000000000000000000000000000000"; + listen.enable = true; + listen.endpoints = flatten (map (c: c.listen.endpoints) (filter (c: c.listen.enable) (attrValues hexYgg))); + extra.pubkeys = { + } // (mapAttrs (_: c: c.pubkey) hexYgg); + }; + + # snippet for single host + # hexchen.network = { + # enable = true; + # pubkey = "0000000000000000000000000000000000000000000000000000000000000000"; + # # if server, enable this and set endpoint: + # listen.enable = false; + # listen.endpoints = [ + # "tcp://0.0.0.0:0" + # ]; + # }; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 111da8c6..81e403ab 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,10 +1,17 @@ -{ sources, ... }: +{ sources, lib, ... }: -{ +let + hexchen = (import sources.nix-hexchen) {}; +in { imports = [ ./deploy ./tf-glue (sources.tf-nix + "/modules/nixos/secrets.nix") (sources.tf-nix + "/modules/nixos/secrets-users.nix") + hexchen.modules.hexnet ]; + + # stubs for hexchens modules, until more generalized + options.hexchen.dns = lib.mkOption {}; + options.hexchen.deploy = lib.mkOption {}; } diff --git a/nix/sources.json b/nix/sources.json index 3195d1c1..e5bb887d 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -59,6 +59,13 @@ "url": "https://github.com/vlaci/nix-doom-emacs/archive/51645030623075a50f0f2fb8e95d113336fa109f.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nix-hexchen": { + "branch": "main", + "ref": "main", + "repo": "https://gitlab.com/hexchen/nixfiles", + "rev": "c0cb61737832d3332984b92939eb15e90ed6b8c2", + "type": "git" + }, "nixos-mailserver": { "branch": "master", "ref": "master",