Compare commits

..

8 commits

Author SHA1 Message Date
2e5899b22e WIP
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-02-07 20:56:13 +00:00
c68574b745 home: add wget
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This is mostly so that I can add the XDG-compliant configuration.
2024-02-07 20:17:49 +00:00
7a03ce2012 home: xdg: add python configuration
All checks were successful
ci/woodpecker/push/check Pipeline was successful
It looks like 3.13 finally brought a way to change the history location
through `PYTHON_HISTORY`.
2024-02-07 20:01:28 +00:00
0650c1f159 home: xdg: fix sort order 2024-02-07 19:44:51 +00:00
9b2963cb8c overlays: add gruvbox-nvim-treesitter-fix
All checks were successful
ci/woodpecker/push/check Pipeline was successful
The version in nixpkgs is not up-to-date with regards to the
nvim-treesitter breaking changes that were recently introduced.
2024-02-07 13:10:25 +00:00
091424cb14 overlays: gruvbox-nvim-better-diff: simplify 2024-02-07 11:53:56 +00:00
1a7223a5e5 overlays: remove 'tandoor-recipes-failing-test'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This is now redundant, the nixpkgs bump provided an updated package
which builds successfully.

This reverts commit 473be47b29.
2024-02-06 17:25:03 +01:00
c8b5b1586c flake: bump inputs
And remove the now-redundant overlay to fix a flaky `tandoor-recipes`
test.
2024-02-06 17:24:11 +01:00
191 changed files with 1918 additions and 3386 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

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": 1703433843,
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=", "narHash": "sha256-nmtA4KqFboWxxoOAA6Y1okHbZh+HsXaMPFkYHsoDRDw=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "fcdea223397448d35d9b31f798479227e80183f6", "rev": "417caa847f9383e111d1397039c9d4337d024bf0",
"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": 1763759067, "lastModified": 1706830856,
"narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -94,11 +94,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1705309234,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"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": 1763988335,
"narHash": "sha256-QlcnByMc8KBjpU37rbq5iP7Cp97HvjRP0ucfdh+M4Qc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "50b9238891e388c9fdc6a5c49e49c42533a1b5ce",
"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": 1764361670, "lastModified": 1707175763,
"narHash": "sha256-jgWzgpIaHbL3USIq0gihZeuy1lLf2YSfwvWEwnfAJUw=", "narHash": "sha256-0MKHC6tQ4KEuM5rui6DjKZ/VNiSANB4E+DJ/+wPS1PU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "780be8ef503a28939cf9dc7996b48ffb1a3e04c6", "rev": "f99eace7c167b8a6a0871849493b1c613d0f1b80",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -175,11 +152,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1764242076, "lastModified": 1707092692,
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=", "narHash": "sha256-ZbHsm+mGk/izkWtT4xwwqz38fdlwu7nUUKXTOmm4SyE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4", "rev": "faf912b086576fd1a15fca610166c98d47bc667e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -190,38 +167,59 @@
} }
}, },
"nur": { "nur": {
"inputs": {
"flake-parts": [
"flake-parts"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1764449851, "lastModified": 1707234300,
"narHash": "sha256-VnodC1+3KML8MYLLnK84E6U2Fz4ioNacOeQd1pMCSTw=", "narHash": "sha256-D+LdA8g0Tq+KE9EmJMmn8EGRO5jZ2nLe/W0Fr5EIsdg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "b1781c0aa8935d8d1f35d228bcc7127fcebcd363", "rev": "59fceae769455455ef44c1dfb63bbae1ecddc41d",
"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": 1706424699,
"narHash": "sha256-Q3RBuOpZNH2eFA1e+IHgZLAOqDD9SKhJ/sszrL8bQD4=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf",
"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

@ -1,9 +1,9 @@
{ flake-parts { flake-parts
, systems , futils
, ... , ...
} @ inputs: } @ inputs:
let let
mySystems = import systems; mySystems = futils.lib.defaultSystems;
in in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = mySystems; systems = mySystems;

View file

@ -6,6 +6,7 @@
name = "NixOS-config"; name = "NixOS-config";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
gitAndTools.pre-commit
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

@ -1,23 +1,9 @@
# Google Laptop configuration # Google Laptop configuration
{ lib, options, pkgs, ... }: { lib, pkgs, ... }:
{ {
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;
}; };
@ -26,10 +12,8 @@
# 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;
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 = { }; trueColorTerminals = [ "xterm-256color" ];
};
}; };
ssh = { ssh = {
@ -37,21 +21,5 @@
package = pkgs.emptyDirectory; package = pkgs.emptyDirectory;
}; };
}; };
zsh = {
notify = {
enable = true;
exclude = options.my.home.zsh.notify.exclude.default ++ [
"adb shell$" # Only interactive shell sessions
];
ssh = {
enable = true;
# `notify-send` is proxied to the ChromeOS layer
useOsc777 = false;
};
};
};
}; };
} }

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,13 +15,8 @@
# 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 = {
# HTerm uses `xterm-256color` as its `$TERM`, so use that here # HTerm uses `xterm-256color` as its `$TERM`, so use that here
xterm-256color = { }; trueColorTerminals = [ "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

@ -3,14 +3,15 @@
{ {
boot = { boot = {
# Use the systemd-boot EFI boot loader. # Use the GRUB 2 boot loader.
loader = { loader.grub = {
systemd-boot.enable = true; enable = true;
efi.canTouchEfiVariables = true; # Define on which hard drive you want to install Grub.
device = "/dev/disk/by-id/ata-HGST_HUS724020ALA640_PN2181P6J58M1P";
}; };
initrd = { initrd = {
availableKernelModules = [ "ahci" "xhci_pci" "ehci_pci" "usbhid" "sd_mod" ]; availableKernelModules = [ "uhci_hcd" "ahci" "usbhid" ];
kernelModules = [ "dm-snapshot" ]; kernelModules = [ "dm-snapshot" ];
}; };

View file

@ -16,5 +16,11 @@
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
system.stateVersion = "24.05"; # Did you read the comment? # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.09"; # Did you read the comment?
} }

View file

@ -1,5 +1,5 @@
# Hardware configuration # Hardware configuration
{ modulesPath, ... }: { lib, modulesPath, ... }:
{ {
imports = [ imports = [
@ -11,18 +11,9 @@
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
swapDevices = [ swapDevices = [
{ device = "/dev/disk/by-label/swap"; } { device = "/dev/disk/by-label/swap"; }
]; ];
my.hardware = { powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
firmware = {
cpuFlavor = "intel";
};
};
} }

View file

@ -1,18 +1,11 @@
{ ... }: { ... }:
{ {
my.home = { my.home = {
nix = { # Allow using 24bit color when SSH-ing from various clients
cache = { tmux.trueColorTerminals = [
# This server is the one serving the cache, don't try to query it
selfHosted = false;
};
};
# Allow using extended features when SSH-ing from various clients
tmux.terminalFeatures = {
# My usual terminal, e.g: on laptop # My usual terminal, e.g: on laptop
alacritty = { }; "alacritty"
}; ];
# Always start a tmux session when opening a shell session # Always start a tmux session when opening a shell session
zsh.launchTmux = true; zsh.launchTmux = true;

View file

@ -3,7 +3,7 @@
SWAP_SIZE=16GiB SWAP_SIZE=16GiB
parted /dev/sda --script -- \ parted /dev/sda --script -- \
mklabel gpt \ mklabel msdos \
mkpart primary 512MiB -$SWAP_SIZE \ mkpart primary 512MiB -$SWAP_SIZE \
mkpart primary linux-swap -$SWAP_SIZE 100% \ mkpart primary linux-swap -$SWAP_SIZE 100% \
mkpart ESP fat32 1MiB 512MiB \ mkpart ESP fat32 1MiB 512MiB \
@ -11,24 +11,14 @@ parted /dev/sda --script -- \
parted /dev/sdb --script -- \ parted /dev/sdb --script -- \
mklabel gpt \ mklabel gpt \
mkpart primary 0% 100% mkpart primary 0MiB 100%
parted /dev/sdc --script -- \
mklabel gpt \
mkpart primary 0% 100%
parted /dev/sdd --script -- \
mklabel gpt \
mkpart primary 0% 100%
mkfs.ext4 -L media1 /dev/sda1 mkfs.ext4 -L media1 /dev/sda1
mkfs.ext4 -L media2 /dev/sdb1 mkfs.ext4 -L media2 /dev/sdb1
mkfs.ext4 -L media3 /dev/sdc1
mkfs.ext4 -L media4 /dev/sdd1
pvcreate /dev/sda1 pvcreate /dev/sda1
pvcreate /dev/sdb1 pvcreate /dev/sdb1
pvcreate /dev/sdc1 vgcreate lvm /dev/sda1 /dev/sdb1
pvcreate /dev/sdd1
vgcreate lvm /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
lvcreate -l 100%FREE -n media lvm lvcreate -l 100%FREE -n media lvm
mkfs.ext4 -L nixos /dev/mapper/lvm-media mkfs.ext4 -L nixos /dev/mapper/lvm-media
@ -37,17 +27,17 @@ mkfs.fat -F 32 -n boot /dev/sda3
mount /dev/disk/by-label/nixos /mnt mount /dev/disk/by-label/nixos /mnt
swapon /dev/sda2 swapon /dev/sda2
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
apt install sudo apt install sudo
useradd -m -G sudo setupuser useradd -m -G sudo setupuser
# shellcheck disable=2117
su setupuser
cat << EOF cat << EOF
# Run the following commands as setup user # Run the following commands as setup user
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install curl -L https://nixos.org/nix/install | sh
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh . $HOME/.nix-profile/etc/profile.d/nix.sh
nix profile install nixpkgs#nixos-install-tools nix-channel --add https://nixos.org/channels/nixos-20.09 nixpkgs
sudo "$(which nixos-generate-config)" --root /mnt sudo "$(which nixos-generate-config)" --root /mnt
# Change uuids to labels # Change uuids to labels
@ -64,6 +54,3 @@ git crypt unlock
nixos-install --root /mnt --flake '.#<hostname>' nixos-install --root /mnt --flake '.#<hostname>'
EOF EOF
# shellcheck disable=2117
su setupuser

View file

@ -6,17 +6,30 @@
hostName = "porthos"; # Define your hostname. hostName = "porthos"; # Define your hostname.
domain = "belanyi.fr"; # Define your domain. domain = "belanyi.fr"; # Define your domain.
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # The global useDHCP flag is deprecated, therefore explicitly set to false here.
# still possible to use this option, but it's recommended to use it in conjunction # Per-interface useDHCP will be mandatory in the future, so this generated config
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # replicates the default behaviour.
useDHCP = true; useDHCP = false;
interfaces = { interfaces = {
eno1.useDHCP = true; bond0.useDHCP = true;
eno2.useDHCP = true; bonding_masters.useDHCP = true;
dummy0.useDHCP = true;
erspan0.useDHCP = true;
eth0.useDHCP = true;
eth1.useDHCP = true;
gre0.useDHCP = true;
gretap0.useDHCP = true;
ifb0.useDHCP = true;
ifb1.useDHCP = true;
ip6tnl0.useDHCP = true;
sit0.useDHCP = true;
teql0.useDHCP = true;
tunl0.useDHCP = true;
}; };
}; };
# Which interface is used to connect to the internet # Which interface is used to connect to the internet
my.hardware.networking.externalInterface = "eno1"; my.hardware.networking.externalInterface = "eth0";
} }

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

@ -1,10 +0,0 @@
age-encryption.org/v1
-> ssh-ed25519 cKojmg Lhgx43wR8PtAMf5v1eJxKlUBSAoOLdOOn/QaQrwF8zA
jfUCpgNzkHCNTWCqtErDaLMmg1Oy+s9zUra1JLCi+J4
-> ssh-ed25519 jPowng kSeQ/SmMrzd8ByVu3YHWeZyKmqFZvQSBnDunkB8e6wc
WRmnfrV5xcRXA9t0ZXx6YvbRl0sX4PTrw63VVKX4Ei4
--- a+LLM1gP9g1AbUapbeeKaS4cEcRBmPo3MHU2DSWTAds
Ò,FÜÒ6”â⬘ ixÌ<78>°Øe| «
²
ÌÏœ,{† ˆõvª!†‰zÜ$P;ãé©TØÆÉKW
qGô

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

@ -21,24 +21,13 @@ in
"drone/secret.age".publicKeys = all; "drone/secret.age".publicKeys = all;
"drone/ssh/private-key.age".publicKeys = all; "drone/ssh/private-key.age".publicKeys = all;
"forgejo/mail-password.age" = {
owner = "git";
publicKeys = all;
};
"gitea/mail-password.age" = { "gitea/mail-password.age" = {
owner = "git"; owner = "git";
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,8 +37,7 @@ in
owner = "matrix-synapse"; owner = "matrix-synapse";
publicKeys = all; publicKeys = all;
}; };
"matrix/sliding-sync-secret.age" = {
"mealie/mail.age" = {
publicKeys = all; publicKeys = all;
}; };
@ -74,15 +62,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;
@ -41,19 +36,19 @@ in
flood = { flood = {
enable = true; enable = true;
}; };
# Forgejo forge # Gitea forge
forgejo = { gitea = {
enable = true; enable = true;
mail = { mail = {
enable = true; enable = true;
host = "smtp.migadu.com"; host = "smtp.migadu.com:465";
user = lib.my.mkMailAddress "forgejo" "belanyi.fr"; user = lib.my.mkMailAddress "gitea" "belanyi.fr";
passwordFile = secrets."forgejo/mail-password".path; passwordFile = secrets."gitea/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,10 +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 = {
enable = true;
credentialsFile = secrets."mealie/mail".path;
}; };
miniflux = { miniflux = {
enable = true; enable = true;
@ -95,9 +89,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 +118,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 +142,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
@ -38,8 +25,6 @@ in
search_mode = "skim"; search_mode = "skim";
# Show long command lines at the bottom # Show long command lines at the bottom
show_preview = true; show_preview = true;
# I like being able to edit my commands
enter_accept = false;
}; };
}; };
}; };

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

@ -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

@ -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

@ -61,8 +61,7 @@ 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
@ -78,5 +77,4 @@ in
}; };
}; };
}; };
};
} }

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,29 +6,27 @@ 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 = "";
};
home.sessionVariables = {
GDBHISTFILE = "${config.xdg.stateHome}/gdb/gdb_history";
};
} }
(lib.mkIf cfg.rr.enable { (lib.mkIf cfg.rr.enable {

View file

@ -21,19 +21,13 @@ 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;
lfs.enable = true; aliases = {
# There's more
settings = {
# Who am I?
user = {
email = mkMailAddress "bruno" "belanyi.fr";
name = "Bruno BELANYI";
};
alias = {
git = "!git"; git = "!git";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit --topo-order"; lol = "log --graph --decorate --pretty=oneline --abbrev-commit --topo-order";
lola = "lol --all"; lola = "lol --all";
@ -46,6 +40,38 @@ in
root = "git rev-parse --show-toplevel"; root = "git rev-parse --show-toplevel";
}; };
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
extraConfig = {
# 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";
}; };
@ -117,10 +148,6 @@ in
autoStash = true; autoStash = true;
}; };
rerere = {
enabled = true;
};
url = { url = {
"git@git.belanyi.fr:" = { "git@git.belanyi.fr:" = {
insteadOf = "https://git.belanyi.fr/"; insteadOf = "https://git.belanyi.fr/";
@ -136,8 +163,8 @@ in
}; };
}; };
includes = lib.mkAfter [
# Multiple identities # Multiple identities
includes = [
{ {
condition = "gitdir:~/git/EPITA/"; condition = "gitdir:~/git/EPITA/";
contents = { contents = {
@ -156,10 +183,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

@ -12,7 +12,7 @@ let
# Use pinned nixpkgs when using `nix run pkgs#<whatever>` # Use pinned nixpkgs when using `nix run pkgs#<whatever>`
pkgs = inputs.nixpkgs; pkgs = inputs.nixpkgs;
} }
(lib.optionalAttrs cfg.inputs.overrideNixpkgs { (lib.optionalAttrs cfg.overrideNixpkgs {
# ... And with `nix run nixpkgs#<whatever>` # ... And with `nix run nixpkgs#<whatever>`
nixpkgs = inputs.nixpkgs; nixpkgs = inputs.nixpkgs;
}) })
@ -22,16 +22,7 @@ in
options.my.home.nix = with lib; { options.my.home.nix = with lib; {
enable = my.mkDisableOption "nix configuration"; enable = my.mkDisableOption "nix configuration";
gc = { linkInputs = my.mkDisableOption "link inputs to `$XDG_CONFIG_HOME/nix/inputs`";
enable = my.mkDisableOption "nix GC configuration";
};
cache = {
selfHosted = my.mkDisableOption "self-hosted cache";
};
inputs = {
link = my.mkDisableOption "link inputs to `$XDG_CONFIG_HOME/nix/inputs/`";
addToRegistry = my.mkDisableOption "add inputs and self to registry"; addToRegistry = my.mkDisableOption "add inputs and self to registry";
@ -39,13 +30,12 @@ in
overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version"; overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version";
}; };
};
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
assertions = [ assertions = [
{ {
assertion = cfg.inputs.addToNixPath -> cfg.inputs.link; assertion = cfg.addToNixPath -> cfg.linkInputs;
message = '' message = ''
enabling `my.home.nix.addToNixPath` needs to have enabling `my.home.nix.addToNixPath` needs to have
`my.home.nix.linkInputs = true` `my.home.nix.linkInputs = true`
@ -58,43 +48,17 @@ in
nix = { nix = {
package = lib.mkDefault pkgs.nix; # NixOS module sets it unconditionally package = lib.mkDefault pkgs.nix; # NixOS module sets it unconditionally
# FIXME: waiting on https://github.com/nix-community/home-manager/pull/3876
settings = { settings = {
# I like XDG-compliance
use-xdg-base-directories = true;
experimental-features = [ "nix-command" "flakes" ]; experimental-features = [ "nix-command" "flakes" ];
}; };
}; };
} }
(lib.mkIf cfg.gc.enable { (lib.mkIf cfg.addToRegistry {
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 {
nix = {
settings = {
extra-substituters = [
"https://cache.belanyi.fr/"
];
extra-trusted-public-keys = [
"cache.belanyi.fr:LPhrTqufwfxTceg1nRWueDWf7/2zSVY9K00pq2UI7tw="
];
};
};
})
(lib.mkIf cfg.inputs.addToRegistry {
nix.registry = nix.registry =
let let
makeEntry = v: { flake = v; }; makeEntry = v: { flake = v; };
@ -103,7 +67,7 @@ in
makeEntries channels; makeEntries channels;
}) })
(lib.mkIf cfg.inputs.link { (lib.mkIf cfg.linkInputs {
xdg.configFile = xdg.configFile =
let let
makeLink = n: v: { makeLink = n: v: {
@ -115,8 +79,8 @@ in
makeLinks channels; makeLinks channels;
}) })
(lib.mkIf cfg.inputs.addToNixPath { (lib.mkIf cfg.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,7 @@ 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";
}; };
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
@ -50,16 +49,15 @@ in
}; };
porthos = { porthos = {
hostname = "37.187.146.15"; hostname = "91.121.177.163";
identityFile = "~/.ssh/shared_rsa"; identityFile = "~/.ssh/shared_rsa";
user = "ambroisie"; user = "ambroisie";
}; };
};
# `*` is automatically made the last match block by the module extraConfig = ''
"*" = { AddKeysToAgent yes
addKeysToAgent = "yes"; '';
};
};
}; };
} }

View file

@ -5,14 +5,6 @@ let
config.my.home.x.enable config.my.home.x.enable
(config.my.home.wm.windowManager != null) (config.my.home.wm.windowManager != null)
]; ];
mkTerminalFeature = opt: flag:
let
mkFlag = term: ''set -as terminal-features ",${term}:${flag}"'';
enabledTerminals = lib.filterAttrs (_: v: v.${opt}) cfg.terminalFeatures;
terminals = lib.attrNames enabledTerminals;
in
lib.concatMapStringsSep "\n" mkFlag terminals;
in in
{ {
options.my.home.tmux = with lib; { options.my.home.tmux = with lib; {
@ -20,24 +12,16 @@ in
enablePassthrough = mkEnableOption "tmux DCS passthrough sequence"; enablePassthrough = mkEnableOption "tmux DCS passthrough sequence";
enableResurrect = mkEnableOption "tmux-resurrect plugin"; trueColorTerminals = mkOption {
type = with types; listOf str;
terminalFeatures = mkOption { default = lib.my.nullableToList config.my.home.terminal.program;
type = with types; attrsOf (submodule { defaultText = ''
options = { `[ config.my.home.terminal.program ]` if it is non-null, otherwise an
hyperlinks = my.mkDisableOption "hyperlinks through OSC8"; empty list.
trueColor = my.mkDisableOption "24-bit (RGB) color support";
};
});
default = { ${config.my.home.terminal.program} = { }; };
defaultText = literalExpression ''
{ ''${config.my.home.terminal.program} = { }; };
''; '';
example = { xterm-256color = { }; }; example = [ "xterm-256color" ];
description = '' description = ''
$TERM values which should be considered to have additional features. $TERM values which should be considered to always support 24-bit color.
''; '';
}; };
}; };
@ -48,21 +32,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 = 50000; # 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 +52,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 +63,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
${ ${
@ -122,10 +89,13 @@ in
'' ''
} }
# Force OSC8 hyperlinks for each relevant $TERM
${mkTerminalFeature "hyperlinks" "hyperlinks"}
# Force 24-bit color for each relevant $TERM # Force 24-bit color for each relevant $TERM
${mkTerminalFeature "trueColor" "RGB"} ${
let
mkTcFlag = term: ''set -as terminal-features ",${term}:RGB"'';
in
lib.concatMapStringsSep "\n" mkTcFlag cfg.trueColorTerminals
}
''; '';
}; };
} }

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

@ -1,5 +1,11 @@
local M = {} local M = {}
--- pretty print lua object
--- @param obj any object to pretty print
M.dump = function(obj)
print(vim.inspect(obj))
end
--- checks if a given command is executable --- checks if a given command is executable
--- @param cmd string? command to check --- @param cmd string? command to check
--- @return boolean executable --- @return boolean executable
@ -9,7 +15,7 @@ end
--- return a function that checks if a given command is executable --- return a function that checks if a given command is executable
--- @param cmd string? command to check --- @param cmd string? command to check
--- @return fun(): boolean executable --- @return fun(cmd: string): boolean executable
M.is_executable_condition = function(cmd) M.is_executable_condition = function(cmd)
return function() return function()
return M.is_executable(cmd) return M.is_executable(cmd)
@ -34,11 +40,11 @@ M.is_ssh = function()
return false return false
end end
--- list all active LSP clients for specific buffer, or all buffers --- list all active LSP clients for current buffer
--- @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.buf_get_clients(bufnr)
local names = {} local names = {}
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
@ -48,22 +54,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,46 @@ 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
lspconfig.clangd.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = lsp.on_attach, on_attach = lsp.on_attach,
}) })
end
local servers = {
-- C/C++
clangd = {},
-- Haskell
hls = {},
-- Nix -- Nix
nil_ls = {}, if utils.is_executable("nil") then
-- Python lspconfig.nil_ls.setup({
pyright = {}, capabilities = capabilities,
ruff = {}, on_attach = lsp.on_attach,
-- Rust })
rust_analyzer = {}, end
-- Shell
bashls = {
filetypes = { "bash", "sh", "zsh" },
settings = {
bashIde = {
shfmt = {
-- Simplify the code
simplifyCode = true,
-- Indent switch cases
caseIndent = true,
},
},
},
},
-- Starlark
starpls = {},
-- Generic
harper_ls = {},
typos_lsp = {},
}
for server, config in pairs(servers) do if utils.is_executable("rnix-lsp") then
if not vim.tbl_isempty(config) then lspconfig.rnix.setup({
vim.lsp.config(server, config) capabilities = capabilities,
on_attach = lsp.on_attach,
})
end end
vim.lsp.enable(server)
-- Python
if utils.is_executable("pyright") then
lspconfig.pyright.setup({
capabilities = capabilities,
on_attach = lsp.on_attach,
})
end
-- Rust
if utils.is_executable("rust-analyzer") then
lspconfig.rust_analyzer.setup({
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()
@ -11,7 +10,7 @@ local function list_spell_languages()
end end
local function list_lsp_clients() local function list_lsp_clients()
local client_names = utils.list_lsp_clients(0) local client_names = utils.list_lsp_clients()
if #client_names == 0 then if #client_names == 0 then
return "" return ""
@ -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,16 +18,48 @@ 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,
}),
})
-- Haskell
null_ls.register({
null_ls.builtins.formatting.brittany.with({
-- Only used if available
condition = utils.is_executable_condition("brittany"),
}),
})
-- Nix -- Nix
null_ls.register({ null_ls.register({
null_ls.builtins.formatting.nixpkgs_fmt.with({ null_ls.builtins.formatting.nixpkgs_fmt.with({
-- Only used if available -- Only used if available, but prefer rnix if available
condition = utils.is_executable_condition("nixpkgs-fmt"), condition = function()
return utils.is_executable("nixpkgs-fmt")
and not utils.is_executable("rnix-lsp")
and not utils.is_executable("nil")
end,
}), }),
}) })
-- Python -- Python
null_ls.register({ null_ls.register({
null_ls.builtins.diagnostics.flake8.with({
-- Only used if available, but prefer pflake8 if available
condition = function()
return utils.is_executable("flake8") and not utils.is_executable("pflake8")
end,
}),
null_ls.builtins.diagnostics.pyproject_flake8.with({
-- Only used if available
condition = utils.is_executable_condition("pflake8"),
}),
null_ls.builtins.diagnostics.mypy.with({ null_ls.builtins.diagnostics.mypy.with({
-- Only used if available -- Only used if available
condition = utils.is_executable_condition("mypy"), condition = utils.is_executable_condition("mypy"),
@ -46,3 +78,61 @@ null_ls.register({
condition = utils.is_executable_condition("isort"), condition = utils.is_executable_condition("isort"),
}), }),
}) })
-- Shell (non-POSIX)
null_ls.register({
null_ls.builtins.code_actions.shellcheck.with({
-- Restrict to bash and zsh
filetypes = { "bash", "zsh" },
-- Only used if available
condition = utils.is_executable_condition("shellcheck"),
}),
null_ls.builtins.diagnostics.shellcheck.with({
-- Show error code in message
diagnostics_format = "[#{c}] #{m}",
-- Require explicit empty string test, use bash dialect
extra_args = { "-s", "bash", "-o", "avoid-nullary-conditions" },
-- Restrict to bash and zsh
filetypes = { "bash", "zsh" },
-- Only used if available
condition = utils.is_executable_condition("shellcheck"),
}),
null_ls.builtins.formatting.shfmt.with({
-- 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.code_actions.shellcheck.with({
-- Restrict to POSIX sh
filetypes = { "sh" },
-- Only used if available
condition = utils.is_executable_condition("shellcheck"),
}),
null_ls.builtins.diagnostics.shellcheck.with({
-- Show error code in message
diagnostics_format = "[#{c}] #{m}",
-- Require explicit empty string test
extra_args = { "-o", "avoid-nullary-conditions" },
-- Restrict to POSIX sh
filetypes = { "sh" },
-- Only used if available
condition = utils.is_executable_condition("shellcheck"),
}),
null_ls.builtins.formatting.shfmt.with({
-- 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 = "";
}; };
}; };
@ -44,19 +42,17 @@ in
ANDROID_USER_HOME = "${configHome}/android"; ANDROID_USER_HOME = "${configHome}/android";
CARGO_HOME = "${dataHome}/cargo"; CARGO_HOME = "${dataHome}/cargo";
DOCKER_CONFIG = "${configHome}/docker"; DOCKER_CONFIG = "${configHome}/docker";
GRADLE_USER_HOME = "${dataHome}/gradle"; GDBHISTFILE = "${dataHome}/gdb/gdb_history";
HISTFILE = "${stateHome}/bash/history"; HISTFILE = "${dataHome}/bash/history";
INPUTRC = "${configHome}/readline/inputrc"; INPUTRC = "${configHome}/readline/inputrc";
PSQL_HISTORY = "${stateHome}/psql_history"; LESSHISTFILE = "${dataHome}/less/history";
LESSKEY = "${configHome}/less/lesskey";
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";
}; };
# Some modules *optionally* use `XDG_*_HOME` when told to
config.home.preferXdgDirectories = lib.mkIf cfg.enable true;
} }

View file

@ -1,61 +1,30 @@
{ 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; {
enable = my.mkDisableOption "zsh configuration"; enable = my.mkDisableOption "zsh configuration";
launchTmux = mkEnableOption "auto launch tmux at shell start"; launchTmux = mkEnableOption "auto launch tmux at shell start";
completionSync = {
enable = mkEnableOption "zsh-completion-sync plugin";
}; };
notify = { config = lib.mkIf cfg.enable {
enable = mkEnableOption "zsh-done notification";
exclude = mkOption {
type = with types; listOf str;
default = [
"bat"
"delta"
"direnv reload"
"fg"
"git (?!push|pull|fetch)"
"home-manager (?!switch|build)"
"htop"
"less"
"man"
"nvim"
"tail -f"
"tmux"
"vim"
];
example = [ "command --long-running-option" ];
description = ''
List of exclusions which should not be create a notification. Accepts
Perl regexes (implicitly anchored with `^\s*`).
'';
};
ssh = {
enable = mkEnableOption "notify through SSH/non-graphical connections";
useOsc777 = lib.my.mkDisableOption "use OSC-777 for notifications";
};
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
home.packages = with pkgs; [ home.packages = with pkgs; [
zsh-completions zsh-completions
]; ];
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 +35,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,16 +54,19 @@ 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
(lib.mkBefore (lib.optionalString cfg.launchTmux '' initExtraFirst = ''
${
lib.optionalString cfg.launchTmux ''
# Launch tmux unless already inside one # Launch tmux unless already inside one
if [ -z "$TMUX" ]; then if [ -z "$TMUX" ]; then
exec tmux new-session exec tmux new-session
fi fi
'')) ''
}
'';
(lib.mkAfter '' initExtra = ''
source ${./completion-styles.zsh} source ${./completion-styles.zsh}
source ${./extra-mappings.zsh} source ${./extra-mappings.zsh}
source ${./options.zsh} source ${./options.zsh}
@ -103,8 +75,7 @@ in
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
@ -120,55 +91,5 @@ in
# Enable VTE integration # Enable VTE integration
enableVteIntegration = true; enableVteIntegration = true;
}; };
}
(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 {
programs.zsh = {
plugins = [
{
name = "zsh-done";
file = "share/zsh/site-functions/done.plugin.zsh";
src = pkgs.ambroisie.zsh-done;
}
];
# `localVariables` values don't get merged correctly due to their type,
# don't use `mkIf`
localVariables = {
DONE_EXCLUDE =
let
joined = lib.concatMapStringsSep "|" (c: "(${c})") cfg.notify.exclude;
in
''^\s*(${joined})'';
}
# Enable `zsh-done` through SSH, if configured
// lib.optionalAttrs cfg.notify.ssh.enable {
DONE_ALLOW_NONGRAPHICAL = 1;
};
# Use OSC-777 to send the notification through SSH
initContent = lib.mkIf cfg.notify.ssh.useOsc777 ''
done_send_notification() {
local exit_status="$1"
local title="$2"
local message="$3"
${lib.getExe pkgs.ambroisie.osc777} "$title" "$message"
}
'';
};
})
]);
} }

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;
}; };
environment.etc = {
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
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

@ -26,30 +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;
# Vulkan
amdvlk = lib.mkIf cfg.amd.amdvlk {
enable = true;
support32Bit = {
enable = true;
};
};
};
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
;
}; };
}) })
@ -61,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
@ -71,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;
}) })
]; ];
} }

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