infrastructure/machines/nixos/compute01/nimbolus/module.nix
catvayor a7def32a75
Some checks failed
Check meta / check_meta (pull_request) Successful in 16s
Check workflows / check_workflows (pull_request) Successful in 18s
Check meta / check_dns (pull_request) Successful in 26s
Build all the nodes / Jaccess04 (pull_request) Successful in 27s
Build all the nodes / Jaccess01 (pull_request) Successful in 37s
Run pre-commit on all files / pre-commit (pull_request) Successful in 42s
Build all the nodes / netcore02 (pull_request) Successful in 27s
Build all the nodes / netcore01 (pull_request) Successful in 35s
Build all the nodes / ap01 (pull_request) Successful in 56s
Build all the nodes / hypervisor01 (pull_request) Successful in 57s
Build all the nodes / geo01 (pull_request) Successful in 57s
Build all the nodes / cof02 (pull_request) Successful in 59s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m7s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m8s
Build all the nodes / geo02 (pull_request) Successful in 1m10s
Build all the nodes / bridge01 (pull_request) Successful in 1m13s
Build the shell / build-shell (pull_request) Successful in 37s
Build all the nodes / iso (pull_request) Successful in 1m13s
Build all the nodes / lab-router01 (pull_request) Successful in 1m2s
Build all the nodes / build01 (pull_request) Successful in 1m15s
Build all the nodes / tower01 (pull_request) Successful in 57s
Build all the nodes / web02 (pull_request) Successful in 1m3s
Build all the nodes / vault01 (pull_request) Successful in 1m7s
Build all the nodes / zulip01 (pull_request) Successful in 1m4s
Build all the nodes / rescue01 (pull_request) Successful in 1m30s
Build all the nodes / web03 (pull_request) Successful in 1m17s
Build all the nodes / web01 (pull_request) Successful in 1m24s
Build all the nodes / compute01 (pull_request) Successful in 1m52s
Build all the nodes / storage01 (pull_request) Successful in 1m35s
Build all the nodes / krz01 (pull_request) Successful in 1m51s
Build all the nodes / Jaccess04 (push) Successful in 49s
Build all the nodes / Jaccess01 (push) Successful in 49s
Run pre-commit on all files / pre-commit (push) Successful in 53s
Build all the nodes / ap01 (push) Successful in 1m15s
Build all the nodes / hypervisor01 (push) Successful in 1m23s
Build all the nodes / hypervisor03 (push) Successful in 1m29s
Build all the nodes / cof02 (push) Successful in 1m33s
Build all the nodes / build01 (push) Successful in 1m34s
Build all the nodes / hypervisor02 (push) Successful in 1m33s
Build all the nodes / bridge01 (push) Successful in 1m44s
Build all the nodes / geo01 (push) Successful in 1m44s
Build all the nodes / netcore01 (push) Successful in 31s
Build all the nodes / netcore02 (push) Successful in 34s
Build all the nodes / compute01 (push) Successful in 1m57s
Build the shell / build-shell (push) Successful in 26s
Build all the nodes / geo02 (push) Successful in 2m4s
Build all the nodes / iso (push) Successful in 1m19s
Build all the nodes / lab-router01 (push) Successful in 58s
Build all the nodes / tower01 (push) Successful in 57s
Build all the nodes / web02 (push) Successful in 55s
Build all the nodes / vault01 (push) Successful in 1m9s
Build all the nodes / zulip01 (push) Successful in 58s
Build all the nodes / web03 (push) Successful in 1m2s
Build all the nodes / rescue01 (push) Successful in 1m19s
Build all the nodes / web01 (push) Successful in 1m26s
Build all the nodes / krz01 (push) Successful in 6m19s
Build all the nodes / storage01 (push) Has been cancelled
feat(nimbolus): init a http terraform backend
2025-06-17 17:26:53 +02:00

104 lines
2.7 KiB
Nix

# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
lib,
config,
sources,
pkgs,
...
}:
let
inherit (lib)
getExe
mapAttrsToList
mkEnableOption
mkIf
mkPackageOption
mkOption
;
inherit (lib.types)
attrsOf
path
str
;
cfg = config.services.nimbolus-tf;
in
{
options.services.nimbolus-tf = {
enable = mkEnableOption "the nimbolus terraform http backend";
package = mkPackageOption (import sources.kat-pkgs { inherit pkgs; }) "nimbolus-tf-backend" {
pkgsText = "kat-pkgs";
};
user = mkOption {
type = str;
description = ''
User used by the nimbolus server.
'';
default = "nimbolus";
};
group = mkOption {
type = str;
description = ''
Group used by the nimbolus server.
'';
default = "nimbolus";
};
settings = mkOption {
type = attrsOf str;
default = { };
description = ''
Environment variables for nimbolus configuration.
'';
};
credentials = mkOption {
type = attrsOf path;
default = { };
description = ''
Files to pass by systemd LoadCredentials.
'';
};
};
config = mkIf cfg.enable {
systemd.services.nimbolus-tf = {
description = "Nimbolus terraform http backend";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = getExe cfg.package;
Environment =
mapAttrsToList (name: value: "${name}=${value}") cfg.settings
++ mapAttrsToList (name: _: "${name}=%d/${name}") cfg.credentials;
LoadCredential = mapAttrsToList (name: file: "${name}:${file}") cfg.credentials;
StateDirectory = "nimbolus-tf";
StateDirectoryMode = "0700";
WorkingDirectory = "/var/lib/nimbolus-tf";
# Hardening
DynamicUser = true;
CapabilityBoundingSet = "";
PrivateDevices = true;
ProtectClock = true;
ProtectKernelLogs = true;
ProtectControlGroups = true;
ProtectKernelModules = true;
RestrictNamespaces = true;
ProtectHostname = true;
LockPersonality = true;
RestrictRealtime = true;
ProtectHome = true;
ProtectProc = "noaccess";
ProcSubset = "pid";
PrivateUsers = true;
UMask = "0077";
ProtectKernelTunables = true;
RestrictAddressFamilies = "AF_INET AF_INET6";
SystemCallFilter = "~@clock @cpu-emulation @debug @module @mount @obsolete @privileged @raw-io @reboot @resources @swap";
MemoryDenyWriteExecute = true;
SystemCallArchitectures = "native";
};
};
};
}