Compare commits

..

1 commit

Author SHA1 Message Date
42ea0f97b1 WIP: setup lua LSP
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-03-12 15:33:48 +00:00
181 changed files with 1811 additions and 2799 deletions

1
.envrc
View file

@ -1,4 +1,3 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg=" source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg="
fi fi

18
.nvim.lua Normal file
View file

@ -0,0 +1,18 @@
local lspconfig = require("lspconfig")
-- FIXME: https://github.com/folke/neodev.nvim ?
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
},
},
},
})

View file

@ -7,17 +7,17 @@ steps:
commands: commands:
- nix flake check - nix flake check
- name: notify - name: notifiy
image: bash image: bash
environment: secrets:
ADDRESS: - source: matrix_homeserver
from_secret: matrix_homeserver target: address
ROOM: - source: matrix_roomid
from_secret: matrix_roomid target: room
USER: - source: matrix_username
from_secret: matrix_username target: user
PASS: - source: matrix_password
from_secret: matrix_password target: pass
commands: commands:
- nix run '.#matrix-notifier' - nix run '.#matrix-notifier'
when: when:

120
flake.lock generated
View file

@ -14,11 +14,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762618334, "lastModified": 1707830867,
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=", "narHash": "sha256-PAdwm5QqdlwIqGrfzzvzZubM+FXtilekQ/FA0cI49/o=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "fcdea223397448d35d9b31f798479227e80183f6", "rev": "8cb01a0e717311680e0cbca06a76cbceba6f3ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -36,11 +36,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1744478979, "lastModified": 1700795494,
"narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "43975d782b418ebf4969e9ccba82466728c2851b", "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -53,11 +53,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1761588595, "lastModified": 1696426674,
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,11 +73,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1765835352, "lastModified": 1709336216,
"narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=", "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "a34fae9c08a15ad73f295041fec82323541400a9", "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -94,11 +94,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1709126324,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -108,42 +108,19 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1765911976,
"narHash": "sha256-t3T/xm8zstHRLx+pIHxVpQTiySbKqcQbK+r+01XVKc0=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "b68b780b69702a090c8bb1b973bab13756cc7a27",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "master",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"git-hooks", "pre-commit-hooks",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1709087332, "lastModified": 1703887061,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -159,11 +136,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1766171975, "lastModified": 1709988192,
"narHash": "sha256-47Ee0bTidhF/3/sHuYnWRuxcCrrm0mBNDxBkOTd3wWQ=", "narHash": "sha256-qxwIkl85P0I1/EyTT+NJwzbXdOv86vgZxcv4UKicjK8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "bb35f07cc95a73aacbaf1f7f46bb8a3f40f265b5", "rev": "b0b0c3d94345050a7f86d1ebc6c56eea4389d030",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -175,11 +152,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1766070988, "lastModified": 1709703039,
"narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=", "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c6245e83d836d0433170a16eb185cefe0572f8b8", "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -190,38 +167,59 @@
} }
}, },
"nur": { "nur": {
"inputs": {
"flake-parts": [
"flake-parts"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1766242030, "lastModified": 1710013455,
"narHash": "sha256-GdaKIZrzm4fbFf9jBVmeQFZTwYPxUlSTZrSId/JNMAU=", "narHash": "sha256-qzOpU4APTso6JLA+/F4zlO/yL8++n/CsUpmxbQAsy/4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "30006228925f07c5c2a270bb95dc8da35d9942dc", "rev": "cf1e9b0e085368cc489c765f285f1d07c2ec8d36",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "main", "ref": "master",
"repo": "NUR", "repo": "NUR",
"type": "github" "type": "github"
} }
}, },
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": [
"futils"
],
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "master",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"futils": "futils", "futils": "futils",
"git-hooks": "git-hooks",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nur": "nur", "nur": "nur",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems" "systems": "systems"
} }
}, },

View file

@ -54,20 +54,18 @@
type = "github"; type = "github";
owner = "nix-community"; owner = "nix-community";
repo = "NUR"; repo = "NUR";
ref = "main"; ref = "master";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
};
}; };
git-hooks = { pre-commit-hooks = {
type = "github"; type = "github";
owner = "cachix"; owner = "cachix";
repo = "git-hooks.nix"; repo = "pre-commit-hooks.nix";
ref = "master"; ref = "master";
inputs = { inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
}; };
}; };

View file

@ -1,7 +1,7 @@
{ inputs, ... }: { inputs, ... }:
{ {
imports = [ imports = [
inputs.git-hooks.flakeModule inputs.pre-commit-hooks.flakeModule
]; ];
perSystem = { ... }: { perSystem = { ... }: {

View file

@ -6,6 +6,8 @@
name = "NixOS-config"; name = "NixOS-config";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
gitAndTools.pre-commit
lua-language-server
nixpkgs-fmt nixpkgs-fmt
]; ];

View file

@ -3,11 +3,6 @@ let
defaultModules = [ defaultModules = [
# Include generic settings # Include generic settings
"${self}/modules/home" "${self}/modules/home"
{
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlays.default
];
}
{ {
# Basic user information defaults # Basic user information defaults
home.username = lib.mkDefault "ambroisie"; home.username = lib.mkDefault "ambroisie";
@ -22,15 +17,22 @@ let
]; ];
mkHome = name: system: inputs.home-manager.lib.homeManagerConfiguration { mkHome = name: system: inputs.home-manager.lib.homeManagerConfiguration {
pkgs = inputs.nixpkgs.legacyPackages.${system}; # Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import inputs.nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlay
];
};
modules = defaultModules ++ [ modules = defaultModules ++ [
"${self}/hosts/homes/${name}" "${self}/hosts/homes/${name}"
]; ];
# Use my extended lib in NixOS configuration
inherit (self) lib;
extraSpecialArgs = { extraSpecialArgs = {
# Inject inputs to use them in global registry # Inject inputs to use them in global registry
inherit inputs; inherit inputs;

View file

@ -3,11 +3,11 @@ let
defaultModules = [ defaultModules = [
{ {
# Let 'nixos-version --json' know about the Git revision # Let 'nixos-version --json' know about the Git revision
system.configurationRevision = self.rev or self.dirtyRev or "dirty"; system.configurationRevision = self.rev or "dirty";
} }
{ {
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [ nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlays.default inputs.nur.overlay
]; ];
} }
# Include generic settings # Include generic settings
@ -15,10 +15,8 @@ let
]; ];
buildHost = name: system: lib.nixosSystem { buildHost = name: system: lib.nixosSystem {
inherit system;
modules = defaultModules ++ [ modules = defaultModules ++ [
{
nixpkgs.hostPlatform = system;
}
"${self}/hosts/nixos/${name}" "${self}/hosts/nixos/${name}"
]; ];
specialArgs = { specialArgs = {

View file

@ -1,4 +1,4 @@
{ self, lib, ... }: { self, ... }:
let let
default-overlays = import "${self}/overlays"; default-overlays = import "${self}/overlays";
@ -8,7 +8,7 @@ let
# Expose my custom packages # Expose my custom packages
pkgs = _final: prev: { pkgs = _final: prev: {
ambroisie = lib.recurseIntoAttrs (import "${self}/pkgs" { pkgs = prev; }); ambroisie = prev.recurseIntoAttrs (import "${self}/pkgs" { pkgs = prev; });
}; };
}; };
in in

View file

@ -4,20 +4,6 @@
services.gpg-agent.enable = lib.mkForce false; services.gpg-agent.enable = lib.mkForce false;
my.home = { my.home = {
atuin = {
package = pkgs.stdenv.mkDerivation {
pname = "atuin";
version = "18.4.0";
buildCommand = ''
mkdir -p $out/bin
ln -s /usr/bin/atuin $out/bin/atuin
'';
meta.mainProgram = "atuin";
};
};
git = { git = {
package = pkgs.emptyDirectory; package = pkgs.emptyDirectory;
}; };

View file

@ -7,20 +7,6 @@
services.gpg-agent.enable = lib.mkForce false; services.gpg-agent.enable = lib.mkForce false;
my.home = { my.home = {
atuin = {
package = pkgs.stdenv.mkDerivation {
pname = "atuin";
version = "18.4.0";
buildCommand = ''
mkdir -p $out/bin
ln -s /usr/bin/atuin $out/bin/atuin
'';
meta.mainProgram = "atuin";
};
};
git = { git = {
package = pkgs.emptyDirectory; package = pkgs.emptyDirectory;
}; };
@ -29,9 +15,6 @@
# I use scripts that use the passthrough sequence often on this host # I use scripts that use the passthrough sequence often on this host
enablePassthrough = true; enablePassthrough = true;
# Frequent reboots mean that session persistence can be handy
enableResurrect = true;
terminalFeatures = { terminalFeatures = {
# HTerm uses `xterm-256color` as its `$TERM`, so use that here # HTerm uses `xterm-256color` as its `$TERM`, so use that here
xterm-256color = { }; xterm-256color = { };

View file

@ -2,7 +2,7 @@
{ {
my.home = { my.home = {
# Use graphical pinentry # Use graphical pinentry
bitwarden.pinentry = pkgs.pinentry-gtk2; bitwarden.pinentry = "gtk2";
# Ebook library # Ebook library
calibre.enable = true; calibre.enable = true;
# Some amount of social life # Some amount of social life
@ -14,11 +14,13 @@
# Blue light filter # Blue light filter
gammastep.enable = true; gammastep.enable = true;
# Use a small popup to enter passwords # Use a small popup to enter passwords
gpg.pinentry = pkgs.pinentry-gtk2; gpg.pinentry = "gtk2";
# Machine specific packages # Machine specific packages
packages.additionalPackages = with pkgs; [ packages.additionalPackages = with pkgs; [
element-desktop # Matrix client element-desktop # Matrix client
jellyfin-media-player # Wraps the webui and mpv together
pavucontrol # Audio mixer GUI pavucontrol # Audio mixer GUI
transgui # Transmission remote
]; ];
# Minimal video player # Minimal video player
mpv.enable = true; mpv.enable = true;
@ -26,8 +28,6 @@
nm-applet.enable = true; nm-applet.enable = true;
# Terminal # Terminal
terminal.program = "alacritty"; terminal.program = "alacritty";
# Transmission remote
trgui.enable = true;
# Zathura document viewer # Zathura document viewer
zathura.enable = true; zathura.enable = true;
}; };

View file

@ -1,9 +1,8 @@
age-encryption.org/v1 age-encryption.org/v1
-> ssh-ed25519 cKojmg Ec0xt1uJTva8MxUdoTVX5m3uWaIiRlodf345FEM7Uzs -> ssh-ed25519 cKojmg bQFr9oAnbo1rI/MpUV8wQz/Xj7iZY4ZU+Swf0nSIQFw
aJIneWFJPB5HVeoUGp57agXih9YeZ6xMEbyQ+zJtWQY zama2XJ0gdvUlD2GHMhmZqHSxHe+dKSfXnHoWDcSw7Y
-> ssh-ed25519 jPowng B5XotRgv7s/FUegGhceBj7EoukewNUOIFl4TFRQf1EQ -> ssh-ed25519 jPowng gitUwSKTNKWLSxnwa185O7x/u0ul93g8wPESdZaKRk8
PgGCBd/Pqwp7ayqi7okHBGF1SfFpwT4KlHJ/np6p2uQ uvBIfAUkZp5sg6rfeEGvL5ZDV8m2uSEotW02kjPN3Hw
--- AeLgwGz6k3OABb53cXNaCU/sgI4FlU1s6p8PhAaFOlg --- SZxe5f/CUZBvPQa2Sz/UBY3L68rMkIGGRuZPk7YE+Vg
1ÌÉCÔ¹ð¤ŽULfI1¸Hm»Ûòb}m” ÁÅ¡ìg•ß0¦¢–¤`X<16>G>\>¹8rŽz+ŠY ™¼`—Ê¢.JBUÏ!z¸Z50ú*õ¡ÙŸ¤×ÖÇ®I<C2AE>ôÔ]¹Ïå I ¾r ú&…¥‹{~v?¨}=Ä
ĵ<18>¿oÒÛ°…g„®„ÒêÁ³Â¿Ÿt©nƒºãcz[»{ }+ ¿SQM[²]Œ±k MÒAàtŒÃmMë/£µLsü|Þ…m©CÀñiYC}ƒŽ‡çxŽ€
jçå&ÁõõNæ°Nÿo{õ𽂠-eP¾=L‰™ 6¦.SP:»e¶

View file

@ -0,0 +1,8 @@
age-encryption.org/v1
-> ssh-ed25519 cKojmg xRtF3XVc7yPicAV/E4U7mn0itvD0h1BWBTjwunuoe2E
OkB9sjGB3ulH4Feuyj3Ed0DBG4+mghW/Qpum9oXL/8c
-> ssh-ed25519 jPowng 1r8drqhz1yZdTq0Kvqya+ArU1C2fkN7Gg9LiWWfeUFg
cjbxntVwHvqLaJpiKs/Y8ojeb6e3/cLFcsoeuoobfFg
--- B1qA2PylJBrdZxZtCzlU2kRPvxLM+IrXTvR+ERxVtTY
"W9<57>Äbg¸©~Ì/áÕb4ãÕ†ú³ÜÔIÊ
Û}ð §ËÅË-³²ªNó±”ÑC7vWœbºØ?¦8=œÉwÆB ÃUpJClï²OÈ™³œnOÁ\

View file

@ -1,8 +0,0 @@
age-encryption.org/v1
-> ssh-ed25519 cKojmg VYlHgHSLpfKb5bn1XA3aCpfX7M23DgbraLxxOfo9PDk
Rj+mDvAsWX3WwpuhTrOubmo17j/aud5+P87df5bosBA
-> ssh-ed25519 jPowng o9ZFaYrITZ6DjWw07Vk/+TkuU187/ytlEK4sw7G32G4
zmxlpDvDDEgQFqBVARXeX1ABhvfJ4uAHfa6mIxXzjAY
--- k/d9FWW8/OSo8EllwOBV74pZyX918u54jEljGk3ATUc
ü4+ø2{hE7!Ò­GA`×<>_@Íß—´¡R_ý§6J„ñL4v,6%ô‡øó#^® Ù¹ åB­§OøF|7ܽÉL]œÙj
BþóÛ¾éaòs]xS<78>Î pbÞo#¬J1QŸ=t}5Õ>Oï{+¼. M"7e»yý÷—

View file

@ -31,14 +31,8 @@ in
publicKeys = all; publicKeys = all;
}; };
"lohr/secret.age" = { "lohr/secret.age".publicKeys = all;
owner = "lohr"; "lohr/ssh-key.age".publicKeys = all;
publicKeys = all;
};
"lohr/ssh-key.age" = {
owner = "lohr";
publicKeys = all;
};
"matrix/mail.age" = { "matrix/mail.age" = {
owner = "matrix-synapse"; owner = "matrix-synapse";
@ -48,6 +42,9 @@ in
owner = "matrix-synapse"; owner = "matrix-synapse";
publicKeys = all; publicKeys = all;
}; };
"matrix/sliding-sync-secret.age" = {
publicKeys = all;
};
"mealie/mail.age" = { "mealie/mail.age" = {
publicKeys = all; publicKeys = all;
@ -74,15 +71,10 @@ in
"paperless/password.age".publicKeys = all; "paperless/password.age".publicKeys = all;
"paperless/secret-key.age".publicKeys = all; "paperless/secret-key.age".publicKeys = all;
"pdf-edit/login.age".publicKeys = all;
"podgrab/password.age".publicKeys = all; "podgrab/password.age".publicKeys = all;
"pyload/credentials.age".publicKeys = all; "pyload/credentials.age".publicKeys = all;
"servarr/autobrr/session-secret.age".publicKeys = all;
"servarr/cross-seed/configuration.json.age".publicKeys = all;
"sso/auth-key.age".publicKeys = all; "sso/auth-key.age".publicKeys = all;
"sso/ambroisie/password-hash.age".publicKeys = all; "sso/ambroisie/password-hash.age".publicKeys = all;
"sso/ambroisie/totp-secret.age".publicKeys = all; "sso/ambroisie/totp-secret.age".publicKeys = all;

View file

@ -1,7 +0,0 @@
age-encryption.org/v1
-> ssh-ed25519 cKojmg bu09lB+fjaPP31cUQZP6EqSPuseucgNK7k9vAS08iS0
+NGL+b2QD/qGo6hqHvosAXzHZtDvfodmPdcgnrKlD1o
-> ssh-ed25519 jPowng QDCdRBGWhtdvvMCiDH52cZHz1/W7aomhTatZ4+9IKwI
Ou3jjV/O55G1CPgGS33l3eWhhYWrVdwVNPSiE14d5rE
--- q0ssmpG50OX1WaNSInc2hbtH3DbTwQGDU74VGEoMh94
 ¯mCùº<C3B9>Æ'hK.Ðì/™Xu(€«Õ×g$½'¼šM{fK˜ !ÛMZ²oR÷®ˆüÎÕ<C38E>ÍŸö;yb

View file

@ -10,11 +10,6 @@ in
adblock = { adblock = {
enable = true; enable = true;
}; };
# Audiobook and podcast library
audiobookshelf = {
enable = true;
port = 9599;
};
# Backblaze B2 backup # Backblaze B2 backup
backup = { backup = {
enable = true; enable = true;
@ -51,9 +46,9 @@ in
passwordFile = secrets."forgejo/mail-password".path; passwordFile = secrets."forgejo/mail-password".path;
}; };
}; };
# Home inventory # Meta-indexers
homebox = { indexers = {
enable = true; prowlarr.enable = true;
}; };
# Jellyfin media server # Jellyfin media server
jellyfin.enable = true; jellyfin.enable = true;
@ -69,6 +64,9 @@ in
mailConfigFile = secrets."matrix/mail".path; mailConfigFile = secrets."matrix/mail".path;
# Only necessary when doing the initial registration # Only necessary when doing the initial registration
secretFile = secrets."matrix/secret".path; secretFile = secrets."matrix/secret".path;
slidingSync = {
secretFile = secrets."matrix/sliding-sync-secret".path;
};
}; };
mealie = { mealie = {
enable = true; enable = true;
@ -95,9 +93,6 @@ in
nextcloud = { nextcloud = {
enable = true; enable = true;
passwordFile = secrets."nextcloud/password".path; passwordFile = secrets."nextcloud/password".path;
collabora = {
enable = true;
};
}; };
nix-cache = { nix-cache = {
enable = true; enable = true;
@ -127,10 +122,19 @@ in
passwordFile = secrets."paperless/password".path; passwordFile = secrets."paperless/password".path;
secretKeyFile = secrets."paperless/secret-key".path; secretKeyFile = secrets."paperless/secret-key".path;
}; };
# Sometimes, editing PDFs is useful # The whole *arr software suite
pdf-edit = { pirate = {
enable = true; enable = true;
loginFile = secrets."pdf-edit/login".path; # ... But not Lidarr because I don't care for music that much
lidarr = {
enable = false;
};
};
# Podcast automatic downloader
podgrab = {
enable = true;
passwordFile = secrets."podgrab/password".path;
port = 9598;
}; };
# Regular backups # Regular backups
postgresql-backup.enable = true; postgresql-backup.enable = true;
@ -142,29 +146,13 @@ in
rss-bridge.enable = true; rss-bridge.enable = true;
# Usenet client # Usenet client
sabnzbd.enable = true; sabnzbd.enable = true;
# The whole *arr software suite # Because I stilll need to play sysadmin
servarr = {
enableAll = true;
autobrr = {
sessionSecretFile = secrets."servarr/autobrr/session-secret".path;
};
cross-seed = {
secretSettingsFile = secrets."servarr/cross-seed/configuration.json".path;
};
# ... But not Lidarr because I don't care for music that much
lidarr = {
enable = false;
};
# I only use Prowlarr nowadays
jackett = {
enable = false;
};
nzbhydra = {
enable = false;
};
};
# Because I still need to play sysadmin
ssh-server.enable = true; ssh-server.enable = true;
# Recipe manager
tandoor-recipes = {
enable = true;
secretKeyFile = secrets."tandoor-recipes/secret-key".path;
};
# Torrent client and webui # Torrent client and webui
transmission = { transmission = {
enable = true; enable = true;

View file

@ -1,26 +1,15 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
let let
cfg = config.my.home.atuin; cfg = config.my.home.atuin;
in in
{ {
options.my.home.atuin = with lib; { options.my.home.atuin = with lib; {
enable = my.mkDisableOption "atuin configuration"; enable = my.mkDisableOption "atuin configuration";
package = mkPackageOption pkgs "atuin" { };
daemon = {
enable = my.mkDisableOption "atuin daemon";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.atuin = { programs.atuin = {
enable = true; enable = true;
inherit (cfg) package;
daemon = lib.mkIf cfg.daemon.enable {
enable = true;
};
flags = [ flags = [
# I *despise* this hijacking of the up key, even though I use Ctrl-p # I *despise* this hijacking of the up key, even though I use Ctrl-p
@ -28,8 +17,6 @@ in
]; ];
settings = { settings = {
# Reasonable date format
dialect = "uk";
# The package is managed by Nix # The package is managed by Nix
update_check = false; update_check = false;
# I don't care for the fancy display # I don't care for the fancy display

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
let let
cfg = config.my.home.bitwarden; cfg = config.my.home.bitwarden;
in in
@ -6,7 +6,12 @@ in
options.my.home.bitwarden = with lib; { options.my.home.bitwarden = with lib; {
enable = my.mkDisableOption "bitwarden configuration"; enable = my.mkDisableOption "bitwarden configuration";
pinentry = mkPackageOption pkgs "pinentry" { default = [ "pinentry-tty" ]; }; pinentry = mkOption {
type = types.str;
default = "tty";
example = "gtk2";
description = "Which pinentry interface to use";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {

View file

@ -5,13 +5,11 @@ in
{ {
options.my.home.calibre = with lib; { options.my.home.calibre = with lib; {
enable = mkEnableOption "calibre configuration"; enable = mkEnableOption "calibre configuration";
package = mkPackageOption pkgs "calibre" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
cfg.package calibre
]; ];
}; };
} }

View file

@ -8,7 +8,6 @@
./bluetooth ./bluetooth
./calibre ./calibre
./comma ./comma
./delta
./dircolors ./dircolors
./direnv ./direnv
./discord ./discord
@ -38,7 +37,6 @@
./ssh ./ssh
./terminal ./terminal
./tmux ./tmux
./trgui
./udiskie ./udiskie
./vim ./vim
./wget ./wget
@ -52,6 +50,9 @@
# First sane reproducible version # First sane reproducible version
home.stateVersion = "20.09"; home.stateVersion = "20.09";
# Who am I?
home.username = "ambroisie";
# Start services automatically # Start services automatically
systemd.user.startServices = "sd-switch"; systemd.user.startServices = "sd-switch";
} }

View file

@ -1,49 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.my.home.delta;
in
{
options.my.home.delta = with lib; {
enable = my.mkDisableOption "delta configuration";
package = mkPackageOption pkgs "delta" { };
git = {
enable = my.mkDisableOption "git integration";
};
};
config = lib.mkIf cfg.enable {
programs.delta = {
enable = true;
inherit (cfg) package;
enableGitIntegration = cfg.git.enable;
options = {
features = "diff-highlight decorations";
# Less jarring style for `diff-highlight` emulation
diff-highlight = {
minus-style = "red";
minus-non-emph-style = "red";
minus-emph-style = "bold red 52";
plus-style = "green";
plus-non-emph-style = "green";
plus-emph-style = "bold green 22";
whitespace-error-style = "reverse red";
};
# Personal preference for easier reading
decorations = {
commit-style = "raw"; # Do not recolor meta information
keep-plus-minus-markers = true;
paging = "always";
};
};
};
};
}

View file

@ -7,9 +7,9 @@ in
enable = my.mkDisableOption "direnv configuration"; enable = my.mkDisableOption "direnv configuration";
defaultFlake = mkOption { defaultFlake = mkOption {
type = with types; nullOr str; type = types.str;
default = null; default = "pkgs";
example = "pkgs"; example = "nixpkgs";
description = '' description = ''
Which flake from the registry should be used for Which flake from the registry should be used for
<command>use pkgs</command> by default. <command>use pkgs</command> by default.
@ -39,7 +39,7 @@ in
in in
lib.my.genAttrs' files linkLibFile; lib.my.genAttrs' files linkLibFile;
home.sessionVariables = lib.mkIf (cfg.defaultFlake != null) { home.sessionVariables = {
DIRENV_DEFAULT_FLAKE = cfg.defaultFlake; DIRENV_DEFAULT_FLAKE = cfg.defaultFlake;
}; };
}; };

View file

@ -1,4 +1,4 @@
# shellcheck shell=bash #shellcheck shell=bash
# shellcheck disable=2155 # shellcheck disable=2155
use_android() { use_android() {
@ -32,16 +32,10 @@ use_android() {
-b|--build-tools) -b|--build-tools)
build_tools_version="$2" build_tools_version="$2"
shift 2 shift 2
if ! [ -e "$ANDROID_HOME/build-tools/$build_tools_version" ]; then
log_error "use_android: build-tools version '$build_tools_version' does not exist"
fi
;; ;;
-n|--ndk) -n|--ndk)
ndk_version="$2" ndk_version="$2"
shift 2 shift 2
if ! [ -e "$ANDROID_HOME/ndk/$ndk_version" ]; then
log_error "use_android: NDK version '$ndk_version' does not exist"
fi
;; ;;
--) --)
shift shift

View file

@ -1,4 +1,4 @@
# shellcheck shell=bash #shellcheck shell=bash
use_pkgs() { use_pkgs() {
if ! has nix; then if ! has nix; then

View file

@ -1,4 +1,4 @@
# shellcheck shell=bash #shellcheck shell=bash
layout_postgres() { layout_postgres() {
if ! has postgres || ! has initdb; then if ! has postgres || ! has initdb; then

View file

@ -1,4 +1,4 @@
# shellcheck shell=bash #shellcheck shell=bash
layout_poetry() { layout_poetry() {
if ! has poetry; then if ! has poetry; then
@ -9,12 +9,12 @@ layout_poetry() {
if [[ ! -f pyproject.toml ]]; then if [[ ! -f pyproject.toml ]]; then
# shellcheck disable=2016 # shellcheck disable=2016
log_error 'layout_poetry: no pyproject.toml found. Use `poetry init` to create one first' log_error 'layout_poetry: no pyproject.toml found. Use `poetry new` or `poetry init` to create one first'
return 1 return 1
fi fi
# create venv if it doesn't exist # create venv if it doesn't exist
poetry run -q -- true poetry run true
# shellcheck disable=2155 # shellcheck disable=2155
export VIRTUAL_ENV=$(poetry env info --path) export VIRTUAL_ENV=$(poetry env info --path)
@ -23,35 +23,3 @@ layout_poetry() {
watch_file pyproject.toml watch_file pyproject.toml
watch_file poetry.lock watch_file poetry.lock
} }
layout_uv() {
if ! has uv; then
# shellcheck disable=2016
log_error 'layout_uv: `uv` is not in PATH'
return 1
fi
if [[ ! -f pyproject.toml ]]; then
# shellcheck disable=2016
log_error 'layout_uv: no pyproject.toml found. Use `uv init` to create one first'
return 1
fi
local default_venv="$PWD/.venv"
: "${VIRTUAL_ENV:=$default_venv}"
# Use non-default venv path if required
if [ "$VIRTUAL_ENV" != "$default_venv" ]; then
export UV_PROJECT_ENVIRONMENT="$VIRTUAL_ENV"
fi
# create venv if it doesn't exist
uv venv -q --allow-existing
export VIRTUAL_ENV
export UV_ACTIVE=1
PATH_add "$VIRTUAL_ENV/bin"
watch_file pyproject.toml
watch_file uv.lock
watch_file .python-version
}

View file

@ -1,24 +1,23 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.home.discord; cfg = config.my.home.discord;
jsonFormat = pkgs.formats.json { };
in in
{ {
options.my.home.discord = with lib; { options.my.home.discord = with lib; {
enable = mkEnableOption "discord configuration"; enable = mkEnableOption "discord configuration";
package = mkPackageOption pkgs "discord" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.discord = { home.packages = with pkgs; [
enable = true; discord
];
inherit (cfg) package; xdg.configFile."discord/settings.json".source =
jsonFormat.generate "discord.json" {
settings = {
# Do not keep me from using the app just to force an update # Do not keep me from using the app just to force an update
SKIP_HOST_UPDATE = true; SKIP_HOST_UPDATE = true;
}; };
};
}; };
} }

View file

@ -52,7 +52,6 @@ in
"browser.newtabpage.activity-stream.feeds.sections" = false; "browser.newtabpage.activity-stream.feeds.sections" = false;
"browser.newtabpage.activity-stream.feeds.system.topstories" = false; # Disable top stories "browser.newtabpage.activity-stream.feeds.system.topstories" = false; # Disable top stories
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false; # Disable pocket "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; # Disable pocket
"browser.urlbar.trimURLs" = false; # Always show the `http://` prefix
"extensions.pocket.enabled" = false; # Disable pocket "extensions.pocket.enabled" = false; # Disable pocket
"media.eme.enabled" = true; # Enable DRM "media.eme.enabled" = true; # Enable DRM
"media.gmp-widevinecdm.enabled" = true; # Enable DRM "media.gmp-widevinecdm.enabled" = true; # Enable DRM
@ -62,21 +61,19 @@ in
"ui.systemUsesDarkTheme" = true; # Dark mode "ui.systemUsesDarkTheme" = true; # Dark mode
}; };
extensions = { extensions = with pkgs.nur.repos.rycee.firefox-addons; ([
packages = with pkgs.nur.repos.rycee.firefox-addons; ([ bitwarden
bitwarden consent-o-matic
consent-o-matic form-history-control
form-history-control reddit-comment-collapser
reddit-comment-collapser reddit-enhancement-suite
reddit-enhancement-suite refined-github
refined-github sponsorblock
sponsorblock ublock-origin
ublock-origin ]
] ++ lib.optional (cfg.tridactyl.enable) tridactyl
++ lib.optional (cfg.tridactyl.enable) tridactyl ++ lib.optional (cfg.ff2mpv.enable) ff2mpv
++ lib.optional (cfg.ff2mpv.enable) ff2mpv );
);
};
}; };
}; };
}; };

View file

@ -12,7 +12,9 @@ let
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
xdg.configFile."tridactyl/tridactylrc".source = pkgs.replaceVars ./tridactylrc { xdg.configFile."tridactyl/tridactylrc".source = pkgs.substituteAll {
src = ./tridactylrc;
editorcmd = lib.concatStringsSep " " [ editorcmd = lib.concatStringsSep " " [
# Use my configured terminal # Use my configured terminal
term term

View file

@ -4,7 +4,7 @@
" Use dark color scheme " Use dark color scheme
colorscheme dark colorscheme dark
" Make tridactyl open Vim in my preferred terminal " Make tridactyl open Vim in my prefered terminal
set editorcmd @editorcmd@ set editorcmd @editorcmd@
" Remove editor file after use " Remove editor file after use
@ -15,8 +15,8 @@ bind --mode=input <C-i> editor_rm
" Binds {{{ " Binds {{{
" Reddit et al. {{{ " Reddit et al. {{{
" Toggle comments on Reddit, Hacker News, Lobste.rs, LWN " Toggle comments on Reddit, Hacker News, Lobste.rs
bind ;c hint -Jc [class*="expand"],[class*="togg"],[class="comment_folder"],[class="CommentTitle"] bind ;c hint -Jc [class*="expand"],[class*="togg"],[class="comment_folder"]
" Make `gu` take me back to subreddit from comments " Make `gu` take me back to subreddit from comments
bindurl reddit.com gu urlparent 3 bindurl reddit.com gu urlparent 3
@ -26,8 +26,8 @@ bindurl www.google.com f hint -Jc #search a
bindurl www.google.com F hint -Jbc #search a bindurl www.google.com F hint -Jbc #search a
" Only hint search results on DuckDuckGo " Only hint search results on DuckDuckGo
bindurl ^https://duckduckgo.com f hint -Jc [data-testid="result"] bindurl ^https://duckduckgo.com f hint -Jc [data-testid="result-title-a"]
bindurl ^https://duckduckgo.com F hint -Jbc [data-testid="result"] bindurl ^https://duckduckgo.com F hint -Jbc [data-testid="result-title-a"]
" Only hint item pages on Hacker News " Only hint item pages on Hacker News
bindurl news.ycombinator.com ;f hint -Jc .age > a bindurl news.ycombinator.com ;f hint -Jc .age > a

View file

@ -6,28 +6,33 @@ in
options.my.home.gdb = with lib; { options.my.home.gdb = with lib; {
enable = my.mkDisableOption "gdb configuration"; enable = my.mkDisableOption "gdb configuration";
package = mkPackageOption pkgs "gdb" { };
rr = { rr = {
enable = my.mkDisableOption "rr configuration"; enable = my.mkDisableOption "rr configuration";
package = mkPackageOption pkgs "rr" { }; package = mkOption {
type = types.package;
default = pkgs.rr;
defaultText = literalExample "pkgs.rr";
description = ''
Package providing rr
'';
};
}; };
}; };
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
cfg.package gdb
]; ];
xdg = { xdg = {
configFile."gdb/gdbinit".source = ./gdbinit; configFile."gdb/gdbinit".source = ./gdbinit;
stateFile."gdb/.keep".text = ""; dataFile. "gdb/.keep".text = "";
}; };
home.sessionVariables = { home.sessionVariables = {
GDBHISTFILE = "${config.xdg.stateHome}/gdb/gdb_history"; GDBHISTFILE = "${config.xdg.dataHome}/gdb/gdb_history";
}; };
} }

View file

@ -21,31 +21,57 @@ in
config.programs.git = lib.mkIf cfg.enable { config.programs.git = lib.mkIf cfg.enable {
enable = true; enable = true;
# Who am I?
userEmail = mkMailAddress "bruno" "belanyi.fr";
userName = "Bruno BELANYI";
inherit (cfg) package; inherit (cfg) package;
aliases = {
git = "!git";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit --topo-order";
lola = "lol --all";
assume = "update-index --assume-unchanged";
unassume = "update-index --no-assume-unchanged";
assumed = "!git ls-files -v | grep ^h | cut -c 3-";
pick = "log -p -G";
push-new = "!git push -u origin "
+ ''"$(git branch | grep '^* ' | cut -f2- -d' ')"'';
root = "git rev-parse --show-toplevel";
};
lfs.enable = true; lfs.enable = true;
delta = {
enable = true;
options = {
features = "diff-highlight decorations";
# Less jarring style for `diff-highlight` emulation
diff-highlight = {
minus-style = "red";
minus-non-emph-style = "red";
minus-emph-style = "bold red 52";
plus-style = "green";
plus-non-emph-style = "green";
plus-emph-style = "bold green 22";
whitespace-error-style = "reverse red";
};
# Personal preference for easier reading
decorations = {
commit-style = "raw"; # Do not recolor meta information
keep-plus-minus-markers = true;
paging = "always";
};
};
};
# There's more # There's more
settings = { extraConfig = {
# Who am I?
user = {
email = mkMailAddress "bruno" "belanyi.fr";
name = "Bruno BELANYI";
};
alias = {
git = "!git";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit --topo-order";
lola = "lol --all";
assume = "update-index --assume-unchanged";
unassume = "update-index --no-assume-unchanged";
assumed = "!git ls-files -v | grep ^h | cut -c 3-";
pick = "log -p -G";
push-new = "!git push -u origin "
+ ''"$(git branch | grep '^* ' | cut -f2- -d' ')"'';
root = "git rev-parse --show-toplevel";
};
# Makes it a bit more readable # Makes it a bit more readable
blame = { blame = {
coloring = "repeatedLines"; coloring = "repeatedLines";
@ -97,6 +123,11 @@ in
defaultBranch = "main"; defaultBranch = "main";
}; };
# Local configuration, not-versioned
include = {
path = "config.local";
};
merge = { merge = {
conflictStyle = "zdiff3"; conflictStyle = "zdiff3";
}; };
@ -136,8 +167,8 @@ in
}; };
}; };
includes = lib.mkAfter [ # Multiple identities
# Multiple identities includes = [
{ {
condition = "gitdir:~/git/EPITA/"; condition = "gitdir:~/git/EPITA/";
contents = { contents = {
@ -156,10 +187,6 @@ in
}; };
}; };
} }
# Local configuration, not-versioned
{
path = "config.local";
}
]; ];
ignores = ignores =

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, ... }:
let let
cfg = config.my.home.gpg; cfg = config.my.home.gpg;
in in
@ -6,7 +6,12 @@ in
options.my.home.gpg = with lib; { options.my.home.gpg = with lib; {
enable = my.mkDisableOption "gpg configuration"; enable = my.mkDisableOption "gpg configuration";
pinentry = mkPackageOption pkgs "pinentry" { default = [ "pinentry-tty" ]; }; pinentry = mkOption {
type = types.str;
default = "tty";
example = "gtk2";
description = "Which pinentry interface to use";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -17,7 +22,7 @@ in
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; # One agent to rule them all enableSshSupport = true; # One agent to rule them all
pinentry.package = cfg.pinentry; pinentryFlavor = cfg.pinentry;
extraConfig = '' extraConfig = ''
allow-loopback-pinentry allow-loopback-pinentry
''; '';

View file

@ -21,12 +21,12 @@ in
}; };
iconTheme = { iconTheme = {
package = pkgs.gnome-themes-extra; package = pkgs.gnome.gnome-themes-extra;
name = "Adwaita"; name = "Adwaita";
}; };
theme = { theme = {
package = pkgs.gnome-themes-extra; package = pkgs.gnome.gnome-themes-extra;
name = "Adwaita"; name = "Adwaita";
}; };
}; };

View file

@ -17,7 +17,6 @@ in
strings = "0;32"; strings = "0;32";
arrays = "1;39"; arrays = "1;39";
objects = "1;39"; objects = "1;39";
objectKeys = "1;34";
}; };
}; };
} }

View file

@ -26,7 +26,20 @@ let
}; };
migaduConfig = { migaduConfig = {
flavor = "migadu.com"; imap = {
host = "imap.migadu.com";
port = 993;
tls = {
enable = true;
};
};
smtp = {
host = "smtp.migadu.com";
port = 465;
tls = {
enable = true;
};
};
}; };
gmailConfig = { gmailConfig = {
@ -45,7 +58,7 @@ in
{ {
config.accounts.email.accounts = { config.accounts.email.accounts = {
personal = lib.mkMerge [ personal = lib.mkMerge [
# Common configuration # Common configuraton
(mkConfig { (mkConfig {
domain = "belanyi.fr"; domain = "belanyi.fr";
address = "bruno"; address = "bruno";
@ -57,7 +70,7 @@ in
]; ];
gmail = lib.mkMerge [ gmail = lib.mkMerge [
# Common configuration # Common configuraton
(mkConfig { (mkConfig {
domain = "gmail.com"; domain = "gmail.com";
address = "brunobelanyi"; address = "brunobelanyi";

View file

@ -22,16 +22,12 @@ in
options.my.home.nix = with lib; { options.my.home.nix = with lib; {
enable = my.mkDisableOption "nix configuration"; enable = my.mkDisableOption "nix configuration";
gc = {
enable = my.mkDisableOption "nix GC configuration";
};
cache = { cache = {
selfHosted = my.mkDisableOption "self-hosted cache"; selfHosted = my.mkDisableOption "self-hosted cache";
}; };
inputs = { inputs = {
link = my.mkDisableOption "link inputs to `$XDG_CONFIG_HOME/nix/inputs/`"; link = my.mkDisableOption "link inputs to `/etc/nix/inputs/`";
addToRegistry = my.mkDisableOption "add inputs and self to registry"; addToRegistry = my.mkDisableOption "add inputs and self to registry";
@ -64,22 +60,6 @@ in
}; };
} }
(lib.mkIf cfg.gc.enable {
nix.gc = {
automatic = true;
# Every week, with some wiggle room
dates = "weekly";
randomizedDelaySec = "10min";
# Use a persistent timer for e.g: laptops
persistent = true;
# Delete old profiles automatically after 15 days
options = "--delete-older-than 15d";
};
})
(lib.mkIf cfg.cache.selfHosted { (lib.mkIf cfg.cache.selfHosted {
nix = { nix = {
settings = { settings = {
@ -116,7 +96,7 @@ in
}) })
(lib.mkIf cfg.inputs.addToNixPath { (lib.mkIf cfg.inputs.addToNixPath {
nix.nixPath = [ "${config.xdg.configHome}/nix/inputs" ]; home.sessionVariables.NIX_PATH = "${config.xdg.configHome}/nix/inputs\${NIX_PATH:+:$NIX_PATH}";
}) })
]); ]);
} }

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, osConfig, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.home.packages; cfg = config.my.home.packages;
useGlobalPkgs = osConfig.home-manager.useGlobalPkgs or false;
in in
{ {
options.my.home.packages = with lib; { options.my.home.packages = with lib; {
@ -27,10 +26,9 @@ in
fd fd
file file
ripgrep ripgrep
tree
] ++ cfg.additionalPackages); ] ++ cfg.additionalPackages);
nixpkgs.config = lib.mkIf (!useGlobalPkgs) { nixpkgs.config = {
inherit (cfg) allowAliases allowUnfree; inherit (cfg) allowAliases allowUnfree;
}; };
}; };

View file

@ -15,12 +15,8 @@ in
# Clear the screen on start and exit # Clear the screen on start and exit
LESS = "-R -+X -c"; LESS = "-R -+X -c";
# Better XDG compliance # Better XDG compliance
LESSHISTFILE = "${config.xdg.stateHome}/less/history"; LESSHISTFILE = "${config.xdg.dataHome}/less/history";
LESSKEY = "${config.xdg.configHome}/less/lesskey";
}; };
xdg.configFile."lesskey".text = ''
# Quit without clearing the screen on `Q`
Q toggle-option -!^Predraw-on-quit\nq
'';
}; };
} }

View file

@ -1,6 +1,6 @@
# Common secrets # Common secrets
let let
keys = import ../../../keys; keys = import ../../keys;
all = builtins.attrValues keys.users; all = builtins.attrValues keys.users;
in in

View file

@ -17,7 +17,6 @@ in
{ {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
enableDefaultConfig = false;
includes = [ includes = [
# Local configuration, not-versioned # Local configuration, not-versioned
@ -54,12 +53,11 @@ in
identityFile = "~/.ssh/shared_rsa"; identityFile = "~/.ssh/shared_rsa";
user = "ambroisie"; user = "ambroisie";
}; };
# `*` is automatically made the last match block by the module
"*" = {
addKeysToAgent = "yes";
};
}; };
extraConfig = ''
AddKeysToAgent yes
'';
}; };
} }

View file

@ -6,7 +6,7 @@ let
(config.my.home.wm.windowManager != null) (config.my.home.wm.windowManager != null)
]; ];
mkTerminalFeature = opt: flag: mkTerminalFlags = opt: flag:
let let
mkFlag = term: ''set -as terminal-features ",${term}:${flag}"''; mkFlag = term: ''set -as terminal-features ",${term}:${flag}"'';
enabledTerminals = lib.filterAttrs (_: v: v.${opt}) cfg.terminalFeatures; enabledTerminals = lib.filterAttrs (_: v: v.${opt}) cfg.terminalFeatures;
@ -20,8 +20,6 @@ in
enablePassthrough = mkEnableOption "tmux DCS passthrough sequence"; enablePassthrough = mkEnableOption "tmux DCS passthrough sequence";
enableResurrect = mkEnableOption "tmux-resurrect plugin";
terminalFeatures = mkOption { terminalFeatures = mkOption {
type = with types; attrsOf (submodule { type = with types; attrsOf (submodule {
options = { options = {
@ -32,7 +30,7 @@ in
}); });
default = { ${config.my.home.terminal.program} = { }; }; default = { ${config.my.home.terminal.program} = { }; };
defaultText = literalExpression '' defaultText = litteralExpression ''
{ ''${config.my.home.terminal.program} = { }; }; { ''${config.my.home.terminal.program} = { }; };
''; '';
example = { xterm-256color = { }; }; example = { xterm-256color = { }; };
@ -48,21 +46,18 @@ in
keyMode = "vi"; # Home-row keys and other niceties keyMode = "vi"; # Home-row keys and other niceties
clock24 = true; # I'm one of those heathens clock24 = true; # I'm one of those heathens
escapeTime = 0; # Let vim do its thing instead escapeTime = 0; # Let vim do its thing instead
historyLimit = 1000000; # Bigger buffer historyLimit = 100000; # Bigger buffer
mouse = false; # I dislike mouse support
focusEvents = true; # Report focus events
terminal = "tmux-256color"; # I want accurate termcap info terminal = "tmux-256color"; # I want accurate termcap info
aggressiveResize = true; # Automatic resize when switching client size
plugins = with pkgs.tmuxPlugins; builtins.filter (attr: attr != { }) [ plugins = with pkgs.tmuxPlugins; [
# Open high-lighted files in copy mode # Open high-lighted files in copy mode
open open
# Better pane management # Better pane management
pain-control pain-control
# Better session management # Better session management
sessionist sessionist
# X clipboard integration
{ {
# X clipboard integration
plugin = yank; plugin = yank;
extraConfig = '' extraConfig = ''
# Use 'clipboard' because of misbehaving apps (e.g: firefox) # Use 'clipboard' because of misbehaving apps (e.g: firefox)
@ -71,8 +66,8 @@ in
set -g @yank_action 'copy-pipe' set -g @yank_action 'copy-pipe'
''; '';
} }
# Show when prefix has been pressed
{ {
# Show when prefix has been pressed
plugin = prefix-highlight; plugin = prefix-highlight;
extraConfig = '' extraConfig = ''
# Also show when I'm in copy or sync mode # Also show when I'm in copy or sync mode
@ -82,23 +77,9 @@ in
set -g status-right '#{prefix_highlight} %a %Y-%m-%d %H:%M' set -g status-right '#{prefix_highlight} %a %Y-%m-%d %H:%M'
''; '';
} }
# Resurrect sessions
(lib.optionalAttrs cfg.enableResurrect {
plugin = resurrect;
extraConfig = ''
set -g @resurrect-dir '${config.xdg.stateHome}/tmux/resurrect'
'';
})
]; ];
extraConfig = '' extraConfig = ''
# Refresh configuration
bind-key -N "Source tmux.conf" R source-file ${config.xdg.configHome}/tmux/tmux.conf \; display-message "Sourced tmux.conf!"
# Accept sloppy Ctrl key when switching windows, on top of default mapping
bind-key -N "Select the previous window" C-p previous-window
bind-key -N "Select the next window" C-n next-window
# Better vim mode # Better vim mode
bind-key -T copy-mode-vi 'v' send -X begin-selection bind-key -T copy-mode-vi 'v' send -X begin-selection
${ ${
@ -123,9 +104,9 @@ in
} }
# Force OSC8 hyperlinks for each relevant $TERM # Force OSC8 hyperlinks for each relevant $TERM
${mkTerminalFeature "hyperlinks" "hyperlinks"} ${mkTerminalFlags "hyperlinks" "hyperlinks"}
# Force 24-bit color for each relevant $TERM # Force 24-bit color for each relevant $TERM
${mkTerminalFeature "trueColor" "RGB"} ${mkTerminalFlags "trueColor" "RGB"}
''; '';
}; };
} }

View file

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.home.trgui;
in
{
options.my.home.trgui = with lib; {
enable = mkEnableOption "Transmission GUI onfiguration";
package = mkPackageOption pkgs "TrguiNG" { default = "trgui-ng"; };
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
cfg.package
];
};
}

View file

@ -1,6 +0,0 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use a small indentation value on JSON files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Don't show Netrw in buffer list
setlocal bufhidden=delete
let b:undo_ftplugin='|setlocal bufhidden<'

View file

@ -1,6 +0,0 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use a small indentation value on query files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'

View file

@ -0,0 +1,10 @@
local wk = require("which-key")
local keys = {
name = "Comment/uncomment",
c = "Current line",
u = "Uncomment the current and adjacent commented lines",
["gc"] = "Uncomment the current and adjacent commented lines",
}
wk.register(keys, { prefix = "gc" })

View file

@ -0,0 +1,7 @@
local wk = require("which-key")
local keys = {
["<leader>"] = { "<cmd>nohls<CR>", "Clear search highlight" },
}
wk.register(keys, { prefix = "<leader>" })

View file

@ -0,0 +1,15 @@
local wk = require("which-key")
local telescope_builtin = require("telescope.builtin")
local keys = {
f = {
name = "Fuzzy finder",
b = { telescope_builtin.buffers, "Open buffers" },
f = { telescope_builtin.git_files, "Git tracked files" },
F = { telescope_builtin.find_files, "Files" },
g = { telescope_builtin.live_grep, "Grep string" },
G = { telescope_builtin.grep_string, "Grep string under cursor" },
},
}
wk.register(keys, { prefix = "<leader>" })

View file

@ -0,0 +1,30 @@
local wk = require("which-key")
local motions = {
["]m"] = "Next method start",
["]M"] = "Next method end",
["]S"] = "Next statement start",
["]]"] = "Next class start",
["]["] = "Next class end",
["[m"] = "Previous method start",
["[M"] = "Previous method end",
["[S"] = "Previous statement start",
["[["] = "Previous class start",
["[]"] = "Previous class end",
}
local objects = {
["aa"] = "a parameter",
["ia"] = "inner parameter",
["ab"] = "a block",
["ib"] = "inner block",
["ac"] = "a class",
["ic"] = "inner class",
["af"] = "a function",
["if"] = "inner function",
["ak"] = "a comment",
["aS"] = "a statement",
}
wk.register(motions, { mode = "n" })
wk.register(objects, { mode = "o" })

View file

@ -3,120 +3,126 @@ local wk = require("which-key")
local lsp = require("ambroisie.lsp") local lsp = require("ambroisie.lsp")
local keys = { local keys = {
-- Previous -- Edition and navigation mappins
{ "[", group = "Previous" }, ["["] = {
-- Edition and navigation mappings name = "Previous",
{ "[<space>", desc = "Insert blank line above" }, ["<space>"] = "Insert blank line above",
{ "[<C-L>", desc = "Previous location list file" }, ["<C-L>"] = "Previous location list file",
{ "[<C-Q>", desc = "Previous quickfix list file" }, ["<C-Q>"] = "Previous quickfix list file",
{ "[<C-T>", desc = "Previous tag in preview window" }, ["<C-T>"] = "Previous tag in preview window",
{ "[a", desc = "Previous argument" }, a = "Previous argument",
{ "[A", desc = "First argument" }, A = "First argument",
{ "[b", desc = "Previous buffer" }, b = "Previous buffer",
{ "[B", desc = "First buffer" }, B = "First buffer",
{ "[e", desc = "Exchange previous line" }, e = "Exchange previous line",
{ "[f", desc = "Previous file in directory" }, f = "Previous file in directory",
{ "[l", desc = "Previous location list entry" }, l = "Previous location list entry",
{ "[L", desc = "First Location list entry" }, L = "First Location list entry",
{ "[n", desc = "Previous conflict marker/diff hunk" }, n = "Previous conflict marker/diff hunk",
{ "[p", desc = "Paste line above" }, p = "Paste line above",
{ "[P", desc = "Paste line above" }, P = "Paste line above",
{ "[q", desc = "Previous quickfix list entry" }, q = "Previous quickfix list entry",
{ "[Q", desc = "First quickfix list entry" }, Q = "First quickfix list entry",
{ "[t", desc = "Previous matching tag" }, t = "Previous matching tag",
{ "[T", desc = "First matching tag" }, T = "First matching tag",
{ "[z", desc = "Previous fold" }, z = "Previous fold",
-- Encoding -- Encoding
{ "[C", desc = "C string encode" }, C = "C string encode",
{ "[u", desc = "URL encode" }, u = "URL encode",
{ "[x", desc = "XML encode" }, x = "XML encode",
{ "[y", desc = "C string encode" }, y = "C string encode",
-- Custom
d = { lsp.goto_prev_diagnostic, "Previous diagnostic" },
},
["]"] = {
name = "Next",
["<space>"] = "Insert blank line below",
["<C-L>"] = "Next location list file",
["<C-Q>"] = "Next quickfix list file",
["<C-T>"] = "Next tag in preview window",
a = "Next argument",
A = "Last argument",
b = "Next buffer",
B = "Last buffer",
e = "Exchange next line",
f = "Next file in directory",
l = "Next location list entry",
L = "Last Location list entry",
n = "Next conflict marker/diff hunk",
p = "Paste line below",
P = "Paste line below",
q = "Next quickfix list entry",
Q = "Last quickfix list entry",
t = "Next matching tag",
T = "Last matching tag",
z = "Next fold",
-- Decoding
C = "C string decode",
u = "URL decode",
x = "XML decode",
y = "C string decode",
-- Custom
d = { lsp.goto_next_diagnostic, "Next diagnostic" },
},
-- Next -- Option mappings
{ "]", group = "Next" }, ["[o"] = {
-- Edition and navigation mappings name = "Enable option",
{ "]<space>", desc = "Insert blank line below" }, b = "Light background",
{ "]<C-L>", desc = "Next location list file" }, c = "Cursor line",
{ "]<C-Q>", desc = "Next quickfix list file" }, d = "Diff",
{ "]<C-T>", desc = "Next tag in preview window" }, f = { "<cmd>FormatEnable<CR>", "LSP Formatting" },
{ "]a", desc = "Next argument" }, h = "Search high-lighting",
{ "]A", desc = "Last argument" }, i = "Case insensitive search",
{ "]b", desc = "Next buffer" }, l = "List mode",
{ "]B", desc = "Last buffer" }, n = "Line numbers",
{ "]e", desc = "Exchange next line" }, r = "Relative line numbers",
{ "]f", desc = "Next file in directory" }, p = { "<cmd>lwindow<CR>", "Location list" },
{ "]l", desc = "Next location list entry" }, q = { "<cmd>cwindow<CR>", "Quickfix list" },
{ "]L", desc = "Last Location list entry" }, u = "Cursor column",
{ "]n", desc = "Next conflict marker/diff hunk" }, v = "Virtual editing",
{ "]p", desc = "Paste line below" }, w = "Text wrapping",
{ "]P", desc = "Paste line below" }, x = "Cursor line and column",
{ "]q", desc = "Next quickfix list entry" }, z = "Spell checking",
{ "]Q", desc = "Last quickfix list entry" }, },
{ "]t", desc = "Next matching tag" }, ["]o"] = {
{ "]T", desc = "Last matching tag" }, name = "Option off",
{ "]z", desc = "Next fold" }, b = "Light background",
-- Decoding c = "Cursor line",
{ "]C", desc = "C string decode" }, d = "Diff",
{ "]u", desc = "URL decode" }, f = { "<cmd>FormatDisable<CR>", "LSP Formatting" },
{ "]x", desc = "XML decode" }, h = "Search high-lighting",
{ "]y", desc = "C string decode" }, i = "Case insensitive search",
l = "List mode",
-- Enable option n = "Line numbers",
{ "[o", group = "Enable option" }, p = { "<cmd>lclose<CR>", "Location list" },
{ "[ob", desc = "Light background" }, q = { "<cmd>cclose<CR>", "Quickfix list" },
{ "[oc", desc = "Cursor line" }, r = "Relative line numbers",
{ "[od", desc = "Diff" }, u = "Cursor column",
{ "[of", "<cmd>FormatEnable<CR>", desc = "LSP Formatting" }, v = "Virtual editing",
{ "[oh", desc = "Search high-lighting" }, w = "Text wrapping",
{ "[oi", desc = "Case insensitive search" }, x = "Cursor line and column",
{ "[ol", desc = "List mode" }, z = "Spell checking",
{ "[on", desc = "Line numbers" }, },
{ "[or", desc = "Relative line numbers" }, ["yo"] = {
{ "[op", "<cmd>lwindow<CR>", desc = "Location list" }, name = "Option toggle",
{ "[oq", "<cmd>cwindow<CR>", desc = "Quickfix list" }, b = "Light background",
{ "[ou", desc = "Cursor column" }, c = "Cursor line",
{ "[ov", desc = "Virtual editing" }, d = "Diff",
{ "[ow", desc = "Text wrapping" }, f = { "<cmd>FormatToggle<CR>", "LSP Formatting" },
{ "[ox", desc = "Cursor line and column" }, h = "Search high-lighting",
{ "[oz", desc = "Spell checking" }, i = "Case insensitive search",
l = "List mode",
-- Disable option n = "Line numbers",
{ "]o", group = "Disable option" }, p = { "<Plug>(qf_loc_toggle)", "Location list" },
{ "]ob", desc = "Light background" }, q = { "<Plug>(qf_qf_toggle)", "Quickfix list" },
{ "]oc", desc = "Cursor line" }, r = "Relative line numbers",
{ "]od", desc = "Diff" }, u = "Cursor column",
{ "]of", "<cmd>FormatDisable<CR>", desc = "LSP Formatting" }, v = "Virtual editing",
{ "]oh", desc = "Search high-lighting" }, w = "Text wrapping",
{ "]oi", desc = "Case insensitive search" }, x = "Cursor line and column",
{ "]ol", desc = "List mode" }, z = "Spell checking",
{ "]on", desc = "Line numbers" }, },
{ "]op", "<cmd>lclose<CR>", desc = "Location list" },
{ "]oq", "<cmd>cclose<CR>", desc = "Quickfix list" },
{ "]or", desc = "Relative line numbers" },
{ "]ou", desc = "Cursor column" },
{ "]ov", desc = "Virtual editing" },
{ "]ow", desc = "Text wrapping" },
{ "]ox", desc = "Cursor line and column" },
{ "]oz", desc = "Spell checking" },
-- Toggle option
{ "yo", group = "Toggle option" },
{ "yob", desc = "Light background" },
{ "yoc", desc = "Cursor line" },
{ "yod", desc = "Diff" },
{ "yof", "<cmd>FormatToggle<CR>", desc = "LSP Formatting" },
{ "yoh", desc = "Search high-lighting" },
{ "yoi", desc = "Case insensitive search" },
{ "yol", desc = "List mode" },
{ "yon", desc = "Line numbers" },
{ "yop", "<Plug>(qf_loc_toggle)", desc = "Location list" },
{ "yoq", "<Plug>(qf_qf_toggle)", desc = "Quickfix list" },
{ "yor", desc = "Relative line numbers" },
{ "you", desc = "Cursor column" },
{ "yov", desc = "Virtual editing" },
{ "yow", desc = "Text wrapping" },
{ "yox", desc = "Cursor line and column" },
{ "yoz", desc = "Spell checking" },
} }
wk.add(keys) wk.register(keys)

View file

@ -1,5 +0,0 @@
; extends
; I want to the line added/removed markers to be the correct color
"+" @diff.plus
"-" @diff.minus

View file

@ -1,6 +0,0 @@
; extends
; Highlight over-extended subject lines (rely on wrapping for message body)
((subject) @comment.error
(#vim-match? @comment.error ".\{50,}")
(#offset! @comment.error 0 50 0 0))

View file

@ -40,18 +40,25 @@ in
lualine-lsp-progress # Show progress for LSP servers lualine-lsp-progress # Show progress for LSP servers
# tpope essentials # tpope essentials
vim-commentary # Easy comments
vim-eunuch # UNIX integrations vim-eunuch # UNIX integrations
vim-fugitive # A 'git' wrapper vim-fugitive # A 'git' wrapper
vim-git # Sane git syntax files vim-git # Sane git syntax files
vim-repeat # Enanche '.' for plugins vim-repeat # Enanche '.' for plugins
vim-rsi # Readline mappings vim-rsi # Readline mappings
vim-unimpaired # Some ex command mappings vim-unimpaired # Some ex command mappings
vim-vinegar # Better netrw
# Languages # Languages
rust-vim
vim-beancount vim-beancount
vim-jsonnet
vim-nix
vim-toml
# General enhancements # General enhancements
vim-qf # Better quick-fix list vim-qf # Better quick-fix list
nvim-osc52 # Send clipboard data through terminal escape for SSH
# Other wrappers # Other wrappers
git-messenger-vim # A simple blame window git-messenger-vim # A simple blame window
@ -59,13 +66,16 @@ in
# LSP and linting # LSP and linting
nvim-lspconfig # Easy LSP configuration nvim-lspconfig # Easy LSP configuration
lsp-format-nvim # Simplified formatting configuration lsp-format-nvim # Simplified formatting configuration
lsp_lines-nvim # Show diagnostics *over* regions
none-ls-nvim # LSP integration for linters and formatters none-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting nvim-treesitter.withAllGrammars # Better highlighting
nvim-treesitter-textobjects # More textobjects nvim-treesitter-textobjects # More textobjects
nvim-ts-context-commentstring # Comment string in nested language blocks
plenary-nvim # 'null-ls', 'telescope' dependency plenary-nvim # 'null-ls', 'telescope' dependency
# Completion # Completion
luasnip # Snippet manager compatible with LSP luasnip # Snippet manager compatible with LSP
friendly-snippets # LSP snippets collection
nvim-cmp # Completion engine nvim-cmp # Completion engine
cmp-async-path # More responsive path completion cmp-async-path # More responsive path completion
cmp-buffer # Words from open buffers cmp-buffer # Words from open buffers
@ -78,8 +88,8 @@ in
dressing-nvim # Integrate native UI hooks with Telescope etc... dressing-nvim # Integrate native UI hooks with Telescope etc...
gitsigns-nvim # Fast git UI integration gitsigns-nvim # Fast git UI integration
nvim-surround # Deal with pairs, now in Lua nvim-surround # Deal with pairs, now in Lua
oil-nvim # Better alternative to NetrW
telescope-fzf-native-nvim # Use 'fzf' fuzzy matching algorithm telescope-fzf-native-nvim # Use 'fzf' fuzzy matching algorithm
telescope-lsp-handlers-nvim # Use 'telescope' for various LSP actions
telescope-nvim # Fuzzy finder interface telescope-nvim # Fuzzy finder interface
which-key-nvim # Show available mappings which-key-nvim # Show available mappings
]; ];
@ -95,11 +105,8 @@ in
nixpkgs-fmt nixpkgs-fmt
# Shell # Shell
bash-language-server nodePackages.bash-language-server
shfmt shfmt
# Generic
typos-lsp
]; ];
}; };

View file

@ -0,0 +1,7 @@
-- Use GLSL filetype for common shader file extensions
vim.filetype.add({
extension = {
frag = "glsl",
vert = "glsl",
},
})

View file

@ -0,0 +1,7 @@
-- Use GN filetype for Chromium Generate Ninja files
vim.filetype.add({
extension = {
gn = "gn",
gni = "gn",
},
})

View file

@ -0,0 +1,6 @@
-- Kbuild is just a Makefile under a different name
vim.filetype.add({
filename = {
["Kbuild"] = "make",
},
})

View file

@ -0,0 +1,6 @@
-- Use LaTeX filetype for TikZ files
vim.filetype.add({
extension = {
tikz = "tex",
},
})

View file

@ -1,4 +1,4 @@
" Basic configuration {{{ " Basic configuraion {{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use UTF-8 " Use UTF-8
set encoding=utf-8 set encoding=utf-8
@ -38,10 +38,10 @@ set tabstop=8
" File parameters {{{ " File parameters {{{
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Disable swap files " Disable backups, we have source control for that
set nobackup
" Disable swapfiles too
set noswapfile set noswapfile
" Enable undo files
set undofile
" }}} " }}}
" UI and UX parameters {{{ " UI and UX parameters {{{
@ -68,6 +68,8 @@ set listchars=tab:>─,trail:·,nbsp:¤
" Use patience diff " Use patience diff
set diffopt+=algorithm:patience set diffopt+=algorithm:patience
" Align similar lines in each hunk
set diffopt+=linematch:50
" Don't redraw when executing macros " Don't redraw when executing macros
set lazyredraw set lazyredraw
@ -81,29 +83,11 @@ set updatetime=250
" Disable all mouse integrations " Disable all mouse integrations
set mouse= set mouse=
" Setup some overrides for gruvbox " Set dark mode by default
lua << EOF set background=dark
local gruvbox = require("gruvbox")
local colors = gruvbox.palette
gruvbox.setup({ " 24 bit colors
overrides = { set termguicolors
-- Only URLs should be underlined
["@string.special.path"] = { link = "GruvboxOrange" },
-- Revert back to the better diff highlighting
DiffAdd = { fg = colors.green, bg = "NONE" },
DiffChange = { fg = colors.aqua, bg = "NONE" },
DiffDelete = { fg = colors.red, bg = "NONE" },
DiffText = { fg = colors.yellow, bg = colors.bg0 },
-- Directories "pop" better in blue
Directory = { link = "GruvboxBlueBold" },
},
italic = {
-- Comments should not be italic, for e.g: box drawing
comments = false,
},
})
EOF
" Use my preferred colorscheme " Use my preferred colorscheme
colorscheme gruvbox colorscheme gruvbox
" }}} " }}}

View file

@ -3,9 +3,46 @@ local M = {}
-- Simplified LSP formatting configuration -- Simplified LSP formatting configuration
local lsp_format = require("lsp-format") local lsp_format = require("lsp-format")
--- Move to the next/previous diagnostic, automatically showing the diagnostics
--- float if necessary.
--- @param forward whether to go forward or backwards
local function goto_diagnostic(forward)
vim.validate({
forward = { forward, "boolean" },
})
local opts = {
float = false,
}
-- Only show floating diagnostics if they are otherwise not displayed
local config = vim.diagnostic.config()
if not (config.virtual_text or config.virtual_lines) then
opts.float = true
end
if forward then
vim.diagnostic.goto_next(opts)
else
vim.diagnostic.goto_prev(opts)
end
end
--- Move to the next diagnostic, automatically showing the diagnostics float if
--- necessary.
M.goto_next_diagnostic = function()
goto_diagnostic(true)
end
--- Move to the previous diagnostic, automatically showing the diagnostics float
--- if necessary.
M.goto_prev_diagnostic = function()
goto_diagnostic(false)
end
--- shared LSP configuration callback --- shared LSP configuration callback
--- @param client native client configuration --- @param client native client configuration
--- @param bufnr int? buffer number of the attached client --- @param bufnr int? buffer number of the attched client
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
-- Format on save -- Format on save
lsp_format.on_attach(client, bufnr) lsp_format.on_attach(client, bufnr)
@ -42,10 +79,6 @@ M.on_attach = function(client, bufnr)
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = text, virtual_text = text,
virtual_lines = lines, virtual_lines = lines,
jump = {
-- Show float on jump if no diagnostic text is otherwise shown
float = not (text or lines),
},
}) })
end end
@ -53,36 +86,32 @@ M.on_attach = function(client, bufnr)
vim.diagnostic.open_float(nil, { scope = "buffer" }) vim.diagnostic.open_float(nil, { scope = "buffer" })
end end
local function toggle_inlay_hints()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
local keys = { local keys = {
buffer = bufnr, K = { vim.lsp.buf.hover, "Show symbol information" },
-- LSP navigation ["<C-k>"] = { vim.lsp.buf.signature_help, "Show signature information" },
{ "K", vim.lsp.buf.hover, desc = "Show symbol information" }, ["gd"] = { vim.lsp.buf.definition, "Go to definition" },
{ "<C-k>", vim.lsp.buf.signature_help, desc = "Show signature information" }, ["gD"] = { vim.lsp.buf.declaration, "Go to declaration" },
{ "gd", vim.lsp.buf.definition, desc = "Go to definition" }, ["gi"] = { vim.lsp.buf.implementation, "Go to implementation" },
{ "gD", vim.lsp.buf.declaration, desc = "Go to declaration" }, ["gr"] = { vim.lsp.buf.references, "List all references" },
{ "gi", vim.lsp.buf.implementation, desc = "Go to implementation" },
{ "gr", vim.lsp.buf.references, desc = "List all references" }, ["<leader>c"] = {
-- Code name = "Code",
{ "<leader>c", group = "Code" }, a = { vim.lsp.buf.code_action, "Code actions" },
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code actions" }, d = { cycle_diagnostics_display, "Cycle diagnostics display" },
{ "<leader>cd", cycle_diagnostics_display, desc = "Cycle diagnostics display" }, D = { show_buffer_diagnostics, "Show buffer diagnostics" },
{ "<leader>cD", show_buffer_diagnostics, desc = "Show buffer diagnostics" }, r = { vim.lsp.buf.rename, "Rename symbol" },
{ "<leader>ch", toggle_inlay_hints, desc = "Toggle inlay hints" }, s = { vim.lsp.buf.signature_help, "Show signature" },
{ "<leader>cr", vim.lsp.buf.rename, desc = "Rename symbol" }, t = { vim.lsp.buf.type_definition, "Go to type definition" },
{ "<leader>cs", vim.lsp.buf.signature_help, desc = "Show signature" }, w = {
{ "<leader>ct", vim.lsp.buf.type_definition, desc = "Go to type definition" }, name = "Workspace",
-- Workspace a = { vim.lsp.buf.add_workspace_folder, "Add folder to workspace" },
{ "<leader>cw", group = "Workspace" }, l = { list_workspace_folders, "List folders in workspace" },
{ "<leader>cwa", vim.lsp.buf.add_workspace_folder, desc = "Add folder to workspace" }, r = { vim.lsp.buf.remove_workspace_folder, "Remove folder from workspace" },
{ "<leader>cwl", list_workspace_folders, desc = "List folders in workspace" }, },
{ "<leader>cwr", vim.lsp.buf.remove_workspace_folder, desc = "Remove folder from workspace" }, },
} }
wk.add(keys) wk.register(keys, { buffer = bufnr })
end end
return M return M

View file

@ -38,7 +38,7 @@ end
--- @param bufnr int? buffer number --- @param bufnr int? buffer number
--- @return table all active LSP client names --- @return table all active LSP client names
M.list_lsp_clients = function(bufnr) M.list_lsp_clients = function(bufnr)
local clients = vim.lsp.get_clients({ bufnr = bufnr }) local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
local names = {} local names = {}
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
@ -48,22 +48,4 @@ M.list_lsp_clients = function(bufnr)
return names return names
end end
--- partially apply a function with given arguments
M.partial = function(f, ...)
local a = { ... }
local a_len = select("#", ...)
return function(...)
local tmp = { ... }
local tmp_len = select("#", ...)
-- Merge arg lists
for i = 1, tmp_len do
a[a_len + i] = tmp[i]
end
return f(unpack(a, 1, a_len + tmp_len))
end
end
return M return M

View file

@ -7,18 +7,17 @@ local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", { clear = true
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
pattern = "*", pattern = "*",
group = numbertoggle, group = numbertoggle,
callback = function() command = "if &nu | setlocal rnu | endif",
if vim.opt.number:get() then
vim.opt.relativenumber = true
end
end,
}) })
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, { vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, {
pattern = "*", pattern = "*",
group = numbertoggle, group = numbertoggle,
callback = function() command = "if &nu | setlocal nornu | endif",
if vim.opt.number:get() then })
vim.opt.relativenumber = false
end -- Never show the sign column in a terminal buffer
end, vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
group = numbertoggle,
command = "setlocal nonu nornu",
}) })

View file

@ -0,0 +1,5 @@
-- Intercept all fold commands
-- stylua: ignore
vim.g.fastfold_fold_command_suffixes = {
"x", "X", "a", "A", "o", "O", "c", "C", "r", "R", "m", "M", "i", "n", "N",
}

View file

@ -1,75 +1,58 @@
local gitsigns = require("gitsigns") local gitsigns = require("gitsigns")
local utils = require("ambroisie.utils")
local wk = require("which-key") local wk = require("which-key")
--- Transform `f` into a function which acts on the current visual selection
local function make_visual(f)
return function()
local first = vim.fn.line("v")
local last = vim.fn.line(".")
f({ first, last })
end
end
local function nav_hunk(dir)
if vim.wo.diff then
local map = {
prev = "[c",
next = "]c",
}
vim.cmd.normal({ map[dir], bang = true })
else
gitsigns.nav_hunk(dir)
end
end
gitsigns.setup({ gitsigns.setup({
current_line_blame_opts = { current_line_blame_opts = {
-- Show the blame quickly -- Show the blame quickly
delay = 100, delay = 100,
}, },
-- Work-around for https://github.com/lewis6991/gitsigns.nvim/issues/929
signs_staged_enable = false,
}) })
local keys = { local keys = {
-- Navigation -- Navigation
{ "[c", utils.partial(nav_hunk, "prev"), desc = "Previous hunk/diff" }, ["[c"] = { "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", "Previous hunk/diff", expr = true },
{ "]c", utils.partial(nav_hunk, "next"), desc = "Next hunk/diff" }, ["]c"] = { "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", "Next hunk/diff", expr = true },
-- Commands -- Commands
{ "<leader>g", group = "Git" }, ["<leader>g"] = {
{ "<leader>gb", gitsigns.toggle_current_line_blame, desc = "Toggle blame virtual text" }, name = "Git",
{ "<leader>gd", gitsigns.diffthis, desc = "Diff buffer" }, -- Actions
{ "<leader>gD", utils.partial(gitsigns.diffthis, "~"), desc = "Diff buffer against last commit" }, b = { gitsigns.toggle_current_line_blame, "Toggle blame virtual text" },
{ "<leader>gg", "<cmd>Git<CR>", desc = "Git status" }, d = { gitsigns.diffthis, "Diff buffer" },
{ "<leader>gh", gitsigns.toggle_deleted, desc = "Show deleted hunks" }, -- stylua: ignore
{ "<leader>gL", "<cmd>:sp<CR><C-w>T:Gllog --follow -- %:p<CR>", desc = "Current buffer log" }, D = { function() gitsigns.diffthis("~") end, "Diff buffer against last commit" },
{ "<leader>gm", "<Plug>(git-messenger)", desc = "Current line blame" }, g = { "<cmd>Git<CR>", "Git status" },
{ "<leader>gp", gitsigns.preview_hunk, desc = "Preview hunk" }, h = { gitsigns.toggle_deleted, "Show deleted hunks" },
{ "<leader>gr", gitsigns.reset_hunk, desc = "Restore hunk" }, L = { "<cmd>:sp<CR><C-w>T:Gllog --follow -- %:p<CR>", "Current buffer log" },
{ "<leader>gR", gitsigns.reset_buffer, desc = "Restore buffer" }, m = { "<Plug>(git-messenger)", "Current line blame" },
{ "<leader>gs", gitsigns.stage_hunk, desc = "Stage hunk" }, p = { gitsigns.preview_hunk, "Preview hunk" },
{ "<leader>gS", gitsigns.stage_buffer, desc = "Stage buffer" }, r = { gitsigns.reset_hunk, "Restore hunk" },
{ "<leader>gu", gitsigns.undo_stage_hunk, desc = "Undo stage hunk" }, R = { gitsigns.reset_buffer, "Restore buffer" },
{ "<leader>g[", utils.partial(gitsigns.nav_hunk, "prev"), desc = "Previous hunk" }, s = { gitsigns.stage_hunk, "Stage hunk" },
{ "<leader>g]", utils.partial(gitsigns.nav_hunk, "next"), desc = "Next hunk" }, S = { gitsigns.stage_buffer, "Stage buffer" },
u = { gitsigns.undo_stage_hunk, "Undo stage hunk" },
["["] = { gitsigns.prev_hunk, "Previous hunk" },
["]"] = { gitsigns.next_hunk, "Next hunk" },
},
} }
local objects = { local objects = {
mode = "o", ["ih"] = { gitsigns.select_hunk, "Git hunk" },
{ "ih", gitsigns.select_hunk, desc = "Git hunk" },
}
-- Visual
local visual = {
mode = { "x" },
{ "ih", gitsigns.select_hunk, desc = "Git hunk" },
{ "<leader>g", group = "Git" },
{ "<leader>gp", gitsigns.preview_hunk, desc = "Preview selection" },
{ "<leader>gr", make_visual(gitsigns.reset_hunk), desc = "Restore selection" },
{ "<leader>gs", make_visual(gitsigns.stage_hunk), desc = "Stage selection" },
{ "<leader>gu", gitsigns.undo_stage_hunk, desc = "Undo stage selection" },
} }
wk.add(keys) local visual = {
wk.add(objects) ["ih"] = { gitsigns.select_hunk, "Git hunk" },
wk.add(visual)
-- Only the actual command can make use of the visual selection...
["<leader>g"] = {
name = "Git",
p = { ":Gitsigns preview_hunk<CR>", "Preview selection" },
r = { ":Gitsigns reset_hunk<CR>", "Restore selection" },
s = { ":Gitsigns stage_hunk<CR>", "Stage selection" },
u = { ":Gitsigns undo_stage_hunk<CR>", "Undo stage selection" },
},
}
wk.register(keys, { buffer = bufnr })
wk.register(objects, { buffer = bufnr, mode = "o" })
wk.register(visual, { buffer = bufnr, mode = "x" })

View file

@ -0,0 +1,3 @@
local lsp_lines = require("lsp_lines")
lsp_lines.setup()

View file

@ -1,3 +1,4 @@
local lspconfig = require("lspconfig")
local lsp = require("ambroisie.lsp") local lsp = require("ambroisie.lsp")
local utils = require("ambroisie.utils") local utils = require("ambroisie.utils")
@ -15,57 +16,63 @@ vim.diagnostic.config({
update_in_insert = false, update_in_insert = false,
-- Show highest severity first -- Show highest severity first
severity_sort = true, severity_sort = true,
jump = {
-- Show float on diagnostic jumps
float = true,
},
}) })
-- Inform servers we are able to do completion, snippets, etc... -- Inform servers we are able to do completion, snippets, etc...
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Shared configuration -- C/C++
vim.lsp.config("*", { if utils.is_executable("clangd") then
capabilities = capabilities, lspconfig.clangd.setup({
on_attach = lsp.on_attach, capabilities = capabilities,
}) on_attach = lsp.on_attach,
})
local servers = { end
-- C/C++
clangd = {}, -- Haskell
-- Haskell if utils.is_executable("haskell-language-server-wrapper") then
hls = {}, lspconfig.hls.setup({
-- Nix capabilities = capabilities,
nil_ls = {}, on_attach = lsp.on_attach,
-- Python })
pyright = {}, end
ruff = {},
-- Rust -- Nix
rust_analyzer = {}, if utils.is_executable("nil") then
-- Shell lspconfig.nil_ls.setup({
bashls = { capabilities = capabilities,
filetypes = { "bash", "sh", "zsh" }, on_attach = lsp.on_attach,
settings = { })
bashIde = { end
shfmt = {
-- Simplify the code -- Python
simplifyCode = true, if utils.is_executable("pyright") then
-- Indent switch cases lspconfig.pyright.setup({
caseIndent = true, capabilities = capabilities,
}, on_attach = lsp.on_attach,
}, })
}, end
},
-- Starlark if utils.is_executable("ruff-lsp") then
starpls = {}, lspconfig.ruff_lsp.setup({
-- Generic capabilities = capabilities,
harper_ls = {}, on_attach = lsp.on_attach,
typos_lsp = {}, })
} end
for server, config in pairs(servers) do -- Rust
if not vim.tbl_isempty(config) then if utils.is_executable("rust-analyzer") then
vim.lsp.config(server, config) lspconfig.rust_analyzer.setup({
end capabilities = capabilities,
vim.lsp.enable(server) on_attach = lsp.on_attach,
})
end
-- Shell
if utils.is_executable("bash-language-server") then
lspconfig.bashls.setup({
filetypes = { "bash", "sh", "zsh" },
capabilities = capabilities,
on_attach = lsp.on_attach,
})
end end

View file

@ -1,5 +1,4 @@
local lualine = require("lualine") local lualine = require("lualine")
local oil = require("oil")
local utils = require("ambroisie.utils") local utils = require("ambroisie.utils")
local function list_spell_languages() local function list_spell_languages()
@ -31,7 +30,7 @@ lualine.setup({
{ "mode" }, { "mode" },
}, },
lualine_b = { lualine_b = {
{ "branch" }, { "FugitiveHead" },
{ "filename", symbols = { readonly = "🔒" } }, { "filename", symbols = { readonly = "🔒" } },
}, },
lualine_c = { lualine_c = {
@ -58,21 +57,5 @@ lualine.setup({
extensions = { extensions = {
"fugitive", "fugitive",
"quickfix", "quickfix",
{
sections = {
lualine_a = {
{ "mode" },
},
lualine_b = {
{ "branch" },
},
lualine_c = {
function()
return vim.fn.fnamemodify(oil.get_current_dir(), ":~")
end,
},
},
filetypes = { "oil" },
},
}, },
}) })

View file

@ -0,0 +1 @@
require("luasnip.loaders.from_vscode").lazy_load()

View file

@ -18,6 +18,16 @@ null_ls.register({
}), }),
}) })
-- C, C++
null_ls.register({
null_ls.builtins.formatting.clang_format.with({
-- Only used if available, but prefer clangd formatting if available
condition = function()
return utils.is_executable("clang-format") and not utils.is_executable("clangd")
end,
}),
})
-- Nix -- Nix
null_ls.register({ null_ls.register({
null_ls.builtins.formatting.nixpkgs_fmt.with({ null_ls.builtins.formatting.nixpkgs_fmt.with({
@ -46,3 +56,29 @@ null_ls.register({
condition = utils.is_executable_condition("isort"), condition = utils.is_executable_condition("isort"),
}), }),
}) })
-- Shell (non-POSIX)
null_ls.register({
null_ls.builtins.formatting.shfmt.with({
-- Indent with 4 spaces, simplify the code, indent switch cases,
-- add space after redirection, use bash dialect
extra_args = { "-i", "4", "-s", "-ci", "-sr", "-ln", "bash" },
-- Restrict to bash and zsh
filetypes = { "bash", "zsh" },
-- Only used if available
condition = utils.is_executable_condition("shfmt"),
}),
})
-- Shell (POSIX)
null_ls.register({
null_ls.builtins.formatting.shfmt.with({
-- Indent with 4 spaces, simplify the code, indent switch cases,
-- add space after redirection, use POSIX
extra_args = { "-i", "4", "-s", "-ci", "-sr", "-ln", "posix" },
-- Restrict to POSIX sh
filetypes = { "sh" },
-- Only used if available
condition = utils.is_executable_condition("shfmt"),
}),
})

View file

@ -1,36 +0,0 @@
local oil = require("oil")
local wk = require("which-key")
local detail = false
oil.setup({
-- Don't show icons
columns = {},
view_options = {
-- Show files and directories that start with "." by default
show_hidden = true,
-- But never '..'
is_always_hidden = function(name, bufnr)
return name == ".."
end,
},
keymaps = {
["gd"] = {
desc = "Toggle file detail view",
callback = function()
detail = not detail
if detail then
oil.set_columns({ "icon", "permissions", "size", "mtime" })
else
oil.set_columns({ "icon" })
end
end,
},
},
})
local keys = {
{ "-", oil.open, desc = "Open parent directory" },
}
wk.add(keys)

View file

@ -0,0 +1,17 @@
if not require("ambroisie.utils").is_ssh() then
return
end
local function copy(lines, _)
require("osc52").copy(table.concat(lines, "\n"))
end
local function paste()
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
end
vim.g.clipboard = {
name = "osc52",
copy = { ["+"] = copy, ["*"] = copy },
paste = { ["+"] = paste, ["*"] = paste },
}

View file

@ -1,6 +1,4 @@
local telescope = require("telescope") local telescope = require("telescope")
local telescope_builtin = require("telescope.builtin")
local wk = require("which-key")
telescope.setup({ telescope.setup({
defaults = { defaults = {
@ -23,14 +21,4 @@ telescope.setup({
}) })
telescope.load_extension("fzf") telescope.load_extension("fzf")
telescope.load_extension("lsp_handlers")
local keys = {
{ "<leader>f", group = "Fuzzy finder" },
{ "<leader>fb", telescope_builtin.buffers, desc = "Open buffers" },
{ "<leader>ff", telescope_builtin.git_files, desc = "Git tracked files" },
{ "<leader>fF", telescope_builtin.find_files, desc = "Files" },
{ "<leader>fg", telescope_builtin.live_grep, desc = "Grep string" },
{ "<leader>fG", telescope_builtin.grep_string, desc = "Grep string under cursor" },
}
wk.add(keys)

View file

@ -1,5 +1,4 @@
local ts_config = require("nvim-treesitter.configs") local ts_config = require("nvim-treesitter.configs")
ts_config.setup({ ts_config.setup({
highlight = { highlight = {
enable = true, enable = true,
@ -15,16 +14,16 @@ ts_config.setup({
-- Jump to matching text objects -- Jump to matching text objects
lookahead = true, lookahead = true,
keymaps = { keymaps = {
["aa"] = { query = "@parameter.outer", desc = "a parameter" }, ["aa"] = "@parameter.outer",
["ia"] = { query = "@parameter.inner", desc = "inner parameter" }, ["ia"] = "@parameter.inner",
["ab"] = { query = "@block.outer", desc = "a block" }, ["ab"] = "@block.outer",
["ib"] = { query = "@block.inner", desc = "inner block" }, ["ib"] = "@block.inner",
["ac"] = { query = "@class.outer", desc = "a class" }, ["ac"] = "@class.outer",
["ic"] = { query = "@class.inner", desc = "inner class" }, ["ic"] = "@class.inner",
["af"] = { query = "@function.outer", desc = "a function" }, ["af"] = "@function.outer",
["if"] = { query = "@function.inner", desc = "inner function" }, ["if"] = "@function.inner",
["ak"] = { query = "@comment.outer", desc = "a comment" }, ["ak"] = "@comment.outer",
["aS"] = { query = "@statement.outer", desc = "a statement" }, ["aS"] = "@statement.outer",
}, },
}, },
move = { move = {
@ -32,22 +31,22 @@ ts_config.setup({
-- Add to jump list -- Add to jump list
set_jumps = true, set_jumps = true,
goto_next_start = { goto_next_start = {
["]m"] = { query = "@function.outer", desc = "Next method start" }, ["]m"] = "@function.outer",
["]S"] = { query = "@statement.outer", desc = "Next statement start" }, ["]S"] = "@statement.outer",
["]]"] = { query = "@class.outer", desc = "Next class start" }, ["]]"] = "@class.outer",
}, },
goto_next_end = { goto_next_end = {
["]M"] = { query = "@function.outer", desc = "Next method end" }, ["]M"] = "@function.outer",
["]["] = { query = "@class.outer", desc = "Next class end" }, ["]["] = "@class.outer",
}, },
goto_previous_start = { goto_previous_start = {
["[m"] = { query = "@function.outer", desc = "Previous method start" }, ["[m"] = "@function.outer",
["[S"] = { query = "@statement.outer", desc = "Previous statement start" }, ["[S"] = "@statement.outer",
["[["] = { query = "@class.outer", desc = "Previous class start" }, ["[["] = "@class.outer",
}, },
goto_previous_end = { goto_previous_end = {
["[M"] = { query = "@function.outer", desc = "Previous method end" }, ["[M"] = "@function.outer",
["[]"] = { query = "@class.outer", desc = "Previous class end" }, ["[]"] = "@class.outer",
}, },
}, },
}, },

View file

@ -1,33 +1,2 @@
local wk = require("which-key") local wk = require("which-key")
wk.setup({ wk.setup()
icons = {
-- I don't like icons
mappings = false,
breadcrumb = "»",
separator = "",
group = "+",
ellipsis = "",
keys = {
Up = "",
Down = "",
Left = "",
Right = "",
C = "<C>",
M = "<M>",
D = "<D>",
S = "<S>",
CR = "<CR>",
Esc = "<Esc> ",
NL = "<NL>",
BS = "<BS>",
Space = "<space>",
Tab = "<Tab> ",
},
},
})
local keys = {
{ "<leader><leader>", vim.cmd.nohlsearch, desc = "Clear search highlight" },
}
wk.add(keys)

View file

@ -1,21 +1,20 @@
local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true }) local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true })
-- Only show sign column for the currently focused buffer, if it has a number column -- Only show sign column for the currently focused buffer
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {
pattern = "*", pattern = "*",
group = signtoggle, group = signtoggle,
callback = function() command = "setlocal signcolumn=yes",
if vim.opt.number:get() then
vim.opt.signcolumn = "yes"
end
end,
}) })
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, { vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, {
pattern = "*", pattern = "*",
group = signtoggle, group = signtoggle,
callback = function() command = "setlocal signcolumn=yes",
if vim.opt.number:get() then })
vim.opt.signcolumn = "no"
end -- Never show the sign column in a terminal buffer
end, vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=no",
}) })

View file

@ -20,7 +20,7 @@ in
}; };
xdg.configFile."wgetrc".text = '' xdg.configFile."wgetrc".text = ''
hsts-file = ${config.xdg.stateHome}/wget-hsts hsts-file = ${config.xdg.dataHome}/wget-hsts
''; '';
}; };
} }

View file

@ -58,7 +58,7 @@ in
service = "some-service-name"; service = "some-service-name";
} }
]; ];
description = "list of block configurations, merged with the defaults"; description = "list of block configurations, merged with the defauls";
}; };
}; };
}; };

View file

@ -127,11 +127,9 @@ in
{ class = "^Blueman-.*$"; } { class = "^Blueman-.*$"; }
{ title = "^htop$"; } { title = "^htop$"; }
{ class = "^Thunderbird$"; instance = "Mailnews"; window_role = "filterlist"; } { class = "^Thunderbird$"; instance = "Mailnews"; window_role = "filterlist"; }
{ class = "^firefox$"; instance = "Places"; window_role = "Organizer"; } { class = "^Pavucontrol.*$"; }
{ class = "^pavucontrol.*$"; }
{ class = "^Arandr$"; } { class = "^Arandr$"; }
{ class = "^\\.blueman-manager-wrapped$"; } { class = ".?blueman-manager.*$"; }
{ class = "^\\.arandr-wrapped$"; }
]; ];
}; };
@ -373,7 +371,8 @@ in
}; };
startup = [ startup = [
# NOTE: rely on systemd user services instead... # FIXME
# { commdand; always; notification; }
]; ];
window = { window = {

View file

@ -2,7 +2,7 @@
let let
cfg = config.my.home.wm.screen-lock; cfg = config.my.home.wm.screen-lock;
notificationCmd = notficationCmd =
let let
duration = toString (cfg.notify.delay * 1000); duration = toString (cfg.notify.delay * 1000);
notifyCmd = "${lib.getExe pkgs.libnotify} -u critical -t ${duration}"; notifyCmd = "${lib.getExe pkgs.libnotify} -u critical -t ${duration}";
@ -48,7 +48,7 @@ in
"-notify" "-notify"
"${toString cfg.notify.delay}" "${toString cfg.notify.delay}"
"-notifier" "-notifier"
notificationCmd notficationCmd
]; ];
}; };
}; };

View file

@ -11,7 +11,7 @@ in
enable = true; enable = true;
# File types # File types
mime.enable = true; mime.enable = true;
# File associations # File associatons
mimeApps = { mimeApps = {
enable = true; enable = true;
}; };
@ -30,11 +30,9 @@ in
}; };
# A tidy home is a tidy mind # A tidy home is a tidy mind
dataFile = { dataFile = {
"tig/.keep".text = ""; # `tig` uses `XDG_DATA_HOME` specifically...
};
stateFile = {
"bash/.keep".text = ""; "bash/.keep".text = "";
"python/.keep".text = ""; "gdb/.keep".text = "";
"tig/.keep".text = "";
}; };
}; };
@ -45,18 +43,15 @@ in
CARGO_HOME = "${dataHome}/cargo"; CARGO_HOME = "${dataHome}/cargo";
DOCKER_CONFIG = "${configHome}/docker"; DOCKER_CONFIG = "${configHome}/docker";
GRADLE_USER_HOME = "${dataHome}/gradle"; GRADLE_USER_HOME = "${dataHome}/gradle";
HISTFILE = "${stateHome}/bash/history"; HISTFILE = "${dataHome}/bash/history";
INPUTRC = "${configHome}/readline/inputrc"; INPUTRC = "${configHome}/readline/inputrc";
PSQL_HISTORY = "${stateHome}/psql_history"; PSQL_HISTORY = "${dataHome}/psql_history";
PYTHONPYCACHEPREFIX = "${cacheHome}/python/"; PYTHONPYCACHEPREFIX = "${cacheHome}/python/";
PYTHONUSERBASE = "${dataHome}/python/"; PYTHONUSERBASE = "${dataHome}/python/";
PYTHON_HISTORY = "${stateHome}/python/history"; PYTHON_HISTORY = "${stateHome}/python/history";
REDISCLI_HISTFILE = "${stateHome}/redis/rediscli_history"; REDISCLI_HISTFILE = "${dataHome}/redis/rediscli_history";
REPO_CONFIG_DIR = "${configHome}/repo"; REPO_CONFIG_DIR = "${configHome}/repo";
XCOMPOSECACHE = "${dataHome}/X11/xcompose"; XCOMPOSECACHE = "${dataHome}/X11/xcompose";
_JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${configHome}/java"; _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${configHome}/java";
}; };
# Some modules *optionally* use `XDG_*_HOME` when told to
config.home.preferXdgDirectories = lib.mkIf cfg.enable true;
} }

View file

@ -1,6 +1,14 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.my.home.zsh; cfg = config.my.home.zsh;
# Have a nice relative path for XDG_CONFIG_HOME, without leading `/`
relativeXdgConfig =
let
noHome = lib.removePrefix config.home.homeDirectory;
noSlash = lib.removePrefix "/";
in
noSlash (noHome config.xdg.configHome);
in in
{ {
options.my.home.zsh = with lib; { options.my.home.zsh = with lib; {
@ -8,22 +16,16 @@ in
launchTmux = mkEnableOption "auto launch tmux at shell start"; launchTmux = mkEnableOption "auto launch tmux at shell start";
completionSync = {
enable = mkEnableOption "zsh-completion-sync plugin";
};
notify = { notify = {
enable = mkEnableOption "zsh-done notification"; enable = mkEnableOption "zsh-done notification";
exclude = mkOption { exclude = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ default = [
"bat"
"delta" "delta"
"direnv reload" "direnv reload"
"fg" "fg"
"git (?!push|pull|fetch)" "git (?!push|pull|fetch)"
"home-manager (?!switch|build)"
"htop" "htop"
"less" "less"
"man" "man"
@ -55,7 +57,7 @@ in
programs.zsh = { programs.zsh = {
enable = true; enable = true;
dotDir = "${config.xdg.configHome}/zsh"; # Don't clutter $HOME dotDir = "${relativeXdgConfig}/zsh"; # Don't clutter $HOME
enableCompletion = true; enableCompletion = true;
history = { history = {
@ -66,13 +68,13 @@ in
ignoreSpace = true; ignoreSpace = true;
ignoreDups = true; ignoreDups = true;
share = false; share = false;
path = "${config.xdg.stateHome}/zsh/zsh_history"; path = "${config.xdg.dataHome}/zsh/zsh_history";
}; };
plugins = [ plugins = [
{ {
name = "fast-syntax-highlighting"; name = "fast-syntax-highlighting";
file = "share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"; file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
src = pkgs.zsh-fast-syntax-highlighting; src = pkgs.zsh-fast-syntax-highlighting;
} }
{ {
@ -85,26 +87,28 @@ in
# Modal editing is life, but CLI benefits from emacs gymnastics # Modal editing is life, but CLI benefits from emacs gymnastics
defaultKeymap = "emacs"; defaultKeymap = "emacs";
initContent = lib.mkMerge [ # Make those happen early to avoid doing double the work
# Make those happen early to avoid doing double the work initExtraFirst = lib.mkBefore ''
(lib.mkBefore (lib.optionalString cfg.launchTmux '' ${
# Launch tmux unless already inside one lib.optionalString cfg.launchTmux ''
if [ -z "$TMUX" ]; then # Launch tmux unless already inside one
exec tmux new-session if [ -z "$TMUX" ]; then
fi exec tmux new-session
'')) fi
''
}
'';
(lib.mkAfter '' initExtra = lib.mkAfter ''
source ${./completion-styles.zsh} source ${./completion-styles.zsh}
source ${./extra-mappings.zsh} source ${./extra-mappings.zsh}
source ${./options.zsh} source ${./options.zsh}
# Source local configuration # Source local configuration
if [ -f "$ZDOTDIR/zshrc.local" ]; then if [ -f "$ZDOTDIR/zshrc.local" ]; then
source "$ZDOTDIR/zshrc.local" source "$ZDOTDIR/zshrc.local"
fi fi
'') '';
];
localVariables = { localVariables = {
# I like having the full path # I like having the full path
@ -122,18 +126,6 @@ in
}; };
} }
(lib.mkIf cfg.completionSync.enable {
programs.zsh = {
plugins = [
{
name = "zsh-completion-sync";
file = "share/zsh-completion-sync/zsh-completion-sync.plugin.zsh";
src = pkgs.zsh-completion-sync;
}
];
};
})
(lib.mkIf cfg.notify.enable { (lib.mkIf cfg.notify.enable {
programs.zsh = { programs.zsh = {
plugins = [ plugins = [
@ -159,7 +151,7 @@ in
}; };
# Use OSC-777 to send the notification through SSH # Use OSC-777 to send the notification through SSH
initContent = lib.mkIf cfg.notify.ssh.useOsc777 '' initExtra = lib.mkIf cfg.notify.ssh.useOsc777 ''
done_send_notification() { done_send_notification() {
local exit_status="$1" local exit_status="$1"
local title="$2" local title="$2"

View file

@ -12,7 +12,7 @@ setopt rc_quotes
setopt auto_resume setopt auto_resume
# Show history expansion before running a command # Show history expansion before running a command
setopt hist_verify setopt hist_verify
# Append commands to history as they are executed # Append commands to history as they are exectuted
setopt inc_append_history_time setopt inc_append_history_time
# Remove useless whitespace from commands # Remove useless whitespace from commands
setopt hist_reduce_blanks setopt hist_reduce_blanks

View file

@ -20,10 +20,28 @@ in
# Support for additional bluetooth codecs # Support for additional bluetooth codecs
(lib.mkIf cfg.loadExtraCodecs { (lib.mkIf cfg.loadExtraCodecs {
services.pulseaudio = { hardware.pulseaudio = {
extraModules = [ pkgs.pulseaudio-modules-bt ]; extraModules = [ pkgs.pulseaudio-modules-bt ];
package = pkgs.pulseaudioFull; package = pkgs.pulseaudioFull;
}; };
services.pipewire.wireplumber.configPackages = [
(pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
bluez_monitor.properties = {
-- SBC XQ provides better audio
["bluez5.enable-sbc-xq"] = true,
-- mSBC provides better audio + microphone
["bluez5.enable-msbc"] = true,
-- Synchronize volume with bluetooth device
["bluez5.enable-hw-volume"] = true,
-- FIXME: Some devices may now support both hsp_ag and hfp_ag
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'')
];
}) })
# Support for A2DP audio profile # Support for A2DP audio profile

View file

@ -15,6 +15,8 @@ in
amd = { amd = {
enableKernelModule = lib.my.mkDisableOption "Kernel driver module"; enableKernelModule = lib.my.mkDisableOption "Kernel driver module";
amdvlk = lib.mkEnableOption "Use AMDVLK instead of Mesa RADV driver";
}; };
intel = { intel = {
@ -24,23 +26,28 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
hardware.graphics = { hardware.opengl = {
enable = true; enable = true;
}; };
} }
# AMD GPU # AMD GPU
(lib.mkIf (cfg.gpuFlavor == "amd") { (lib.mkIf (cfg.gpuFlavor == "amd") {
hardware.amdgpu = { boot.initrd.kernelModules = lib.mkIf cfg.amd.enableKernelModule [ "amdgpu" ];
initrd.enable = cfg.amd.enableKernelModule;
};
hardware.graphics = { hardware.opengl = {
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# OpenCL # OpenCL
rocmPackages.clr rocmPackages.clr
rocmPackages.clr.icd rocmPackages.clr.icd
]; ]
++ lib.optional cfg.amd.amdvlk amdvlk
;
extraPackages32 = with pkgs; [
]
++ lib.optional cfg.amd.amdvlk driversi686Linux.amdvlk
;
}; };
}) })
@ -52,7 +59,7 @@ in
VDPAU_DRIVER = "va_gl"; VDPAU_DRIVER = "va_gl";
}; };
hardware.graphics = { hardware.opengl = {
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# Open CL # Open CL
intel-compute-runtime intel-compute-runtime
@ -62,13 +69,6 @@ in
intel-vaapi-driver intel-vaapi-driver
libvdpau-va-gl libvdpau-va-gl
]; ];
extraPackages32 = with pkgs.driversi686Linux; [
# VA API
intel-media-driver
intel-vaapi-driver
libvdpau-va-gl
];
}; };
}) })
]); ]);

View file

@ -54,7 +54,10 @@ in
# Pulseaudio setup # Pulseaudio setup
(lib.mkIf cfg.pulse.enable { (lib.mkIf cfg.pulse.enable {
services.pulseaudio.enable = true; # ALSA
sound.enable = true;
hardware.pulseaudio.enable = true;
}) })
]); ]);
} }

View file

@ -11,7 +11,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.xserver = { services.xserver = {
# This section must be *after* the one configured by `libinput` # This section must be *after* the one configured by `libinput`
# for the `ScrollMethod` configuration to not be overridden # for the `ScrollMethod` configuration to not be overriden
inputClassSections = lib.mkAfter [ inputClassSections = lib.mkAfter [
# MX Ergo # MX Ergo
'' ''

View file

@ -1,4 +1,4 @@
# Configuration that spans across system and home, or are almagations of modules # Configuration that spans accross system and home, or are almagations of modules
{ ... }: { ... }:
{ {
imports = [ imports = [

View file

@ -9,7 +9,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Enable touchpad support # Enable touchpad support
services.libinput.enable = true; services.xserver.libinput.enable = true;
# Enable TLP power management # Enable TLP power management
my.services.tlp.enable = true; my.services.tlp.enable = true;

View file

@ -24,8 +24,6 @@ in
my.home.udiskie.enable = true; my.home.udiskie.enable = true;
# udiskie fails if it can't find this dbus service # udiskie fails if it can't find this dbus service
services.udisks2.enable = true; services.udisks2.enable = true;
# Ensure i3lock can actually unlock the session
security.pam.services.i3lock.enable = true;
}) })
]; ];
} }

View file

@ -13,7 +13,7 @@ in
# Nice wallpaper # Nice wallpaper
services.xserver.displayManager.lightdm.background = services.xserver.displayManager.lightdm.background =
let let
wallpapers = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers"; wallpapers = "${pkgs.plasma5Packages.plasma-workspace-wallpapers}/share/wallpapers";
in in
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg"; "${wallpapers}/summer_1am/contents/images/2560x1600.jpg";

View file

@ -65,7 +65,9 @@ in
aria-rpc = { aria-rpc = {
port = cfg.rpcPort; port = cfg.rpcPort;
# Proxy websockets for RPC # Proxy websockets for RPC
websocketsLocations = [ "/" ]; extraConfig = {
locations."/".proxyWebsockets = true;
};
}; };
}; };

View file

@ -1,53 +0,0 @@
# Audiobook and podcast library
{ config, lib, ... }:
let
cfg = config.my.services.audiobookshelf;
in
{
options.my.services.audiobookshelf = with lib; {
enable = mkEnableOption "Audiobookshelf, a self-hosted podcast manager";
port = mkOption {
type = types.port;
default = 8000;
example = 4242;
description = "The port on which Audiobookshelf will listen for incoming HTTP traffic.";
};
};
config = lib.mkIf cfg.enable {
services.audiobookshelf = {
enable = true;
inherit (cfg) port;
group = "media";
};
# Set-up media group
users.groups.media = { };
my.services.nginx.virtualHosts = {
audiobookshelf = {
inherit (cfg) port;
# Proxy websockets for RPC
websocketsLocations = [ "/" ];
};
};
services.fail2ban.jails = {
audiobookshelf = ''
enabled = true
filter = audiobookshelf
port = http,https
'';
};
environment.etc = {
"fail2ban/filter.d/audiobookshelf.conf".text = ''
[Definition]
failregex = ^.*ERROR: \[Auth\] Failed login attempt for username ".*" from ip <ADDR>
journalmatch = _SYSTEMD_UNIT=audiobookshelf.service
'';
};
};
}

View file

@ -4,7 +4,6 @@
imports = [ imports = [
./adblock ./adblock
./aria ./aria
./audiobookshelf
./backup ./backup
./blog ./blog
./calibre-web ./calibre-web
@ -14,9 +13,8 @@
./forgejo ./forgejo
./gitea ./gitea
./grocy ./grocy
./homebox ./indexers
./jellyfin ./jellyfin
./komga
./lohr ./lohr
./matrix ./matrix
./mealie ./mealie
@ -27,7 +25,7 @@
./nginx ./nginx
./nix-cache ./nix-cache
./paperless ./paperless
./pdf-edit ./pirate
./podgrab ./podgrab
./postgresql ./postgresql
./postgresql-backup ./postgresql-backup
@ -35,10 +33,8 @@
./quassel ./quassel
./rss-bridge ./rss-bridge
./sabnzbd ./sabnzbd
./servarr
./ssh-server ./ssh-server
./tandoor-recipes ./tandoor-recipes
./thelounge
./tlp ./tlp
./transmission ./transmission
./vikunja ./vikunja

View file

@ -6,8 +6,8 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
systemd.services.drone-server = { systemd.services.drone-server = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "postgresql.target" ]; after = [ "postgresql.service" ];
requires = [ "postgresql.target" ]; requires = [ "postgresql.service" ];
serviceConfig = { serviceConfig = {
EnvironmentFile = [ EnvironmentFile = [
cfg.secretFile cfg.secretFile

View file

@ -1,5 +1,5 @@
# A nice UI for various torrent clients # A nice UI for various torrent clients
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.flood; cfg = config.my.services.flood;
in in
@ -13,13 +13,31 @@ in
example = 3000; example = 3000;
description = "Internal port for Flood UI"; description = "Internal port for Flood UI";
}; };
stateDir = mkOption {
type = types.str;
default = "flood";
example = "floodUI";
description = "Directory under `/var/run` for storing Flood's files";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.flood = { systemd.services.flood = {
enable = true; description = "Flood torrent UI";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
inherit (cfg) port; serviceConfig = {
ExecStart = lib.concatStringsSep " " [
(lib.getExe pkgs.flood)
"--port ${builtins.toString cfg.port}"
"--rundir /var/lib/${cfg.stateDir}"
];
DynamicUser = true;
StateDirectory = cfg.stateDir;
ReadWritePaths = "";
};
}; };
my.services.nginx.virtualHosts = { my.services.nginx.virtualHosts = {
@ -27,7 +45,5 @@ in
inherit (cfg) port; inherit (cfg) port;
}; };
}; };
# NOTE: unfortunately flood does not log connection failures for fail2ban
}; };
} }

Some files were not shown because too many files have changed in this diff Show more