Compare commits

..

No commits in common. "038913d3b5de34e5b0db4757c0d96541cfd8b242" and "b9eebc2a7ef94e3752fabd9660e4e7be97aa44da" have entirely different histories.

29 changed files with 337 additions and 554 deletions

1
.envrc
View file

@ -1 +0,0 @@
use flake

2
.gitignore vendored
View file

@ -1,3 +1 @@
.direnv
.vscode
result

View file

@ -55,42 +55,22 @@
outputs = { self, ... }@inputs:
with inputs;
let
homeConfigurations = import ./home;
sharedModules = [
self.homeManagerModules
inputs.nix-index-database.hmModules.nix-index
];
mkHome = user: host: { config, system, ... }: {
imports = [
home-manager.nixosModules.home-manager
{
home-manager = {
inherit sharedModules;
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
};
home-manager.users.${user} = homeConfigurations.${user}.${host};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.xin = import ./home/${user}/${host};
home-manager.extraSpecialArgs = { inherit inputs system; };
}
];
};
mkHomeConfiguration = user: settings: {
name = user;
value = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
self.homeManagerModules
] ++ sharedModules;
specialArgs = {
inherit inputs;
};
};
};
mkNixos = { system, modules, specialArgs ? {}}: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs // { inherit inputs system; };
modules = [
self.nixosModules.default
home-manager.nixosModules.home-manager
nur.nixosModules.nur
] ++ modules;
};
@ -100,8 +80,6 @@
nixosModules.default = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
homeConfigurations = listToAttrs [ (mkHomeConfiguration "xin" "calcite") ];
colmenaHive = colmena.lib.makeHive {
meta = {
nixpkgs = import nixpkgs {
@ -187,14 +165,5 @@
}
];
}).config.system.build.sdImage;
} // flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [ git colmena ];
};
};
}
);
}

View file

@ -1,5 +0,0 @@
{
xin = {
calcite = import ./xin/calcite.nix;
};
}

19
home/xin/alacritty.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, ... }: {
programs.alacritty = {
enable = true;
settings = {
shell = {
program = config.programs.zellij.package + "/bin/zellij";
args = [
"attach"
"-c"
];
};
font.size = 10.0;
window = {
resize_increments = true;
dynamic_padding = true;
};
};
};
}

View file

@ -1,7 +1,10 @@
{ config, pkgs, ... }:
{ inputs, config, pkgs, ... }:
{
imports = [
./common
../common
../vscode.nix
../alacritty.nix
inputs.nix-index-database.hmModules.nix-index
];
programs.nix-index-database.comma.enable = true;
@ -31,14 +34,4 @@
thunderbird
remmina
];
custom-hm = {
alacritty = { enable = true; };
direnv = { enable = true; };
fish = { enable = true; };
git = { enable = true; };
neovim = { enable = true; };
vscode = { enable = true; };
zellij = { enable = true; };
};
}

View file

@ -1,5 +1,10 @@
{ inputs, pkgs, ... }: {
imports = [ ];
{ pkgs, ... }: {
imports = [
./fish.nix
./git.nix
./zellij.nix
./vim.nix
];
home.packages = with pkgs; [
dig

37
home/xin/common/fish.nix Normal file
View file

@ -0,0 +1,37 @@
{ pkgs, ... }: {
programs.fish = {
enable = true;
plugins = with pkgs; [
{
name = "pisces";
src = fishPlugins.pisces.src;
}
{
name = "done";
src = fishPlugins.done.src;
}
{
name = "hydro";
src = fishPlugins.hydro.src;
}
];
interactiveShellInit = ''
fish_config theme choose 'ayu Dark'
fish_config prompt choose arrow
${pkgs.nix-your-shell}/bin/nix-your-shell fish | source
function fish_right_prompt
if test -n "$IN_NIX_SHELL"
echo -n "<nix-shell>"
else if test $SHLVL -ge 3
echo -n "<🚀lv$SHLVL>"
end
end
function fish_command_not_found
${pkgs.comma}/bin/comma $argv
end
'';
functions = {
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
};
};
}

13
home/xin/common/git.nix Normal file
View file

@ -0,0 +1,13 @@
{
programs.git = {
enable = true;
delta.enable = true;
userName = "Xinyang Li";
userEmail = "lixinyang411@gmail.com";
aliases = {
graph = "log --all --oneline --graph --decorate";
s = "status";
d = "diff";
};
};
}

32
home/xin/common/vim.nix Normal file
View file

@ -0,0 +1,32 @@
{ pkgs, ... }: {
programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
nvim-treesitter.withAllGrammars
dracula-nvim
];
extraConfig = ''
set nocompatible
syntax on
set number
set relativenumber
set shortmess+=I
set laststatus=2
set ignorecase
set smartcase
set list
set listchars=tab:·
set tabstop=4
set shiftwidth=4
set expandtab
set mouse+=a
colorscheme dracula
'';
};
}

View file

@ -0,0 +1,28 @@
{
programs.zellij = {
enable = true;
settings = {
default_shell = "fish";
keybinds = {
unbind = [
"Ctrl p"
"Ctrl n"
];
};
theme = "dracula";
themes.dracula = {
fg = [ 248 248 242 ];
bg = [ 40 42 54 ];
black = [ 0 0 0 ];
red = [ 255 85 85 ];
green = [ 80 250 123 ];
yellow = [ 241 250 140 ];
blue = [ 98 114 164 ];
magenta = [ 255 121 198 ];
cyan = [ 139 233 253 ];
white = [ 255 255 255 ];
orange = [ 255 184 108 ];
};
};
};
}

133
home/xin/vscode.nix Normal file
View file

@ -0,0 +1,133 @@
{ config, pkgs, inputs, system, ... }:
{
home.packages = with pkgs; [
pkgs.wl-clipboard-x11
];
programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
extensions = (with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace; [
arrterian.nix-env-selector
bbenoist.nix
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
vscodevim.vim
github.vscode-pull-request-github
eamodio.gitlens
gruntfuggly.todo-tree # todo highlight
# Language support
# Python
ms-python.python
# Markdown
davidanson.vscode-markdownlint
# C/C++
ms-vscode.cmake-tools
llvm-vs-code-extensions.vscode-clangd
# Nix
jnoortheen.nix-ide
# Latex
james-yu.latex-workshop
# Vue
vue.volar
ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image
]) ++ (with pkgs.vscode-extensions; [
# Rust
rust-lang.rust-analyzer
github.copilot
]);
userSettings = {
"workbench.colorTheme" = "Default Dark+";
"terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"editor.inlineSuggest.enabled" = true;
"editor.rulers" = [
80
];
"editor.mouseWheelZoom" = true;
"git.autofetch" = true;
"window.zoomLevel" = -1;
"nix.enableLanguageServer" = true;
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{
"name" = "xelatex";
"command" = "xelatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"-pdf"
"%DOCFILE%"
];
}
{
"name" = "pdflatex";
"command" = "pdflatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
{
"name" = "bibtex";
"command" = "bibtex";
"args" = [
"%DOCFILE%"
];
}
];
"latex-workshop.latex.recipes" = [
{
"name" = "xelatex";
"tools" = [
"xelatex"
];
}
{
"name" = "pdflatex";
"tools" = [
"pdflatex"
];
}
{
"name" = "xe->bib->xe->xe";
"tools" = [
"xelatex"
"bibtex"
"xelatex"
"xelatex"
];
}
{
"name" = "pdf->bib->pdf->pdf";
"tools" = [
"pdflatex"
"bibtex"
"pdflatex"
"pdflatex"
];
}
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
};
# Extension vscode-paste-image
"pasteImage.path" = "\${currentFileDir}/.assets";
};
};
}

View file

@ -158,6 +158,10 @@
clang-tools
rnix-lsp
# C/C++
gcc
gdb
# Python
# reference: https://nixos.wiki/wiki/Python
(
@ -189,6 +193,7 @@
gnomeExtensions.paperwm
gnomeExtensions.search-light
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.gsconnect
gnome.gnome-tweaks
gthumb

View file

@ -23,6 +23,13 @@
fsType = "vfat";
};
fileSystems."/media/data" =
{
device = "/dev/disk/by-label/WINDATA";
fsType = "ntfs3";
options = [ "rw" "uid=1000" ];
};
swapDevices =
[ { device = "/dev/disk/by-label/NIXSWAP"; }
];

View file

@ -18,9 +18,6 @@
gts_env = {
owner = "gotosocial";
};
hedgedoc_env = {
owner = "hedgedoc";
};
grafana_cloud_api = {
owner = "prometheus";
sopsFile = ../secrets.yaml;

View file

@ -1,6 +1,5 @@
storage_box_mount: ENC[AES256_GCM,data:9lOAL3tkfB0pN4/cuM4SX0xoMrW0UUEzTN8spw3MQ3BWrfsRc3Stsce3puXz1sRf,iv:7Q9wzpBgQ3tqcfy0n/c6Ya84Kg60nhR/e2H0pVntWsY=,tag:9a0xvNBGQpCvhxgmV3hrww==,type:str]
gts_env: ENC[AES256_GCM,data:CKFKHXCJvTD0HFkVrBWhabcl/cloCT03qcZIc5JymiIAu+o6wef6gsQlkKP81vxC9S3XMYtLgXQ03D7Jetkfg+7nafF1+ogN,iv:/axRqZIatwYL++/KmBIievPPyKRkHGmVpgRe2Eet+fg=,tag:gwxyuePOYiD1vlSyq3yjXA==,type:str]
hedgedoc_env: ENC[AES256_GCM,data:zwAA+zKSJT0tZyYArCaa1lfL0y8DNHDp/thS11DrVxNvjmk38o0ydsKArfZKzFYye+qNBzz1B4sPCdW4cFgQUNgbM+n9AvoMB8CssdmQ+sALKmozA5aEV23q+khZSGlHocP6WA==,iv:SgZruOS1nanK64Ex1dvgoD1HzbGbNa4DFSBuVoaNgEc=,tag:R+I8m1AloDCXs5PdpEpS0w==,type:str]
sops:
kms: []
gcp_kms: []
@ -25,8 +24,8 @@ sops:
dnFBa0lDWWZtS1BHdzBoVzNTaGNkSEEKi/W1n7RT8NpTp00SBMwxsUJAPDhumJ/i
V2VnaSNwouD3SswTcoBzqQpBP9XrqzjIYGke90ZODFQbMY9WDQ+O0g==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2023-12-22T08:05:27Z"
mac: ENC[AES256_GCM,data:CiXU49arW+3w4/Lkh4l+6VjopyP7XNCU4AmuwZmnmQ7Vv4RCt84fC6lM6o4HiCc5jB07QY+2WZ5LvWz9zgSt636UpnCMgbG1w2Lxae38fW02RHJv90rn+cyyddB5kSucr5/P5NKBOZut54Cf4zVW9BaqajpQMxe4hEOn+xXpXz8=,iv:beWRlUvb6OUOK+mUXdvpvmM8S7xK0QIkIA2Bk9QA35c=,tag:KrBXqsAdBAhtwygdEHnUqQ==,type:str]
lastmodified: "2023-12-15T13:06:05Z"
mac: ENC[AES256_GCM,data:ArxA3+i+W2hU0mpzjPqzBA1pQdZySwJ+LVAez2PWFMsrgT4QATi+KmlWWfuPBkOq/DYafAES8lTemDeuzuQl7bWZq06g3s35C8Q3D/TDUKFF3ALEL5grSxKTVzg4Npjc2q2OIOXrIp/j83Gn1lBuyBFg0YdGkJ+b/BmDGkTbyUg=,iv:8MB/+WklLsFTnlvxLyvCK8VUMNeXtaPTGXlp9hRGzOM=,tag:VbbnQfPewNGdrPqmZJSYlA==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View file

@ -11,21 +11,6 @@ in
domain = "vaultwarden.xinyang.life";
};
custom.hedgedoc = {
enable = true;
caddy = true;
domain = "docs.xinyang.life";
mediaPath = "/mnt/storage/hedgedoc";
oidc = {
enable = true;
baseURL = "https://auth.xinyang.life/oauth2/openid/hedgedoc";
authorizationURL = "https://auth.xinyang.life/ui/oauth2";
tokenURL = "https://auth.xinyang.life/oauth2/token";
userProfileURL = "https://auth.xinyang.life/oauth2/openid/hedgedoc/userinfo";
};
environmentFile = config.sops.secrets.hedgedoc_env.path;
};
custom.prometheus = {
enable = true;
exporters.enable = true;
@ -42,7 +27,7 @@ in
fsType = "cifs";
options = ["uid=${share},gid=${share},credentials=${config.sops.secrets.storage_box_mount.path}"];
};
}) [ "forgejo" "gotosocial" "conduit" "hedgedoc" ] );
}) [ "forgejo" "gotosocial" "conduit" ] );
system.activationScripts = {
conduit-media-link.text = ''
@ -159,7 +144,7 @@ in
flush_interval -1
}
'';
virtualHosts."https://git.xinyang.life:443".extraConfig = ''
virtualHosts."git.xinyang.life:443".extraConfig = ''
reverse_proxy http://${config.services.gitea.settings.server.DOMAIN}:${toString config.services.gitea.settings.server.HTTP_PORT}
'';
@ -170,8 +155,8 @@ in
abort
}
'';
virtualHosts."https://auth.xinyang.life".extraConfig = ''
reverse_proxy https://127.0.0.1:${toString kanidm_listen_port} {
virtualHosts."https://auth.xinyang.life:443".extraConfig = ''
reverse_proxy https://auth.xinyang.life:${toString kanidm_listen_port} {
header_up Host {upstream_hostport}
header_down Access-Control-Allow-Origin "*"
transport http {

36
machines/vscode.nix Normal file
View file

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = [
(pkgs.vscode-with-extensions.override {
vscodeExtensions = with pkgs.vscode-extensions; [
arrterian.nix-env-selector
bbenoist.nix
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
vscodevim.vim
github.copilot
github.vscode-pull-request-github
eamodio.gitlens
gruntfuggly.todo-tree # todo highlight
vadimcn.vscode-lldb # debugger
# Language support
ms-python.python
davidanson.vscode-markdownlint
llvm-vs-code-extensions.vscode-clangd
jnoortheen.nix-ide
james-yu.latex-workshop
rust-lang.rust-analyzer
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "remote-ssh-edit";
publisher = "ms-vscode-remote";
version = "0.47.2";
sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g";
}
];
})
];
}

View file

@ -1,31 +0,0 @@
{ config, lib, ... }:
with lib;
let
cfg = config.custom-hm.alacritty;
in
{
options.custom-hm.alacritty = {
enable = mkEnableOption "alacritty";
};
config = mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {
shell = {
program = config.programs.zellij.package + "/bin/zellij";
args = [
"attach"
"-c"
];
};
font.size = 10.0;
window = {
resize_increments = true;
dynamic_padding = true;
};
};
};
};
}

View file

@ -1,12 +1,3 @@
{
imports = [
./alacritty.nix
./direnv.nix
./fish.nix
./git.nix
./tmux.nix
./vim.nix
./vscode.nix
./zellij.nix
];
}

View file

@ -1,18 +0,0 @@
{ config, lib, ... }:
with lib;
let
cfg = config.custom-hm.direnv;
in
{
options.custom-hm.direnv = {
enable = mkEnableOption "direnv";
};
config = {
programs = mkIf config.custom-hm.direnv.enable {
direnv = {
enable = true;
};
};
};
}

View file

@ -1,72 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom-hm.fish;
in
{
options.custom-hm.fish = {
enable = mkEnableOption "fish";
plugins = mkOption {
type = types.listOf types.str;
default = [ "pisces" "done" "hydro" ];
};
functions = {
enable = mkOption {
type = types.bool;
default = true;
};
};
alias = {
enable = mkOption {
type = types.bool;
default = true;
};
};
};
config = {
programs.fish = mkIf cfg.enable {
enable = true;
plugins = with pkgs; filter (
e: hasAttr e.name (builtins.listToAttrs # { "xxx" = true; }
(map (p: { name = p; value = true; }) cfg.plugins) # { name = "xxx"; value = true; }
)) [
{
name = "pisces";
src = fishPlugins.pisces.src;
}
{
name = "done";
src = fishPlugins.done.src;
}
{
name = "hydro";
src = fishPlugins.hydro.src;
}
];
interactiveShellInit = let
extraInit = if cfg.functions.enable then ''
${pkgs.nix-your-shell}/bin/nix-your-shell fish | source
function fish_right_prompt
if test -n "$IN_NIX_SHELL"
echo -n "<nix-shell>"
else if test $SHLVL -ge 3
echo -n "<🚀lv$SHLVL>"
end
end
function fish_command_not_found
${pkgs.comma}/bin/comma $argv
end
'' else "";
in ''
fish_config theme choose 'ayu Dark'
fish_config prompt choose arrow
'' + extraInit;
functions = mkIf cfg.functions.enable {
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
};
};
};
}

View file

@ -1,26 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom-hm.git;
in
{
options.custom-hm.git = {
enable = mkEnableOption "Enable git configuration";
};
config = {
programs.git = {
enable = true;
delta.enable = true;
userName = "Xinyang Li";
userEmail = "lixinyang411@gmail.com";
aliases = {
graph = "log --all --oneline --graph --decorate";
a = "add";
d = "diff";
s = "status";
};
};
};
}

View file

@ -1 +0,0 @@
{}

View file

@ -1,43 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom-hm.neovim;
in
{
options.custom-hm.neovim = {
enable = mkEnableOption "neovim configurations";
};
config = mkIf cfg.enable {
programs.neovim = {
enable = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
catppuccin-nvim
];
extraConfig = ''
set nocompatible
syntax on
set number
set relativenumber
set shortmess+=I
set laststatus=2
set ignorecase
set smartcase
set list
set listchars=tab:·
set tabstop=4
set shiftwidth=4
set expandtab
set mouse+=a
colorscheme catppuccin-macchiato
'';
};
};
}

View file

@ -1,143 +0,0 @@
{ inputs, config, lib, pkgs, ... }:
with lib;
let
cfg = config.custom-hm.vscode;
in
{
options.custom-hm.vscode = {
enable = mkEnableOption "Vscode config";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
pkgs.wl-clipboard-x11
];
programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = true;
extensions = (with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
mkhl.direnv
bbenoist.nix
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
vscodevim.vim
github.vscode-pull-request-github
eamodio.gitlens
gruntfuggly.todo-tree # todo highlight
# Language support
# Python
ms-python.python
# Markdown
davidanson.vscode-markdownlint
# C/C++
ms-vscode.cmake-tools
llvm-vs-code-extensions.vscode-clangd
# Nix
jnoortheen.nix-ide
# Latex
james-yu.latex-workshop
# Vue
vue.volar
# Scale / chisel
scalameta.metals
ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image
]) ++ (with pkgs.vscode-extensions; [
# Rust
rust-lang.rust-analyzer
github.copilot
]);
userSettings = {
"workbench.colorTheme" = "Default Dark+";
"terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"editor.inlineSuggest.enabled" = true;
"editor.rulers" = [
80
];
"editor.mouseWheelZoom" = true;
"git.autofetch" = true;
"window.zoomLevel" = -1;
"nix.enableLanguageServer" = true;
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{
"name" = "xelatex";
"command" = "xelatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"-pdf"
"%DOCFILE%"
];
}
{
"name" = "pdflatex";
"command" = "pdflatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
{
"name" = "bibtex";
"command" = "bibtex";
"args" = [
"%DOCFILE%"
];
}
];
"latex-workshop.latex.recipes" = [
{
"name" = "xelatex";
"tools" = [
"xelatex"
];
}
{
"name" = "pdflatex";
"tools" = [
"pdflatex"
];
}
{
"name" = "xe->bib->xe->xe";
"tools" = [
"xelatex"
"bibtex"
"xelatex"
"xelatex"
];
}
{
"name" = "pdf->bib->pdf->pdf";
"tools" = [
"pdflatex"
"bibtex"
"pdflatex"
"pdflatex"
];
}
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
};
};
};
};
}

View file

@ -1,40 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom-hm.zellij;
in
{
options.custom-hm.zellij = {
enable = mkEnableOption "zellij configurations";
};
config = {
programs.zellij = mkIf cfg.enable {
enable = true;
settings = {
default_shell = "fish";
keybinds = {
unbind = [
"Ctrl p"
"Ctrl n"
];
};
theme = "catppuccin-macchiato";
themes.dracula = {
fg = [ 248 248 242 ];
bg = [ 40 42 54 ];
black = [ 0 0 0 ];
red = [ 255 85 85 ];
green = [ 80 250 123 ];
yellow = [ 241 250 140 ];
blue = [ 98 114 164 ];
magenta = [ 255 121 198 ];
cyan = [ 139 233 253 ];
white = [ 255 255 255 ];
orange = [ 255 184 108 ];
};
};
};
};
}

View file

@ -4,6 +4,5 @@
./restic.nix
./vaultwarden.nix
./prometheus.nix
./hedgedoc.nix
];
}

View file

@ -1,83 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom.hedgedoc;
in
{
options = {
custom.hedgedoc = {
enable = mkEnableOption "HedgeDoc Markdown Editor";
domain = mkOption {
type = types.str;
default = "docs.example.com";
description = "Domain name of the HedgeDoc server";
};
caddy = mkOption {
type = types.bool;
default = true;
description = "Enable Caddy as reverse proxy";
};
mediaPath = mkOption {
type = types.path;
default = /var/lib/hedgedoc/uploads;
description = "Directory for storing medias";
};
oidc = {
enable = mkEnableOption "OIDC support for HedgeDoc";
baseURL = mkOption {
type = types.str;
};
authorizationURL = mkOption {
type = types.str;
};
tokenURL = mkOption {
type = types.str;
};
userProfileURL = mkOption {
type = types.str;
};
};
environmentFile = mkOption {
type = types.path;
};
};
};
config = {
services.hedgedoc = mkIf cfg.enable {
enable = true;
environmentFile = cfg.environmentFile;
settings = {
domain = cfg.domain;
protocolUseSSL = cfg.caddy;
uploadsPath = cfg.mediaPath;
path = "/run/hedgedoc/hedgedoc.sock";
email = false;
allowEmailRegister = false;
oauth2 = mkIf cfg.oidc.enable {
baseURL = cfg.oidc.baseURL;
authorizationURL = cfg.oidc.authorizationURL;
tokenURL = cfg.oidc.tokenURL;
userProfileURL = cfg.oidc.userProfileURL;
userProfileEmailAttr = "email";
userProfileUsernameAttr = "name";
userProfileDisplayNameAttr = "preferred_name";
scope = "openid email profile";
clientID = "$HEDGEDOC_CLIENT_ID";
clientSecret = "$HEDGEDOC_CLIENT_SECRET";
};
allowAnonymous = false;
defaultPermission = "private";
};
};
services.caddy = mkIf ( cfg.enable && cfg.enable ) {
enable = true;
virtualHosts."https://${cfg.domain}".extraConfig = ''
reverse_proxy unix/${config.services.hedgedoc.settings.path}
'';
};
users.users.caddy.extraGroups = mkIf ( cfg.enable && cfg.enable ) [ "hedgedoc" ];
};
}