Compare commits
3 Commits
198c9a8c11
...
main
Author | SHA1 | Date | |
---|---|---|---|
7115a93a0b | |||
b5f3adacd8 | |||
2eb52251cc |
@@ -5,7 +5,6 @@
|
|||||||
tags = {
|
tags = {
|
||||||
glom = [ "vega" ];
|
glom = [ "vega" ];
|
||||||
b4l = [ "rigel" ];
|
b4l = [ "rigel" ];
|
||||||
|
|
||||||
fax-bridge = [ ];
|
fax-bridge = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,7 +55,13 @@
|
|||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
roles.default.tags."fax-bridge" = { };
|
roles.default.tags."fax-bridge" = { };
|
||||||
roles.default.machines."b4l" = { };
|
};
|
||||||
|
|
||||||
|
asterisk = {
|
||||||
|
module = {
|
||||||
|
name = "asterisk";
|
||||||
|
input = "self";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pocket-id = {
|
pocket-id = {
|
||||||
@@ -64,55 +69,63 @@
|
|||||||
name = "pocket-id";
|
name = "pocket-id";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
roles.default.machines."b4l" = { };
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
module = {
|
module = {
|
||||||
name = "nextcloud";
|
name = "nextcloud";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
stirling-pdf = {
|
stirling-pdf = {
|
||||||
module = {
|
module = {
|
||||||
name = "stirling-pdf";
|
name = "stirling-pdf";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
actual-budget = {
|
actual-budget = {
|
||||||
module = {
|
module = {
|
||||||
name = "actual-budget";
|
name = "actual-budget";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
victoriametrics = {
|
victoriametrics = {
|
||||||
module = {
|
module = {
|
||||||
name = "victoriametrics";
|
name = "victoriametrics";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
vikunja = {
|
vikunja = {
|
||||||
module = {
|
module = {
|
||||||
name = "vikunja";
|
name = "vikunja";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
grafana = {
|
grafana = {
|
||||||
module = {
|
module = {
|
||||||
name = "grafana";
|
name = "grafana";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
pingvin = {
|
pingvin = {
|
||||||
module = {
|
module = {
|
||||||
name = "pingvin";
|
name = "pingvin";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
paperless = {
|
paperless = {
|
||||||
module = {
|
module = {
|
||||||
name = "paperless";
|
name = "paperless";
|
||||||
input = "self";
|
input = "self";
|
||||||
};
|
};
|
||||||
|
roles.default.machines.b4l = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{ inputs, config, ... }:
|
{ inputs, config, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# (inputs.import-tree ./services)
|
(inputs.import-tree ./services)
|
||||||
];
|
];
|
||||||
nixpkgs.hostPlatform = {
|
nixpkgs.hostPlatform = {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
69
modules/clan/asterisk/default.nix
Normal file
69
modules/clan/asterisk/default.nix
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
_class = "clan.service";
|
||||||
|
manifest.name = "asterisk";
|
||||||
|
manifest.description = "Asterisk PBX server";
|
||||||
|
manifest.categories = [ "System" ];
|
||||||
|
|
||||||
|
roles.default = {
|
||||||
|
perInstance.nixosModule =
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
services.asterisk = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
confFiles = {
|
||||||
|
# Dial plan config
|
||||||
|
"extensions.conf" = ''
|
||||||
|
exten => 1001,1,Dial(PJSIP/user1,20)
|
||||||
|
exten => 1002,1,Dial(PJSIP/user2,20)
|
||||||
|
|
||||||
|
exten => 100,1,Answer()
|
||||||
|
same => n,Wait(1)
|
||||||
|
same => n,Playback(hello-world)
|
||||||
|
same => n,Hangup()
|
||||||
|
'';
|
||||||
|
|
||||||
|
"pjsip.conf" = ''
|
||||||
|
[transport-udp]
|
||||||
|
type=transport
|
||||||
|
protocol=udp
|
||||||
|
bind=0.0.0.0,[::]
|
||||||
|
|
||||||
|
[endpoint_internal](!)
|
||||||
|
type=endpoint
|
||||||
|
context=from-internal
|
||||||
|
disallow=all
|
||||||
|
allow=ulaw
|
||||||
|
|
||||||
|
[auth_userpass](!)
|
||||||
|
type=auth
|
||||||
|
auth_type=userpass
|
||||||
|
|
||||||
|
[aor_dynamic](!)
|
||||||
|
type=aor
|
||||||
|
max_contacts=1
|
||||||
|
|
||||||
|
[user1](endpoint_internal)
|
||||||
|
auth=user1
|
||||||
|
aors=user1
|
||||||
|
[user1](auth_userpass)
|
||||||
|
password=user1
|
||||||
|
username=user1
|
||||||
|
[user1](aor_dynamic)
|
||||||
|
|
||||||
|
[user2](endpoint_internal)
|
||||||
|
auth=user2
|
||||||
|
aors=user2
|
||||||
|
[user2](auth_userpass)
|
||||||
|
password=user2
|
||||||
|
username=user2
|
||||||
|
[user2](aor_dynamic)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
18
modules/clan/asterisk/flake-module.nix
Normal file
18
modules/clan/asterisk/flake-module.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
module = lib.modules.importApply ./default.nix { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
clan.modules = {
|
||||||
|
asterisk = module;
|
||||||
|
};
|
||||||
|
perSystem =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
clan.nixosTests.asterisk = {
|
||||||
|
imports = [ ./tests/vm/default.nix ];
|
||||||
|
|
||||||
|
clan.modules."@clan/asterisk" = module;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
39
modules/clan/asterisk/tests/vm/default.nix
Normal file
39
modules/clan/asterisk/tests/vm/default.nix
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
name = "service-asterisk";
|
||||||
|
|
||||||
|
clan = {
|
||||||
|
directory = ./.;
|
||||||
|
inventory = {
|
||||||
|
machines.server = { };
|
||||||
|
|
||||||
|
instances = {
|
||||||
|
asterisk-test = {
|
||||||
|
module.name = "@clan/asterisk";
|
||||||
|
module.input = "self";
|
||||||
|
roles.default.machines."server".settings = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
server = {
|
||||||
|
services.asterisk = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
server.wait_for_unit("asterisk")
|
||||||
|
|
||||||
|
# Check that garage is running
|
||||||
|
server.succeed("systemctl status asterisk")
|
||||||
|
|
||||||
|
'';
|
||||||
|
}
|
@@ -13,18 +13,16 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
user = "yggdrasil";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
clan.core.vars.generators.yggdrasil = {
|
clan.core.vars.generators.yggdrasil = {
|
||||||
files = {
|
files = {
|
||||||
yggdrasil-secret = {
|
yggdrasil-secret = {
|
||||||
secret = true;
|
secret = true;
|
||||||
owner = user;
|
|
||||||
group = user;
|
|
||||||
};
|
};
|
||||||
yggdrasil-ip.secret = false;
|
yggdrasil-ip = {
|
||||||
|
secret = false;
|
||||||
|
};
|
||||||
|
yggdrasil-subnet.secret = false;
|
||||||
};
|
};
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
yggdrasil
|
yggdrasil
|
||||||
@@ -33,12 +31,13 @@
|
|||||||
script = ''
|
script = ''
|
||||||
yggdrasil -genconf -json | jq {PrivateKey} > $out/yggdrasil-secret
|
yggdrasil -genconf -json | jq {PrivateKey} > $out/yggdrasil-secret
|
||||||
cat $out/yggdrasil-secret | yggdrasil -useconf -address | tr -d "\n" > $out/yggdrasil-ip
|
cat $out/yggdrasil-secret | yggdrasil -useconf -address | tr -d "\n" > $out/yggdrasil-ip
|
||||||
|
yggdrasil -useconffile $out/yggdrasil-secret -subnet | tr -d "\n" > $out/yggdrasil-subnet
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
services.yggdrasil = {
|
services.yggdrasil = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
# configFile = config.clan.core.vars.generators.yggdrasil.files.yggdrasil-secret.path;
|
configFile = config.clan.core.vars.generators.yggdrasil.files.yggdrasil-secret.path;
|
||||||
settings = {
|
settings = {
|
||||||
Peers = [
|
Peers = [
|
||||||
# US Peers
|
# US Peers
|
||||||
|
@@ -1,4 +1,9 @@
|
|||||||
{ lib, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
module = lib.modules.importApply ./default.nix { };
|
module = lib.modules.importApply ./default.nix { };
|
||||||
in
|
in
|
||||||
@@ -9,10 +14,10 @@ in
|
|||||||
perSystem =
|
perSystem =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
clan.nixosTests.yggdrasil = {
|
# clan.nixosTests.yggdrasil = {
|
||||||
imports = [ ./tests/vm/default.nix ];
|
# imports = [ ./tests/vm/default.nix ];
|
||||||
|
#
|
||||||
clan.modules."@clan/yggdrasil" = module;
|
# clan.modules."@clan/yggdrasil" = module;
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
@@ -34,8 +33,5 @@
|
|||||||
|
|
||||||
# Check that garage is running
|
# Check that garage is running
|
||||||
server.succeed("systemctl status yggdrasil")
|
server.succeed("systemctl status yggdrasil")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user