Compare commits
32 commits
050dd8660e
...
1f7294581f
Author | SHA1 | Date | |
---|---|---|---|
|
1f7294581f | ||
|
75f8ce74c5 | ||
|
75b3f8d1f4 | ||
|
89ca51d7e2 | ||
|
139af8729f | ||
|
12dcbcb3f6 | ||
|
2a2cbc295f | ||
|
32e5d3a3a5 | ||
|
8a19a3d900 | ||
|
8e886fd13b | ||
|
d160c48ba2 | ||
|
599434e43d | ||
|
23e731a2ac | ||
|
eb16655d2a | ||
|
fe98578843 | ||
|
54a41c5273 | ||
|
d80b12e7a9 | ||
|
689a6b061e | ||
|
43a33c2313 | ||
|
ec187e65c0 | ||
|
4afc60bd6a | ||
|
32b4df7c28 | ||
|
82cefd68e0 | ||
|
2cb0cb736c | ||
|
baa3d1cd0d | ||
|
cd4a9807cb | ||
|
f98b48a5e3 | ||
|
fc57e77340 | ||
|
dc49540f8d | ||
|
c36f5f66b1 | ||
|
8702656b24 | ||
|
02ea7e95b7 |
56
flake.lock
56
flake.lock
|
@ -232,18 +232,18 @@
|
|||
"nixpkgs": "nixpkgs_7"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728598146,
|
||||
"narHash": "sha256-8zAvVSR3chBSJ7YKW+MYC1mrDxtZDFBPVobfO4KPXzg=",
|
||||
"lastModified": 1731494335,
|
||||
"narHash": "sha256-G1G2WRGgIOFNmlJglfqEupSg0VWHgODbBJzp5xo+cYY=",
|
||||
"ref": "dtth-fork",
|
||||
"rev": "fc6bd96aef92d7796d9c7663ac23e3fa837f8ddb",
|
||||
"revCount": 3218,
|
||||
"rev": "c414bb78f27b20df4463c36a5851c94cfe9c79b0",
|
||||
"revCount": 3367,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.dtth.ch/nki/phanpy"
|
||||
"url": "ssh://gitea@git.dtth.ch/nki-dtth/phanpy"
|
||||
},
|
||||
"original": {
|
||||
"ref": "dtth-fork",
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.dtth.ch/nki/phanpy"
|
||||
"url": "ssh://gitea@git.dtth.ch/nki-dtth/phanpy"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
|
@ -742,11 +742,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728337164,
|
||||
"narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=",
|
||||
"lastModified": 1731887066,
|
||||
"narHash": "sha256-uw7K/RsYioJicV79Nl39yjtfhdfTDU2aRxnBgvFhkZ8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "038630363e7de57c36c417fd2f5d7c14773403e4",
|
||||
"rev": "f3a2ff69586f3a54b461526e5702b1a2f81e740a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -817,15 +817,15 @@
|
|||
"lix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1723503926,
|
||||
"narHash": "sha256-Rosl9iA9MybF5Bud4BTAQ9adbY81aGmPfV8dDBGl34s=",
|
||||
"rev": "bcaeb6388b8916ac6d1736e3aa2b13313e6a6bd2",
|
||||
"lastModified": 1729298361,
|
||||
"narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=",
|
||||
"rev": "ad9d06f7838a25beec425ff406fe68721fef73be",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/bcaeb6388b8916ac6d1736e3aa2b13313e6a6bd2.tar.gz"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz?rev=ad9d06f7838a25beec425ff406fe68721fef73be"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/lix/archive/2.91.0.tar.gz"
|
||||
"url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz"
|
||||
}
|
||||
},
|
||||
"lix-module": {
|
||||
|
@ -838,15 +838,15 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723510904,
|
||||
"narHash": "sha256-zNW/rqNJwhq2lYmQf19wJerRuNimjhxHKmzrWWFJYts=",
|
||||
"rev": "622a2253a071a1fb97a4d3c8103a91114acc1140",
|
||||
"lastModified": 1729360442,
|
||||
"narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=",
|
||||
"rev": "9098ac95768f7006d7e070b88bae76939f6034e6",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/622a2253a071a1fb97a4d3c8103a91114acc1140.tar.gz"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz?rev=9098ac95768f7006d7e070b88bae76939f6034e6"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz"
|
||||
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz"
|
||||
}
|
||||
},
|
||||
"mpd-mpris": {
|
||||
|
@ -1022,11 +1022,11 @@
|
|||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1728409405,
|
||||
"narHash": "sha256-kk530XBUGDpt0DQbyUb3yDpSddPqF9PA5KTo/nsmmg0=",
|
||||
"lastModified": 1731890469,
|
||||
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1366d1af8f58325602280e43ed6233849fb92216",
|
||||
"rev": "5083ec887760adfe12af64830a66807423a859a7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1166,11 +1166,11 @@
|
|||
},
|
||||
"nixpkgs_9": {
|
||||
"locked": {
|
||||
"lastModified": 1726838390,
|
||||
"narHash": "sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM=",
|
||||
"lastModified": 1731239293,
|
||||
"narHash": "sha256-q2yjIWFFcTzp5REWQUOU9L6kHdCDmFDpqeix86SOvDc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "944b2aea7f0a2d7c79f72468106bc5510cbf5101",
|
||||
"rev": "9256f7c71a195ebe7a218043d9f93390d49e6884",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1549,11 +1549,11 @@
|
|||
"rust-overlay": "rust-overlay_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728746553,
|
||||
"narHash": "sha256-BlZpmTt6wyMIpJvd5nEWGgqJQbtjVTzBlYYQVShZ7Io=",
|
||||
"lastModified": 1731934405,
|
||||
"narHash": "sha256-5lRtAsJjjc9BkTbpuhjgMgDpXKYkYcGDydh+xJzDVyU=",
|
||||
"owner": "natsukagami",
|
||||
"repo": "youmubot",
|
||||
"rev": "c5354e30ad40f67938deed1deb5ea92bb168a586",
|
||||
"rev": "a4fab5438bebd9c399f628151958789c7f2454a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
};
|
||||
arion.url = github:hercules-ci/arion;
|
||||
lix-module = {
|
||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";
|
||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
url = github:natsukagami/mpd-mpris;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
dtth-phanpy.url = "git+ssh://gitea@git.dtth.ch/nki/phanpy?ref=dtth-fork";
|
||||
dtth-phanpy.url = "git+ssh://gitea@git.dtth.ch/nki-dtth/phanpy?ref=dtth-fork";
|
||||
conduit.url = "gitlab:famedly/conduit/v0.9.0";
|
||||
nix-gaming.url = github:fufexan/nix-gaming;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ in
|
|||
systemd.user.startServices = "sd-switch";
|
||||
|
||||
# Audio stuff!
|
||||
services.easyeffects.enable = true;
|
||||
# services.easyeffects.enable = true;
|
||||
|
||||
# Bluetooth controls
|
||||
# services.mpris-proxy.enable = true;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
./kakoune/kak.nix
|
||||
./kakoune.nix
|
||||
./fish/fish.nix
|
||||
./modules/programs/my-broot.nix
|
||||
./modules/programs/my-sway
|
||||
|
@ -14,8 +14,9 @@
|
|||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Enable the manual so we don't have to load it
|
||||
manual.html.enable = true;
|
||||
# Temporarily disable the manuals
|
||||
manual.html.enable = false;
|
||||
# manual.manpage.enable = false;
|
||||
|
||||
# Packages that are not in programs section
|
||||
home.packages = with pkgs; [
|
||||
|
|
|
@ -37,7 +37,12 @@
|
|||
# Enable X11 configuration
|
||||
linux.graphical.type = "wayland";
|
||||
linux.graphical.wallpaper = ./images/pixiv_18776904.png;
|
||||
linux.graphical.defaults.webBrowser = "librewolf.desktop";
|
||||
linux.graphical.startup = with pkgs; [
|
||||
zen-browser-bin
|
||||
thunderbird
|
||||
vesktop
|
||||
];
|
||||
linux.graphical.defaults.webBrowser = "zen.desktop";
|
||||
programs.my-sway.enable = true;
|
||||
programs.my-sway.fontSize = 15.0;
|
||||
programs.my-sway.enableLaptopBars = false;
|
||||
|
|
143
home/kakoune.nix
Normal file
143
home/kakoune.nix
Normal file
|
@ -0,0 +1,143 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
|
||||
in
|
||||
{
|
||||
imports = [ ./modules/programs/my-kakoune ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# ctags for peneira
|
||||
universal-ctags
|
||||
# tree-sitter for kak
|
||||
kak-tree-sitter
|
||||
];
|
||||
|
||||
# xdg.configFile."kak-tree-sitter/config.toml".source = ./kak-tree-sitter.toml;
|
||||
|
||||
# Enable the kakoune package.
|
||||
programs.my-kakoune.enable = true;
|
||||
programs.my-kakoune.enable-fish-session = true;
|
||||
|
||||
programs.my-kakoune.tree-sitter.extraAliases = {
|
||||
# Scala stuff
|
||||
method = "function";
|
||||
module = "namespace";
|
||||
function_call = "function";
|
||||
method_call = "method";
|
||||
|
||||
boolean = "constant_builtin_boolean";
|
||||
number = "constant_numeric";
|
||||
float = "constant_numeric_float";
|
||||
|
||||
type_qualifier = "keyword_special";
|
||||
storageclass = "keyword_storage_modifier";
|
||||
conditional = "keyword_conditional";
|
||||
include = "keyword_control_import";
|
||||
};
|
||||
programs.my-kakoune.tree-sitter.languages =
|
||||
let
|
||||
tree-sitter-go = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-go";
|
||||
rev = "v0.20.0";
|
||||
hash = "sha256-G7d8CHCyKDAb9j6ijRfHk/HlgPqSI+uvkuRIRRvjkHI=";
|
||||
};
|
||||
in
|
||||
{
|
||||
scala =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-scala";
|
||||
rev = "70afdd5632d57dd63a960972ab25945e353a52f6";
|
||||
hash = "sha256-bi0Lqo/Zs2Uaz1efuKAARpEDg5Hm59oUe7eSXgL1Wow=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
queries.src = src;
|
||||
queries.path = "queries/scala";
|
||||
};
|
||||
haskell =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-haskell";
|
||||
rev = "ba0bfb0e5d8e9e31c160d287878c6f26add3ec08";
|
||||
hash = "sha256-ZSOF0CLOn82GwU3xgvFefmh/AD2j5zz8I0t5YPwfan0=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "../scanner.c" "../unicode.h" "-I" ".." ];
|
||||
queries.src = src;
|
||||
queries.path = "queries";
|
||||
};
|
||||
yaml = {
|
||||
grammar.src = pkgs.fetchFromGitHub {
|
||||
owner = "ikatyang";
|
||||
repo = "tree-sitter-yaml";
|
||||
rev = "0e36bed171768908f331ff7dff9d956bae016efb";
|
||||
hash = "sha256-bpiT3FraOZhJaoiFWAoVJX1O+plnIi8aXOW2LwyU23M=";
|
||||
};
|
||||
grammar.compile.args = [ "-c" "-fpic" "../scanner.cc" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "scanner.o" "parser.o" ];
|
||||
grammar.link.flags = [ "-O3" "-lstdc++" ];
|
||||
|
||||
queries.src = pkgs.fetchFromGitHub {
|
||||
owner = "helix-editor";
|
||||
repo = "helix";
|
||||
rev = "dbd248fdfa680373d94fbc10094a160aafa0f7a7";
|
||||
hash = "sha256-wk8qVUDFXhAOi1Ibc6iBMzDCXb6t+YiWZcTd0IJybqc=";
|
||||
};
|
||||
queries.path = "runtime/queries/yaml";
|
||||
};
|
||||
|
||||
templ =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "vrischmann";
|
||||
repo = "tree-sitter-templ";
|
||||
rev = "4519e3ec9ca92754ca25659bb1fd410d5e0f8d88";
|
||||
hash = "sha256-ic5SlqDEZoYakrJFe0H9GdzravqovlL5sTaHjyhe74M=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
queries.src = pkgs.runCommandLocal "templ-tree-sitter-queries" { } ''
|
||||
mkdir -p $out/queries
|
||||
# copy most stuff from tree-sitter-templ
|
||||
install -m644 ${src}/queries/templ/* $out/queries
|
||||
# override inherited files
|
||||
cat ${tree-sitter-go}/queries/highlights.scm ${src}/queries/templ/highlights.scm > $out/queries/highlights.scm
|
||||
'';
|
||||
queries.path = "queries";
|
||||
};
|
||||
|
||||
go = {
|
||||
grammar.src = tree-sitter-go;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
|
||||
queries.src = tree-sitter-go;
|
||||
queries.path = "queries";
|
||||
};
|
||||
|
||||
hylo =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "tree-sitter-hylo";
|
||||
rev = "494cbdff0d13cbc67348316af2efa0286dbddf6f";
|
||||
hash = "sha256-R5UeoglCTl0do3VDJ/liCTeqbxU9slvmVKNRA/el2VY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
|
||||
queries.src = src;
|
||||
queries.path = "queries";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,515 +0,0 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
kak-lsp-frontend = { pkgs, lib, ... }:
|
||||
let
|
||||
langserver = name: {
|
||||
name = "vscode-${name}-language-server";
|
||||
value = {
|
||||
args = [ "--stdio" ];
|
||||
command = "vscode-${name}-language-server";
|
||||
filetypes = [ name ];
|
||||
roots = [ "package.json" ".git" ];
|
||||
};
|
||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
||||
};
|
||||
|
||||
tailwind = {
|
||||
command = "tailwindcss-language-server";
|
||||
args = [ "--stdio" ];
|
||||
filetypes = [ "html" "css" "javascript" "typescript" "templ" ];
|
||||
roots = [ "tailwind.config.{js,cjs,mjs,ts}" "package.json" ".git" ];
|
||||
settings_section = "tailwindCSS";
|
||||
settings.tailwindCSS = {
|
||||
validate = "warning";
|
||||
userLanguages.templ = "html";
|
||||
};
|
||||
package = pkgs.tailwindcss-language-server;
|
||||
};
|
||||
|
||||
templModule = { pkgs, lib, ... }: {
|
||||
programs.kak-lsp.languageServers."vscode-html-language-server".filetypes = [ "templ" ];
|
||||
programs.kak-lsp.languageServers."tailwindcss-language-server".filetypes = [ "templ" ];
|
||||
programs.kak-lsp.languageServers.templ = {
|
||||
command = "templ";
|
||||
args = [ "lsp" ];
|
||||
filetypes = [ "templ" ];
|
||||
roots = [ "go.mod" ".git" ];
|
||||
package = pkgs.unstable.templ;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
imports = [ templModule ];
|
||||
|
||||
programs.kak-lsp.languageServers = (builtins.listToAttrs (map langserver [ "html" "css" "json" ])) // {
|
||||
tailwindcss-language-server = tailwind;
|
||||
};
|
||||
};
|
||||
|
||||
ltexLsp = { pkgs, lib, ... }: {
|
||||
programs.kak-lsp.languageServers.ltex-ls = {
|
||||
command = "ltex-ls";
|
||||
args = [ "--log-file=/tmp" ];
|
||||
filetypes = [ "latex" "typst" ];
|
||||
roots = [ "main.tex" "main.typ" ".git" ];
|
||||
package = pkgs.ltex-ls;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
imports = [ ../modules/programs/my-kakoune ./kaktex.nix kak-lsp-frontend ltexLsp ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# ctags for peneira
|
||||
universal-ctags
|
||||
# tree-sitter for kak
|
||||
kak-tree-sitter
|
||||
];
|
||||
|
||||
# xdg.configFile."kak-tree-sitter/config.toml".source = ./kak-tree-sitter.toml;
|
||||
|
||||
# Enable the kakoune package.
|
||||
programs.my-kakoune.enable = true;
|
||||
programs.my-kakoune.enable-fish-session = true;
|
||||
programs.kak-lsp.enable = true;
|
||||
programs.kak-lsp.semanticTokens.additionalFaces = [
|
||||
# Typst
|
||||
{ face = "header"; token = "heading"; }
|
||||
{ face = "ts_markup_link_url"; token = "link"; }
|
||||
{ face = "ts_markup_link_uri"; token = "ref"; }
|
||||
{ face = "ts_markup_link_label"; token = "label"; }
|
||||
{ face = "ts_property"; token = "pol"; }
|
||||
{ face = "ts_markup_list_checked"; token = "marker"; }
|
||||
{ face = "ts_constant_builtin_boolean"; token = "bool"; }
|
||||
{ face = "ts_keyword_control"; token = "delim"; }
|
||||
{ face = "ts_number"; token = "text"; modifiers = [ "math" ]; }
|
||||
{ face = "ts_markup_bold"; token = "text"; modifiers = [ "strong" ]; }
|
||||
{ face = "ts_markup_italic"; token = "text"; modifiers = [ "emph" ]; }
|
||||
];
|
||||
|
||||
programs.kak-lsp.languageServers.elixir-ls = {
|
||||
args = [ ];
|
||||
command = "elixir-ls";
|
||||
filetypes = [ "elixir" ];
|
||||
roots = [ "mix.exs" ];
|
||||
};
|
||||
programs.kak-lsp.languageServers.typescript-language-server = {
|
||||
args = [ "--stdio" ];
|
||||
command = "typescript-language-server";
|
||||
filetypes = [ "typescript" "javascript" ];
|
||||
roots = [ "package.json" ];
|
||||
package = pkgs.nodePackages.typescript-language-server;
|
||||
};
|
||||
programs.kak-lsp.languageServers.fsautocomplete = {
|
||||
args = [ "--adaptive-lsp-server-enabled" "--project-graph-enabled" "--source-text-factory" "RoslynSourceText" ];
|
||||
command = "fsautocomplete";
|
||||
filetypes = [ "fsharp" ];
|
||||
roots = [ "*.fsproj" ];
|
||||
settings_section = "FSharp";
|
||||
settings.FSharp = {
|
||||
AutomaticWorkspaceInit = true;
|
||||
};
|
||||
};
|
||||
programs.kak-lsp.languageServers.metals = {
|
||||
command = "metals";
|
||||
filetypes = [ "scala" ];
|
||||
roots = [ "build.sbt" "build.sc" ];
|
||||
settings_section = "metals";
|
||||
settings.metals = {
|
||||
enableSemanticHighlighting = true;
|
||||
showInferredType = true;
|
||||
decorationProvider = true;
|
||||
inlineDecorationProvider = true;
|
||||
# From kakoune-lsp's own options
|
||||
icons = "unicode";
|
||||
isHttpEnabled = true;
|
||||
statusBarProvider = "log-message";
|
||||
compilerOptions = { overrideDefFormat = "unicode"; };
|
||||
};
|
||||
package = pkgs.metals;
|
||||
};
|
||||
programs.kak-lsp.languageServers.texlab = {
|
||||
command = "texlab";
|
||||
filetypes = [ "latex" ];
|
||||
roots = [ "main.tex" "all.tex" ".git" ];
|
||||
settings_section = "texlab";
|
||||
settings.texlab = {
|
||||
build.executable = "latexmk";
|
||||
build.args = [ "-pdf" "-shell-escape" "-interaction=nonstopmode" "-synctex=1" "%f" ];
|
||||
|
||||
build.forwardSearchAfter = true;
|
||||
build.onSave = true;
|
||||
|
||||
forwardSearch =
|
||||
(if pkgs.stdenv.isDarwin then {
|
||||
executable = "/Applications/Skim.app/Contents/SharedSupport/displayline";
|
||||
args = [ "-r" "-g" "%l" "%p" "%f" ];
|
||||
} else
|
||||
{
|
||||
executable = "${pkgs.zathura}/bin/zathura";
|
||||
args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "${./kaktex} jump %%{input} %%{line} %%{column}" ];
|
||||
});
|
||||
};
|
||||
package = pkgs.texlab;
|
||||
};
|
||||
programs.kak-lsp.languageServers.typst-lsp = {
|
||||
command = "typst-lsp";
|
||||
filetypes = [ "typst" ];
|
||||
roots = [ "main.typ" ".git" ];
|
||||
settings_section = "typst-lsp";
|
||||
settings.typst-lsp = {
|
||||
experimentalFormatterMode = "on";
|
||||
};
|
||||
};
|
||||
programs.kak-lsp.languageServers.marksman = {
|
||||
command = "marksman";
|
||||
filetypes = [ "markdown" ];
|
||||
roots = [ ".marksman.toml" ".git" ];
|
||||
package = pkgs.marksman;
|
||||
};
|
||||
programs.kak-lsp.languageServers.rust-analyzer = {
|
||||
args = [ ];
|
||||
command = "rust-analyzer";
|
||||
filetypes = [ "rust" ];
|
||||
roots = [ "Cargo.toml" ];
|
||||
package = pkgs.rust-analyzer;
|
||||
};
|
||||
|
||||
programs.my-kakoune.tree-sitter.extraAliases = {
|
||||
# Scala stuff
|
||||
method = "function";
|
||||
module = "namespace";
|
||||
function_call = "function";
|
||||
method_call = "method";
|
||||
|
||||
boolean = "constant_builtin_boolean";
|
||||
number = "constant_numeric";
|
||||
float = "constant_numeric_float";
|
||||
|
||||
type_qualifier = "keyword_special";
|
||||
storageclass = "keyword_storage_modifier";
|
||||
conditional = "keyword_conditional";
|
||||
include = "keyword_control_import";
|
||||
};
|
||||
programs.my-kakoune.tree-sitter.languages =
|
||||
let
|
||||
tree-sitter-go = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-go";
|
||||
rev = "v0.20.0";
|
||||
hash = "sha256-G7d8CHCyKDAb9j6ijRfHk/HlgPqSI+uvkuRIRRvjkHI=";
|
||||
};
|
||||
in
|
||||
{
|
||||
scala =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-scala";
|
||||
rev = "70afdd5632d57dd63a960972ab25945e353a52f6";
|
||||
hash = "sha256-bi0Lqo/Zs2Uaz1efuKAARpEDg5Hm59oUe7eSXgL1Wow=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
queries.src = src;
|
||||
queries.path = "queries/scala";
|
||||
};
|
||||
haskell =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "tree-sitter";
|
||||
repo = "tree-sitter-haskell";
|
||||
rev = "ba0bfb0e5d8e9e31c160d287878c6f26add3ec08";
|
||||
hash = "sha256-ZSOF0CLOn82GwU3xgvFefmh/AD2j5zz8I0t5YPwfan0=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "../scanner.c" "../unicode.h" "-I" ".." ];
|
||||
queries.src = src;
|
||||
queries.path = "queries";
|
||||
};
|
||||
yaml = {
|
||||
grammar.src = pkgs.fetchFromGitHub {
|
||||
owner = "ikatyang";
|
||||
repo = "tree-sitter-yaml";
|
||||
rev = "0e36bed171768908f331ff7dff9d956bae016efb";
|
||||
hash = "sha256-bpiT3FraOZhJaoiFWAoVJX1O+plnIi8aXOW2LwyU23M=";
|
||||
};
|
||||
grammar.compile.args = [ "-c" "-fpic" "../scanner.cc" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "scanner.o" "parser.o" ];
|
||||
grammar.link.flags = [ "-O3" "-lstdc++" ];
|
||||
|
||||
queries.src = pkgs.fetchFromGitHub {
|
||||
owner = "helix-editor";
|
||||
repo = "helix";
|
||||
rev = "dbd248fdfa680373d94fbc10094a160aafa0f7a7";
|
||||
hash = "sha256-wk8qVUDFXhAOi1Ibc6iBMzDCXb6t+YiWZcTd0IJybqc=";
|
||||
};
|
||||
queries.path = "runtime/queries/yaml";
|
||||
};
|
||||
|
||||
templ =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "vrischmann";
|
||||
repo = "tree-sitter-templ";
|
||||
rev = "044ad200092170727650fa6d368df66a8da98f9d";
|
||||
hash = "sha256-hJuB3h5pp+LLfP0/7bAYH0uLVo+OQk5jpzJb3J9BNkY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
queries.src = pkgs.runCommandLocal "templ-tree-sitter-queries" { } ''
|
||||
mkdir -p $out/queries
|
||||
# copy most stuff from tree-sitter-templ
|
||||
install -m644 ${src}/queries/templ/* $out/queries
|
||||
# override inherited files
|
||||
cat ${tree-sitter-go}/queries/highlights.scm ${src}/queries/templ/highlights.scm > $out/queries/highlights.scm
|
||||
'';
|
||||
queries.path = "queries";
|
||||
};
|
||||
|
||||
go = {
|
||||
grammar.src = tree-sitter-go;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
|
||||
queries.src = tree-sitter-go;
|
||||
queries.path = "queries";
|
||||
};
|
||||
|
||||
hylo =
|
||||
let
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "tree-sitter-hylo";
|
||||
rev = "494cbdff0d13cbc67348316af2efa0286dbddf6f";
|
||||
hash = "sha256-R5UeoglCTl0do3VDJ/liCTeqbxU9slvmVKNRA/el2VY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
grammar.src = src;
|
||||
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
|
||||
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
|
||||
queries.src = src;
|
||||
queries.path = "queries";
|
||||
};
|
||||
};
|
||||
|
||||
programs.my-kakoune.package = pkgs.kakoune;
|
||||
programs.my-kakoune.rc =
|
||||
builtins.readFile ./kakrc + ''
|
||||
|
||||
# Source any settings in the current working directory,
|
||||
# recursive upwards
|
||||
evaluate-commands %sh{
|
||||
${pkgs.writeScript "source-pwd" (builtins.readFile ./source-pwd)}
|
||||
}
|
||||
'';
|
||||
|
||||
programs.my-kakoune.extraFaces = {
|
||||
Default = "%opt{text},%opt{base}";
|
||||
BufferPadding = "%opt{base},%opt{base}";
|
||||
MenuForeground = "%opt{blue},white+bF";
|
||||
MenuBackground = "%opt{sky},white+F";
|
||||
Information = "%opt{sky},white";
|
||||
# Markdown help color scheme
|
||||
InfoDefault = "Information";
|
||||
InfoBlock = "@block";
|
||||
InfoBlockQuote = "+i@block";
|
||||
InfoBullet = "@bullet";
|
||||
InfoHeader = "@header";
|
||||
InfoLink = "@link";
|
||||
InfoLinkMono = "+b@mono";
|
||||
InfoMono = "@mono";
|
||||
InfoRule = "+b@Information";
|
||||
InfoDiagnosticError = "@DiagnosticError";
|
||||
InfoDiagnosticHint = "@DiagnosticHint";
|
||||
InfoDiagnosticInformation = "@Information";
|
||||
InfoDiagnosticWarning = "@DiagnosticWarning";
|
||||
# Extra faces
|
||||
macro = "+u@function";
|
||||
method = "@function";
|
||||
format_specifier = "+i@string";
|
||||
mutable_variable = "+i@variable";
|
||||
class = "+b@variable";
|
||||
};
|
||||
programs.my-kakoune.autoload = [
|
||||
# My own scripts
|
||||
{
|
||||
name = "latex.kak";
|
||||
src = ./autoload/latex.kak;
|
||||
}
|
||||
{
|
||||
name = "markdown.kak";
|
||||
src = ./autoload/markdown.kak;
|
||||
}
|
||||
|
||||
# Plugins
|
||||
{
|
||||
name = "luar";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "gustavo-hms";
|
||||
repo = "luar";
|
||||
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
||||
sha256 = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
|
||||
};
|
||||
activationScript = ''
|
||||
# Enable luar
|
||||
require-module luar
|
||||
# Use luajit
|
||||
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "peneira";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "peneira";
|
||||
rev = "743b9971472853a752475e7c070ce99089c6840c";
|
||||
sha256 = "sha256-E4ndbF9YC1p0KrvSuGgwmG1Y2IGTuGKJo/AuMixhzlM=";
|
||||
};
|
||||
activationScript = ''
|
||||
require-module peneira
|
||||
|
||||
# Change selection color
|
||||
set-face global PeneiraSelected @PrimarySelection
|
||||
|
||||
# Buffers list
|
||||
define-command -hidden peneira-buffers %{
|
||||
peneira 'buffers: ' %{ printf '%s\n' $kak_quoted_buflist } %{
|
||||
buffer %arg{1}
|
||||
}
|
||||
}
|
||||
|
||||
# Grep in the current location
|
||||
define-command peneira-grep %{
|
||||
peneira 'line: ' "rg -n ." %{
|
||||
lua %arg{1} %{
|
||||
local file, line = arg[1]:match("([^:]+):(%d+):")
|
||||
kak.edit(file, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# A peneira menu
|
||||
declare-user-mode fuzzy-match-menu
|
||||
|
||||
map -docstring "Switch to buffer" global fuzzy-match-menu b ": peneira-buffers<ret>"
|
||||
map -docstring "Symbols" global fuzzy-match-menu s ": peneira-symbols<ret>"
|
||||
map -docstring "Lines" global fuzzy-match-menu l ": peneira-lines<ret>"
|
||||
map -docstring "Lines in the current directory" global fuzzy-match-menu g ": peneira-grep<ret>"
|
||||
map -docstring "Files in project" global fuzzy-match-menu f ": peneira-files<ret>"
|
||||
map -docstring "Files in currently opening file's directory" global fuzzy-match-menu F ": peneira-local-files<ret>"
|
||||
|
||||
# Bind menu to user mode
|
||||
map -docstring "Fuzzy matching" global user f ": enter-user-mode fuzzy-match-menu<ret>"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-focus";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "caksoylar";
|
||||
repo = "kakoune-focus";
|
||||
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
||||
sha256 = "sha256-ZV7jlLJQyL420YG++iC9rq1SMjo3WO5hR9KVvJNUiCs=";
|
||||
};
|
||||
activationScript = ''
|
||||
map global user <space> ': focus-toggle<ret>' -docstring "toggle selections focus"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-inc-dec";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "Screwtapello";
|
||||
repo = "kakoune-inc-dec";
|
||||
rev = "7bfe9c51";
|
||||
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "racket.kak";
|
||||
src = (builtins.fetchTree {
|
||||
type = "git";
|
||||
url = "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak.git";
|
||||
rev = "e397042009b46916ff089d79166ec0e8ca813a18";
|
||||
narHash = "sha256-IcxFmvG0jqpMCG/dT9crVRgPgMGKkic6xwrnW5z4+bc=";
|
||||
}) + "/rc";
|
||||
}
|
||||
# {
|
||||
# name = "kakoune-discord";
|
||||
# src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
||||
# }
|
||||
rec {
|
||||
name = "kakoune-mirror";
|
||||
src = pkgs.fetchFromGitHub
|
||||
{
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-mirror";
|
||||
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
|
||||
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
|
||||
} + "/mirror.kak";
|
||||
wrapAsModule = true;
|
||||
activationScript = ''
|
||||
require-module ${name}
|
||||
|
||||
# Bind <a-w> to ${name}
|
||||
map global normal <a-w> ': enter-user-mode -lock mirror<ret>'
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "unicode-math";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "kakoune-unicode-math";
|
||||
rev = "08dff25da2b86ee0b0777091992bc7fb28c3cb1d";
|
||||
# sha256 = lib.fakeSha256;
|
||||
sha256 = "sha256-j0L1ARex1i2ma8sGLYwgkfAbh0jWKh/6QGHFaxPXIKc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
activationScript = ''
|
||||
require-module unicode-math
|
||||
|
||||
# Bind <c-s> to the menu
|
||||
map global insert <c-s> '<a-;>: insert-unicode '
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-buffers";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-buffers";
|
||||
rev = "6b2081f5b7d58c72de319a5cba7bf628b6802881";
|
||||
sha256 = "sha256-jOSrzGcLJjLK1GiTSsl2jLmQMPbPxjycR0pwF5t/eV0=";
|
||||
};
|
||||
activationScript = ''
|
||||
# Suggested hook
|
||||
|
||||
hook global WinDisplay .* info-buffers
|
||||
|
||||
# Suggested mappings
|
||||
|
||||
map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
|
||||
map global normal ^ ':enter-buffers-mode<ret>' -docstring 'buffers…'
|
||||
map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
|
||||
|
||||
# Suggested aliases
|
||||
|
||||
alias global bd delete-buffer
|
||||
alias global bf buffer-first
|
||||
alias global bl buffer-last
|
||||
alias global bo buffer-only
|
||||
alias global bo! buffer-only-force
|
||||
'';
|
||||
}
|
||||
];
|
||||
programs.my-kakoune.themes = {
|
||||
catppuccin-latte = ./catppuccin-latte.kak;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# Source kaktex whenever we have a tex file
|
||||
programs.my-kakoune.rc = ''
|
||||
hook global WinSetOption filetype=(tex|latex) %{
|
||||
hook window WinDisplay '.*' %{
|
||||
eval %sh{
|
||||
${./kaktex} set $kak_client $kak_session
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -38,7 +38,6 @@ in
|
|||
librewolf
|
||||
thunderbird
|
||||
vesktop
|
||||
premid
|
||||
];
|
||||
};
|
||||
defaults.webBrowser = mkOption {
|
||||
|
@ -58,7 +57,6 @@ in
|
|||
feh # For images?
|
||||
deluge # Torrent client
|
||||
pavucontrol # PulseAudio control panel
|
||||
thunderbird # Email
|
||||
sublime-music # For navidrome
|
||||
# cinny-desktop
|
||||
gajim
|
||||
|
@ -66,7 +64,7 @@ in
|
|||
# Audio
|
||||
qpwgraph # Pipewire graph
|
||||
|
||||
zotero_7
|
||||
unstable.zotero
|
||||
libreoffice
|
||||
|
||||
mpv # for anki
|
||||
|
@ -76,15 +74,15 @@ in
|
|||
tdesktop
|
||||
whatsapp-for-linux
|
||||
slack
|
||||
zoom-us
|
||||
|
||||
librewolf
|
||||
|
||||
## CLI stuff
|
||||
dex # .desktop file management, startup
|
||||
# sct # Display color temperature
|
||||
xdg-utils # Open stuff
|
||||
wifi-indicator
|
||||
]);
|
||||
] ++ cfg.startup);
|
||||
|
||||
nki.programs.discord.enable = pkgs.stdenv.isx86_64;
|
||||
nki.programs.discord.package = pkgs.vesktop;
|
||||
|
|
|
@ -61,6 +61,12 @@ let
|
|||
'';
|
||||
xdg.dataFile."dbus-1/services/org.freedesktop.Notifications.service".source = "${pkgs.kdePackages.plasma-workspace}/share/dbus-1/services/org.kde.plasma.Notifications.service";
|
||||
};
|
||||
|
||||
rofi-rbw-script = pkgs.writeShellApplication {
|
||||
name = "rofi-rbw-script";
|
||||
runtimeInputs = with pkgs; [ rofi wtype rofi-rbw ];
|
||||
text = "rofi-rbw";
|
||||
};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
|
@ -69,6 +75,7 @@ with lib;
|
|||
# Additional packages
|
||||
home.packages = with pkgs; [
|
||||
wl-clipboard # Clipboard management
|
||||
rofi-rbw-script
|
||||
|
||||
# Mimic the clipboard stuff in MacOS
|
||||
(pkgs.writeShellScriptBin "pbcopy" ''
|
||||
|
@ -79,6 +86,16 @@ with lib;
|
|||
'')
|
||||
];
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
package = pkgs.rofi-wayland;
|
||||
cycle = true;
|
||||
font = "monospace";
|
||||
terminal = "${lib.getExe config.programs.kitty.package}";
|
||||
theme = "Paper";
|
||||
plugins = with pkgs; [ rofi-bluetooth rofi-calc rofi-rbw rofi-power-menu ];
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
ANKI_WAYLAND = "1";
|
||||
};
|
||||
|
|
|
@ -1,40 +1,17 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ config, options, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.my-kakoune;
|
||||
|
||||
autoloadModule = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "Name of the autoload script/folder. It might affect kakoune's load order.";
|
||||
};
|
||||
src = mkOption {
|
||||
type = types.path;
|
||||
description = "Path to the autoload script/folder.";
|
||||
};
|
||||
wrapAsModule = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Wrap the given source file in a `provide-module` command. Fails if the `src` is not a single file.";
|
||||
};
|
||||
activationScript = mkOption {
|
||||
type = types.nullOr types.lines;
|
||||
default = null;
|
||||
description = "Add an activation script to the module. It will be wrapped in a `hook global KakBegin .*` wrapper.";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ./kak-lsp.nix ./fish-session.nix ./tree-sitter.nix ];
|
||||
imports = [ ./fish-session.nix ./tree-sitter.nix ];
|
||||
|
||||
options.programs.my-kakoune = {
|
||||
enable = mkEnableOption "My version of the kakoune configuration";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.kakoune;
|
||||
default = pkgs.nki-kakoune;
|
||||
description = "The kakoune package to be installed";
|
||||
};
|
||||
rc = mkOption {
|
||||
|
@ -42,22 +19,16 @@ in
|
|||
default = "";
|
||||
description = "Content of the kakrc file. A line-concatenated string";
|
||||
};
|
||||
autoload = mkOption {
|
||||
type = types.listOf autoloadModule;
|
||||
default = [ ];
|
||||
description = "Sources to autoload";
|
||||
};
|
||||
themes = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
default = { };
|
||||
description = "Themes to load";
|
||||
};
|
||||
|
||||
extraFaces = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = "Extra faces to include";
|
||||
};
|
||||
autoloadFile = mkOption {
|
||||
type = options.xdg.configFile.type;
|
||||
default = { };
|
||||
description = "Extra autoload files";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -65,37 +36,6 @@ in
|
|||
|
||||
xdg.configFile =
|
||||
let
|
||||
kakouneAutoload = { name, src, wrapAsModule ? false, activationScript ? null }:
|
||||
[
|
||||
(if !wrapAsModule then {
|
||||
name = "kak/autoload/${name}";
|
||||
value.source = src;
|
||||
} else {
|
||||
name = "kak/autoload/${name}/module.kak";
|
||||
value.text = ''
|
||||
provide-module ${name} %◍
|
||||
${readFile src}
|
||||
◍
|
||||
'';
|
||||
})
|
||||
] ++ (if activationScript == null then [ ] else [{
|
||||
name = "kak/autoload/on-load/${name}.kak";
|
||||
value.text = ''
|
||||
hook global KakBegin .* %{
|
||||
${activationScript}
|
||||
}
|
||||
'';
|
||||
}]);
|
||||
|
||||
kakouneThemes = builtins.listToAttrs (builtins.attrValues (
|
||||
builtins.mapAttrs
|
||||
(name: src: {
|
||||
name = "kak/colors/${name}.kak";
|
||||
value.source = src;
|
||||
})
|
||||
cfg.themes
|
||||
));
|
||||
|
||||
kakouneFaces =
|
||||
let
|
||||
txt = strings.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: face: "face global ${name} \"${face}\"") cfg.extraFaces));
|
||||
|
@ -103,6 +43,7 @@ in
|
|||
pkgs.writeText "faces.kak" txt;
|
||||
in
|
||||
{
|
||||
"kak/autoload/builtin".source = "${cfg.package}/share/kak/autoload";
|
||||
# kakrc
|
||||
"kak/kakrc".text = ''
|
||||
${cfg.rc}
|
||||
|
@ -110,15 +51,14 @@ in
|
|||
# Load faces
|
||||
source ${kakouneFaces}
|
||||
'';
|
||||
} //
|
||||
(builtins.listToAttrs (lib.lists.flatten (map kakouneAutoload ([
|
||||
# include the original autoload files
|
||||
{
|
||||
name = "rc";
|
||||
src = "${cfg.package}/share/kak/autoload/rc";
|
||||
}
|
||||
] ++ cfg.autoload))))
|
||||
// kakouneThemes;
|
||||
} // lib.mapAttrs'
|
||||
(name: attrs: {
|
||||
name = "kak/autoload/${name}";
|
||||
value = attrs // {
|
||||
target = "kak/autoload/${name}";
|
||||
};
|
||||
})
|
||||
cfg.autoloadFile;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
lspConfig =
|
||||
{
|
||||
language_ids = {
|
||||
c = "c_cpp";
|
||||
cpp = "c_cpp";
|
||||
javascript = "javascriptreact";
|
||||
typescript = "typescriptreact";
|
||||
protobuf = "proto";
|
||||
sh = "shellscript";
|
||||
};
|
||||
|
||||
language_servers = {
|
||||
ccls = {
|
||||
args = [ "-v=2" "-log-file=/tmp/ccls.log" ];
|
||||
command = "ccls";
|
||||
filetypes = [ "c" "cpp" ];
|
||||
roots = [ "compile_commands.json" ".cquery" ".git" ];
|
||||
};
|
||||
gopls = {
|
||||
command = "gopls";
|
||||
filetypes = [ "go" ];
|
||||
offset_encoding = "utf-8";
|
||||
roots = [ "Gopkg.toml" "go.mod" ".git" ".hg" ];
|
||||
settings = { gopls = { hoverKind = "SynopsisDocumentation"; semanticTokens = true; }; };
|
||||
settings_section = "gopls";
|
||||
};
|
||||
haskell-language-server = {
|
||||
args = [ "--lsp" ];
|
||||
command = "haskell-language-server-wrapper";
|
||||
filetypes = [ "haskell" ];
|
||||
roots = [ "Setup.hs" "stack.yaml" "*.cabal" "package.yaml" ];
|
||||
settings_section = "haskell";
|
||||
};
|
||||
nil = {
|
||||
command = "${pkgs.nil}/bin/nil";
|
||||
filetypes = [ "nix" ];
|
||||
roots = [ "flake.nix" "shell.nix" ".git" ];
|
||||
settings.nil = {
|
||||
formatting.command = [ "${getExe pkgs.nixpkgs-fmt}" ];
|
||||
};
|
||||
};
|
||||
pyls = {
|
||||
command = "pyls";
|
||||
filetypes = [ "python" ];
|
||||
offset_encoding = "utf-8";
|
||||
roots = [ "requirements.txt" "setup.py" ".git" ".hg" ];
|
||||
};
|
||||
};
|
||||
semantic_tokens.faces = [
|
||||
## Items
|
||||
# (Rust) Macros
|
||||
{ face = "attribute"; token = "attribute"; }
|
||||
{ face = "attribute"; token = "derive"; }
|
||||
{ face = "macro"; token = "macro"; } # Function-like Macro
|
||||
# Keyword and Fixed Tokens
|
||||
{ face = "keyword"; token = "keyword"; }
|
||||
{ face = "operator"; token = "operator"; }
|
||||
# Functions and Methods
|
||||
{ face = "function"; token = "function"; }
|
||||
{ face = "method"; token = "method"; }
|
||||
# Constants
|
||||
{ face = "string"; token = "string"; }
|
||||
{ face = "format_specifier"; token = "formatSpecifier"; }
|
||||
# Variables
|
||||
{ face = "variable"; token = "variable"; modifiers = [ "readonly" ]; }
|
||||
{ face = "mutable_variable"; token = "variable"; }
|
||||
{ face = "module"; token = "namespace"; }
|
||||
{ face = "variable"; token = "type_parameter"; }
|
||||
{ face = "class"; token = "enum"; }
|
||||
{ face = "class"; token = "struct"; }
|
||||
{ face = "class"; token = "trait"; }
|
||||
{ face = "class"; token = "union"; }
|
||||
{ face = "class"; token = "class"; }
|
||||
|
||||
## Comments
|
||||
{ face = "documentation"; token = "comment"; modifiers = [ "documentation" ]; }
|
||||
{ face = "comment"; token = "comment"; }
|
||||
];
|
||||
server = { timeout = 1800; };
|
||||
snippet_support = false;
|
||||
verbosity = 255;
|
||||
};
|
||||
|
||||
languageServerOption = types.submodule {
|
||||
options = {
|
||||
filetypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The list of filetypes to assign the language to";
|
||||
};
|
||||
roots = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The list of root filenames that are used to determine the project root";
|
||||
};
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
description = "The LSP server command to be called.";
|
||||
};
|
||||
args = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "The arguments passed onto the LSP server.";
|
||||
};
|
||||
offset_encoding = mkOption {
|
||||
type = types.nullOr (types.enum [ "utf-8" ]);
|
||||
default = null;
|
||||
description = "The offset encoding used by the LSP server.";
|
||||
};
|
||||
settings_section = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "The settings section to be sent to LSP server.";
|
||||
};
|
||||
settings = mkOption {
|
||||
type = types.nullOr (types.attrsOf types.anything);
|
||||
default = null;
|
||||
description = "Additional settings to be passed to the LSP server.";
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
description = "The default package of the language server. Will be appended as the ending segments of the PATH to kak-lsp";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.programs.kak-lsp;
|
||||
|
||||
serverPackages =
|
||||
filter (v: v != null)
|
||||
(lib.mapAttrsToList (_: serv: serv.package) cfg.languageServers);
|
||||
|
||||
wrappedPackage = pkgs.symlinkJoin {
|
||||
name = "kak-lsp-wrapped";
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
paths = [ cfg.package ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/kak-lsp --suffix PATH ":" ${lib.makeBinPath serverPackages}
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options.programs.kak-lsp = {
|
||||
enable = mkEnableOption "Enable kak-lsp support";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.kak-lsp;
|
||||
};
|
||||
|
||||
enableSnippets = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable snippet support";
|
||||
};
|
||||
|
||||
semanticTokens.faces = mkOption {
|
||||
type = types.listOf types.anything;
|
||||
default = lspConfig.semantic_tokens.faces;
|
||||
description = "The semantic tokens faces mapping given to kak";
|
||||
};
|
||||
semanticTokens.additionalFaces = mkOption {
|
||||
type = types.listOf types.anything;
|
||||
default = [ ];
|
||||
description = "The semantic tokens faces mapping given to kak";
|
||||
};
|
||||
|
||||
serverTimeout = mkOption {
|
||||
type = types.int;
|
||||
default = 1000;
|
||||
description = "Server timeout";
|
||||
};
|
||||
|
||||
languageServers = mkOption {
|
||||
type = types.attrsOf languageServerOption;
|
||||
default = { };
|
||||
description = "The language options";
|
||||
};
|
||||
|
||||
languageIds = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = "Language IDs to be sent to the LSP";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
{
|
||||
home.packages = [ wrappedPackage ];
|
||||
|
||||
# Configurations
|
||||
xdg.configFile."kak-lsp/kak-lsp.toml" =
|
||||
let
|
||||
toml = pkgs.formats.toml { };
|
||||
toLspConfig = lib.filterAttrsRecursive (n: v: n != "package" && v != null);
|
||||
in
|
||||
{
|
||||
source = toml.generate "config.toml"
|
||||
{
|
||||
semantic_tokens.faces = cfg.semanticTokens.faces ++ cfg.semanticTokens.additionalFaces;
|
||||
server.timeout = cfg.serverTimeout;
|
||||
snippet_support = cfg.enableSnippets;
|
||||
verbosity = 255;
|
||||
language_server = toLspConfig (lspConfig.language_servers // cfg.languageServers);
|
||||
language_ids = lspConfig.language_ids // cfg.languageIds;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -33,6 +33,27 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
mkGrammarPackage =
|
||||
{ name
|
||||
, src
|
||||
, grammarPath ? "src"
|
||||
, grammarCompileArgs ? [ "-O3" "-c" "-fpic" "../parser.c" "../scanner.c" "-I" ".." ]
|
||||
, grammarLinkArgs ? [ "-shared" "-fpic" "parser.o" "scanner.o" ]
|
||||
}: pkgs.stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "kak-tree-sitter-grammar-${name}.so";
|
||||
version = "latest";
|
||||
buildPhase = ''
|
||||
mkdir ${grammarPath}/build
|
||||
cd ${grammarPath}/build
|
||||
$CC ${lib.concatStringsSep " " grammarCompileArgs}
|
||||
$CC ${lib.concatStringsSep " " grammarLinkArgs} -o ${name}.so
|
||||
'';
|
||||
installPhase = ''
|
||||
cp ${name}.so $out
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.my-kakoune.tree-sitter = {
|
||||
|
@ -200,24 +221,15 @@ in
|
|||
|
||||
toml = pkgs.formats.toml { };
|
||||
|
||||
srcName = src: lib.removePrefix "/nix/store/" src.outPath;
|
||||
mkGitRepo = src: pkgs.runCommandLocal "${src.name}-git" { } ''
|
||||
cp -r --no-preserve=all ${src} $out
|
||||
cd $out
|
||||
if ! test -d $out/.git; then
|
||||
${lib.getExe pkgs.git} init -b ${srcName src}
|
||||
${lib.getExe pkgs.git} config user.email "a@b.com"
|
||||
${lib.getExe pkgs.git} config user.name "a"
|
||||
${lib.getExe pkgs.git} add .
|
||||
${lib.getExe pkgs.git} commit -m "Just making a git commit"
|
||||
fi
|
||||
'';
|
||||
|
||||
toLanguageConf = name: lang: with lang; {
|
||||
grammar = {
|
||||
inherit (grammar) path;
|
||||
source.git.url = "${mkGitRepo grammar.src}";
|
||||
source.git.pin = "${srcName grammar.src}";
|
||||
source.local.path = mkGrammarPackage {
|
||||
inherit name;
|
||||
src = grammar.src;
|
||||
grammarPath = grammar.path;
|
||||
grammarCompileArgs = grammar.compile.flags ++ grammar.compile.args;
|
||||
grammarLinkArgs = grammar.link.flags ++ grammar.link.args;
|
||||
};
|
||||
compile = grammar.compile.command;
|
||||
compile_args = grammar.compile.args;
|
||||
compile_flags = grammar.compile.flags;
|
||||
|
@ -225,10 +237,9 @@ in
|
|||
link_args = grammar.link.args ++ [ "-o" "${name}.so" ];
|
||||
link_flags = grammar.link.flags;
|
||||
};
|
||||
queries = {
|
||||
source.git.url = "${mkGitRepo queries.src}";
|
||||
source.git.pin = "${srcName queries.src}";
|
||||
queries = rec {
|
||||
path = if queries.path == null then "runtime/queries/${name}" else queries.path;
|
||||
source.local.path = "${queries.src}/${path}";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
@ -249,14 +260,14 @@ in
|
|||
features = cfg.features;
|
||||
language = builtins.mapAttrs toLanguageConf cfg.languages;
|
||||
};
|
||||
|
||||
onChange = ''
|
||||
export PATH=$PATH:${lib.getBin pkgs.gcc}
|
||||
${cfg.package}/bin/ktsctl sync -a
|
||||
'';
|
||||
};
|
||||
|
||||
programs.my-kakoune.extraFaces = faces;
|
||||
programs.my-kakoune.autoloadFile."kak-tree-sitter.kak".text = ''
|
||||
# Enable kak-tree-sitter
|
||||
eval %sh{kak-tree-sitter --kakoune -d --server --init $kak_session}
|
||||
map global normal <c-t> ": enter-user-mode tree-sitter<ret>"
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -45,12 +45,6 @@ let
|
|||
${pkgs.grim}/bin/grim -g (${pkgs.slurp}/bin/slurp) - | ${pkgs.swappy}/bin/swappy -f -
|
||||
'';
|
||||
|
||||
rofi-rbw-script = pkgs.writeShellApplication {
|
||||
name = "rofi-rbw-script";
|
||||
runtimeInputs = with pkgs; [ rofi wtype rofi-rbw ];
|
||||
text = "rofi-rbw";
|
||||
};
|
||||
|
||||
ignored-devices = [ "Surface_Headphones" ];
|
||||
playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=${strings.concatStringsSep "," ignored-devices}";
|
||||
|
||||
|
@ -223,7 +217,7 @@ in
|
|||
# Launcher
|
||||
"${mod}+space" = "exec rofi -show drun";
|
||||
"${mod}+tab" = "exec ${./rofi-window.py}";
|
||||
"${mod}+shift+p" = "exec ${lib.getExe rofi-rbw-script}";
|
||||
"${mod}+shift+p" = "exec rofi-rbw-script";
|
||||
} // {
|
||||
## Splits
|
||||
"${mod}+v" = "split v";
|
||||
|
@ -297,7 +291,8 @@ in
|
|||
# Assigning windows to workspaces
|
||||
assigns = {
|
||||
"${builtins.elemAt workspaces 0}" = [
|
||||
{ class = "^firefox$"; }
|
||||
{ app_id = "^firefox$"; }
|
||||
{ app_id = "^librewolf$"; }
|
||||
];
|
||||
"${builtins.elemAt workspaces 1}" = [
|
||||
{ class = "^((d|D)iscord|((A|a)rm(c|C)ord))$"; }
|
||||
|
@ -305,6 +300,8 @@ in
|
|||
{ app_id = "VencordDesktop"; }
|
||||
{ class = "vesktop"; }
|
||||
{ app_id = "vesktop"; }
|
||||
|
||||
{ class = "Slack"; }
|
||||
];
|
||||
${extraWorkspaces.mail} = [
|
||||
{ app_id = "thunderbird"; }
|
||||
|
@ -781,14 +778,9 @@ in
|
|||
# For waybar
|
||||
font-awesome
|
||||
]);
|
||||
|
||||
config.programs.rofi = mkIf cfg.enable {
|
||||
enable = true;
|
||||
package = pkgs.rofi-wayland;
|
||||
cycle = true;
|
||||
font = "monospace ${toString cfg.fontSize}";
|
||||
terminal = cfg.terminal;
|
||||
theme = "Paper";
|
||||
plugins = with pkgs; [ rofi-bluetooth rofi-calc rofi-rbw rofi-power-menu ];
|
||||
font = lib.mkForce "monospace ${toString cfg.fontSize}";
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
# Graphical set up
|
||||
linux.graphical.type = "wayland";
|
||||
linux.graphical.wallpaper = ./images/wallpaper_0.png;
|
||||
linux.graphical.defaults.webBrowser = "librewolf.desktop";
|
||||
linux.graphical.startup = with pkgs; [ zen-browser-bin thunderbird vesktop slack ];
|
||||
linux.graphical.defaults.webBrowser = "zen.desktop";
|
||||
# Enable sway
|
||||
programs.my-sway.enable = true;
|
||||
programs.my-sway.fontSize = 14.0;
|
||||
|
@ -96,14 +97,25 @@
|
|||
# Multiple screen setup
|
||||
services.kanshi = with config.common.monitors; {
|
||||
enable = true;
|
||||
profiles.undocked.outputs = [{ criteria = "LVDS-1"; }];
|
||||
profiles.work-both.outputs = [
|
||||
{ criteria = "eDP-1"; position = "0,${toString (builtins.floor ((2160 / work.scale - 1200) + 1200 / 3))}"; status = "enable"; }
|
||||
{ criteria = work.name; position = "1920,0"; }
|
||||
];
|
||||
profiles.work-one.outputs = [
|
||||
{ criteria = "eDP-1"; status = "disable"; }
|
||||
{ criteria = config.common.monitors.work.name; }
|
||||
settings = [
|
||||
{
|
||||
profile.name = "undocked";
|
||||
profile.outputs = [{ criteria = "LVDS-1"; }];
|
||||
}
|
||||
{
|
||||
profile.name = "work-both";
|
||||
profile.outputs = [
|
||||
{ criteria = "eDP-1"; position = "0,${toString (builtins.floor ((2160 / work.scale - 1200) + 1200 / 3))}"; status = "enable"; }
|
||||
{ criteria = work.name; position = "1920,0"; }
|
||||
];
|
||||
}
|
||||
{
|
||||
profile.name = "work-one";
|
||||
profile.outputs = [
|
||||
{ criteria = "eDP-1"; status = "disable"; }
|
||||
{ criteria = work.name; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ let
|
|||
osu-pkg = with pkgs; with lib;
|
||||
appimageTools.wrapType2 rec {
|
||||
pname = "osu-lazer-bin";
|
||||
version = "2024.906.2";
|
||||
version = "2024.1115.3";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/ppy/osu/releases/download/${version}/osu.AppImage";
|
||||
sha256 = "1ddnac72xk9zsi9pmxg72xd3piq6s5hgh7vzb09mh4r5mkfd22fd";
|
||||
sha256 = "sha256-kwZHy0FfOUFIWvyOj0ghlQz05U+Lnzl5TgC4T6bhm7o=";
|
||||
};
|
||||
extraPkgs = pkgs: with pkgs; [ icu ];
|
||||
|
||||
|
|
|
@ -48,7 +48,14 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.arion-authentik.serviceConfig.EnvironmentFile = cfg.envFile;
|
||||
systemd.services.arion-authentik = {
|
||||
serviceConfig.EnvironmentFile = cfg.envFile;
|
||||
serviceConfig.Type = "notify";
|
||||
serviceConfig.NotifyAccess = "all";
|
||||
script = lib.mkBefore ''
|
||||
${lib.getExe pkgs.wait4x} http http://127.0.0.1:${toString cfg.port} --expect-status-code 200 -t 0 -q -- systemd-notify --ready &
|
||||
'';
|
||||
};
|
||||
virtualisation.arion.projects.authentik.settings = {
|
||||
services.postgresql.service = {
|
||||
image = images.postgresql;
|
||||
|
|
|
@ -33,7 +33,7 @@ with lib; {
|
|||
{
|
||||
systemd.services.heisenbridge = {
|
||||
description = "Matrix<->IRC bridge";
|
||||
requires = [ "matrix-synapse.service" ]; # So the registration file can be used by Synapse
|
||||
requires = [ "matrix-conduit-nkagami.service" "matrix-synapse.service" ]; # So the registration file can be used by Synapse
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = rec {
|
||||
|
|
|
@ -4,6 +4,7 @@ let
|
|||
cfg = config.cloud.gotosocial;
|
||||
|
||||
dbUser = "gotosocial";
|
||||
storageLocation = "/mnt/data/gotosocial";
|
||||
in
|
||||
{
|
||||
options.cloud.gotosocial = {
|
||||
|
@ -74,6 +75,9 @@ in
|
|||
# Media
|
||||
media-emoji-remote-max-size = 256 * 1024 /* bytes */;
|
||||
media-emoji-local-max-size = 256 * 1024 /* bytes */;
|
||||
media-remote-cache-days = 7;
|
||||
media-cleanup-from = "00:00";
|
||||
media-cleanup-every = "24h";
|
||||
# OIDC
|
||||
oidc-enabled = true;
|
||||
oidc-idp-name = "DTTH";
|
||||
|
@ -82,10 +86,22 @@ in
|
|||
http-client.block-ips = [ "11.0.0.0/24" ];
|
||||
# Advanced
|
||||
advanced-rate-limit-requests = 0;
|
||||
# Storage
|
||||
storage-backend = "local";
|
||||
storage-local-base-path = "${storageLocation}/storage";
|
||||
# instance-inject-mastodon-version = true;
|
||||
};
|
||||
};
|
||||
systemd.services.gotosocial.requires = mkAfter [ "minio.service" "postgresql.service" ];
|
||||
systemd.services.gotosocial.after = mkAfter [ "minio.service" "postgresql.service" ];
|
||||
systemd.services.gotosocial.requires = mkAfter [ "postgresql.service" "arion-authentik.service" ];
|
||||
systemd.services.gotosocial.after = mkAfter [ "postgresql.service" "arion-authentik.service" ];
|
||||
systemd.services.gotosocial.unitConfig = {
|
||||
RequiresMountsFor = [ storageLocation ];
|
||||
ReadWritePaths = [ storageLocation ];
|
||||
};
|
||||
systemd.tmpfiles.settings."10-gotosocial".${storageLocation}.d = {
|
||||
user = dbUser;
|
||||
group = dbUser;
|
||||
mode = "0700";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
183
modules/cloud/outline/r2.patch
Normal file
183
modules/cloud/outline/r2.patch
Normal file
|
@ -0,0 +1,183 @@
|
|||
commit 8c7f8c28fabc174a71499a4737579b24b5c4b244
|
||||
Author: Natsu Kagami <nki@nkagami.me>
|
||||
Date: Mon Oct 21 02:17:36 2024 +0200
|
||||
|
||||
Support R2
|
||||
|
||||
diff --git a/.env.sample b/.env.sample
|
||||
index eb57ad85c..94ffcee07 100644
|
||||
--- a/.env.sample
|
||||
+++ b/.env.sample
|
||||
@@ -66,6 +66,8 @@ AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569
|
||||
AWS_S3_UPLOAD_BUCKET_NAME=bucket_name_here
|
||||
AWS_S3_FORCE_PATH_STYLE=true
|
||||
AWS_S3_ACL=private
|
||||
+AWS_S3_R2=true
|
||||
+AWS_S3_R2_PUBLIC_URL=http://s3:4569
|
||||
|
||||
# –––––––––––––– AUTHENTICATION ––––––––––––––
|
||||
|
||||
diff --git a/app/utils/files.ts b/app/utils/files.ts
|
||||
index 6607a6b12..5138f68ad 100644
|
||||
--- a/app/utils/files.ts
|
||||
+++ b/app/utils/files.ts
|
||||
@@ -63,8 +63,13 @@ export const uploadFile = async (
|
||||
xhr.addEventListener("loadend", () => {
|
||||
resolve(xhr.readyState === 4 && xhr.status >= 200 && xhr.status < 400);
|
||||
});
|
||||
- xhr.open("POST", data.uploadUrl, true);
|
||||
- xhr.send(formData);
|
||||
+ xhr.open(data.method, data.uploadUrl, true);
|
||||
+ xhr.setRequestHeader("Content-Type", file.type);
|
||||
+ if (data.method === "POST") {
|
||||
+ xhr.send(formData);
|
||||
+ } else {
|
||||
+ xhr.send(file);
|
||||
+ }
|
||||
});
|
||||
|
||||
if (!success) {
|
||||
diff --git a/server/env.ts b/server/env.ts
|
||||
index 5b420f2e1..4ea1e8d3c 100644
|
||||
--- a/server/env.ts
|
||||
+++ b/server/env.ts
|
||||
@@ -519,6 +519,14 @@ export class Environment {
|
||||
environment.AWS_S3_UPLOAD_BUCKET_NAME
|
||||
);
|
||||
|
||||
+ @IsOptional()
|
||||
+ public AWS_S3_R2 = this.toBoolean(environment.AWS_S3_R2 ?? "false");
|
||||
+
|
||||
+ @IsOptional()
|
||||
+ public AWS_S3_R2_PUBLIC_URL = this.toOptionalString(
|
||||
+ environment.AWS_S3_R2_PUBLIC_URL
|
||||
+ );
|
||||
+
|
||||
/**
|
||||
* Whether to force path style URLs for S3 objects, this is required for some
|
||||
* S3-compatible storage providers.
|
||||
diff --git a/server/routes/api/attachments/attachments.ts b/server/routes/api/attachments/attachments.ts
|
||||
index 5e6c27594..b7620f440 100644
|
||||
--- a/server/routes/api/attachments/attachments.ts
|
||||
+++ b/server/routes/api/attachments/attachments.ts
|
||||
@@ -3,6 +3,7 @@ import { v4 as uuidv4 } from "uuid";
|
||||
import { AttachmentPreset } from "@shared/types";
|
||||
import { bytesToHumanReadable } from "@shared/utils/files";
|
||||
import { AttachmentValidation } from "@shared/validations";
|
||||
+import env from "@server/env";
|
||||
import { AuthorizationError, ValidationError } from "@server/errors";
|
||||
import auth from "@server/middlewares/authentication";
|
||||
import { rateLimiter } from "@server/middlewares/rateLimiter";
|
||||
@@ -90,16 +91,30 @@ router.post(
|
||||
{ transaction }
|
||||
);
|
||||
|
||||
- const presignedPost = await FileStorage.getPresignedPost(
|
||||
- key,
|
||||
- acl,
|
||||
- maxUploadSize,
|
||||
- contentType
|
||||
- );
|
||||
+ let uploadUrl;
|
||||
+ let method;
|
||||
+ let presignedPost = {
|
||||
+ fields: {},
|
||||
+ };
|
||||
+ if (env.AWS_S3_R2) {
|
||||
+ uploadUrl = await FileStorage.getPresignedPut(key);
|
||||
+ method = "PUT";
|
||||
+ } else {
|
||||
+ uploadUrl = FileStorage.getUploadUrl();
|
||||
+ method = "POST";
|
||||
+
|
||||
+ presignedPost = await FileStorage.getPresignedPost(
|
||||
+ key,
|
||||
+ acl,
|
||||
+ maxUploadSize,
|
||||
+ contentType
|
||||
+ );
|
||||
+ }
|
||||
|
||||
ctx.body = {
|
||||
data: {
|
||||
- uploadUrl: FileStorage.getUploadUrl(),
|
||||
+ uploadUrl,
|
||||
+ method,
|
||||
form: {
|
||||
"Cache-Control": "max-age=31557600",
|
||||
"Content-Type": contentType,
|
||||
diff --git a/server/storage/files/BaseStorage.ts b/server/storage/files/BaseStorage.ts
|
||||
index ce0287ebc..a1931c83d 100644
|
||||
--- a/server/storage/files/BaseStorage.ts
|
||||
+++ b/server/storage/files/BaseStorage.ts
|
||||
@@ -26,6 +26,8 @@ export default abstract class BaseStorage {
|
||||
contentType: string
|
||||
): Promise<Partial<PresignedPost>>;
|
||||
|
||||
+ public abstract getPresignedPut(key: string): Promise<string>;
|
||||
+
|
||||
/**
|
||||
* Returns a promise that resolves with a stream for reading a file from the storage provider.
|
||||
*
|
||||
diff --git a/server/storage/files/LocalStorage.ts b/server/storage/files/LocalStorage.ts
|
||||
index 83cf98c50..324e60dd9 100644
|
||||
--- a/server/storage/files/LocalStorage.ts
|
||||
+++ b/server/storage/files/LocalStorage.ts
|
||||
@@ -30,6 +30,10 @@ export default class LocalStorage extends BaseStorage {
|
||||
});
|
||||
}
|
||||
|
||||
+ public async getPresignedPut(key: string) {
|
||||
+ return this.getUrlForKey(key);
|
||||
+ }
|
||||
+
|
||||
public getUploadUrl() {
|
||||
return "/api/files.create";
|
||||
}
|
||||
diff --git a/server/storage/files/S3Storage.ts b/server/storage/files/S3Storage.ts
|
||||
index a42442e0c..d55ef5472 100644
|
||||
--- a/server/storage/files/S3Storage.ts
|
||||
+++ b/server/storage/files/S3Storage.ts
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
S3Client,
|
||||
DeleteObjectCommand,
|
||||
GetObjectCommand,
|
||||
+ PutObjectCommand,
|
||||
ObjectCannedACL,
|
||||
} from "@aws-sdk/client-s3";
|
||||
import { Upload } from "@aws-sdk/lib-storage";
|
||||
@@ -58,6 +59,16 @@ export default class S3Storage extends BaseStorage {
|
||||
return createPresignedPost(this.client, params);
|
||||
}
|
||||
|
||||
+ public async getPresignedPut(key: string) {
|
||||
+ const params = {
|
||||
+ Bucket: env.AWS_S3_UPLOAD_BUCKET_NAME,
|
||||
+ Key: key,
|
||||
+ };
|
||||
+
|
||||
+ const command = new PutObjectCommand(params);
|
||||
+ return await getSignedUrl(this.client, command, { expiresIn: 3600 });
|
||||
+ }
|
||||
+
|
||||
private getPublicEndpoint(isServerUpload?: boolean) {
|
||||
if (env.AWS_S3_ACCELERATE_URL) {
|
||||
return env.AWS_S3_ACCELERATE_URL;
|
||||
@@ -137,10 +148,17 @@ export default class S3Storage extends BaseStorage {
|
||||
);
|
||||
}
|
||||
|
||||
+ public getR2ObjectUrl = async (key: string) =>
|
||||
+ env.AWS_S3_R2_PUBLIC_URL + "/" + key;
|
||||
+
|
||||
public getSignedUrl = async (
|
||||
key: string,
|
||||
expiresIn = S3Storage.defaultSignedUrlExpires
|
||||
) => {
|
||||
+ if (env.AWS_S3_R2) {
|
||||
+ return this.getR2ObjectUrl(key);
|
||||
+ }
|
||||
+
|
||||
const isDocker = env.AWS_S3_UPLOAD_BUCKET_URL.match(/http:\/\/s3:/);
|
||||
const params = {
|
||||
Bucket: this.getBucket(),
|
|
@ -71,6 +71,7 @@ let
|
|||
virtualisation = { pkgs, ... }: mkIf cfg.enable {
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
extraPackages = [ pkgs.slirp4netns ];
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
|
@ -315,6 +316,11 @@ in
|
|||
programs.kdeconnect.enable = true;
|
||||
# Flatpaks are useful... sometimes...
|
||||
services.flatpak.enable = true;
|
||||
# AppImages should run
|
||||
programs.appimage = {
|
||||
enable = true;
|
||||
binfmt = true;
|
||||
};
|
||||
# DConf for GNOME configurations
|
||||
programs.dconf.enable = true;
|
||||
# Gaming! (not for ARM64)
|
||||
|
|
|
@ -10,7 +10,7 @@ with lib;
|
|||
ibm-plex
|
||||
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
|
||||
noto-fonts
|
||||
noto-fonts-cjk
|
||||
(pkgs.noto-fonts-cjk-sans or pkgs.noto-fonts-cjk)
|
||||
merriweather
|
||||
corefonts
|
||||
font-awesome
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
./invidious.nix
|
||||
./owncast.nix
|
||||
./peertube.nix
|
||||
./outline.nix
|
||||
];
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
|
||||
common.linux.enable = false; # Don't enable the "common linux" module, this is a special machine.
|
||||
|
||||
# Personal user
|
||||
|
@ -189,74 +192,13 @@
|
|||
protocol = "udp";
|
||||
};
|
||||
|
||||
|
||||
# Outline
|
||||
sops.secrets.minio-secret-key = { owner = "root"; mode = "0444"; };
|
||||
sops.secrets.authentik-oidc-client-secret = { owner = "outline"; };
|
||||
sops.secrets."outline/smtp-password" = { owner = "outline"; };
|
||||
services.outline = {
|
||||
enable = true;
|
||||
package = pkgs.outline.overrideAttrs (attrs: {
|
||||
patches = if builtins.hasAttr "patches" attrs then attrs.patches else [ ] ++ [ ../modules/cloud/outline/dtth-wiki.patch ];
|
||||
});
|
||||
databaseUrl = "postgres://outline:outline@localhost/outline?sslmode=disable";
|
||||
redisUrl = "local";
|
||||
publicUrl = "https://wiki.dtth.ch";
|
||||
port = 18729;
|
||||
storage = {
|
||||
accessKey = "minio";
|
||||
secretKeyFile = config.sops.secrets.minio-secret-key.path;
|
||||
region = config.services.minio.region;
|
||||
uploadBucketUrl = "https://s3.dtth.ch";
|
||||
uploadBucketName = "dtth-outline";
|
||||
uploadMaxSize = 50 * 1024 * 1000;
|
||||
};
|
||||
maximumImportSize = 50 * 1024 * 1000;
|
||||
|
||||
oidcAuthentication = {
|
||||
clientId = "3a0c10e00cdcb4a1194315577fa208a747c1a5f7";
|
||||
clientSecretFile = config.sops.secrets.authentik-oidc-client-secret.path;
|
||||
authUrl = "https://auth.dtth.ch/application/o/authorize/";
|
||||
tokenUrl = "https://auth.dtth.ch/application/o/token/";
|
||||
userinfoUrl = "https://auth.dtth.ch/application/o/userinfo/";
|
||||
displayName = "DTTH Account";
|
||||
};
|
||||
|
||||
smtp = {
|
||||
fromEmail = "DTTH Wiki <dtth.wiki@nkagami.me>";
|
||||
replyEmail = "";
|
||||
host = "mx1.nkagami.me";
|
||||
username = "dtth.wiki@nkagami.me";
|
||||
passwordFile = config.sops.secrets."outline/smtp-password".path;
|
||||
port = 465;
|
||||
secure = true;
|
||||
};
|
||||
|
||||
forceHttps = false;
|
||||
};
|
||||
cloud.postgresql.databases = [ "outline" ];
|
||||
systemd.services.outline.requires = [ "postgresql.service" ];
|
||||
cloud.traefik.hosts.outline = { host = "wiki.dtth.ch"; port = 18729; };
|
||||
|
||||
# GoToSocial
|
||||
sops.secrets.gts-env = { };
|
||||
sops.secrets.gts-env = { restartUnits = [ "gotosocial.service" ]; };
|
||||
cloud.gotosocial = {
|
||||
enable = true;
|
||||
envFile = config.sops.secrets.gts-env.path;
|
||||
};
|
||||
|
||||
# Minio
|
||||
sops.secrets.minio-credentials = { };
|
||||
services.minio = {
|
||||
enable = true;
|
||||
listenAddress = ":61929";
|
||||
consoleAddress = ":62929";
|
||||
rootCredentialsFile = config.sops.secrets.minio-credentials.path;
|
||||
dataDir = lib.mkForce [ "/mnt/data/minio" ];
|
||||
};
|
||||
cloud.traefik.hosts.minio = { host = "s3.dtth.ch"; port = 61929; };
|
||||
system.stateVersion = "21.11";
|
||||
|
||||
# ntfy
|
||||
cloud.traefik.hosts.ntfy-sh = { host = "ntfy.nkagami.me"; port = 11161; noCloudflare = true; };
|
||||
services.ntfy-sh = {
|
||||
|
|
|
@ -98,6 +98,7 @@ in
|
|||
};
|
||||
users.groups.${user} = { };
|
||||
sops.secrets."gitea/signing-key".owner = user;
|
||||
sops.secrets."gitea/minio-secret-key".owner = user;
|
||||
sops.secrets."gitea/mailer-password".owner = user;
|
||||
# database
|
||||
cloud.postgresql.databases = [ user ];
|
||||
|
@ -174,6 +175,17 @@ in
|
|||
PATH = "${pkgs.git}/bin/git";
|
||||
};
|
||||
|
||||
storage = {
|
||||
STORAGE_TYPE = "minio";
|
||||
MINIO_USE_SSL = "true";
|
||||
MINIO_ENDPOINT = "60c0807121eb35ef52cdcd4a33735fa6.r2.cloudflarestorage.com";
|
||||
MINIO_ACCESS_KEY_ID = "704c29ade7a8b438b77ab520da2799ca";
|
||||
MINIO_SECRET_ACCESS_KEY = "#miniosecretkey#";
|
||||
MINIO_BUCKET = "dtth-gitea";
|
||||
MINIO_LOCATION = "auto";
|
||||
MINIO_CHECKSUM_ALGORITHM = "md5"; # R2 moment
|
||||
};
|
||||
|
||||
federation.ENABLED = true;
|
||||
DEFAULT.APP_NAME = "DTTHGit";
|
||||
};
|
||||
|
@ -203,17 +215,25 @@ in
|
|||
environment.GNUPGHOME = "${config.services.gitea.stateDir}/.gnupg";
|
||||
# https://github.com/NixOS/nixpkgs/commit/93c1d370db28ad4573fb9890c90164ba55391ce7
|
||||
serviceConfig.SystemCallFilter = mkForce "~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @setuid @swap";
|
||||
preStart = ''
|
||||
# Import the signing subkey
|
||||
if cat ${config.services.gitea.stateDir}/.gnupg/gpg.conf | grep -q ${signingKey}; then
|
||||
echo "Keys already imported"
|
||||
# imported
|
||||
else
|
||||
echo "Import your keys!"
|
||||
${pkgs.gnupg}/bin/gpg --quiet --import ${secrets."gitea/signing-key".path}
|
||||
echo "trusted-key ${signingKey}" >> ${config.services.gitea.stateDir}/.gnupg/gpg.conf
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
preStart =
|
||||
let
|
||||
configFile = "${config.services.forgejo.customDir}/conf/app.ini";
|
||||
in
|
||||
''
|
||||
# Update minio secret key
|
||||
chmod u+w ${configFile} && \
|
||||
${lib.getExe pkgs.replace-secret} '#miniosecretkey#' '${config.sops.secrets."gitea/minio-secret-key".path}' '${configFile}' && \
|
||||
chmod u-w ${configFile}
|
||||
# Import the signing subkey
|
||||
if cat ${config.services.forgejo.stateDir}/.gnupg/gpg.conf | grep -q ${signingKey}; then
|
||||
echo "Keys already imported"
|
||||
# imported
|
||||
else
|
||||
echo "Import your keys!"
|
||||
${pkgs.gnupg}/bin/gpg --quiet --import ${secrets."gitea/signing-key".path}
|
||||
echo "trusted-key ${signingKey}" >> ${config.services.forgejo.stateDir}/.gnupg/gpg.conf
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
swapDevices = [{ device = "/var/swapfile"; size = 4 * 1024; priority = 1024; }];
|
||||
zramSwap.enable = true;
|
||||
# volumes
|
||||
services.btrfs.autoScrub.enable = true;
|
||||
fileSystems.data = {
|
||||
device = "/dev/disk/by-id/scsi-0HC_Volume_31812942";
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-id/scsi-0HC_Volume_101470796";
|
||||
fsType = "btrfs";
|
||||
mountPoint = "/mnt/data";
|
||||
options = [ "compress=zstd" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
user = "nextcloud";
|
||||
host = "cloud.dtth.ch";
|
||||
port = 61155;
|
||||
|
||||
secrets = config.sops.secrets;
|
||||
in
|
||||
{
|
||||
sops.secrets."nextcloud/admin-password" = { owner = user; };
|
||||
sops.secrets."nextcloud/minio-secret-key" = { owner = user; key = "minio-secret-key"; };
|
||||
# database
|
||||
cloud.postgresql.databases = [ user ];
|
||||
# traefik
|
||||
cloud.traefik.hosts.nextcloud = {
|
||||
inherit port host;
|
||||
};
|
||||
systemd.services.nextcloud.requires = [ "postgresql.service" ];
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
hostName = host;
|
||||
package = pkgs.nextcloud26;
|
||||
enableBrokenCiphersForSSE = false;
|
||||
|
||||
home = "/mnt/data/nextcloud";
|
||||
https = true;
|
||||
database.createLocally = false;
|
||||
|
||||
extraApps = with pkgs.nextcloud26Packages.apps; {
|
||||
inherit calendar contacts deck forms groupfolders news tasks;
|
||||
sociallogin = pkgs.fetchNextcloudApp rec {
|
||||
url = "https://github.com/zorn-v/nextcloud-social-login/releases/download/v5.4.3/release.tar.gz";
|
||||
sha256 = "sha256-ZKwtF9j9WFIk3MZgng9DmN00A73S2Rb4qbehL9adaZo=";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Database
|
||||
dbtype = "pgsql";
|
||||
dbname = user;
|
||||
dbuser = user;
|
||||
dbhost = "/run/postgresql";
|
||||
# User
|
||||
adminuser = "nki";
|
||||
adminpassFile = secrets."nextcloud/admin-password".path;
|
||||
# General
|
||||
overwriteProtocol = "https";
|
||||
defaultPhoneRegion = "VN";
|
||||
|
||||
objectstore.s3 = {
|
||||
enable = true;
|
||||
bucket = "nextcloud-dtth";
|
||||
autocreate = true;
|
||||
key = "minio";
|
||||
secretFile = config.sops.secrets."nextcloud/minio-secret-key".path;
|
||||
hostname = "s3.dtth.ch";
|
||||
port = 443;
|
||||
useSsl = true;
|
||||
usePathStyle = true;
|
||||
region = "us-east-1";
|
||||
};
|
||||
};
|
||||
};
|
||||
services.nginx.virtualHosts.${host}.listen = [{ inherit port; addr = "127.0.0.1"; }];
|
||||
}
|
||||
|
56
nki-personal-do/outline.nix
Normal file
56
nki-personal-do/outline.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ config, pkgs, ... }: {
|
||||
sops.secrets.authentik-oidc-client-secret = { owner = "outline"; };
|
||||
sops.secrets."outline/smtp-password" = { owner = "outline"; };
|
||||
sops.secrets."outline/s3-secret-key" = { owner = "outline"; };
|
||||
|
||||
services.outline = {
|
||||
enable = true;
|
||||
package = pkgs.outline.overrideAttrs (attrs: {
|
||||
patches = attrs.patches or [ ] ++ [
|
||||
../modules/cloud/outline/dtth-wiki.patch
|
||||
../modules/cloud/outline/r2.patch
|
||||
];
|
||||
});
|
||||
databaseUrl = "postgres://outline:outline@localhost/outline?sslmode=disable";
|
||||
redisUrl = "local";
|
||||
publicUrl = "https://wiki.dtth.ch";
|
||||
port = 18729;
|
||||
storage = {
|
||||
accessKey = "6ef730e13f172d2ed6ed77f0b5b9bad9";
|
||||
secretKeyFile = config.sops.secrets."outline/s3-secret-key".path;
|
||||
region = "auto";
|
||||
uploadBucketUrl = "https://60c0807121eb35ef52cdcd4a33735fa6.r2.cloudflarestorage.com";
|
||||
uploadBucketName = "dtth-outline";
|
||||
uploadMaxSize = 50 * 1024 * 1000;
|
||||
};
|
||||
maximumImportSize = 50 * 1024 * 1000;
|
||||
|
||||
oidcAuthentication = {
|
||||
clientId = "3a0c10e00cdcb4a1194315577fa208a747c1a5f7";
|
||||
clientSecretFile = config.sops.secrets.authentik-oidc-client-secret.path;
|
||||
authUrl = "https://auth.dtth.ch/application/o/authorize/";
|
||||
tokenUrl = "https://auth.dtth.ch/application/o/token/";
|
||||
userinfoUrl = "https://auth.dtth.ch/application/o/userinfo/";
|
||||
displayName = "DTTH Account";
|
||||
};
|
||||
|
||||
smtp = {
|
||||
fromEmail = "DTTH Wiki <dtth.wiki@nkagami.me>";
|
||||
replyEmail = "";
|
||||
host = "mx1.nkagami.me";
|
||||
username = "dtth.wiki@nkagami.me";
|
||||
passwordFile = config.sops.secrets."outline/smtp-password".path;
|
||||
port = 465;
|
||||
secure = true;
|
||||
};
|
||||
|
||||
forceHttps = false;
|
||||
};
|
||||
cloud.postgresql.databases = [ "outline" ];
|
||||
systemd.services.outline.requires = [ "postgresql.service" ];
|
||||
systemd.services.outline.environment = {
|
||||
AWS_S3_R2 = "true";
|
||||
AWS_S3_R2_PUBLIC_URL = "https://s3.wiki.dtth.ch";
|
||||
};
|
||||
cloud.traefik.hosts.outline = { host = "wiki.dtth.ch"; port = 18729; };
|
||||
}
|
File diff suppressed because one or more lines are too long
21
overlay.nix
21
overlay.nix
|
@ -25,7 +25,7 @@ let
|
|||
|
||||
overlay-versioning = final: prev: {
|
||||
gotosocial = prev.gotosocial.overrideAttrs (attrs: rec {
|
||||
version = "0.17.0-rc3";
|
||||
version = "0.17.1";
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
|
@ -35,13 +35,13 @@ let
|
|||
|
||||
web-assets = final.fetchurl {
|
||||
url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v${version}/gotosocial_${version}_web-assets.tar.gz";
|
||||
hash = "sha256-Uwltr5syOnDZOgMc2L/iedxiMMKXmULzm0SAs3W0SXQ=";
|
||||
hash = "sha256-rGntLlIbgfCtdqpD7tnvAY8qwF+BpYbQWfAGMhdOTgY=";
|
||||
};
|
||||
src = final.fetchFromGitHub {
|
||||
owner = "superseriousbusiness";
|
||||
repo = "gotosocial";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-c7CJFQWTMCBZuzI/Mf5PJuCWY1NKW4LLMAJem3TTJvM=";
|
||||
hash = "sha256-oWWsCs9jgd244yzWhgLkuHp7kY0BQ8+Ay6KpuBVG+U8=";
|
||||
};
|
||||
postInstall = ''
|
||||
tar xf ${web-assets}
|
||||
|
@ -87,13 +87,6 @@ let
|
|||
})
|
||||
];
|
||||
};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/issues/334822
|
||||
vulkan-validation-layers = prev.vulkan-validation-layers.overrideAttrs (attrs: {
|
||||
buildInputs = attrs.buildInputs ++ [
|
||||
final.spirv-tools
|
||||
];
|
||||
});
|
||||
};
|
||||
|
||||
overlay-libs = final: prev: {
|
||||
|
@ -101,7 +94,7 @@ let
|
|||
};
|
||||
|
||||
overlay-packages = final: prev: {
|
||||
kak-tree-sitter = final.callPackage ./packages/common/kak-tree-sitter.nix { rustPlatform = final.unstable.rustPlatform; };
|
||||
kak-tree-sitter = final.callPackage ./packages/common/kak-tree-sitter { rustPlatform = final.unstable.rustPlatform; };
|
||||
|
||||
kak-lsp =
|
||||
let
|
||||
|
@ -113,7 +106,13 @@ let
|
|||
buildInputs = (with final;
|
||||
lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration CoreServices ])
|
||||
) ++ (with final; [ libiconv ]);
|
||||
|
||||
meta.mainProgram = "kak-lsp";
|
||||
};
|
||||
|
||||
zen-browser-bin = final.callPackage ./packages/x86_64-linux/zen-browser-bin.nix {
|
||||
nativeMessagingHosts = with final; [ kdePackages.plasma-browser-integration ];
|
||||
};
|
||||
};
|
||||
|
||||
overlay-rust-is-dumb = final: prev: {
|
||||
|
|
|
@ -2,4 +2,5 @@ final: prev: {
|
|||
epfl-cups-drivers = final.callPackage ./epfl-cups-drivers { };
|
||||
ttaenc = final.callPackage ./ttaenc.nix { };
|
||||
suwako-cursors = final.callPackage ./suwako-cursors { };
|
||||
nki-kakoune = final.callPackage ./nki-kakoune { };
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ let
|
|||
self.runtime_dir.join("sources").join(url_dir)
|
||||
'')
|
||||
];
|
||||
|
||||
meta.mainProgram = "kak-tree-sitter";
|
||||
};
|
||||
in
|
||||
kak-tree-sitter
|
25
packages/common/nki-kakoune/default.nix
Normal file
25
packages/common/nki-kakoune/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ callPackage, kakoune, kakoune-unwrapped, ... }:
|
||||
let
|
||||
lsp = callPackage ./lsp.nix { };
|
||||
rc = (callPackage ./rc.nix { });
|
||||
in
|
||||
(kakoune.override {
|
||||
plugins = callPackage ./plugins.nix { }
|
||||
++ callPackage ./themes.nix { }
|
||||
++ [
|
||||
(callPackage ./kaktex { })
|
||||
(callPackage ./faces.nix { })
|
||||
rc
|
||||
lsp.plugin
|
||||
];
|
||||
}).overrideAttrs (attrs: {
|
||||
buildCommand = ''
|
||||
${attrs.buildCommand or ""}
|
||||
# location of kak binary is used to find ../share/kak/autoload,
|
||||
# unless explicitly overriden with KAKOUNE_RUNTIME
|
||||
rm "$out/bin/kak"
|
||||
makeWrapper "${kakoune-unwrapped}/bin/kak" "$out/bin/kak" \
|
||||
--set KAKOUNE_RUNTIME "$out/share/kak" \
|
||||
--suffix PATH ":" "${lsp.extraPaths}"
|
||||
'';
|
||||
})
|
31
packages/common/nki-kakoune/faces.nix
Normal file
31
packages/common/nki-kakoune/faces.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ callPackage, ... } :
|
||||
let
|
||||
utils = callPackage ./utils.nix { };
|
||||
faces = {
|
||||
Default = "%opt{text},%opt{base}";
|
||||
BufferPadding = "%opt{base},%opt{base}";
|
||||
MenuForeground = "%opt{blue},white+bF";
|
||||
MenuBackground = "%opt{sky},white+F";
|
||||
Information = "%opt{sky},white";
|
||||
# Markdown help color scheme
|
||||
InfoDefault = "Information";
|
||||
InfoBlock = "@block";
|
||||
InfoBlockQuote = "+i@block";
|
||||
InfoBullet = "@bullet";
|
||||
InfoHeader = "@header";
|
||||
InfoLink = "@link";
|
||||
InfoLinkMono = "+b@mono";
|
||||
InfoMono = "@mono";
|
||||
InfoRule = "+b@Information";
|
||||
InfoDiagnosticError = "@DiagnosticError";
|
||||
InfoDiagnosticHint = "@DiagnosticHint";
|
||||
InfoDiagnosticInformation = "@Information";
|
||||
InfoDiagnosticWarning = "@DiagnosticWarning";
|
||||
# Extra faces
|
||||
macro = "+u@function";
|
||||
method = "@function";
|
||||
format_specifier = "+i@string";
|
||||
mutable_variable = "+i@variable";
|
||||
class = "+b@variable";
|
||||
};
|
||||
in utils.mkFacesScript "default-faces" faces
|
|
@ -1,6 +1,3 @@
|
|||
# Enable kak-tree-sitter
|
||||
eval %sh{test -z "$WE_STARTED_KAK" && kak-tree-sitter --kakoune -d --server --init $kak_session}
|
||||
map global normal <c-t> ": enter-user-mode tree-sitter<ret>"
|
||||
# ## Set some color overrides
|
||||
# set global kts_yellow "rgb:e2b75e"
|
||||
# set global kts_teal "rgb:008080"
|
||||
|
@ -8,6 +5,7 @@ map global normal <c-t> ": enter-user-mode tree-sitter<ret>"
|
|||
# set global kts_sky "rgb:6aa622"
|
||||
# Color scheme
|
||||
colorscheme catppuccin-latte
|
||||
set-face global module "%opt{sapphire}"
|
||||
set global base "default"
|
||||
|
||||
# Set indentation guides
|
||||
|
@ -90,47 +88,6 @@ hook global InsertCompletionHide .* %{
|
|||
unmap window insert <s-tab> <c-p>
|
||||
}
|
||||
|
||||
# Enable LSP
|
||||
try %{
|
||||
eval %sh{test -z "$WE_STARTED_KAK" && kak-lsp --kakoune -s $kak_session}
|
||||
set-option global lsp_cmd "kak-lsp -s %val{session}"
|
||||
}
|
||||
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|fsharp|ocaml|haskell|nix|scala|typst|html|css|json|markdown|templ|elixir) %{
|
||||
lsp-enable-window
|
||||
map window lsp N -docstring "Display the next message request" ": lsp-show-message-request-next<ret>"
|
||||
map window normal <c-l> ": enter-user-mode lsp<ret>"
|
||||
map window normal <c-h> ": lsp-hover<ret>"
|
||||
map window normal <c-s-h> ": lsp-hover-buffer<ret>"
|
||||
# lsp-auto-hover-insert-mode-enable
|
||||
set window lsp_hover_anchor true
|
||||
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
||||
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
||||
map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
|
||||
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
|
||||
map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|haskell|nix|fsharp|templ) %{
|
||||
# Format the document if possible
|
||||
hook window BufWritePre .* %{ lsp-formatting-sync }
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(rust|scala|fsharp) %{
|
||||
# Enable inlay hints
|
||||
lsp-inlay-hints-enable window
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(rust|go|fsharp|typst|scala) %{
|
||||
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
|
||||
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
|
||||
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window semantic-tokens
|
||||
}
|
||||
}
|
||||
|
||||
# <a-a> in Insert mode moves to end of line.
|
||||
map global insert <a-a> '<esc>A'
|
||||
|
||||
|
@ -174,7 +131,6 @@ hook global WinSetOption filetype=(typst) %{
|
|||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ }
|
||||
}
|
||||
|
||||
|
||||
define-command -params 0 -docstring "Set up build" scala-build-connect %{
|
||||
lsp-execute-command 'build-connect' '"[]"'
|
||||
}
|
22
packages/common/nki-kakoune/kaktex/default.nix
Normal file
22
packages/common/nki-kakoune/kaktex/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ fish, lib, writeScript, writeTextDir, kakouneUtils, ... }:
|
||||
let
|
||||
kaktex-script = writeScript "kaktex" ''
|
||||
#!/usr/bin/env ${lib.getExe fish}
|
||||
|
||||
${builtins.readFile ./kaktex.fish}
|
||||
'';
|
||||
kaktex = writeTextDir "kaktex.kak" ''
|
||||
hook global WinSetOption filetype=(tex|latex) %{
|
||||
hook window WinDisplay '.*' %{
|
||||
eval %sh{
|
||||
${kaktex-script} set $kak_client $kak_session
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
in
|
||||
kakouneUtils.buildKakounePluginFrom2Nix {
|
||||
pname = "kaktex";
|
||||
version = "latest";
|
||||
src = kaktex;
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
function usage
|
||||
echo "Usage: "
|
||||
echo " kaktex set [client] [session]"
|
307
packages/common/nki-kakoune/lsp.nix
Normal file
307
packages/common/nki-kakoune/lsp.nix
Normal file
|
@ -0,0 +1,307 @@
|
|||
{ lib
|
||||
, writeTextDir
|
||||
, formats
|
||||
, kak-lsp
|
||||
, # LSP packages
|
||||
ccls
|
||||
, gopls
|
||||
, nil
|
||||
, nixpkgs-fmt
|
||||
, python311Packages
|
||||
, ltex-ls
|
||||
, nodePackages
|
||||
, tailwindcss-language-server
|
||||
, fsautocomplete
|
||||
, metals
|
||||
, texlab
|
||||
, marksman
|
||||
, rust-analyzer
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
# Configuration for kak-lsp
|
||||
config = {
|
||||
languageIDs = {
|
||||
c = "c_cpp";
|
||||
cpp = "c_cpp";
|
||||
javascript = "javascriptreact";
|
||||
typescript = "typescriptreact";
|
||||
protobuf = "proto";
|
||||
sh = "shellscript";
|
||||
};
|
||||
|
||||
languageServers =
|
||||
let
|
||||
vscodeServerOf = name: {
|
||||
name = "vscode-${name}-language-server";
|
||||
value = {
|
||||
args = [ "--stdio" ];
|
||||
command = "vscode-${name}-language-server";
|
||||
filetypes = [ name "templ" ];
|
||||
roots = [ "package.json" ".git" ];
|
||||
package = nodePackages.vscode-langservers-extracted;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
ccls = {
|
||||
args = [ "-v=2" "-log-file=/tmp/ccls.log" ];
|
||||
package = ccls;
|
||||
command = "ccls";
|
||||
filetypes = [ "c" "cpp" ];
|
||||
roots = [ "compile_commands.json" ".cquery" ".git" ];
|
||||
};
|
||||
gopls = {
|
||||
command = "gopls";
|
||||
package = gopls;
|
||||
filetypes = [ "go" ];
|
||||
offset_encoding = "utf-8";
|
||||
roots = [ "Gopkg.toml" "go.mod" ".git" ".hg" ];
|
||||
settings = { gopls = { hoverKind = "SynopsisDocumentation"; semanticTokens = true; }; };
|
||||
settings_section = "gopls";
|
||||
};
|
||||
haskell-language-server = {
|
||||
args = [ "--lsp" ];
|
||||
command = "haskell-language-server-wrapper";
|
||||
filetypes = [ "haskell" ];
|
||||
roots = [ "Setup.hs" "stack.yaml" "*.cabal" "package.yaml" ];
|
||||
settings_section = "haskell";
|
||||
};
|
||||
nil = {
|
||||
command = "nil";
|
||||
package = nil;
|
||||
filetypes = [ "nix" ];
|
||||
roots = [ "flake.nix" "shell.nix" ".git" ];
|
||||
settings.nil = {
|
||||
formatting.command = [ "${lib.getExe nixpkgs-fmt}" ];
|
||||
};
|
||||
};
|
||||
pylsp = {
|
||||
command = "pylsp";
|
||||
package = python311Packages.python-lsp-server;
|
||||
filetypes = [ "python" ];
|
||||
offset_encoding = "utf-8";
|
||||
roots = [ "requirements.txt" "setup.py" ".git" ".hg" ];
|
||||
};
|
||||
# Spellchecking server
|
||||
ltex-ls = {
|
||||
command = "ltex-ls";
|
||||
args = [ "--log-file=/tmp" ];
|
||||
filetypes = [ "latex" "typst" ];
|
||||
roots = [ "main.tex" "main.typ" ".git" ];
|
||||
package = ltex-ls;
|
||||
};
|
||||
tailwind = {
|
||||
command = "tailwindcss-language-server";
|
||||
args = [ "--stdio" ];
|
||||
filetypes = [ "html" "css" "javascript" "typescript" "templ" ];
|
||||
roots = [ "tailwind.config.{js,cjs,mjs,ts}" "package.json" ".git" ];
|
||||
settings_section = "tailwindCSS";
|
||||
settings.tailwindCSS = {
|
||||
validate = "warning";
|
||||
userLanguages.templ = "html";
|
||||
};
|
||||
package = tailwindcss-language-server;
|
||||
};
|
||||
elixir-ls = {
|
||||
args = [ ];
|
||||
command = "elixir-ls";
|
||||
filetypes = [ "elixir" ];
|
||||
roots = [ "mix.exs" ];
|
||||
};
|
||||
typescript-language-server = {
|
||||
args = [ "--stdio" ];
|
||||
command = "typescript-language-server";
|
||||
filetypes = [ "typescript" "javascript" ];
|
||||
roots = [ "package.json" ];
|
||||
package = nodePackages.typescript-language-server;
|
||||
};
|
||||
fsautocomplete = {
|
||||
args = [ "--adaptive-lsp-server-enabled" "--project-graph-enabled" "--source-text-factory" "RoslynSourceText" ];
|
||||
command = "fsautocomplete";
|
||||
filetypes = [ "fsharp" ];
|
||||
roots = [ "*.fsproj" ];
|
||||
settings_section = "FSharp";
|
||||
settings.FSharp = {
|
||||
AutomaticWorkspaceInit = true;
|
||||
};
|
||||
package = fsautocomplete;
|
||||
};
|
||||
metals = {
|
||||
command = "metals";
|
||||
filetypes = [ "scala" ];
|
||||
roots = [ "build.sbt" "build.sc" ];
|
||||
settings_section = "metals";
|
||||
settings.metals = {
|
||||
enableSemanticHighlighting = true;
|
||||
showInferredType = true;
|
||||
decorationProvider = true;
|
||||
inlineDecorationProvider = true;
|
||||
# From kakoune-lsp's own options
|
||||
icons = "unicode";
|
||||
isHttpEnabled = true;
|
||||
statusBarProvider = "log-message";
|
||||
compilerOptions = { overrideDefFormat = "unicode"; };
|
||||
};
|
||||
package = metals;
|
||||
};
|
||||
texlab = {
|
||||
command = "texlab";
|
||||
filetypes = [ "latex" ];
|
||||
roots = [ "main.tex" "all.tex" ".git" ];
|
||||
settings_section = "texlab";
|
||||
settings.texlab = {
|
||||
build.executable = "latexmk";
|
||||
build.args = [ "-pdf" "-shell-escape" "-interaction=nonstopmode" "-synctex=1" "%f" ];
|
||||
|
||||
build.forwardSearchAfter = true;
|
||||
build.onSave = true;
|
||||
|
||||
# forwardSearch =
|
||||
# (if pkgs.stdenv.isDarwin then {
|
||||
# executable = "/Applications/Skim.app/Contents/SharedSupport/displayline";
|
||||
# args = [ "-r" "-g" "%l" "%p" "%f" ];
|
||||
# } else
|
||||
# {
|
||||
# executable = "${pkgs.zathura}/bin/zathura";
|
||||
# args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "${./kaktex} jump %%{input} %%{line} %%{column}" ];
|
||||
# });
|
||||
};
|
||||
package = texlab;
|
||||
};
|
||||
typst-lsp = {
|
||||
command = "typst-lsp";
|
||||
filetypes = [ "typst" ];
|
||||
roots = [ "main.typ" ".git" ];
|
||||
settings_section = "typst-lsp";
|
||||
settings.typst-lsp = {
|
||||
experimentalFormatterMode = "on";
|
||||
};
|
||||
};
|
||||
marksman = {
|
||||
command = "marksman";
|
||||
filetypes = [ "markdown" ];
|
||||
roots = [ ".marksman.toml" ".git" ];
|
||||
package = marksman;
|
||||
};
|
||||
rust-analyzer = {
|
||||
args = [ ];
|
||||
command = "rust-analyzer";
|
||||
filetypes = [ "rust" ];
|
||||
roots = [ "Cargo.toml" ];
|
||||
package = rust-analyzer;
|
||||
};
|
||||
|
||||
} // (builtins.listToAttrs (builtins.map vscodeServerOf [ "html" "css" "json" ]));
|
||||
|
||||
faces = [
|
||||
## Items
|
||||
# (Rust) Macros
|
||||
{ face = "attribute"; token = "attribute"; }
|
||||
{ face = "attribute"; token = "derive"; }
|
||||
{ face = "macro"; token = "macro"; } # Function-like Macro
|
||||
# Keyword and Fixed Tokens
|
||||
{ face = "keyword"; token = "keyword"; }
|
||||
{ face = "operator"; token = "operator"; }
|
||||
# Functions and Methods
|
||||
{ face = "function"; token = "function"; }
|
||||
{ face = "method"; token = "method"; }
|
||||
# Constants
|
||||
{ face = "string"; token = "string"; }
|
||||
{ face = "format_specifier"; token = "formatSpecifier"; }
|
||||
# Variables
|
||||
{ face = "variable"; token = "variable"; modifiers = [ "readonly" ]; }
|
||||
{ face = "mutable_variable"; token = "variable"; }
|
||||
{ face = "module"; token = "namespace"; }
|
||||
{ face = "variable"; token = "type_parameter"; }
|
||||
{ face = "class"; token = "enum"; }
|
||||
{ face = "class"; token = "struct"; }
|
||||
{ face = "class"; token = "trait"; }
|
||||
{ face = "class"; token = "union"; }
|
||||
{ face = "class"; token = "class"; }
|
||||
|
||||
## Comments
|
||||
{ face = "documentation"; token = "comment"; modifiers = [ "documentation" ]; }
|
||||
{ face = "comment"; token = "comment"; }
|
||||
|
||||
# Typst
|
||||
{ face = "header"; token = "heading"; }
|
||||
{ face = "ts_markup_link_url"; token = "link"; }
|
||||
{ face = "ts_markup_link_uri"; token = "ref"; }
|
||||
{ face = "ts_markup_link_label"; token = "label"; }
|
||||
{ face = "ts_property"; token = "pol"; }
|
||||
{ face = "ts_markup_list_checked"; token = "marker"; }
|
||||
{ face = "ts_constant_builtin_boolean"; token = "bool"; }
|
||||
{ face = "ts_keyword_control"; token = "delim"; }
|
||||
{ face = "ts_number"; token = "text"; modifiers = [ "math" ]; }
|
||||
{ face = "ts_markup_bold"; token = "text"; modifiers = [ "strong" ]; }
|
||||
{ face = "ts_markup_italic"; token = "text"; modifiers = [ "emph" ]; }
|
||||
];
|
||||
|
||||
raw = {
|
||||
server = { timeout = 1800; };
|
||||
snippet_support = false;
|
||||
verbosity = 255;
|
||||
};
|
||||
};
|
||||
|
||||
kak-lsp-config =
|
||||
let
|
||||
toml = formats.toml { };
|
||||
toLspConfig = builtins.mapAttrs (_: attrs: builtins.removeAttrs attrs [ "package" ]);
|
||||
in
|
||||
toml.generate "kak-lsp.toml" ({
|
||||
semantic_tokens.faces = config.faces;
|
||||
language_server = toLspConfig config.languageServers;
|
||||
language_ids = config.languageIDs;
|
||||
} // config.raw);
|
||||
|
||||
serverPackages =
|
||||
builtins.filter (v: v != null)
|
||||
(lib.mapAttrsToList (_: serv: serv.package or null) config.languageServers);
|
||||
in
|
||||
{
|
||||
extraPaths = lib.makeBinPath serverPackages;
|
||||
plugin = writeTextDir "share/kak/autoload/kak-lsp.kak" ''
|
||||
hook global KakBegin .* %{
|
||||
try %{
|
||||
eval %sh{${lib.getExe kak-lsp} --kakoune --config ${kak-lsp-config} -s $kak_session}
|
||||
}
|
||||
|
||||
lsp-enable
|
||||
map global lsp N -docstring "Display the next message request" ": lsp-show-message-request-next<ret>"
|
||||
map global normal <c-l> ": enter-user-mode lsp<ret>"
|
||||
map global normal <c-h> ": lsp-hover<ret>"
|
||||
map global normal <c-s-h> ": lsp-hover-buffer<ret>"
|
||||
# lsp-auto-hover-insert-mode-enable
|
||||
set global lsp_hover_anchor true
|
||||
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
||||
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
||||
map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
|
||||
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
|
||||
map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
|
||||
|
||||
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|haskell|nix|fsharp|templ) %{
|
||||
# Format the document if possible
|
||||
hook window BufWritePre .* %{ lsp-formatting-sync }
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(rust|scala|fsharp) %{
|
||||
# Enable inlay hints
|
||||
lsp-inlay-hints-enable window
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(rust|go|fsharp|typst|scala) %{
|
||||
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
|
||||
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
|
||||
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window semantic-tokens
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
205
packages/common/nki-kakoune/plugins.nix
Normal file
205
packages/common/nki-kakoune/plugins.nix
Normal file
|
@ -0,0 +1,205 @@
|
|||
{ pkgs, symlinkJoin, writeTextDir, kakouneUtils, ... }:
|
||||
with {
|
||||
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
|
||||
};
|
||||
let
|
||||
toDir = name: file: writeTextDir name (builtins.readFile file);
|
||||
|
||||
writeActivationScript = script: writeTextDir "on-load.kak" ''
|
||||
hook global KakBegin .* %{
|
||||
${script}
|
||||
}
|
||||
'';
|
||||
|
||||
writeModuleWrapper = name: script: writeTextDir "module.kak" ''
|
||||
provide-module ${name} %◍
|
||||
${script}
|
||||
◍
|
||||
'';
|
||||
|
||||
kakounePlugin = { name, src, wrapAsModule ? false, activationScript ? null, ... }@attrs:
|
||||
let
|
||||
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
|
||||
in
|
||||
buildKakounePluginFrom2Nix {
|
||||
pname = name;
|
||||
version = attrs.version or "latest";
|
||||
src = if activationScript == null then module else
|
||||
symlinkJoin {
|
||||
name = "${name}-src";
|
||||
paths = [
|
||||
module
|
||||
(writeActivationScript activationScript)
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
builtins.map kakounePlugin [
|
||||
# My own scripts
|
||||
{
|
||||
name = "latex.kak";
|
||||
src = toDir "latex.kak" ./autoload/latex.kak;
|
||||
}
|
||||
{
|
||||
name = "markdown.kak";
|
||||
src = toDir "markdown.kak" ./autoload/markdown.kak;
|
||||
}
|
||||
|
||||
# Plugins
|
||||
{
|
||||
name = "luar";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "gustavo-hms";
|
||||
repo = "luar";
|
||||
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
||||
sha256 = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
|
||||
};
|
||||
activationScript = ''
|
||||
# Enable luar
|
||||
require-module luar
|
||||
# Use luajit
|
||||
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "peneira";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "peneira";
|
||||
rev = "743b9971472853a752475e7c070ce99089c6840c";
|
||||
sha256 = "sha256-E4ndbF9YC1p0KrvSuGgwmG1Y2IGTuGKJo/AuMixhzlM=";
|
||||
};
|
||||
activationScript = ''
|
||||
require-module peneira
|
||||
|
||||
# Change selection color
|
||||
set-face global PeneiraSelected @PrimarySelection
|
||||
|
||||
# Buffers list
|
||||
define-command -hidden peneira-buffers %{
|
||||
peneira 'buffers: ' %{ printf '%s\n' $kak_quoted_buflist } %{
|
||||
buffer %arg{1}
|
||||
}
|
||||
}
|
||||
|
||||
# Grep in the current location
|
||||
define-command peneira-grep %{
|
||||
peneira 'line: ' "rg -n ." %{
|
||||
lua %arg{1} %{
|
||||
local file, line = arg[1]:match("([^:]+):(%d+):")
|
||||
kak.edit(file, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# A peneira menu
|
||||
declare-user-mode fuzzy-match-menu
|
||||
|
||||
map -docstring "Switch to buffer" global fuzzy-match-menu b ": peneira-buffers<ret>"
|
||||
map -docstring "Symbols" global fuzzy-match-menu s ": peneira-symbols<ret>"
|
||||
map -docstring "Lines" global fuzzy-match-menu l ": peneira-lines<ret>"
|
||||
map -docstring "Lines in the current directory" global fuzzy-match-menu g ": peneira-grep<ret>"
|
||||
map -docstring "Files in project" global fuzzy-match-menu f ": peneira-files<ret>"
|
||||
map -docstring "Files in currently opening file's directory" global fuzzy-match-menu F ": peneira-local-files<ret>"
|
||||
|
||||
# Bind menu to user mode
|
||||
map -docstring "Fuzzy matching" global user f ": enter-user-mode fuzzy-match-menu<ret>"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-focus";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "caksoylar";
|
||||
repo = "kakoune-focus";
|
||||
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
||||
sha256 = "sha256-ZV7jlLJQyL420YG++iC9rq1SMjo3WO5hR9KVvJNUiCs=";
|
||||
};
|
||||
activationScript = ''
|
||||
map global user <space> ': focus-toggle<ret>' -docstring "toggle selections focus"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-inc-dec";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "Screwtapello";
|
||||
repo = "kakoune-inc-dec";
|
||||
rev = "7bfe9c51";
|
||||
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "racket.kak";
|
||||
src = (builtins.fetchTree {
|
||||
type = "git";
|
||||
url = "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak.git";
|
||||
rev = "e397042009b46916ff089d79166ec0e8ca813a18";
|
||||
narHash = "sha256-IcxFmvG0jqpMCG/dT9crVRgPgMGKkic6xwrnW5z4+bc=";
|
||||
}) + "/rc";
|
||||
}
|
||||
# {
|
||||
# name = "kakoune-discord";
|
||||
# src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
||||
# }
|
||||
rec {
|
||||
name = "kakoune-mirror";
|
||||
src = pkgs.fetchFromGitHub
|
||||
{
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-mirror";
|
||||
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
|
||||
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
|
||||
} + "/mirror.kak";
|
||||
wrapAsModule = true;
|
||||
activationScript = ''
|
||||
require-module ${name}
|
||||
|
||||
# Bind <a-w> to ${name}
|
||||
map global normal <a-w> ': enter-user-mode -lock mirror<ret>'
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "unicode-math";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "natsukagami";
|
||||
repo = "kakoune-unicode-math";
|
||||
rev = "08dff25da2b86ee0b0777091992bc7fb28c3cb1d";
|
||||
# sha256 = lib.fakeSha256;
|
||||
sha256 = "sha256-j0L1ARex1i2ma8sGLYwgkfAbh0jWKh/6QGHFaxPXIKc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
activationScript = ''
|
||||
require-module unicode-math
|
||||
|
||||
# Bind <c-s> to the menu
|
||||
map global insert <c-s> '<a-;>: insert-unicode '
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "kakoune-buffers";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Delapouite";
|
||||
repo = "kakoune-buffers";
|
||||
rev = "6b2081f5b7d58c72de319a5cba7bf628b6802881";
|
||||
sha256 = "sha256-jOSrzGcLJjLK1GiTSsl2jLmQMPbPxjycR0pwF5t/eV0=";
|
||||
};
|
||||
activationScript = ''
|
||||
# Suggested hook
|
||||
|
||||
hook global WinDisplay .* info-buffers
|
||||
|
||||
# Suggested mappings
|
||||
|
||||
map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
|
||||
map global normal ^ ':enter-buffers-mode<ret>' -docstring 'buffers…'
|
||||
map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
|
||||
|
||||
# Suggested aliases
|
||||
|
||||
alias global bd delete-buffer
|
||||
alias global bf buffer-first
|
||||
alias global bl buffer-last
|
||||
alias global bo buffer-only
|
||||
alias global bo! buffer-only-force
|
||||
'';
|
||||
}
|
||||
]
|
27
packages/common/nki-kakoune/rc.nix
Normal file
27
packages/common/nki-kakoune/rc.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib
|
||||
, fish
|
||||
, writeScript
|
||||
, writeTextDir
|
||||
, prependRc ? ""
|
||||
, appendRc ? ""
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
source-pwd = writeScript "source-pwd" ''
|
||||
#!/usr/bin/env ${lib.getExe fish}
|
||||
|
||||
${builtins.readFile ./source-pwd.fish}
|
||||
'';
|
||||
in
|
||||
writeTextDir "share/kak/kakrc.local" ''
|
||||
${prependRc}
|
||||
${builtins.readFile ./kakrc}
|
||||
${appendRc}
|
||||
|
||||
# Source any settings in the current working directory,
|
||||
# recursive upwards
|
||||
evaluate-commands %sh{
|
||||
${source-pwd}
|
||||
}
|
||||
''
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
if test (pwd) = "/home/natsukagami/.config/kak"
|
||||
exit 0
|
||||
end
|
9
packages/common/nki-kakoune/themes.nix
Normal file
9
packages/common/nki-kakoune/themes.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ writeTextDir, ... }:
|
||||
let
|
||||
themes = [
|
||||
{ name = "catppuccin-latte"; src = ./themes/catppuccin-latte.kak; }
|
||||
];
|
||||
|
||||
themeToColorscheme = { name, src }: writeTextDir "share/kak/colors/${name}.kak" (builtins.readFile src);
|
||||
in
|
||||
builtins.map themeToColorscheme themes
|
7
packages/common/nki-kakoune/utils.nix
Normal file
7
packages/common/nki-kakoune/utils.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ lib, writeTextDir, ... }: {
|
||||
mkFacesScript = name: faces: writeTextDir "share/kak/autoload/${name}/faces.kak" ''
|
||||
hook global KakBegin .* %{
|
||||
${lib.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: face: " face global ${name} \"${face}\"") faces))}
|
||||
}
|
||||
'';
|
||||
}
|
32
packages/x86_64-linux/zen-browser-bin.nix
Normal file
32
packages/x86_64-linux/zen-browser-bin.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ appimageTools, fetchurl, nativeMessagingHosts ? [ ], ... }:
|
||||
let
|
||||
pname = "zen-browser-bin";
|
||||
version = "1.0.1-a.19";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen-specific.AppImage";
|
||||
hash = "sha256-qAPZ4VyVmeZLRfL0kPHF75zyrSUFHKQUSUcpYKs3jk8=";
|
||||
};
|
||||
|
||||
appimageContents = appimageTools.extract {
|
||||
inherit pname version src;
|
||||
};
|
||||
|
||||
in
|
||||
appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/${pname} $out/bin/zen
|
||||
install -m 444 -D ${appimageContents}/zen.desktop $out/share/applications/zen.desktop
|
||||
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/128x128/apps/zen.png \
|
||||
$out/share/icons/hicolor/128x128/apps/zen.png
|
||||
|
||||
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
||||
for ext in ${toString nativeMessagingHosts}; do
|
||||
ln -sLt $out/lib/mozilla/native-messaging-hosts $ext/lib/mozilla/native-messaging-hosts/*
|
||||
done
|
||||
'';
|
||||
|
||||
meta.mainProgram = "zen";
|
||||
}
|
||||
|
Loading…
Reference in a new issue