generated from Luis/nextjs-python-web-template
Merge pull request 'add clanModules, autoimport nixosModules' (#64) from modules into main
This commit is contained in:
29
clanModules/zerotier.nix
Normal file
29
clanModules/zerotier.nix
Normal 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 ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
];
|
||||
|
||||
16
flake.nix
16
flake.nix
@@ -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
17
lib/default.nix
Normal 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
5
lib/flake-module.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{ lib
|
||||
, ...
|
||||
}: {
|
||||
flake.lib = import ./default.nix { inherit lib; };
|
||||
}
|
||||
Reference in New Issue
Block a user