move stuff

This commit is contained in:
mjallen18
2025-08-26 17:20:27 -05:00
parent f66c0726b0
commit d15762b199
68 changed files with 24 additions and 25 deletions

View File

@@ -0,0 +1,37 @@
{
config,
lib,
namespace,
...
}:
with lib;
let
cfg = config.${namespace}.services.code-server;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
# Configure the standard NixOS code-server service
services.code-server = {
enable = true;
port = cfg.port;
user = cfg.user;
group = cfg.group;
host = cfg.host;
auth = cfg.auth;
disableTelemetry = cfg.disableTelemetry;
disableUpdateCheck = cfg.disableUpdateCheck;
extraEnvironment = cfg.extraEnvironment;
}
// optionalAttrs (cfg.hashedPassword != null) {
hashedPassword = cfg.hashedPassword;
};
# Open firewall for code-server if enabled
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [ cfg.port ];
};
};
}

View File

@@ -0,0 +1,70 @@
{ lib, namespace, ... }:
with lib;
{
options.${namespace}.services.code-server = {
enable = mkEnableOption "code-server with enhanced configuration";
port = mkOption {
type = types.port;
default = 4444;
description = "Port for code-server";
};
openFirewall = mkOption {
type = types.bool;
default = true;
description = "Whether to open firewall for code-server";
};
user = mkOption {
type = types.str;
default = "admin";
description = "User to run code-server as";
};
group = mkOption {
type = types.str;
default = "users";
description = "Group to run code-server as";
};
host = mkOption {
type = types.str;
default = "0.0.0.0";
description = "Host to bind code-server to";
};
auth = mkOption {
type = types.enum [
"none"
"password"
];
default = "none";
description = "Authentication method for code-server";
};
hashedPassword = mkOption {
type = types.nullOr types.str;
default = null;
description = "Hashed password for code-server authentication";
};
extraEnvironment = mkOption {
type = types.attrsOf types.str;
default = { };
description = "Extra environment variables for code-server";
};
disableTelemetry = mkOption {
type = types.bool;
default = true;
description = "Whether to disable telemetry";
};
disableUpdateCheck = mkOption {
type = types.bool;
default = true;
description = "Whether to disable update checks";
};
};
}