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 6m22s

This commit is contained in:
Chris Kruining 2025-09-23 11:13:23 +00:00
parent 0cf2576bfc
commit b509508ee6
46 changed files with 139 additions and 11 deletions

0
bun.lock Normal file → Executable file
View file

0
bunfig.toml Normal file → Executable file
View file

0
flake.nix Normal file → Executable file
View file

0
justfile Normal file → Executable file
View file

0
nix/devShells/flake-module.nix Normal file → Executable file
View file

0
nix/modules/customer-portal/default.nix Normal file → Executable file
View file

150
nix/modules/customer-portal/flake-module.nix Normal file → Executable file
View file

@ -1,16 +1,144 @@
{ ... }: { moduleWithSystem, ... }:
{ {
flake = { flake.nixosModules.default = moduleWithSystem (
nixosModules = { perSystem@{ config, lib, pkgs, utils, ... }:
# default = self'.nixosModules.amarth-customer-portal; nixos@{ ... }:
let
inherit (lib) mkEnableOption mkPackageOption mkOption mkIf types;
# amarth-customer-portal = { ... }: { format = pkgs.formats.json {};
# imports = [ ./default.nix ];
# };
default = { ... }: { cfg = config.services.amarth-customer-portal;
imports = [ ./default.nix ]; in
{
options.services.amarth-customer-portal = {
enable = mkEnableOption "Enable Amarth cloud's customer portal.";
package = mkPackageOption config.packages "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 ];
};
}
);
} }

0
nix/modules/flake-module.nix Normal file → Executable file
View file

0
nix/packages/flake-module.nix Normal file → Executable file
View file

0
src/app.css Normal file → Executable file
View file

0
src/auth.client.ts Normal file → Executable file
View file

0
src/auth.server.ts Normal file → Executable file
View file

0
src/components/details/details.module.css Normal file → Executable file
View file

0
src/components/details/details.tsx Normal file → Executable file
View file

0
src/components/details/index.ts Normal file → Executable file
View file

0
src/components/dropdown/dropdown.module.css Normal file → Executable file
View file

0
src/components/dropdown/dropdown.tsx Normal file → Executable file
View file

0
src/components/dropdown/index.ts Normal file → Executable file
View file

0
src/components/hero/hero.module.css Normal file → Executable file
View file

0
src/components/hero/hero.tsx Normal file → Executable file
View file

0
src/components/hero/index.ts Normal file → Executable file
View file

0
src/components/list/index.ts Normal file → Executable file
View file

0
src/components/list/list.module.css Normal file → Executable file
View file

0
src/components/list/list.tsx Normal file → Executable file
View file

0
src/components/select/index.ts Normal file → Executable file
View file

0
src/components/select/select.module.css Normal file → Executable file
View file

0
src/components/select/select.tsx Normal file → Executable file
View file

0
src/features/shell/index.tsx Normal file → Executable file
View file

0
src/features/shell/nav.module.css Normal file → Executable file
View file

0
src/features/shell/nav.tsx Normal file → Executable file
View file

0
src/features/shell/shell.module.css Normal file → Executable file
View file

0
src/features/shell/shell.tsx Normal file → Executable file
View file

0
src/features/shell/top.module.css Normal file → Executable file
View file

0
src/features/shell/top.tsx Normal file → Executable file
View file

0
src/features/theme/context.ts Normal file → Executable file
View file

0
src/features/theme/index.ts Normal file → Executable file
View file

0
src/features/theme/picker.module.css Normal file → Executable file
View file

0
src/features/theme/picker.tsx Normal file → Executable file
View file

0
src/features/user/avatar.module.css Normal file → Executable file
View file

0
src/features/user/avatar.tsx Normal file → Executable file
View file

0
src/features/user/index.ts Normal file → Executable file
View file

0
src/features/user/profile.module.css Normal file → Executable file
View file

0
src/features/user/profile.tsx Normal file → Executable file
View file

0
src/features/user/user.ts Normal file → Executable file
View file

0
src/routes/(shell).tsx Normal file → Executable file
View file

0
src/utilities.ts Normal file → Executable file
View file