Merge pull request 'add clanModules, autoimport nixosModules' (#64) from modules into main

This commit is contained in:
clan-bot
2023-08-02 08:35:37 +00:00
8 changed files with 58 additions and 16 deletions

29
clanModules/zerotier.nix Normal file
View File

@@ -0,0 +1,29 @@
{ config, lib, ... }:
{
options.clan.networking.zerotier = {
networkId = lib.mkOption {
type = lib.types.str;
description = ''
zerotier networking id
'';
};
};
config = {
systemd.network.networks.zerotier = {
matchConfig.Name = "zt*";
networkConfig = {
LLMNR = true;
LLDP = true;
MulticastDNS = true;
KeepConfiguration = "static";
};
};
networking.firewall.allowedUDPPorts = [ 9993 ];
networking.firewall.interfaces."zt+".allowedTCPPorts = [ 5353 ];
networking.firewall.interfaces."zt+".allowedUDPPorts = [ 5353 ];
services.zerotierone = {
enable = true;
joinNetworks = [ config.clan.networking.zerotier.networkId ];
};
};
}

View File

@@ -1,7 +1,11 @@
# export some of our flake moduels for re-use in other projects
{ ...
{ lib
, self
, ...
}: {
flake.modules.flake-parts = {
writers = ./writers;
};
flake.nixosModules = lib.mapAttrs (_: nix: { imports = [ nix ]; }) (self.lib.findNixFiles ../nixosModules);
flake.clanModules = lib.mapAttrs (_: nix: { imports = [ nix ]; }) (self.lib.findNixFiles ../clanModules);
}

View File

@@ -5,6 +5,7 @@
system = "x86_64-linux";
modules = [
self.nixosModules.installer
self.nixosModules.hidden-ssh-announce
self.inputs.nixos-generators.nixosModules.all-formats
self.inputs.disko.nixosModules.disko
];

View File

@@ -31,21 +31,7 @@
./templates/flake-module.nix
./templates/python-project/flake-module.nix
./pkgs/clan-cli/flake-module.nix
./lib/flake-module.nix
];
flake = {
nixosModules = {
installer = {
imports = [
./modules/installer.nix
./modules/hidden-ssh-announce.nix
];
};
hidden-announce = {
imports = [
./modules/hidden-ssh-announce.nix
];
};
};
};
});
}

17
lib/default.nix Normal file
View File

@@ -0,0 +1,17 @@
{ lib, ... }:
let
clanLib = {
findNixFiles = folder:
lib.mapAttrs'
(name: type:
if
type == "directory"
then
lib.nameValuePair name "${folder}/${name}"
else
lib.nameValuePair (lib.removeSuffix ".nix" name) "${folder}/${name}"
)
(builtins.readDir folder);
};
in
clanLib

5
lib/flake-module.nix Normal file
View File

@@ -0,0 +1,5 @@
{ lib
, ...
}: {
flake.lib = import ./default.nix { inherit lib; };
}