chore: initialized project
This commit is contained in:
commit
d79fe97b7e
24 changed files with 786 additions and 0 deletions
13
modules/flake-module.nix
Normal file
13
modules/flake-module.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
flake.nixosModules =
|
||||
let
|
||||
allModules = import ./top-level.nix;
|
||||
in
|
||||
lib.listToAttrs (
|
||||
map (module: {
|
||||
name = lib.removeSuffix ".nix" (baseNameOf module);
|
||||
value = import module;
|
||||
}) allModules
|
||||
);
|
||||
}
|
||||
76
modules/services/resonite-server.nix
Normal file
76
modules/services/resonite-server.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.resonite-server;
|
||||
|
||||
settingsFormat = pkgs.formats.json { };
|
||||
settingsFile = settingsFormat.generate "config.json" cfg.settings;
|
||||
in
|
||||
{
|
||||
options.services.resonite-server = {
|
||||
enable = lib.mkEnableOption "Resonite headless server";
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = { };
|
||||
example = { };
|
||||
description = ''
|
||||
The configuration to run on startup.
|
||||
Read <https://wiki.resonite.com/Headless_server_software/Configuration_file> for details.
|
||||
'';
|
||||
};
|
||||
|
||||
environment = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = { };
|
||||
example = {
|
||||
STEAM_BRANCH = "headless";
|
||||
TZ = "Etc/UTC";
|
||||
};
|
||||
description = ''
|
||||
Environment variables passed to the Resonite container.
|
||||
Check <https://github.com/voxelbonecloud/resonite-headless-docker> for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFiles = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [ ];
|
||||
example = [
|
||||
"/run/secrets/resonite-credentials"
|
||||
];
|
||||
description = "Environment files for the Resonite container.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.resonite-server.environment = {
|
||||
STEAM_BRANCH = "headless";
|
||||
CONFIG_FILE = "config.json";
|
||||
TZ = "Etc/UTC";
|
||||
};
|
||||
|
||||
virtualisation.oci-containers = {
|
||||
backend = lib.mkDefault "podman";
|
||||
|
||||
containers.resonite-server = {
|
||||
image = "ghcr.io/voxelbonecloud/resonite-headless-docker:main";
|
||||
pull = "newer";
|
||||
|
||||
inherit (cfg) environment environmentFiles;
|
||||
|
||||
user = "0";
|
||||
|
||||
volumes = [
|
||||
"${settingsFile}:/Config/config.json:ro"
|
||||
"resonite-server-logs:/Logs"
|
||||
"resonite-server-mods:/RML"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
3
modules/top-level.nix
Normal file
3
modules/top-level.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[
|
||||
./services/resonite-server.nix
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue