Compare commits

...

4 commits

Author SHA1 Message Date
038913d3b5 home-manager: modularize home configurations 2023-12-24 19:21:07 +08:00
ac9918c759 wip: modularize home-manager 2023-12-24 13:59:50 +08:00
8b735dd5da massicot: host hedgedoc with oidc 2023-12-24 13:59:06 +08:00
b944954b3c calcite: remove win drive from fstab
- Remove ntfs drive from fstab as it will cause systemd enter emergency
  mode if corrupted.
- TODO: use autofs to mount the ntfs drive, or add extra options to
  ignore failed ntfs drive.
2023-12-24 13:55:56 +08:00
29 changed files with 554 additions and 337 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

2
.gitignore vendored
View file

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

View file

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

5
home/default.nix Normal file
View file

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

View file

@ -1,19 +0,0 @@
{ 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,10 +1,7 @@
{ inputs, config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [
../common ./common
../vscode.nix
../alacritty.nix
inputs.nix-index-database.hmModules.nix-index
]; ];
programs.nix-index-database.comma.enable = true; programs.nix-index-database.comma.enable = true;
@ -34,4 +31,14 @@
thunderbird thunderbird
remmina 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,10 +1,5 @@
{ pkgs, ... }: { { inputs, pkgs, ... }: {
imports = [ imports = [ ];
./fish.nix
./git.nix
./zellij.nix
./vim.nix
];
home.packages = with pkgs; [ home.packages = with pkgs; [
dig dig

View file

@ -1,37 +0,0 @@
{ 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";
};
};
}

View file

@ -1,13 +0,0 @@
{
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";
};
};
}

View file

@ -1,32 +0,0 @@
{ 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

@ -1,28 +0,0 @@
{
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 ];
};
};
};
}

View file

@ -1,133 +0,0 @@
{ 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,10 +158,6 @@
clang-tools clang-tools
rnix-lsp rnix-lsp
# C/C++
gcc
gdb
# Python # Python
# reference: https://nixos.wiki/wiki/Python # reference: https://nixos.wiki/wiki/Python
( (
@ -193,7 +189,6 @@
gnomeExtensions.paperwm gnomeExtensions.paperwm
gnomeExtensions.search-light gnomeExtensions.search-light
gnomeExtensions.tray-icons-reloaded gnomeExtensions.tray-icons-reloaded
gnomeExtensions.gsconnect
gnome.gnome-tweaks gnome.gnome-tweaks
gthumb gthumb

View file

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

View file

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

View file

@ -1,5 +1,6 @@
storage_box_mount: ENC[AES256_GCM,data:9lOAL3tkfB0pN4/cuM4SX0xoMrW0UUEzTN8spw3MQ3BWrfsRc3Stsce3puXz1sRf,iv:7Q9wzpBgQ3tqcfy0n/c6Ya84Kg60nhR/e2H0pVntWsY=,tag:9a0xvNBGQpCvhxgmV3hrww==,type:str] 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] 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: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -24,8 +25,8 @@ sops:
dnFBa0lDWWZtS1BHdzBoVzNTaGNkSEEKi/W1n7RT8NpTp00SBMwxsUJAPDhumJ/i dnFBa0lDWWZtS1BHdzBoVzNTaGNkSEEKi/W1n7RT8NpTp00SBMwxsUJAPDhumJ/i
V2VnaSNwouD3SswTcoBzqQpBP9XrqzjIYGke90ZODFQbMY9WDQ+O0g== V2VnaSNwouD3SswTcoBzqQpBP9XrqzjIYGke90ZODFQbMY9WDQ+O0g==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2023-12-15T13:06:05Z" lastmodified: "2023-12-22T08:05:27Z"
mac: ENC[AES256_GCM,data:ArxA3+i+W2hU0mpzjPqzBA1pQdZySwJ+LVAez2PWFMsrgT4QATi+KmlWWfuPBkOq/DYafAES8lTemDeuzuQl7bWZq06g3s35C8Q3D/TDUKFF3ALEL5grSxKTVzg4Npjc2q2OIOXrIp/j83Gn1lBuyBFg0YdGkJ+b/BmDGkTbyUg=,iv:8MB/+WklLsFTnlvxLyvCK8VUMNeXtaPTGXlp9hRGzOM=,tag:VbbnQfPewNGdrPqmZJSYlA==,type:str] mac: ENC[AES256_GCM,data:CiXU49arW+3w4/Lkh4l+6VjopyP7XNCU4AmuwZmnmQ7Vv4RCt84fC6lM6o4HiCc5jB07QY+2WZ5LvWz9zgSt636UpnCMgbG1w2Lxae38fW02RHJv90rn+cyyddB5kSucr5/P5NKBOZut54Cf4zVW9BaqajpQMxe4hEOn+xXpXz8=,iv:beWRlUvb6OUOK+mUXdvpvmM8S7xK0QIkIA2Bk9QA35c=,tag:KrBXqsAdBAhtwygdEHnUqQ==,type:str]
pgp: [] pgp: []
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.8.1 version: 3.8.1

View file

@ -11,6 +11,21 @@ in
domain = "vaultwarden.xinyang.life"; 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 = { custom.prometheus = {
enable = true; enable = true;
exporters.enable = true; exporters.enable = true;
@ -27,7 +42,7 @@ in
fsType = "cifs"; fsType = "cifs";
options = ["uid=${share},gid=${share},credentials=${config.sops.secrets.storage_box_mount.path}"]; options = ["uid=${share},gid=${share},credentials=${config.sops.secrets.storage_box_mount.path}"];
}; };
}) [ "forgejo" "gotosocial" "conduit" ] ); }) [ "forgejo" "gotosocial" "conduit" "hedgedoc" ] );
system.activationScripts = { system.activationScripts = {
conduit-media-link.text = '' conduit-media-link.text = ''
@ -144,7 +159,7 @@ in
flush_interval -1 flush_interval -1
} }
''; '';
virtualHosts."git.xinyang.life:443".extraConfig = '' virtualHosts."https://git.xinyang.life:443".extraConfig = ''
reverse_proxy http://${config.services.gitea.settings.server.DOMAIN}:${toString config.services.gitea.settings.server.HTTP_PORT} reverse_proxy http://${config.services.gitea.settings.server.DOMAIN}:${toString config.services.gitea.settings.server.HTTP_PORT}
''; '';
@ -155,8 +170,8 @@ in
abort abort
} }
''; '';
virtualHosts."https://auth.xinyang.life:443".extraConfig = '' virtualHosts."https://auth.xinyang.life".extraConfig = ''
reverse_proxy https://auth.xinyang.life:${toString kanidm_listen_port} { reverse_proxy https://127.0.0.1:${toString kanidm_listen_port} {
header_up Host {upstream_hostport} header_up Host {upstream_hostport}
header_down Access-Control-Allow-Origin "*" header_down Access-Control-Allow-Origin "*"
transport http { transport http {

View file

@ -1,36 +0,0 @@
{ 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

@ -0,0 +1,31 @@
{ 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,3 +1,12 @@
{ {
imports = [
./alacritty.nix
./direnv.nix
./fish.nix
./git.nix
./tmux.nix
./vim.nix
./vscode.nix
./zellij.nix
];
} }

View file

@ -0,0 +1,18 @@
{ 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

@ -0,0 +1,72 @@
{ 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

@ -0,0 +1,26 @@
{ 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

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,43 @@
{ 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

@ -0,0 +1,143 @@
{ 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

@ -0,0 +1,40 @@
{ 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,5 +4,6 @@
./restic.nix ./restic.nix
./vaultwarden.nix ./vaultwarden.nix
./prometheus.nix ./prometheus.nix
./hedgedoc.nix
]; ];
} }

View file

@ -0,0 +1,83 @@
{ 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" ];
};
}