This commit is contained in:
commit
30ce0dafc2
195 changed files with 8902 additions and 0 deletions
7
services/code-server/default.nix
Normal file
7
services/code-server/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./service.nix
|
||||
./nginx.nix
|
||||
];
|
||||
}
|
||||
27
services/code-server/nginx.nix
Normal file
27
services/code-server/nginx.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.machine.code-server;
|
||||
in
|
||||
with lib; mkIf cfg.enable {
|
||||
services.nginx.virtualHosts = mkIf (cfg.domain != null) {
|
||||
${cfg.domain} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString cfg.port}";
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 86400;
|
||||
proxy_send_timeout 86400;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
services/code-server/options.nix
Normal file
33
services/code-server/options.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.machine.code-server;
|
||||
in
|
||||
with lib; {
|
||||
options.machine.code-server = {
|
||||
enable = mkEnableOption "code-server";
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 4444;
|
||||
description = "Port to listen on.";
|
||||
};
|
||||
domain = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "domain for the code-server instance.";
|
||||
};
|
||||
hashedPassword = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Hashed password for code-server";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = config.services.code-server.user;
|
||||
description = "The user to run code-server as";
|
||||
};
|
||||
};
|
||||
}
|
||||
49
services/code-server/service.nix
Normal file
49
services/code-server/service.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.machine.code-server;
|
||||
in
|
||||
with lib; mkIf cfg.enable {
|
||||
services.code-server = {
|
||||
enable = cfg.enable;
|
||||
port = cfg.port;
|
||||
hashedPassword = cfg.hashedPassword;
|
||||
user = cfg.user;
|
||||
host = "127.0.0.1";
|
||||
disableTelemetry = true;
|
||||
disableUpdateCheck = true;
|
||||
disableWorkspaceTrust = true;
|
||||
package = pkgs.vscode-with-extensions.override {
|
||||
vscode = pkgs.code-server;
|
||||
vscodeExtensions =
|
||||
(with pkgs.vscode-extensions; [
|
||||
rust-lang.rust-analyzer
|
||||
fill-labs.dependi
|
||||
ms-python.black-formatter
|
||||
ms-python.python
|
||||
ms-python.isort
|
||||
ms-python.mypy-type-checker
|
||||
intellsmi.comment-translate
|
||||
editorconfig.editorconfig
|
||||
dbaeumer.vscode-eslint
|
||||
davidanson.vscode-markdownlint
|
||||
yzhang.markdown-all-in-one
|
||||
jnoortheen.nix-ide
|
||||
ziglang.vscode-zig
|
||||
bbenoist.nix
|
||||
])
|
||||
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "purpleVoid";
|
||||
publisher = "Rej";
|
||||
version = "1.0.3";
|
||||
sha256 = "oCZ2N8j2U0xGvechD7DlW64KiL0eSDKYwniYft0kVu4=";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue