mkModule code-server
This commit is contained in:
@@ -6,32 +6,32 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.services.code-server;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
name = "code-server";
|
||||
cfg = config.${namespace}.services.${name};
|
||||
|
||||
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 ];
|
||||
codeServerConfig = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
description = "vscode server";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
# Configure the standard NixOS code-server service
|
||||
services.code-server = {
|
||||
enable = true;
|
||||
port = cfg.port;
|
||||
user = "nix-apps";
|
||||
group = "jallen-nas";
|
||||
host = cfg.listenAddress;
|
||||
auth = "none"; # "password"
|
||||
disableTelemetry = true;
|
||||
disableUpdateCheck = true;
|
||||
extraEnvironment = cfg.extraEnvironment;
|
||||
}
|
||||
// optionalAttrs (cfg.hashedPassword != null) {
|
||||
hashedPassword = cfg.hashedPassword;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ codeServerConfig ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user