too lazy to think of a message, so enjoy this pointless text. Good luck future me...
All checks were successful
Test action / Print hello world (push) Successful in 8m32s
All checks were successful
Test action / Print hello world (push) Successful in 8m32s
This commit is contained in:
parent
e7b0307690
commit
28fdba8b00
15 changed files with 3868 additions and 2785 deletions
|
|
@ -1,142 +1,144 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
flake.nixosModules.default =
|
||||
nixos@{ config, pkgs, lib, utils, ... }:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf types;
|
||||
|
||||
format = pkgs.formats.json {};
|
||||
|
||||
cfg = config.services.amarth-customer-portal;
|
||||
in
|
||||
{
|
||||
options.services.amarth-customer-portal = {
|
||||
enable = mkEnableOption "Enable Amarth cloud's customer portal.";
|
||||
|
||||
package = mkPackageOption self.packages.${pkgs.hostPlatform.system} "amarth-customer-portal" {};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = "true";
|
||||
description = ''
|
||||
Open the configured port in the firewall.
|
||||
'';
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = types.str;
|
||||
default = "amarth";
|
||||
description = ''
|
||||
User account under which FileBrowser runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = types.str;
|
||||
default = "amarth";
|
||||
description = ''
|
||||
Group under which FileBrowser runs.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = {};
|
||||
description = ''
|
||||
'';
|
||||
type = types.submodule {
|
||||
freeformType = format.type;
|
||||
|
||||
options = {
|
||||
address = mkOption {
|
||||
default = "localhost";
|
||||
description = ''
|
||||
The address to listen on.
|
||||
'';
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
description = ''
|
||||
Which port to run the portal on.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
default = "/var/lib/amarth/customer-portal";
|
||||
description = ''
|
||||
Directory where the portal persists files.
|
||||
'';
|
||||
type = types.path;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd = {
|
||||
services.amarthCustomerPortal = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
description = "Amarth cloud's customer portal";
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = utils.escapeSystemdExecArgs [
|
||||
(lib.getExe cfg.package)
|
||||
"--config"
|
||||
(format.generate "config.json" cfg.settings)
|
||||
];
|
||||
|
||||
StateDirectory = "amarth-customer-portal";
|
||||
CacheDirectory = "amarth-customer-portal";
|
||||
WorkingDirectory = cfg.settings.dataDir;
|
||||
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
UMask = "0077";
|
||||
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
LockPersonality = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_UNIX"
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
];
|
||||
DevicePolicy = "closed";
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true;
|
||||
};
|
||||
};
|
||||
|
||||
tmpfiles.settings.amarth-customer-portal = {
|
||||
"${cfg.settings.dataDir}".d = {
|
||||
inherit (cfg) user group;
|
||||
mode = "0700";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
users = mkIf (cfg.user == "amarth") {
|
||||
amarth = { inherit (cfg) group; isSystemUser = true; };
|
||||
};
|
||||
|
||||
groups = mkIf (cfg.group == "amarth") {
|
||||
amarth = {};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.port ];
|
||||
};
|
||||
};
|
||||
{ self, ... }:
|
||||
{
|
||||
flake.nixosModules.default =
|
||||
nixos@{ config, pkgs, lib, utils, ... }:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf types;
|
||||
|
||||
format = pkgs.formats.json {};
|
||||
|
||||
cfg = config.services.amarth-customer-portal;
|
||||
in
|
||||
{
|
||||
options.services.amarth-customer-portal = {
|
||||
enable = mkEnableOption "Enable Amarth cloud's customer portal.";
|
||||
|
||||
package = mkPackageOption self.packages.${pkgs.hostPlatform.system} "amarth-customer-portal" {};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = "true";
|
||||
description = ''
|
||||
Open the configured port in the firewall.
|
||||
'';
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = types.str;
|
||||
default = "amarth";
|
||||
description = ''
|
||||
User account under which FileBrowser runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = types.str;
|
||||
default = "amarth";
|
||||
description = ''
|
||||
Group under which FileBrowser runs.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = {};
|
||||
description = ''
|
||||
'';
|
||||
type = types.submodule {
|
||||
freeformType = format.type;
|
||||
|
||||
options = {
|
||||
address = mkOption {
|
||||
default = "localhost";
|
||||
description = ''
|
||||
The address to listen on.
|
||||
'';
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
description = ''
|
||||
Which port to run the portal on.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
default = "/var/lib/amarth/customer-portal";
|
||||
description = ''
|
||||
Directory where the portal persists files.
|
||||
'';
|
||||
type = types.path;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd = {
|
||||
services.amarthCustomerPortal = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
description = "Amarth cloud's customer portal";
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = utils.escapeSystemdExecArgs [
|
||||
(lib.getExe cfg.bun)
|
||||
"run"
|
||||
"start"
|
||||
"--config"
|
||||
(format.generate "config.json" cfg.settings)
|
||||
];
|
||||
|
||||
StateDirectory = "amarth-customer-portal";
|
||||
CacheDirectory = "amarth-customer-portal";
|
||||
WorkingDirectory = cfg.settings.dataDir;
|
||||
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
UMask = "0077";
|
||||
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
LockPersonality = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_UNIX"
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
];
|
||||
DevicePolicy = "closed";
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true;
|
||||
};
|
||||
};
|
||||
|
||||
tmpfiles.settings.amarth-customer-portal = {
|
||||
"${cfg.settings.dataDir}".d = {
|
||||
inherit (cfg) user group;
|
||||
mode = "0700";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
users = mkIf (cfg.user == "amarth") {
|
||||
amarth = { inherit (cfg) group; isSystemUser = true; };
|
||||
};
|
||||
|
||||
groups = mkIf (cfg.group == "amarth") {
|
||||
amarth = {};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.settings.port ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports =
|
||||
let
|
||||
# Get all subdirectories in the current directory
|
||||
dirContents = builtins.readDir ./.;
|
||||
|
||||
# Filter to include only directories that have a flake-module.nix file
|
||||
# and exclude special directories like 'result'
|
||||
validModuleDirs = builtins.filter (
|
||||
name:
|
||||
name != "result"
|
||||
&& dirContents.${name} == "directory"
|
||||
&& builtins.pathExists (./. + "/${name}/flake-module.nix")
|
||||
) (builtins.attrNames dirContents);
|
||||
|
||||
# Create import paths for each valid directory
|
||||
imports = map (name: ./. + "/${name}/flake-module.nix") validModuleDirs;
|
||||
in
|
||||
imports;
|
||||
}
|
||||
{ ... }:
|
||||
{
|
||||
imports =
|
||||
let
|
||||
# Get all subdirectories in the current directory
|
||||
dirContents = builtins.readDir ./.;
|
||||
|
||||
# Filter to include only directories that have a flake-module.nix file
|
||||
# and exclude special directories like 'result'
|
||||
validModuleDirs = builtins.filter (
|
||||
name:
|
||||
name != "result"
|
||||
&& dirContents.${name} == "directory"
|
||||
&& builtins.pathExists (./. + "/${name}/flake-module.nix")
|
||||
) (builtins.attrNames dirContents);
|
||||
|
||||
# Create import paths for each valid directory
|
||||
imports = map (name: ./. + "/${name}/flake-module.nix") validModuleDirs;
|
||||
in
|
||||
imports;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue