initial commit
Some checks failed
Nix CI / build (push) Failing after 31s

This commit is contained in:
Rustam Efimov 2026-04-01 08:50:01 +03:00
commit 30ce0dafc2
No known key found for this signature in database
195 changed files with 8902 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
imports = [
./options.nix
./service.nix
./nginx.nix
];
}

View 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;
'';
};
};
};
}

View 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";
};
};
}

View 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=";
}
];
};
};
}