Compare commits

..

1 commit

Author SHA1 Message Date
Bruno BELANYI 723bc90852 WIP: flake: add deploy-rs
Some checks are pending
ci/woodpecker/push/check Pipeline is pending
2023-06-11 16:12:55 +01:00
336 changed files with 5114 additions and 3171 deletions

8
.envrc
View file

@ -1,8 +1,10 @@
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="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake
watch_file ./flake/checks.nix
watch_file ./flake/dev-shells.nix
use flake
eval "$shellHooks"

View file

@ -1,23 +1,33 @@
labels:
backend: local
backend: exec
steps:
pipeline:
- name: nix flake check
image: bash
commands:
- nix flake check
- name: deploy
image: bash
commands:
# We already ran the checks in the previous step
- deploy --skip-checks
when:
# FIXME: disable PR
branch:
- main
- name: notifiy
image: bash
environment:
ADDRESS:
from_secret: matrix_homeserver
ROOM:
from_secret: matrix_roomid
USER:
from_secret: matrix_username
PASS:
from_secret: matrix_password
secrets:
- source: matrix_homeserver
target: address
- source: matrix_roomid
target: room
- source: matrix_username
target: user
- source: matrix_password
target: pass
commands:
- nix run '.#matrix-notifier'
when:

View file

@ -1,6 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p bitwarden-cli git gnupg jq nix
# shellcheck shell=bash
# Command failure is script failure
set -e
@ -11,6 +10,7 @@ BOLD_GREEN="\e[0;1;32m"
RESET="\e[0m"
DEST="$HOME/.config/nixpkgs"
BW_SESSION=""
warn() {

View file

@ -8,17 +8,14 @@
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1715290355,
"narHash": "sha256-2T7CHTqBXJJ3ZC6R/4TXTcKoXWHcvubKNj9SfomURnw=",
"lastModified": 1684153753,
"narHash": "sha256-PVbWt3qrjYAK+T5KplFcO+h7aZWfEj1UtyoKlvcDxh0=",
"owner": "ryantm",
"repo": "agenix",
"rev": "8d37c5bdeade12b6479c85acd133063ab53187a0",
"rev": "db5637d10f797bb251b94ef9040b237f4702cde3",
"type": "github"
},
"original": {
@ -36,11 +33,11 @@
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"type": "github"
},
"original": {
@ -50,18 +47,46 @@
"type": "github"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": [
"flake-compat"
],
"nixpkgs": [
"nixpkgs"
],
"utils": [
"futils"
]
},
"locked": {
"lastModified": 1674127017,
"narHash": "sha256-QO1xF7stu5ZMDLbHN30LFolMAwY6TVlzYvQoUs1RD68=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "8c9ea9605eed20528bf60fae35a2b613b901fd77",
"type": "github"
},
"original": {
"owner": "serokell",
"ref": "master",
"repo": "deploy-rs",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"ref": "master",
"repo": "flake-compat",
"type": "github"
}
@ -73,11 +98,11 @@
]
},
"locked": {
"lastModified": 1715865404,
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
"lastModified": 1685662779,
"narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
"rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3",
"type": "github"
},
"original": {
@ -89,16 +114,14 @@
},
"futils": {
"inputs": {
"systems": [
"systems"
]
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
@ -116,11 +139,11 @@
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
@ -136,11 +159,11 @@
]
},
"locked": {
"lastModified": 1715930644,
"narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=",
"lastModified": 1686391840,
"narHash": "sha256-5S0APl6Mfm6a37taHwvuf11UHnAX0+PnoWQbsYbMUnc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d",
"rev": "0144ac418ef633bfc9dbd89b8c199ad3a617c59f",
"type": "github"
},
"original": {
@ -152,11 +175,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1715961556,
"narHash": "sha256-+NpbZRCRisUHKQJZF3CT+xn14ZZQO+KjxIIanH3Pvn4=",
"lastModified": 1686319658,
"narHash": "sha256-tGWdoUAqKnE866mYFlEfc2a99kxFy31hOQJH5YQKrTQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4a6b83b05df1a8bd7d99095ec4b4d271f2956b64",
"rev": "ae766d59b07c450e0f1de8a1bfd6529089f40849",
"type": "github"
},
"original": {
@ -168,11 +191,11 @@
},
"nur": {
"locked": {
"lastModified": 1716149933,
"narHash": "sha256-0Ui2HmmKvSqxXfT5kCzTu2EO+kqYxavPZHROxQLsI14=",
"lastModified": 1686425941,
"narHash": "sha256-9Lip/8IvSxMB6KlvVLTHKx2C4TNm1gUzR8U/CsLjwzA=",
"owner": "nix-community",
"repo": "NUR",
"rev": "0d0e224fe23a49977d871ae2fe2f14c84b03322a",
"rev": "012d2d97f09d2eaa36fb8d83947b2dd9c61cf470",
"type": "github"
},
"original": {
@ -184,7 +207,12 @@
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-compat": [
"flake-compat"
],
"flake-utils": [
"futils"
],
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
@ -194,11 +222,11 @@
]
},
"locked": {
"lastModified": 1715870890,
"narHash": "sha256-nacSOeXtUEM77Gn0G4bTdEOeFIrkCBXiyyFZtdGwuH0=",
"lastModified": 1686213770,
"narHash": "sha256-Re6xXLEqQ/HRnThryumyGzEf3Uv0Pl4cuG50MrDofP8=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "fa606cccd7b0ccebe2880051208e4a0f61bfc8c1",
"rev": "182af51202998af5b64ddecaa7ff9be06425399b",
"type": "github"
},
"original": {
@ -211,13 +239,14 @@
"root": {
"inputs": {
"agenix": "agenix",
"deploy-rs": "deploy-rs",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"futils": "futils",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems"
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
@ -231,7 +260,6 @@
},
"original": {
"owner": "nix-systems",
"ref": "main",
"repo": "default",
"type": "github"
}

View file

@ -9,10 +9,29 @@
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
deploy-rs = {
type = "github";
owner = "serokell";
repo = "deploy-rs";
ref = "master";
inputs = {
flake-compat.follows = "flake-compat";
nixpkgs.follows = "nixpkgs";
utils.follows = "futils";
};
};
flake-compat = {
type = "github";
owner = "edolstra";
repo = "flake-compat";
ref = "master";
flake = false;
};
flake-parts = {
type = "github";
owner = "hercules-ci";
@ -28,9 +47,6 @@
owner = "numtide";
repo = "flake-utils";
ref = "main";
inputs = {
systems.follows = "systems";
};
};
home-manager = {
@ -63,17 +79,12 @@
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-compat.follows = "flake-compat";
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
systems = {
type = "github";
owner = "nix-systems";
repo = "default";
ref = "main";
};
};
# Can't eta-reduce a flake outputs...

View file

@ -1,9 +1,9 @@
{ flake-parts
, systems
, futils
, ...
} @ inputs:
let
mySystems = import systems;
mySystems = futils.lib.defaultSystems;
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = mySystems;
@ -11,6 +11,7 @@ flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
./apps.nix
./checks.nix
./deploy-rs.nix
./dev-shells.nix
./home-manager.nix
./lib.nix

26
flake/deploy-rs.nix Normal file
View file

@ -0,0 +1,26 @@
{ self, inputs, ... }:
let
inherit (inputs)
deploy-rs
;
inherit (self) lib;
in
{
perSystem = { system, ... }: {
checks = deploy-rs.lib.${system}.deployChecks self.deploy;
};
flake = {
deploy = {
nodes = {
porthos = {
hostname = "belanyi.fr";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.porthos;
};
};
};
};
};
}

View file

@ -2,7 +2,7 @@
let
defaultModules = [
# Include generic settings
"${self}/modules/home"
"${self}/home"
{
# Basic user information defaults
home.username = lib.mkDefault "ambroisie";
@ -39,9 +39,8 @@ let
};
};
homes = {
"ambroisie@bazin" = "x86_64-linux";
"ambroisie@mousqueton" = "x86_64-linux";
hosts = {
"ambroisie@ambroisie" = "x86_64-linux"; # Unfortunate naming here...
};
in
{
@ -50,13 +49,13 @@ in
legacyPackages = {
homeConfigurations =
let
filteredHomes = lib.filterAttrs (_: v: v == system) homes;
allHomes = filteredHomes // {
filteredHosts = lib.filterAttrs (_: v: v == system) hosts;
allHosts = filteredHosts // {
# Default configuration
ambroisie = system;
};
in
lib.mapAttrs mkHome allHomes;
lib.mapAttrs mkHome allHosts;
};
};
}

View file

@ -1,5 +1,7 @@
{ self, inputs, lib, ... }:
{ self, inputs, ... }:
let
inherit (self) lib;
defaultModules = [
{
# Let 'nixos-version --json' know about the Git revision
@ -11,7 +13,9 @@ let
];
}
# Include generic settings
"${self}/modules/nixos"
"${self}/modules"
# Include bundles of settings
"${self}/profiles"
];
buildHost = name: system: lib.nixosSystem {
@ -21,7 +25,7 @@ let
];
specialArgs = {
# Use my extended lib in NixOS configuration
inherit (self) lib;
inherit lib;
# Inject inputs to use them in global registry
inherit inputs;
};

View file

@ -25,8 +25,6 @@ in
search_mode = "skim";
# Show long command lines at the bottom
show_preview = true;
# I like being able to edit my commands
enter_accept = false;
};
};
};

29
home/comma/default.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.home.comma;
in
{
options.my.home.comma = with lib; {
enable = my.mkDisableOption "comma configuration";
pkgsFlake = mkOption {
type = types.str;
default = "pkgs";
example = "nixpkgs";
description = ''
Which flake from the registry should be used with
<command>nix shell</command>.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
ambroisie.comma
];
home.sessionVariables = {
COMMA_PKGS_FLAKE = cfg.pkgsFlake;
};
};
}

54
home/default.nix Normal file
View file

@ -0,0 +1,54 @@
{ ... }:
{
imports = [
./aliases
./atuin
./bat
./bluetooth
./comma
./dircolors
./direnv
./discord
./documentation
./feh
./firefox
./flameshot
./fzf
./gammastep
./gdb
./git
./gpg
./gtk
./htop
./jq
./mail
./mpv
./nix
./nix-index
./nixpkgs
./nm-applet
./packages
./pager
./power-alert
./secrets
./ssh
./terminal
./tmux
./udiskie
./vim
./wm
./x
./xdg
./zathura
./zsh
];
# First sane reproducible version
home.stateVersion = "20.09";
# Who am I?
home.username = "ambroisie";
# Start services automatically
systemd.user.startServices = "sd-switch";
}

View file

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

32
home/direnv/lib/nix.sh Normal file
View file

@ -0,0 +1,32 @@
#shellcheck shell=bash
use_pkgs() {
if ! has nix; then
# shellcheck disable=2016
log_error 'use_pkgs: `nix` is not in PATH'
return 1
fi
# Use user-provided default value, or fallback to nixpkgs
local DEFAULT_FLAKE="${DIRENV_DEFAULT_FLAKE:-nixpkgs}"
# Allow changing the default flake through a command line switch
if [ "$1" = "-f" ] || [ "$1" = "--flake" ]; then
DEFAULT_FLAKE="$2"
shift 2
fi
# Allow specifying a full installable, or just a package name and use the default flake
local packages=()
for pkg; do
if [[ $pkg =~ .*#.* ]]; then
packages+=("$pkg")
else
packages+=("$DEFAULT_FLAKE#$pkg")
fi
done
# shellcheck disable=2154
direnv_load nix shell "${packages[@]}" --command "$direnv" dump
}

View file

@ -33,10 +33,13 @@ in
enable = true;
package = pkgs.firefox.override {
nativeMessagingHosts = ([ ]
++ lib.optional cfg.tridactyl.enable pkgs.tridactyl-native
cfg = {
enableTridactylNative = cfg.tridactyl.enable;
};
extraNativeMessagingHosts = with pkgs; ([ ]
# Watch videos using mpv
++ lib.optional cfg.ff2mpv.enable pkgs.ff2mpv-go
++ lib.optional cfg.ff2mpv.enable ambroisie.ff2mpv-go
);
};

View file

@ -22,8 +22,8 @@ bind ;c hint -Jc [class*="expand"],[class*="togg"],[class="comment_folder"]
bindurl reddit.com gu urlparent 3
" Only hint search results on Google
bindurl www.google.com f hint -Jc #search a
bindurl www.google.com F hint -Jbc #search a
bindurl www.google.com f hint -Jc #search div:not(.action-menu) > a
bindurl www.google.com F hint -Jbc #search div:not(.action-menu) > a
" Only hint search results on DuckDuckGo
bindurl ^https://duckduckgo.com f hint -Jc [data-testid="result-title-a"]
@ -69,6 +69,8 @@ unbind <C-f>
" Redirections {{{
" Always redirect Reddit to the old site
autocmd DocStart ^http(s?)://www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")
" Use a better Twitter front-end
autocmd DocStart ^http(s?)://twitter.com js tri.excmds.urlmodify("-t", "twitter.com", "nitter.net")
" }}}
" Disabled websites {{{

View file

@ -20,26 +20,19 @@ in
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
config = lib.mkMerge [
(lib.mkIf cfg.enable {
home.packages = with pkgs; [
gdb
];
xdg = {
configFile."gdb/gdbinit".source = ./gdbinit;
dataFile. "gdb/.keep".text = "";
};
home.sessionVariables = {
GDBHISTFILE = "${config.xdg.dataHome}/gdb/gdb_history";
};
}
xdg.configFile."gdb/gdbinit".source = ./gdbinit;
})
(lib.mkIf cfg.rr.enable {
home.packages = [
cfg.rr.package
];
})
]);
];
}

View file

@ -7,9 +7,6 @@ in
{
options.my.home.git = with lib; {
enable = my.mkDisableOption "git configuration";
# I want the full experience by default
package = mkPackageOption pkgs "git" { default = [ "gitFull" ]; };
};
config.home.packages = with pkgs; lib.mkIf cfg.enable [
@ -25,7 +22,8 @@ in
userEmail = mkMailAddress "bruno" "belanyi.fr";
userName = "Bruno BELANYI";
inherit (cfg) package;
# I want the full experience
package = pkgs.gitFull;
aliases = {
git = "!git";
@ -148,10 +146,6 @@ in
autoStash = true;
};
rerere = {
enabled = true;
};
url = {
"git@git.belanyi.fr:" = {
insteadOf = "https://git.belanyi.fr/";

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
let
cfg = config.my.home.gpg;
in
@ -6,7 +6,12 @@ in
options.my.home.gpg = with lib; {
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 {
@ -17,7 +22,7 @@ in
services.gpg-agent = {
enable = true;
enableSshSupport = true; # One agent to rule them all
pinentryPackage = cfg.pinentry;
pinentryFlavor = cfg.pinentry;
extraConfig = ''
allow-loopback-pinentry
'';

View file

@ -8,7 +8,7 @@ let
realName = lib.mkDefault "Bruno BELANYI";
userName = lib.mkDefault (mkMailAddress address domain);
passwordCommand =
lib.mkDefault [ (lib.getExe pkgs.ambroisie.rbw-pass) "Mail" passName ];
lib.mkDefault [ "${pkgs.ambroisie.bw-pass}/bin/bw-pass" "Mail" passName ];
address = mkMailAddress address domain;
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;
@ -18,6 +18,8 @@ let
himalaya = {
enable = cfg.himalaya.enable;
# FIXME: try to actually configure it at some point
backend = "imap";
sender = "smtp";
};
msmtp = {

View file

@ -9,7 +9,7 @@ in
settings = {
notify-cmd =
let
notify-send = lib.getExe pkgs.libnotify;
notify-send = "${pkgs.libnotify}/bin/notify-send";
in
pkgs.writeScript "mail-notifier" ''
SENDER="$1"

View file

@ -13,8 +13,6 @@ in
scripts = [
pkgs.mpvScripts.mpris # Allow controlling using media keys
pkgs.mpvScripts.mpv-cheatsheet # Show some simple mappings on '?'
pkgs.mpvScripts.uosc # Nicer UI
];
};
};

View file

@ -12,7 +12,7 @@ let
# Use pinned nixpkgs when using `nix run pkgs#<whatever>`
pkgs = inputs.nixpkgs;
}
(lib.optionalAttrs cfg.inputs.overrideNixpkgs {
(lib.optionalAttrs cfg.overrideNixpkgs {
# ... And with `nix run nixpkgs#<whatever>`
nixpkgs = inputs.nixpkgs;
})
@ -22,26 +22,20 @@ in
options.my.home.nix = with lib; {
enable = my.mkDisableOption "nix configuration";
cache = {
selfHosted = my.mkDisableOption "self-hosted cache";
};
linkInputs = my.mkDisableOption "link inputs to `$XDG_CONFIG_HOME/nix/inputs`";
inputs = {
link = my.mkDisableOption "link inputs to `/etc/nix/inputs/`";
addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
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 [
{
assertions = [
{
assertion = cfg.inputs.addToNixPath -> cfg.inputs.link;
assertion = cfg.addToNixPath -> cfg.linkInputs;
message = ''
enabling `my.home.nix.addToNixPath` needs to have
`my.home.nix.linkInputs = true`
@ -60,21 +54,7 @@ in
};
}
(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 {
(lib.mkIf cfg.addToRegistry {
nix.registry =
let
makeEntry = v: { flake = v; };
@ -83,7 +63,7 @@ in
makeEntries channels;
})
(lib.mkIf cfg.inputs.link {
(lib.mkIf cfg.linkInputs {
xdg.configFile =
let
makeLink = n: v: {
@ -95,7 +75,7 @@ in
makeLinks channels;
})
(lib.mkIf cfg.inputs.addToNixPath {
(lib.mkIf cfg.addToNixPath {
home.sessionVariables.NIX_PATH = "${config.xdg.configHome}/nix/inputs\${NIX_PATH:+:$NIX_PATH}";
})
]);

View file

@ -14,7 +14,6 @@ in
home.sessionVariables = {
GITHUB_TOKEN = ''$(cat "${config.age.secrets."github/token".path}")'';
GITHUB_API_TOKEN = ''$(cat "${config.age.secrets."github/token".path}")'';
};
};
}

View file

@ -6,10 +6,6 @@ in
options.my.home.packages = with lib; {
enable = my.mkDisableOption "user packages";
allowAliases = mkEnableOption "allow package aliases";
allowUnfree = my.mkDisableOption "allow unfree packages";
additionalPackages = mkOption {
type = with types; listOf package;
default = [ ];
@ -21,15 +17,10 @@ in
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; ([
fd
file
ripgrep
] ++ cfg.additionalPackages);
nixpkgs.config = {
inherit (cfg) allowAliases allowUnfree;
};
};
config.home.packages = with pkgs; lib.mkIf cfg.enable ([
fd
file
mosh
ripgrep
] ++ cfg.additionalPackages);
}

View file

@ -16,7 +16,6 @@ in
LESS = "-R -+X -c";
# Better XDG compliance
LESSHISTFILE = "${config.xdg.dataHome}/less/history";
LESSKEY = "${config.xdg.configHome}/less/lesskey";
};
};
}

54
home/ssh/default.nix Normal file
View file

@ -0,0 +1,54 @@
{ config, lib, ... }:
let
cfg = config.my.home.ssh;
in
{
options.my.home.ssh = with lib; {
enable = my.mkDisableOption "ssh configuration";
};
config.programs.ssh = lib.mkIf cfg.enable {
enable = true;
includes = [
# Local configuration, not-versioned
"config.local"
];
matchBlocks = {
"github.com" = {
hostname = "github.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"gitlab.com" = {
hostname = "gitlab.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.sr.ht" = {
hostname = "git.sr.ht";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.belanyi.fr" = {
hostname = "git.belanyi.fr";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
porthos = {
hostname = "91.121.177.163";
identityFile = "~/.ssh/shared_rsa";
user = "ambroisie";
};
};
extraConfig = ''
AddKeysToAgent yes
'';
};
}

View file

@ -5,39 +5,12 @@ let
config.my.home.x.enable
(config.my.home.wm.windowManager != null)
];
mkTerminalFlags = 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
{
options.my.home.tmux = with lib; {
enable = my.mkDisableOption "tmux terminal multiplexer";
enablePassthrough = mkEnableOption "tmux DCS passthrough sequence";
terminalFeatures = mkOption {
type = with types; attrsOf (submodule {
options = {
hyperlinks = my.mkDisableOption "hyperlinks through OSC8";
trueColor = my.mkDisableOption "24-bit (RGB) color support";
};
});
default = { ${config.my.home.terminal.program} = { }; };
defaultText = litteralExpression ''
{ ''${config.my.home.terminal.program} = { }; };
'';
example = { xterm-256color = { }; };
description = ''
$TERM values which should be considered to have additional features.
'';
};
enabledPassthrough = mkEnableOption "tmux DCS passthrough sequence";
};
config.programs.tmux = lib.mkIf cfg.enable {
@ -46,7 +19,7 @@ in
keyMode = "vi"; # Home-row keys and other niceties
clock24 = true; # I'm one of those heathens
escapeTime = 0; # Let vim do its thing instead
historyLimit = 100000; # Bigger buffer
historyLimit = 50000; # Bigger buffer
terminal = "tmux-256color"; # I want accurate termcap info
plugins = with pkgs.tmuxPlugins; [
@ -93,20 +66,12 @@ in
# Allow any application to send OSC52 escapes to set the clipboard
set -s set-clipboard on
# Longer session names in status bar
set -g status-left-length 16
${
lib.optionalString cfg.enablePassthrough ''
lib.optionalString cfg.enabledPassthrough ''
# Allow any application to use the tmux DCS for passthrough
set -g allow-passthrough on
''
}
# Force OSC8 hyperlinks for each relevant $TERM
${mkTerminalFlags "hyperlinks" "hyperlinks"}
# Force 24-bit color for each relevant $TERM
${mkTerminalFlags "trueColor" "RGB"}
'';
};
}

View file

@ -4,7 +4,3 @@ call ftplugined#check_undo_ft()
" Enable spell checking on commit messages
setlocal spell
let b:undo_ftplugin.='|setlocal spell<'
" Change max length of a line to 72 for this buffer
setlocal colorcolumn=72
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -67,7 +67,7 @@ in
nvim-lspconfig # Easy LSP configuration
lsp-format-nvim # Simplified formatting configuration
lsp_lines-nvim # Show diagnostics *over* regions
none-ls-nvim # LSP integration for linters and formatters
null-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting
nvim-treesitter-textobjects # More textobjects
nvim-ts-context-commentstring # Comment string in nested language blocks
@ -77,10 +77,10 @@ in
luasnip # Snippet manager compatible with LSP
friendly-snippets # LSP snippets collection
nvim-cmp # Completion engine
cmp-async-path # More responsive path completion
cmp-buffer # Words from open buffers
cmp-nvim-lsp # LSP suggestions
cmp-nvim-lua # NeoVim lua API
cmp-path # Path name suggestions
cmp-under-comparator # Sort items that start with '_' lower
cmp_luasnip # Snippet suggestions from LuaSnip
@ -105,7 +105,7 @@ in
nixpkgs-fmt
# Shell
nodePackages.bash-language-server
shellcheck
shfmt
];
};

View file

@ -1,4 +1,4 @@
-- Use Automake filetype for `local.am` files
-- Use Automake filetype for `local.am` files, explicit `set` to force override
vim.filetype.add({
filename = {
["local.am"] = "automake",

View file

@ -88,23 +88,6 @@ set background=dark
" 24 bit colors
set termguicolors
" Setup some overrides for gruvbox
lua << EOF
local gruvbox = require("gruvbox")
local colors = gruvbox.palette
gruvbox.setup({
overrides = {
-- 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 },
}
})
EOF
" Use my preferred colorscheme
colorscheme gruvbox
" }}}

View file

@ -3,9 +3,9 @@ local M = {}
-- Simplified LSP formatting configuration
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
-- 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" },
@ -28,22 +28,38 @@ local function goto_diagnostic(forward)
end
end
--- Move to the next diagnostic, automatically showing the diagnostics float if
--- necessary.
-- 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.
-- 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
--- @param client native client configuration
--- @param bufnr int? buffer number of the attched client
-- shared LSP configuration callback
-- @param client native client configuration
-- @param bufnr int? buffer number of the attched client
M.on_attach = function(client, bufnr)
-- Diagnostics
vim.diagnostic.config({
-- Disable virtual test next to affected regions
virtual_text = false,
-- Also disable virtual diagnostics under the affected regions
virtual_lines = false,
-- Show diagnostics signs
signs = true,
-- Underline offending regions
underline = true,
-- Do not bother me in the middle of insertion
update_in_insert = false,
-- Show highest severity first
severity_sort = true,
})
-- Format on save
lsp_format.on_attach(client, bufnr)
@ -51,7 +67,8 @@ M.on_attach = function(client, bufnr)
local wk = require("which-key")
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
local function cycle_diagnostics_display()

View file

@ -1,23 +1,29 @@
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
--- @param cmd string? command to check
--- @return boolean executable
---@param cmd string? command to check
---@return boolean executable
M.is_executable = function(cmd)
return cmd and vim.fn.executable(cmd) == 1
end
--- return a function that checks if a given command is executable
--- @param cmd string? command to check
--- @return fun(): boolean executable
---@param cmd string? command to check
---@return fun(cmd: string): boolean executable
M.is_executable_condition = function(cmd)
return function()
return M.is_executable(cmd)
end
end
--- whether or not we are currently in an SSH connection
--- @return boolean ssh connection
-- whether or not we are currently in an SSH connection
-- @return boolean ssh connection
M.is_ssh = function()
local variables = {
"SSH_CONNECTION",
@ -34,11 +40,11 @@ M.is_ssh = function()
return false
end
--- list all active LSP clients for specific buffer, or all buffers
--- @param bufnr int? buffer number
--- @return table all active LSP client names
-- list all active LSP clients for current buffer
-- @param bufnr int? buffer number
-- @return table all active LSP client names
M.list_lsp_clients = function(bufnr)
local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
local clients = vim.lsp.buf_get_clients(bufnr)
local names = {}
for _, client in ipairs(clients) do

View file

@ -37,7 +37,7 @@ cmp.setup({
entries = "native",
},
sources = {
{ name = "async_path", priority_weight = 110 },
{ name = "path", priority_weight = 110 },
{ name = "nvim_lsp", priority_weight = 100 },
{ name = "nvim_lua", priority_weight = 90 },
{ name = "luasnip", priority_weight = 80 },

View file

@ -2,22 +2,6 @@ local lspconfig = require("lspconfig")
local lsp = require("ambroisie.lsp")
local utils = require("ambroisie.utils")
-- Diagnostics
vim.diagnostic.config({
-- Disable virtual test next to affected regions
virtual_text = false,
-- Also disable virtual diagnostics under the affected regions
virtual_lines = false,
-- Show diagnostics signs
signs = true,
-- Underline offending regions
underline = true,
-- Do not bother me in the middle of insertion
update_in_insert = false,
-- Show highest severity first
severity_sort = true,
})
-- Inform servers we are able to do completion, snippets, etc...
local capabilities = require("cmp_nvim_lsp").default_capabilities()
@ -29,14 +13,6 @@ if utils.is_executable("clangd") then
})
end
-- Haskell
if utils.is_executable("haskell-language-server-wrapper") then
lspconfig.hls.setup({
capabilities = capabilities,
on_attach = lsp.on_attach,
})
end
-- Nix
if utils.is_executable("nil") then
lspconfig.nil_ls.setup({
@ -45,16 +21,16 @@ if utils.is_executable("nil") then
})
end
-- Python
if utils.is_executable("pyright") then
lspconfig.pyright.setup({
if utils.is_executable("rnix-lsp") then
lspconfig.rnix.setup({
capabilities = capabilities,
on_attach = lsp.on_attach,
})
end
if utils.is_executable("ruff-lsp") then
lspconfig.ruff_lsp.setup({
-- Python
if utils.is_executable("pyright") then
lspconfig.pyright.setup({
capabilities = capabilities,
on_attach = lsp.on_attach,
})
@ -67,12 +43,3 @@ if utils.is_executable("rust-analyzer") then
on_attach = lsp.on_attach,
})
end
-- Shell
if utils.is_executable("bash-language-server") then
lspconfig.bashls.setup({
filetypes = { "bash", "sh", "zsh" },
capabilities = capabilities,
on_attach = lsp.on_attach,
})
end

View file

@ -10,7 +10,7 @@ local function list_spell_languages()
end
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
return ""

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