Compare commits
8 commits
411b49a042
...
7e77d89602
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e77d89602 | |||
| d96d5d459f | |||
| dd9fa99c3d | |||
| 72f5bc25af | |||
| ea0adeed37 | |||
| 3daa2f4242 | |||
| fe1130c042 | |||
| 880b1c247e |
6 changed files with 58 additions and 99 deletions
24
flake.lock
generated
24
flake.lock
generated
|
|
@ -73,11 +73,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1706830856,
|
"lastModified": 1709336216,
|
||||||
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
|
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
|
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -136,11 +136,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709204054,
|
"lastModified": 1709988192,
|
||||||
"narHash": "sha256-U1idK0JHs1XOfSI1APYuXi4AEADf+B+ZU4Wifc0pBHk=",
|
"narHash": "sha256-qxwIkl85P0I1/EyTT+NJwzbXdOv86vgZxcv4UKicjK8=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "2f3367769a93b226c467551315e9e270c3f78b15",
|
"rev": "b0b0c3d94345050a7f86d1ebc6c56eea4389d030",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -152,11 +152,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709150264,
|
"lastModified": 1709703039,
|
||||||
"narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=",
|
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9099616b93301d5cf84274b184a3a5ec69e94e08",
|
"rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -168,11 +168,11 @@
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709206595,
|
"lastModified": 1710013455,
|
||||||
"narHash": "sha256-lBU/gE7DiJCNkJGPVUms0zA0hxzDVgENIXfebj1oeLc=",
|
"narHash": "sha256-qzOpU4APTso6JLA+/F4zlO/yL8++n/CsUpmxbQAsy/4=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "fbe8df1c13fd8e63e35c2c4654104661eb1fbbed",
|
"rev": "cf1e9b0e085368cc489c765f285f1d07c2ec8d36",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ in
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
|
||||||
# Shell
|
# Shell
|
||||||
shellcheck
|
nodePackages.bash-language-server
|
||||||
shfmt
|
shfmt
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,14 @@ if utils.is_executable("clangd") then
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Haskell
|
||||||
|
if utils.is_executable("haskell-language-server-wrapper") then
|
||||||
|
lspconfig.hls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = lsp.on_attach,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- Nix
|
-- Nix
|
||||||
if utils.is_executable("nil") then
|
if utils.is_executable("nil") then
|
||||||
lspconfig.nil_ls.setup({
|
lspconfig.nil_ls.setup({
|
||||||
|
|
@ -52,6 +60,13 @@ if utils.is_executable("pyright") then
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if utils.is_executable("ruff-lsp") then
|
||||||
|
lspconfig.ruff_lsp.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = lsp.on_attach,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- Rust
|
-- Rust
|
||||||
if utils.is_executable("rust-analyzer") then
|
if utils.is_executable("rust-analyzer") then
|
||||||
lspconfig.rust_analyzer.setup({
|
lspconfig.rust_analyzer.setup({
|
||||||
|
|
@ -59,3 +74,12 @@ if utils.is_executable("rust-analyzer") then
|
||||||
on_attach = lsp.on_attach,
|
on_attach = lsp.on_attach,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Shell
|
||||||
|
if utils.is_executable("bash-language-server") then
|
||||||
|
lspconfig.bashls.setup({
|
||||||
|
filetypes = { "bash", "sh", "zsh" },
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = lsp.on_attach,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,6 @@ null_ls.register({
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Haskell
|
|
||||||
null_ls.register({
|
|
||||||
null_ls.builtins.formatting.brittany.with({
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("brittany"),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Nix
|
-- Nix
|
||||||
null_ls.register({
|
null_ls.register({
|
||||||
null_ls.builtins.formatting.nixpkgs_fmt.with({
|
null_ls.builtins.formatting.nixpkgs_fmt.with({
|
||||||
|
|
@ -50,16 +42,6 @@ null_ls.register({
|
||||||
|
|
||||||
-- Python
|
-- Python
|
||||||
null_ls.register({
|
null_ls.register({
|
||||||
null_ls.builtins.diagnostics.flake8.with({
|
|
||||||
-- Only used if available, but prefer pflake8 if available
|
|
||||||
condition = function()
|
|
||||||
return utils.is_executable("flake8") and not utils.is_executable("pflake8")
|
|
||||||
end,
|
|
||||||
}),
|
|
||||||
null_ls.builtins.diagnostics.pyproject_flake8.with({
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("pflake8"),
|
|
||||||
}),
|
|
||||||
null_ls.builtins.diagnostics.mypy.with({
|
null_ls.builtins.diagnostics.mypy.with({
|
||||||
-- Only used if available
|
-- Only used if available
|
||||||
condition = utils.is_executable_condition("mypy"),
|
condition = utils.is_executable_condition("mypy"),
|
||||||
|
|
@ -81,22 +63,6 @@ null_ls.register({
|
||||||
|
|
||||||
-- Shell (non-POSIX)
|
-- Shell (non-POSIX)
|
||||||
null_ls.register({
|
null_ls.register({
|
||||||
null_ls.builtins.code_actions.shellcheck.with({
|
|
||||||
-- Restrict to bash and zsh
|
|
||||||
filetypes = { "bash", "zsh" },
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("shellcheck"),
|
|
||||||
}),
|
|
||||||
null_ls.builtins.diagnostics.shellcheck.with({
|
|
||||||
-- Show error code in message
|
|
||||||
diagnostics_format = "[#{c}] #{m}",
|
|
||||||
-- Require explicit empty string test, use bash dialect
|
|
||||||
extra_args = { "-s", "bash", "-o", "avoid-nullary-conditions" },
|
|
||||||
-- Restrict to bash and zsh
|
|
||||||
filetypes = { "bash", "zsh" },
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("shellcheck"),
|
|
||||||
}),
|
|
||||||
null_ls.builtins.formatting.shfmt.with({
|
null_ls.builtins.formatting.shfmt.with({
|
||||||
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
||||||
-- add space after redirection, use bash dialect
|
-- add space after redirection, use bash dialect
|
||||||
|
|
@ -110,22 +76,6 @@ null_ls.register({
|
||||||
|
|
||||||
-- Shell (POSIX)
|
-- Shell (POSIX)
|
||||||
null_ls.register({
|
null_ls.register({
|
||||||
null_ls.builtins.code_actions.shellcheck.with({
|
|
||||||
-- Restrict to POSIX sh
|
|
||||||
filetypes = { "sh" },
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("shellcheck"),
|
|
||||||
}),
|
|
||||||
null_ls.builtins.diagnostics.shellcheck.with({
|
|
||||||
-- Show error code in message
|
|
||||||
diagnostics_format = "[#{c}] #{m}",
|
|
||||||
-- Require explicit empty string test
|
|
||||||
extra_args = { "-o", "avoid-nullary-conditions" },
|
|
||||||
-- Restrict to POSIX sh
|
|
||||||
filetypes = { "sh" },
|
|
||||||
-- Only used if available
|
|
||||||
condition = utils.is_executable_condition("shellcheck"),
|
|
||||||
}),
|
|
||||||
null_ls.builtins.formatting.shfmt.with({
|
null_ls.builtins.formatting.shfmt.with({
|
||||||
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
||||||
-- add space after redirection, use POSIX
|
-- add space after redirection, use POSIX
|
||||||
|
|
|
||||||
|
|
@ -59,21 +59,6 @@ in
|
||||||
"LOHR_HOME=${lohrHome}"
|
"LOHR_HOME=${lohrHome}"
|
||||||
"LOHR_CONFIG="
|
"LOHR_CONFIG="
|
||||||
];
|
];
|
||||||
ExecStartPre = lib.mkIf (cfg.sshKeyFile != null) ''+${
|
|
||||||
pkgs.writeScript "copy-ssh-key" ''
|
|
||||||
#!${pkgs.bash}/bin/bash
|
|
||||||
# Ensure the key is not there
|
|
||||||
mkdir -p '${lohrHome}/.ssh'
|
|
||||||
rm -f '${lohrHome}/.ssh/id_ed25519'
|
|
||||||
|
|
||||||
# Move the key into place
|
|
||||||
cp ${cfg.sshKeyFile} '${lohrHome}/.ssh/id_ed25519'
|
|
||||||
|
|
||||||
# Fix permissions
|
|
||||||
chown -R lohr:lohr '${lohrHome}/.ssh'
|
|
||||||
chmod -R 0700 '${lohrHome}/.ssh'
|
|
||||||
''
|
|
||||||
}'';
|
|
||||||
ExecStart =
|
ExecStart =
|
||||||
let
|
let
|
||||||
configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting;
|
configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting;
|
||||||
|
|
@ -103,5 +88,24 @@ in
|
||||||
inherit (cfg) port;
|
inherit (cfg) port;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# SSH key provisioning
|
||||||
|
systemd.tmpfiles.settings."10-lohr" = lib.mkIf (cfg.sshKeyFile != null) {
|
||||||
|
"${lohrHome}/.ssh" = {
|
||||||
|
d = {
|
||||||
|
user = "lohr";
|
||||||
|
group = "lohr";
|
||||||
|
mode = "0700";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"${lohrHome}/.ssh/id_ed25519" = {
|
||||||
|
"f+" = {
|
||||||
|
user = "lohr";
|
||||||
|
group = "lohr";
|
||||||
|
mode = "0700";
|
||||||
|
argument = cfg.sshKeyFile;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ in
|
||||||
frontendScheme = "https";
|
frontendScheme = "https";
|
||||||
frontendHostname = vikunjaDomain;
|
frontendHostname = vikunjaDomain;
|
||||||
|
|
||||||
setupNginx = false;
|
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
type = "postgres";
|
type = "postgres";
|
||||||
user = "vikunja";
|
user = "vikunja";
|
||||||
|
|
@ -61,28 +59,11 @@ in
|
||||||
# This is a weird setup
|
# This is a weird setup
|
||||||
my.services.nginx.virtualHosts = {
|
my.services.nginx.virtualHosts = {
|
||||||
${subdomain} = {
|
${subdomain} = {
|
||||||
# Serve the root for the web-ui
|
socket = socketPath;
|
||||||
root = config.services.vikunja.package-frontend;
|
|
||||||
|
|
||||||
extraConfig = {
|
|
||||||
locations = {
|
|
||||||
"/" = {
|
|
||||||
tryFiles = "try_files $uri $uri/ /";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Serve the API through a UNIX socket
|
|
||||||
"~* ^/(api|dav|\\.well-known)/" = {
|
|
||||||
proxyPass = "http://unix:${socketPath}";
|
|
||||||
extraConfig = ''
|
|
||||||
client_max_body_size 20M;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.vikunja-api = {
|
systemd.services.vikunja = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# Use a system user to simplify using the CLI
|
# Use a system user to simplify using the CLI
|
||||||
DynamicUser = lib.mkForce false;
|
DynamicUser = lib.mkForce false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue