Compare commits
8 commits
7233480d5a
...
825dc68b40
| Author | SHA1 | Date | |
|---|---|---|---|
| 825dc68b40 | |||
| 2096b80bbe | |||
| dddb118d00 | |||
| 3506a3710a | |||
| 2058665de0 | |||
| 9de8071b9b | |||
| 6df42a461f | |||
| ee388398e5 |
26 changed files with 367 additions and 176 deletions
|
|
@ -6,6 +6,8 @@ let
|
|||
in
|
||||
{
|
||||
x86_64-linux = lib.mergeAttrsList [
|
||||
flake-inputs.self.nixosConfigurations.hetzner-1.config.serviceTests
|
||||
|
||||
{
|
||||
nix = checkLib.mkLint {
|
||||
name = "nix-lints";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
flake-inputs,
|
||||
...
|
||||
|
|
@ -9,30 +9,13 @@
|
|||
flake-inputs.disko.nixosModules.disko
|
||||
flake-inputs.sops-nix.nixosModules.sops
|
||||
flake-inputs.tlaternet-webserver.nixosModules.default
|
||||
|
||||
"${modulesPath}/profiles/minimal.nix"
|
||||
(import ../modules)
|
||||
|
||||
./services/backups.nix
|
||||
./services/battery-manager.nix
|
||||
./services/conduit
|
||||
./services/crowdsec.nix
|
||||
./services/foundryvtt.nix
|
||||
./services/gitea.nix
|
||||
./services/immich.nix
|
||||
./services/metrics
|
||||
./services/minecraft.nix
|
||||
./services/nextcloud.nix
|
||||
./services/webserver.nix
|
||||
./services/wireguard.nix
|
||||
# ./services/starbound.nix -- Not currently used
|
||||
./services/postgres.nix
|
||||
../modules
|
||||
./nginx
|
||||
./sops.nix
|
||||
./services
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [ (_: prev: { local = import ../pkgs { pkgs = prev; }; }) ];
|
||||
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
|
|
@ -42,49 +25,9 @@
|
|||
settings.trusted-users = [ "@wheel" ];
|
||||
};
|
||||
|
||||
# Optimization for minecraft servers, see:
|
||||
# https://bugs.mojang.com/browse/MC-183518
|
||||
boot.kernelParams = [
|
||||
"highres=off"
|
||||
"nohz=off"
|
||||
];
|
||||
|
||||
networking = {
|
||||
usePredictableInterfaceNames = false;
|
||||
useDHCP = false;
|
||||
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
# http
|
||||
80
|
||||
443
|
||||
# ssh
|
||||
2222
|
||||
# matrix
|
||||
8448
|
||||
# starbound
|
||||
21025
|
||||
|
||||
config.services.coturn.listening-port
|
||||
config.services.coturn.tls-listening-port
|
||||
config.services.coturn.alt-listening-port
|
||||
config.services.coturn.alt-tls-listening-port
|
||||
];
|
||||
|
||||
allowedUDPPorts = [
|
||||
config.services.coturn.listening-port
|
||||
config.services.coturn.tls-listening-port
|
||||
config.services.coturn.alt-listening-port
|
||||
config.services.coturn.alt-tls-listening-port
|
||||
];
|
||||
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = config.services.coturn.min-port;
|
||||
to = config.services.coturn.max-port;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network.enable = true;
|
||||
|
|
@ -124,9 +67,10 @@
|
|||
services.sudo.rssh = true;
|
||||
};
|
||||
};
|
||||
sops.defaultSopsFile = ../keys/production.yaml;
|
||||
|
||||
# Remove some unneeded packages
|
||||
environment.defaultPackages = [ ];
|
||||
environment.defaultPackages = lib.mkForce [ ];
|
||||
|
||||
system.stateVersion = "20.09";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,15 @@
|
|||
description = "The base domain name to append to virtual domain names";
|
||||
};
|
||||
|
||||
config.services.nginx = {
|
||||
enable = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
clientMaxBodySize = "10G";
|
||||
statusPage = true; # For metrics, should be accessible only from localhost
|
||||
config = {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
clientMaxBodySize = "10G";
|
||||
statusPage = true; # For metrics, should be accessible only from localhost
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
flake-inputs,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hostNames = lib.attrNames config.services.nginx.virtualHosts;
|
||||
logPath = name: "/var/log/nginx/${name}/access.log";
|
||||
|
|
@ -80,5 +86,55 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
serviceTests =
|
||||
let
|
||||
testHostConfig =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./.
|
||||
../../modules/serviceTests/mocks.nix
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
|
||||
services.nginx = {
|
||||
domain = "testHost";
|
||||
virtualHosts."${config.services.nginx.domain}".locations."/".return = "200 ok";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nginxMetricsWork = pkgs.testers.runNixOSTest {
|
||||
name = "nginx-metrics-work";
|
||||
node.specialArgs = { inherit flake-inputs; };
|
||||
|
||||
nodes = {
|
||||
testHost = testHostConfig;
|
||||
|
||||
client =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.curl ];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import time
|
||||
|
||||
start_all()
|
||||
|
||||
testHost.wait_for_unit("nginx.service")
|
||||
client.succeed("curl --max-time 10 http://testHost")
|
||||
|
||||
# Wait a bit for the prometheus exporter to scrape our logs
|
||||
time.sleep(5)
|
||||
|
||||
res = testHost.succeed("curl localhost:${builtins.toString config.services.prometheus.exporters.nginxlog.port}/metrics")
|
||||
assert 'nginxlog_http_response_count_total{method="GET",status="200",vhost="testHost"} 1' in res, res
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
flake-inputs,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
|
|
@ -64,5 +65,77 @@
|
|||
in
|
||||
''${pkgs.runtimeShell} -c '${confirm}' '';
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"porkbun/api-key".owner = "acme";
|
||||
"porkbun/secret-api-key".owner = "acme";
|
||||
};
|
||||
|
||||
serviceTests =
|
||||
let
|
||||
testHostConfig =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./.
|
||||
../../modules/serviceTests/mocks.nix
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
security.acme.certs."tlater.net".extraDomainNames = [ config.services.nginx.domain ];
|
||||
|
||||
services.nginx = {
|
||||
domain = "testHost";
|
||||
|
||||
virtualHosts."${config.services.nginx.domain}" = {
|
||||
useACMEHost = "tlater.net";
|
||||
forceSSL = true;
|
||||
enableHSTS = true;
|
||||
locations."/".return = "200 ok";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
hstsIsSet = pkgs.testers.runNixOSTest {
|
||||
name = "hsts-is-set";
|
||||
|
||||
node.specialArgs = { inherit flake-inputs; };
|
||||
nodes = {
|
||||
testHost = testHostConfig;
|
||||
|
||||
client =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.curl ];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
testHost.wait_for_unit("nginx.service")
|
||||
testHost.copy_from_vm("/var/lib/acme/tlater.net/", "certs")
|
||||
client.copy_from_host(f"{testHost.out_dir}/certs", "/certs")
|
||||
|
||||
client.succeed("curl --max-time 10 http://testHost")
|
||||
res = client.succeed(" ".join([
|
||||
"curl",
|
||||
"--show-error",
|
||||
"--silent",
|
||||
"--dump-header -",
|
||||
"--cacert /certs/tlater.net/fullchain.pem",
|
||||
"https://testHost",
|
||||
"-o /dev/null"
|
||||
]))
|
||||
|
||||
assert "strict-transport-security: max-age=15552000; includeSubDomains" in res
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,5 +265,18 @@ in
|
|||
};
|
||||
groups.backup = { };
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"restic/storagebox-backups" = {
|
||||
owner = "root";
|
||||
group = "backup";
|
||||
mode = "0440";
|
||||
};
|
||||
"restic/storagebox-ssh-key" = {
|
||||
owner = "backup";
|
||||
group = "backup";
|
||||
mode = "0040";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,9 @@
|
|||
log_level = "DEBUG";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"battery-manager/email" = { };
|
||||
"battery-manager/password" = { };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,36 @@ in
|
|||
./matrix-hookshot.nix
|
||||
];
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
# These are for "normal" clients
|
||||
80
|
||||
443
|
||||
|
||||
# Federation happens on 8448
|
||||
8448
|
||||
|
||||
config.services.coturn.listening-port
|
||||
config.services.coturn.tls-listening-port
|
||||
config.services.coturn.alt-listening-port
|
||||
config.services.coturn.alt-tls-listening-port
|
||||
];
|
||||
|
||||
allowedUDPPorts = [
|
||||
config.services.coturn.listening-port
|
||||
config.services.coturn.tls-listening-port
|
||||
config.services.coturn.alt-listening-port
|
||||
config.services.coturn.alt-tls-listening-port
|
||||
];
|
||||
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = config.services.coturn.min-port;
|
||||
to = config.services.coturn.max-port;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services = {
|
||||
matrix-conduit = {
|
||||
enable = true;
|
||||
|
|
@ -179,4 +209,11 @@ in
|
|||
systemd.services.coturn.serviceConfig.SupplementaryGroups = [
|
||||
config.security.acme.certs."tlater.net".group
|
||||
];
|
||||
|
||||
sops.secrets = {
|
||||
"turn/env" = { };
|
||||
"turn/secret" = {
|
||||
owner = "turnserver";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,4 +75,10 @@ in
|
|||
# AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
# Accessed via systemd cred through /run/secrets/heisebridge
|
||||
"heisenbridge/as-token" = { };
|
||||
"heisenbridge/hs-token" = { };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,4 +163,10 @@ in
|
|||
metrics.enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
# Accessed via systemd cred through /run/secrets/matrix-hookshot
|
||||
"matrix-hookshot/as-token" = { };
|
||||
"matrix-hookshot/hs-token" = { };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
18
configuration/services/default.nix
Normal file
18
configuration/services/default.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
imports = [
|
||||
./backups.nix
|
||||
./battery-manager.nix
|
||||
./conduit
|
||||
./crowdsec.nix
|
||||
./foundryvtt.nix
|
||||
./gitea.nix
|
||||
./immich.nix
|
||||
./metrics
|
||||
./minecraft.nix
|
||||
./nextcloud.nix
|
||||
./postgres.nix
|
||||
# ./starbound.nix -- Not currently used
|
||||
./webserver.nix
|
||||
./wireguard.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -11,6 +11,11 @@ in
|
|||
{
|
||||
imports = [ flake-inputs.foundryvtt.nixosModules.foundryvtt ];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services = {
|
||||
foundryvtt = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ let
|
|||
domain = "gitea.${config.services.nginx.domain}";
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services = {
|
||||
forgejo = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ let
|
|||
hostName = "immich.${config.services.nginx.domain}";
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services = {
|
||||
immich = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ let
|
|||
domain = "metrics.${config.services.nginx.domain}";
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
@ -67,4 +72,15 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"grafana/adminPassword" = {
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
"grafana/secretKey" = {
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ let
|
|||
blackbox_port = config.services.prometheus.exporters.blackbox.port;
|
||||
in
|
||||
{
|
||||
config.services.victoriametrics = {
|
||||
services.victoriametrics = {
|
||||
enable = true;
|
||||
extraOptions = [ "-storage.minFreeDiskSpaceBytes=5GB" ];
|
||||
|
||||
|
|
@ -96,4 +96,10 @@ in
|
|||
victorialogs.targets = [ config.services.victorialogs.bindAddress ];
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets."forgejo/metrics-token" = {
|
||||
owner = "forgejo";
|
||||
group = "metrics";
|
||||
mode = "0440";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ let
|
|||
hostName = "nextcloud.${config.services.nginx.domain}";
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services = {
|
||||
nextcloud = {
|
||||
inherit hostName;
|
||||
|
|
@ -100,4 +105,9 @@ in
|
|||
|
||||
# Ensure that this service doesn't start before postgres is ready
|
||||
systemd.services.nextcloud-setup.after = [ "postgresql.service" ];
|
||||
|
||||
sops.secrets."nextcloud/tlater" = {
|
||||
owner = "nextcloud";
|
||||
group = "nextcloud";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
flake-inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) concatStringsSep;
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 21025 ];
|
||||
|
||||
# Sadly, steam-run requires some X libs
|
||||
environment.noXlibs = false;
|
||||
|
||||
|
|
@ -11,7 +18,9 @@ in
|
|||
after = [ "network.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.local.starbound}/bin/launch-starbound ${./configs/starbound.json}";
|
||||
ExecStart = "${
|
||||
flake-inputs.self.packages.${pkgs.system}.starbound
|
||||
}/bin/launch-starbound ${./configs/starbound.json}";
|
||||
|
||||
Type = "simple";
|
||||
|
||||
|
|
@ -114,4 +123,7 @@ in
|
|||
paths = [ "/var/lib/private/starbound/storage/universe/" ];
|
||||
pauseServices = [ "starbound.service" ];
|
||||
};
|
||||
|
||||
# Accessed via systemd cred through /run/secrets/steam
|
||||
sops.secrets."steam/tlater" = { };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ let
|
|||
inherit (config.services.nginx) domain;
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
services.tlaternet-webserver = {
|
||||
enable = true;
|
||||
listen = {
|
||||
|
|
|
|||
|
|
@ -62,4 +62,10 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets."wireguard/server-key" = {
|
||||
owner = "root";
|
||||
group = "systemd-network";
|
||||
mode = "0440";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
{
|
||||
sops = {
|
||||
defaultSopsFile = ../keys/production.yaml;
|
||||
|
||||
secrets = {
|
||||
"battery-manager/email" = { };
|
||||
|
||||
"battery-manager/password" = { };
|
||||
|
||||
# Gitea
|
||||
"forgejo/metrics-token" = {
|
||||
owner = "forgejo";
|
||||
group = "metrics";
|
||||
mode = "0440";
|
||||
};
|
||||
|
||||
# Grafana
|
||||
"grafana/adminPassword" = {
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
"grafana/secretKey" = {
|
||||
owner = "grafana";
|
||||
group = "grafana";
|
||||
};
|
||||
|
||||
# Heisenbridge
|
||||
"heisenbridge/as-token" = { };
|
||||
"heisenbridge/hs-token" = { };
|
||||
|
||||
# Matrix-hookshot
|
||||
"matrix-hookshot/as-token" = { };
|
||||
"matrix-hookshot/hs-token" = { };
|
||||
|
||||
# Nextcloud
|
||||
"nextcloud/tlater" = {
|
||||
owner = "nextcloud";
|
||||
group = "nextcloud";
|
||||
};
|
||||
|
||||
# Porkbub/ACME
|
||||
"porkbun/api-key" = {
|
||||
owner = "acme";
|
||||
};
|
||||
"porkbun/secret-api-key" = {
|
||||
owner = "acme";
|
||||
};
|
||||
|
||||
# Restic
|
||||
"restic/local-backups" = {
|
||||
owner = "root";
|
||||
group = "backup";
|
||||
mode = "0440";
|
||||
};
|
||||
"restic/storagebox-backups" = {
|
||||
owner = "root";
|
||||
group = "backup";
|
||||
mode = "0440";
|
||||
};
|
||||
"restic/storagebox-ssh-key" = {
|
||||
owner = "backup";
|
||||
group = "backup";
|
||||
mode = "0040";
|
||||
};
|
||||
|
||||
# Steam
|
||||
"steam/tlater" = { };
|
||||
|
||||
# Turn
|
||||
"turn/env" = { };
|
||||
"turn/secret" = {
|
||||
owner = "turnserver";
|
||||
};
|
||||
"turn/ssl-key" = {
|
||||
owner = "turnserver";
|
||||
};
|
||||
"turn/ssl-cert" = {
|
||||
owner = "turnserver";
|
||||
};
|
||||
|
||||
# Wireguard
|
||||
"wireguard/server-key" = {
|
||||
owner = "root";
|
||||
group = "systemd-network";
|
||||
mode = "0440";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -136,11 +136,11 @@
|
|||
"pyproject-nix": "pyproject-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1754978539,
|
||||
"narHash": "sha256-nrDovydywSKRbWim9Ynmgj8SBm8LK3DI2WuhIqzOHYI=",
|
||||
"lastModified": 1763413832,
|
||||
"narHash": "sha256-dkqBwDXiv8MPoFyIvOuC4bVubAP+TlVZUkVMB78TTSg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "fbec3263cb4895ac86ee9506cdc4e6919a1a2214",
|
||||
"rev": "5658fba3a0b6b7d5cb0460b949651f64f644a743",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -356,11 +356,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1762868777,
|
||||
"narHash": "sha256-QqS72GvguP56oKDNUckWUPNJHjsdeuXh5RyoKz0wJ+E=",
|
||||
"lastModified": 1763319842,
|
||||
"narHash": "sha256-YG19IyrTdnVn0l3DvcUYm85u3PaqBt6tI6VvolcuHnA=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "c5c3147730384576196fb5da048a6e45dee10d56",
|
||||
"rev": "7275fa67fbbb75891c16d9dee7d88e58aea2d761",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1,6 @@
|
|||
{ imports = [ ./crowdsec ]; }
|
||||
{
|
||||
imports = [
|
||||
./crowdsec
|
||||
./serviceTests/stub.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
27
modules/serviceTests/mocks.nix
Normal file
27
modules/serviceTests/mocks.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
Module containing mock definitions for service test runners.
|
||||
*/
|
||||
{ flake-inputs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
flake-inputs.sops-nix.nixosModules.sops
|
||||
../.
|
||||
../../configuration/services/backups.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../keys/staging.yaml;
|
||||
environment.etc."staging.key" = {
|
||||
mode = "0400";
|
||||
source = ../../keys/hosts/staging.key;
|
||||
};
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
hostKeys = lib.mkForce [
|
||||
{
|
||||
type = "rsa";
|
||||
bits = 4096;
|
||||
path = "/etc/staging.key";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
20
modules/serviceTests/stub.nix
Normal file
20
modules/serviceTests/stub.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
Module to make writing service-specific tests easy.
|
||||
*/
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
serviceTests = mkOption {
|
||||
type = types.attrsOf types.package;
|
||||
|
||||
description = ''
|
||||
NixOS tests to run.
|
||||
'';
|
||||
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue