Merge remote-tracking branch 'origin/main'

This commit is contained in:
Geoffrey Frogeye 2024-01-28 12:13:58 +01:00
commit 16f5a0a9a5
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
30 changed files with 626 additions and 349 deletions

View file

@ -0,0 +1,22 @@
{ pkgs, lib, config, ... }:
let
generator = pkgs.writers.writePython3 "frogarized"
{
libraries = [ pkgs.python3Packages.colorspacious ];
}
(builtins.readFile ./frogarized.py);
frogarized_json = polarity: pkgs.runCommand "frogarized-${polarity}.json" { } "${generator} --polarity ${polarity} --output json > $out";
frogarized_nix = polarity: builtins.fromJSON (builtins.readFile (frogarized_json polarity));
in
{
config = {
stylix = {
base16Scheme = frogarized_nix config.stylix.polarity;
# On purpose also enable without a DE because stylix complains otherwise
image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
};
};
}

112
common/frogarized/frogarized.py Executable file
View file

@ -0,0 +1,112 @@
import argparse
import json
import colorspacious
import numpy as np
# Original values for the Solarized color scheme,
# created by Ethan Schoonover (https://ethanschoonover.com/solarized/)
SOLARIZED_LAB = np.array(
[
[15, -12, -12],
[20, -12, -12],
[45, -7, -7],
[50, -7, -7],
[60, -6, -3],
[65, -5, -2],
[92, -0, 10],
[97, 0, 10],
[50, 65, 45],
[50, 50, 55],
[60, 10, 65],
[60, -20, 65],
[60, -35, -5],
[55, -10, -45],
[50, 15, -45],
[50, 65, -5],
]
)
# I couldn't get a perfect translation of Solarized L*a*b values into sRGB,
# so here is upstream's translation for reference
SOLARIZED_RGB = np.array(
[
[0, 43, 54],
[7, 54, 66],
[88, 110, 117],
[101, 123, 131],
[131, 148, 150],
[147, 161, 161],
[238, 232, 213],
[253, 246, 227],
[220, 50, 47],
[203, 75, 22],
[181, 137, 0],
[133, 153, 0],
[42, 161, 152],
[38, 139, 210],
[108, 113, 196],
[211, 54, 130],
]
)
# Parse arguments
parser = argparse.ArgumentParser(
description="Generate a base16-theme based derived from Solarized"
)
parser.add_argument("--source", choices=["lab", "rgb"], default="lab")
parser.add_argument("--lightness_factor", type=float, default=1.0)
parser.add_argument("--chroma-factor", type=float, default=1.0)
parser.add_argument("--hue_shift", type=float, default=-75.0)
parser.add_argument("--polarity", choices=["dark", "light"], default="dark")
parser.add_argument(
"--output", choices=["json", "truecolor"], default="truecolor"
)
args = parser.parse_args()
# Convert source to JCh color space
if args.source == "lab":
solarized_jch = colorspacious.cspace_convert(
SOLARIZED_LAB, "CIELab", "JCh"
)
elif args.source == "rgb":
solarized_jch = colorspacious.cspace_convert(
SOLARIZED_RGB, "sRGB255", "JCh"
)
# Build frogarized theme
jch_factor = [args.lightness_factor, args.chroma_factor, 1]
jch_shift = [0, 0, args.hue_shift]
frogarzied_jch = np.vstack(
[solarized_jch[:8] * jch_factor + jch_shift, solarized_jch[8:]]
)
# Convert frogarized to RGB
frogarized_srgb = colorspacious.cspace_convert(
frogarzied_jch, "JCh", "sRGB255"
)
frogarized_rgb = np.uint8(np.rint(np.clip(frogarized_srgb, 0, 255)))
if args.polarity == "light":
frogarized_rgb = np.vstack([frogarized_rgb[7::-1], frogarized_rgb[8:]])
# Output
palette = dict()
for i in range(16):
rgb = frogarized_rgb[i]
r, g, b = rgb
hex = f"#{r:02x}{g:02x}{b:02x}"
palette[f"base{i:02X}"] = hex
if args.output == "truecolor":
print(f"\033[48;2;{r};{g};{b}m{hex}\033[0m") # ]]
# treesitter is silly and will consider brackets in strings
# as indentation, hence the comment above
if args.output == "json":
scheme = palette.copy()
scheme.update(
{
"slug": f"frogarized-{args.polarity}",
"scheme": f"Frogarized {args.polarity.title()}",
"author": "Geoffrey Frogeye (with work from Ethan Schoonover)",
}
)
print(json.dumps(scheme, indent=4))

View file

@ -1,4 +1,4 @@
{ ... }:
{ pkgs, lib, config, ... }:
{
imports = [
./options.nix
@ -9,7 +9,6 @@
networking.hostName = "curacao";
boot = {
initrd.luks.reusePassphrases = true;
loader = {
efi.efiSysMountPoint = "/efi";
};

View file

@ -311,6 +311,56 @@
"type": "github"
}
},
"nix-formatter-pack": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
],
"nmd": "nmd",
"nmt": "nmt"
},
"locked": {
"lastModified": 1666720474,
"narHash": "sha256-iWojjDS1D19zpeZXbBdjWb9MiKmVVFQCqtJmtTXgPx8=",
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"rev": "14876cc8fe94a3d329964ecb073b4c988c7b61f5",
"type": "github"
},
"original": {
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"type": "github"
}
},
"nix-on-droid": {
"inputs": {
"home-manager": [
"home-manager"
],
"nix-formatter-pack": "nix-formatter-pack",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap",
"nmd": "nmd_2"
},
"locked": {
"lastModified": 1688144254,
"narHash": "sha256-8KL1l/7eP2Zm1aJjdVaSOk0W5kTnJo9kcgW03gqWuiI=",
"owner": "nix-community",
"repo": "nix-on-droid",
"rev": "2301e01d48c90b60751005317de7a84a51a87eb6",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "nix-on-droid",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
@ -348,11 +398,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1705183652,
"narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
"lastModified": 1706098335,
"narHash": "sha256-r3dWjT8P9/Ah5m5ul4WqIWD8muj5F+/gbCdjiNVBKmU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "428544ae95eec077c7f823b422afae5f174dee4b",
"rev": "a77ab169a83a4175169d78684ddd2e54486ac651",
"type": "github"
},
"original": {
@ -361,6 +411,22 @@
"type": "indirect"
}
},
"nixpkgs-for-bootstrap": {
"locked": {
"lastModified": 1686921029,
"narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1685801374,
@ -386,17 +452,80 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1702044539,
"narHash": "sha256-TNmEd6MipLxsrWromxqNfU4y17MoBr15QF7iEOagPy8=",
"owner": "nix-community",
"lastModified": 1705700164,
"narHash": "sha256-YAWtzc+5KDOHDGz/NBB7ysIusXbYYKtsbDOsRhSWKYk=",
"owner": "GeoffreyFrogeye",
"repo": "nixvim",
"rev": "c96d7b46d05a78e695ed1c725d1596b65509b4f9",
"rev": "2e5f7781fccba0472277cad5d383d10d50772234",
"type": "github"
},
"original": {
"owner": "GeoffreyFrogeye",
"ref": "frogeye-23.11",
"repo": "nixvim",
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmd_2": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"nur": {
"locked": {
"lastModified": 1705693547,
"narHash": "sha256-/6rVfbj1oaycjvYJeZRqL+ApzNL2FNf6pmfWuk+9Bhs=",
"owner": "nix-community",
"repo": "NUR",
"rev": "868aa9b52241ad7c8cb89cdd207f8d0149ebf95b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"rev": "c96d7b46d05a78e695ed1c725d1596b65509b4f9",
"repo": "NUR",
"type": "github"
}
},
@ -429,10 +558,12 @@
"inputs": {
"disko": "disko",
"home-manager": "home-manager",
"nix-on-droid": "nix-on-droid",
"nixgl": "nixgl",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"nur": "nur",
"stylix": "stylix"
}
},

View file

@ -25,8 +25,9 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/c96d7b46d05a78e695ed1c725d1596b65509b4f9";
# 24.05 Anything after this commit works
url = "github:GeoffreyFrogeye/nixvim/frogeye-23.11";
# 24.05 Ensure merged: https://github.com/nix-community/nixvim/pull/953
# url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl = {
@ -81,6 +82,7 @@
./os
disko.nixosModules.disko
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
];
};
nixOnDroidModules.dotfiles = {

View file

@ -58,6 +58,11 @@
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
};
thefuck = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
lsd = {
enable = true;
settings = {

View file

@ -1,6 +1,7 @@
{ ... }:
{
imports = [
../common/frogarized
../options.nix
./brightness
./common.nix

View file

@ -1,11 +1,6 @@
{ pkgs, config, lib, ... }:
{
config = {
# On purpose also enable without a DE because stylix complains otherwise
stylix.image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
# This correctly sets the background on some occasions, below does the rest
programs.autorandr.hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";

View file

@ -108,6 +108,7 @@
inv = invidious;
nixos = "https://search.nixos.org/options?channel=${config.home.version.release}&query={}";
nixpkgs = "https://search.nixos.org/packages?channel=${config.home.version.release}&query={}";
noogle = "https://noogle.dev/q?term={}";
npm = "https://www.npmjs.com/search?q={}";
os = nixos;
pkgs = nixpkgs;

View file

@ -144,6 +144,8 @@ in
# misc
gnome.gedit
xfce.thunar
nomacs
feh
zbar
zathura

View file

@ -4,6 +4,7 @@
./common.nix
./go.nix
./node.nix
./prose.nix
./python.nix
];
}

38
hm/dev/prose.nix Normal file
View file

@ -0,0 +1,38 @@
# Prose is a programming language, fight me
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.prose {
home = {
packages = with pkgs; [
hunspell
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.fr-moderne
hunspellDicts.nl_NL
# TODO libreoffice-extension-languagetool or libreoffice-extension-grammalecte-fr
];
};
programs.nixvim = {
autoCmd = [
# vim-easy-align: Align Markdown tables with |
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
];
extraPlugins = with pkgs.vimPlugins; lib.optionals config.programs.pandoc.enable [
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
vim-pandoc-syntax
];
extraConfigVim = lib.optionalString config.programs.pandoc.enable ''
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0
'';
plugins.none-ls = {
enable = true;
sources = {
code_actions.ltrs.enable = true;
diagnostics.ltrs.enable = true;
};
};
};
};
}

View file

@ -34,12 +34,6 @@
# TODO Convert existing LaTeX documents into using Nix build system
# texlive is big and not that much used, sooo
pdftk
hunspell
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.fr-moderne
hunspellDicts.nl_NL
# TODO libreoffice-extension-languagetool or libreoffice-extension-grammalecte-fr
] ++ lib.optionals config.frogeye.desktop.xorg [

View file

@ -14,9 +14,10 @@
else
(
cd "${r.path}"
${pkgs.git}/bin/git diff --quiet || echo "Repository is dirty!"
${pkgs.git}/bin/git --no-optional-locks diff --quiet || echo "Repository is dirty!"
${pkgs.git}/bin/git pull || true
${pkgs.git}/bin/git push || true
# Only push if there's something to push. Also prevents from trying to push on repos where we don't have rights.
(${pkgs.git}/bin/git --no-optional-locks status --porcelain -b --ignore-submodules | grep ' \[ahead [0-9]\+\]' && ${pkgs.git}/bin/git push) || true
)
fi
'')

View file

@ -34,6 +34,10 @@
services.gpg-agent = {
enableBashIntegration = true;
enableZshIntegration = true;
pinentryFlavor = "gnome3";
# gnome3 is nicer, but requires gcr as a dbus package.
# Which is in my NixOS config, and on non-NixOS too.
# It will fall back to ncurses when running in non-graphics mode.
};
};
}

View file

@ -1,16 +1,8 @@
{ pkgs, config, lib, ... }:
let
basetheme = "solarized";
in
{
config = {
# Setting a custom base16 theme via nixvim is required so feline works, and
# because stylix makes a config that otherwise only works with dark
# polarity.
programs.nixvim.colorschemes.base16.colorscheme = "${basetheme}-${config.frogeye.polarity}";
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/${basetheme}-${config.frogeye.polarity}.yaml";
polarity = config.frogeye.polarity;
fonts = {
monospace = {
package = pkgs.nerdfonts.override {

View file

@ -44,6 +44,12 @@ in
showbreak = "";
};
plugins = {
# Underline all instances of the underlined word
cursorline = {
enable = true;
cursorline.enable = false;
};
# Catches attention when cursor changed position
specs = {
enable = true;
@ -61,7 +67,6 @@ in
};
# indent = true; # Not very working last time I tried apparently
};
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
indent-blankline.enable = true; # Show indent guides
rainbow-delimiters.enable = true; # Randomly colore paired brackets

View file

@ -1,48 +1,159 @@
{ pkgs, lib, config, ... }:
{
config = {
programs.nixvim = {
autoCmd = [
# Turn off relativenumber only for insert mode
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
];
extraConfigLua = builtins.readFile ./feline.lua;
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar
# Status line
feline-nvim # Customizable status line.
# TODO Abandonned. Maybe use lualine?
];
keymaps = [
# barbar
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
# TODO gotos don't work
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options?
];
options = {
title = true;
number = true;
relativenumber = true;
};
plugins = {
# Tabline
barbar.enable = true;
programs = {
# https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
alacritty.settings.key_bindings = [
{ key = "H"; mods = "Control|Shift"; chars = "\\x1b[72;5u"; }
{ key = "L"; mods = "Control|Shift"; chars = "\\x1b[76;5u"; }
] ++ (map
(n: { key = "Key${builtins.toString n}"; mods = "Control"; chars = "\\x1b[${builtins.toString (48+n)};5u"; })
(lib.lists.range 0 9));
# Ctrl+<number> doesn't get interpreted, but Ctrl+Shift+<number> does, so let's use that
nixvim = {
autoCmd = [
# Turn off relativenumber only for insert mode
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
];
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar
];
keymaps =
let
options = { silent = true; };
in
[
# barbar
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; inherit options; }
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; inherit options; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; inherit options; }
{ key = "<C-S-H>"; action = "<Cmd>BufferMovePrevious<CR>"; inherit options; }
{ key = "<C-S-L>"; action = "<Cmd>BufferMoveNext<CR>"; inherit options; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; inherit options; }
] ++ (map
(n: { key = "<C-${builtins.toString n}>"; action = "<Cmd>BufferGoto ${builtins.toString n}<CR>"; inherit options; })
(lib.lists.range 1 9));
options = {
showmode = false;
number = true;
relativenumber = true;
title = true;
};
plugins = {
# Tabline
barbar.enable = true;
# TODO Reload make it use the preset colorscheme
# Status line
lualine = with config.lib.stylix.colors.withHashtag; let
normal = { fg = base05; bg = base01; };
inverted = { fg = base00; bg = base03; };
normal_ina = { fg = base02; bg = base01; };
inverted_ina = { fg = base00; bg = base02; };
in
rec {
enable = true;
inactiveSections = sections;
sections = {
lualine_a = [{
name = ''string.format('%d', vim.fn.line('$'))'';
}];
lualine_b = [
"mode"
];
lualine_c = [{
name = "filename";
color = {
__raw = ''
function(section)
return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' }
end
'';
};
extraConfig = {
path = 1; # Relative path
symbols = {
modified = "";
newfile = "󰻭";
readonly = "󰏯";
unnamed = "󱀶";
};
};
}
"location"];
lualine_x = [{
name = ''(next(vim.lsp.buf_get_clients()) == nil) and "󰒲 " or ""'';
extraConfig.separator = { left = ""; right = ""; };
}] ++ (lib.mapAttrsToList
(diag_name: diag_color: {
name = "diagnostics";
extraConfig = {
color.bg = diag_color;
colored = false;
separator = { left = ""; right = ""; };
sections = [ diag_name ];
};
})
{
error = base08;
warn = base0A;
hint = base0C;
info = base0B;
});
lualine_y = [{
name = "diff";
extraConfig = {
diff_color = {
added.fg = base0B;
modified.fg = base0A;
removed.fg = base08;
};
symbols = {
added = " ";
modified = " ";
removed = " ";
};
};
}
"branch"];
lualine_z = [
"filetype"
"fileformat"
"encoding"
];
};
theme = (lib.mapAttrs
(mode_name: mode_color: {
a = inverted;
b = inverted // { bg = mode_color; gui = "bold"; };
c = normal;
x = inverted;
y = normal;
z = inverted // { bg = mode_color; };
})
{
normal = base0D;
insert = base0B;
visual = base0F;
replace = base08;
command = base0E;
}) // {
inactive = {
a = inverted_ina;
b = normal_ina // { bg = base00; gui = "bold"; };
c = normal_ina;
x = inverted_ina;
y = normal_ina;
z = normal_ina // { bg = base00; };
};
};
};
# Show context on top if scrolled out
treesitter-context = {
enable = true;
maxLines = 5;
};
};
};
};
};

View file

@ -12,6 +12,9 @@
vim = "nvim";
};
programs.nixvim = {
# Required, otherwise light mode becomes a default dark theme.
colorschemes.base16.colorscheme = "solarized-${config.stylix.polarity}";
options = {
ignorecase = true;
smartcase = true;
@ -50,13 +53,6 @@
gH = "command_history";
gS = "search_history";
gC = "commands";
gr = "lsp_references";
ge = "diagnostics";
# ga = "lsp_code_actions";
# gE = "lsp_workspace_diagnostics";
# TODO Above makes nvim crash on startup, action is not provided
gd = "lsp_definitions";
gs = "lsp_document_symbols";
};
defaults = {
vimgrep_arguments = [
@ -77,16 +73,14 @@
overrideGenericSorter = true;
};
};
# TODO Go to any symbol in the current working directory, for when LSP doesn't support it.
# Or at least something to live_grep the curent word.
# Surrounding pairs
surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes)
undotree.enable = true; # Navigate edition history
# Git
fugitive.enable = true; # Git basics
gitsigns.enable = true; # Show changed lines in the gutter
};
extraPlugins = with pkgs.vimPlugins; [
# Search/replace
@ -96,62 +90,20 @@
# Surrounding pairs
targets-vim # Better interaction with surrounding pairs
# Registers
registers-nvim # Show register content when pressing "
# TODO Doesn't work. Didn't work on Arch either
# Tags
vim-gutentags # Generate tags
symbols-outline-nvim # Show a symbol panel on the right
# TODO Fails on startup. Same on Arch. Config issue?
# Git
fugitive-gitlab-vim # Open files in GitLab
# TODO Connect it!
# Language-specific
tcomment_vim # Language-aware (un)commenting
] ++ lib.optionals config.frogeye.extra [
vim-LanguageTool # Check grammar for human languages
] ++ lib.optionals config.programs.pandoc.enable [
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
vim-pandoc-syntax
] ++ lib.optionals config.frogeye.dev.ansible [
ansible-vim # TODO Doesn't have snippets
ansible-vim
# Doesn't generate snippets, but those are for UltiSnip anyways
];
extraConfigLua = builtins.readFile ./symbols-outline-nvim.lua;
extraConfigVim = ''
" GENERAL
" Avoid showing message extra message when using completion
set shortmess+=c
command Reload source $MYVIMRC
" PLUGINS
" vim-gutentags
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
'' + lib.optionalString config.frogeye.extra ''
" languagetool
let g:languagetool_cmd = "${pkgs.languagetool}/bin/languagetool-commandline"
" TODO Doesn't work
'' + lib.optionalString config.programs.pandoc.enable ''
" vim-pandox
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0
'';
autoCmd = [
# vim-easy-align: Align Markdown tables
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
];
userCommands = {
# Reload = { command = "source $MYVIRMC"; };
# TODO Is not working, options is set to nil even though it shouldn't
Reload = { command = "source ${config.xdg.configHome}/nvim/init.lua"; force = false; };
# 24.05 force=false was for https://github.com/nix-community/nixvim/issues/954
};
keymaps = [
@ -175,9 +127,6 @@
# PLUGINS
# symbols-outline-nvim
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
# undotree
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
@ -189,6 +138,7 @@
./code.nix
./completion.nix
./decoration.nix
./git.nix
./lsp.nix
];
}

View file

@ -1,165 +0,0 @@
vim.cmd([[
set noshowmode
set laststatus=2
]])
local base16_colors = require('base16-colorscheme').colors
local vi_mode_utils = require('feline.providers.vi_mode')
local lsp = require('feline.providers.lsp')
require('feline').setup({
default_bg = 'base01',
default_fg = 'base04',
theme = {
base00 = base16_colors.base00,
base01 = base16_colors.base01,
base02 = base16_colors.base02,
base03 = base16_colors.base03,
base04 = base16_colors.base04,
base05 = base16_colors.base05,
base06 = base16_colors.base06,
base07 = base16_colors.base07,
base08 = base16_colors.base08,
base09 = base16_colors.base09,
base0A = base16_colors.base0A,
base0B = base16_colors.base0B,
base0C = base16_colors.base0C,
base0D = base16_colors.base0D,
base0E = base16_colors.base0E,
base0F = base16_colors.base0F,
},
components = {
active = {
{
{
provider = function() return string.format(' %d ', vim.fn.line('$')) end,
-- If you can, make it depend on the actual bar size
left_sep = {
{str = 'block', fg = 'base05'}
},
hl = {
fg = 'base01',
bg = 'base04',
},
},
{
provider = 'vi_mode',
hl = function()
return {
name = vi_mode_utils.get_mode_highlight_name(),
bg = vi_mode_utils.get_mode_color(),
fg = 'white',
style = 'bold',
}
end,
left_sep = {''},
right_sep = {''},
},
{
provider='',
hl = function()
return {
bg = vi_mode_utils.get_mode_color(),
fg = (vim.bo.modified and 'base09') or 'base0D',
}
end,
},
{
provider = 'file_info',
type = 'relative',
hl = function()
return {
fg = 'base06',
bg = (vim.bo.modified and 'base09') or 'base0D',
style = 'bold',
}
end,
left_sep = {''},
right_sep = {''},
},
{
provider='',
hl = function()
return {
bg = 'base02',
fg = (vim.bo.modified and 'base09') or 'base0D',
}
end,
},
{
provider = 'position',
hl = { fg = 'base05', bg = 'base02' },
right_sep = {''},
},
-- If it miraculously became easy to do, add LSP position here
{
provider='',
hl = { bg = 'base01', fg = 'base02' },
},
},
{
{
provider='',
hl = { bg = 'base03', fg = 'base01', },
},
{
provider='z',
enabled = function() return next(vim.lsp.buf_get_clients()) == nil end,
hl = { bg = 'base03', fg = 'base01', },
left_sep = '',
},
{
provider = 'diagnostic_errors',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end,
hl = { fg = 'red', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_warnings',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end,
hl = { fg = 'yellow', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_hints',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end,
hl = { fg = 'cyan', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_info',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end,
hl = { fg = 'skyblue', bg = 'base03', },
left_sep = '',
},
{
provider='█',
hl = { bg = 'base02', fg = 'base03', },
},
{
provider = 'git_diff_added',
hl = { fg = 'green', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_diff_changed',
hl = { fg = 'orange', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_diff_removed',
hl = { fg = 'red', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_branch',
hl = { fg = 'base05', bg = 'base02', style = 'bold', },
right_sep = '',
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
}
},
}
})

31
hm/vim/git.nix Normal file
View file

@ -0,0 +1,31 @@
{ pkgs, lib, config, ... }:
{
config = {
programs.nixvim = {
keymaps = [
{
mode = [ "n" ];
key = "gG";
action = ''<cmd>lua require"gitlinker".get_buf_range_url("n")<cr>'';
}
{
mode = [ "v" ];
key = "gG";
action = ''<cmd>lua require"gitlinker".get_buf_range_url("v")<cr>'';
}
];
plugins = {
fugitive.enable = true; # Git basics
gitsigns.enable = true; # Show changed lines in the gutter
gitlinker = {
enable = true; # Copy URL of forge corresponding to cursor
callbacks = {
"code.techinc.nl" = "get_gitea_type_url";
"git.frogeye.fr" = "get_gitea_type_url";
};
mappings = null; # This option doesn't work, hence manual mappings
};
};
};
};
}

View file

@ -12,25 +12,28 @@
lsp_signature-nvim # Show argument definition when typing a function
];
keymaps = [
# barbar
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
# TODO gotos don't work
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options?
{
mode = "n";
key = "<space>wl";
lua = true;
action = ''
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
'';
options.silent = true;
}
{
mode = "n";
key = "<space>f";
lua = true;
action = ''
function()
vim.lsp.buf.format { async = true }
end
'';
options.silent = true;
}
];
plugins = {
# Language Server
@ -50,17 +53,18 @@
"<C-S-k>" = "signature_help";
"<space>wa" = "add_workspace_folder";
"<space>wr" = "remove_workspace_folder";
# "<space>wl" = "list_workspace_folder";
# TODO Full thing was function() print(vim.inspect(vim.lsp.buf.list_workspace_folder())) end but not sure I'm ever really using this
# Also makes nvim crash like this, so uncommented
"<space>D" = "type_definition";
"<space>rn" = "rename";
"<space>f" = "format";
# TODO Full thing was function() vim.lsp.buf.format { async = true } end, so async while this isn't
# Maybe replace this with lsp-format?
"<space>ca" = "code_action"; # Reference has a binding for visual mode, but it doesn't work
};
};
};
telescope.keymaps = {
gr = "lsp_references";
ge = "diagnostics";
gd = "lsp_definitions";
gs = "lsp_document_symbols";
};
nvim-lightbulb = {
# Shows a lightbulb whenever a codeAction is available under the cursor
enable = true;

View file

@ -1,19 +0,0 @@
vim.g.symbols_outline = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = true,
position = 'right',
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
keymaps = {
close = "<Esc>",
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
rename_symbol = "r",
code_actions = "a",
},
lsp_blacklist = {},
}
-- TODO Should be hierarchical, doesn't seem to be :/

View file

@ -40,6 +40,7 @@
node = lib.mkEnableOption "NodeJS dev stuff";
perl = lib.mkEnableOption "Perl dev stuff";
php = lib.mkEnableOption "PHP dev stuff";
prose = lib.mkEnableOption "Writing stuff";
python = lib.mkEnableOption "Python dev stuff";
};
};
@ -47,7 +48,7 @@
config = {
frogeye = {
dev = {
ansible = lib.mkDefault true;
prose = lib.mkDefault true;
python = lib.mkDefault true;
};
};

View file

@ -2,6 +2,7 @@
{
imports = [
../options.nix
../common/frogarized
./battery.nix
./ccc
./common.nix
@ -9,6 +10,7 @@
./gaming
./geoffrey.nix
./printing
./style
./wireless.nix
];
}

View file

@ -41,5 +41,8 @@
pulseaudio.enable = true;
# TODO Try pipewire
};
# So we can use gnome3 pinentry flavour
services.dbus.packages = [ pkgs.gcr ];
};
}

View file

@ -19,7 +19,9 @@
home-manager = {
users.geoffrey = { pkgs, ... }: {
frogeye = config.frogeye;
frogeye = lib.mkDefault config.frogeye;
# Propagating options that way doesn't seem to conserve priority info,
# this is not great. Hopefully mkDefault resolve conflicts.
};
# Makes VMs able to re-run
useUserPackages = true;

25
os/style/bg.svg Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1" height="1" enable-background="new" version="1.1" viewBox="0 0 1 1" xml:space="preserve">
<defs>
<linearGradient id="a" x1="559.8" x2="559.8" y1=".0125" y2="834.89" gradientTransform="matrix(.002 0 0 .002 -2962.3 128.19)" gradientUnits="userSpaceOnUse">
<stop stop-color="#CCE474" offset="0"/>
<stop stop-color="#CBE372" offset=".21961"/>
<stop stop-color="#C8E26B" offset=".29804"/>
<stop stop-color="#C3DE60" offset=".35686"/>
<stop stop-color="#BBD94F" offset=".4"/>
<stop stop-color="#B1D339" offset=".43922"/>
<stop stop-color="#A4CB1E" offset=".47451"/>
<stop stop-color="#99C405" offset=".49804"/>
<stop stop-color="#A2CC18" offset=".54118"/>
<stop stop-color="#AAD329" offset=".59216"/>
<stop stop-color="#B0D834" offset=".6549"/>
<stop stop-color="#B3DB3B" offset=".74902"/>
<stop stop-color="#B4DC3D" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(559.29 -691.3)">
<g transform="matrix(.44657 0 0 .59891 763.59 614.53)">
<path d="m-2960.1 129.86v-1.6697h-2.2393v1.6697z" fill="url(#a)"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

19
os/style/default.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, lib, config, ... }:
{
config = {
boot = {
plymouth.enable = true;
initrd.systemd.enable = true;
};
stylix = {
homeManagerIntegration.autoImport = false; # Makes config reuse easier
polarity = "dark";
targets.plymouth.logo = pkgs.runCommand "flower.png" { } "${pkgs.inkscape}/bin/inkscape ${pkgs.substituteAll {
src = ./flower.svg;
color = config.lib.stylix.colors.withHashtag.base07;
}} -w 256 -o $out";
# UPST Default grub font is sansSerif, which doesn't work.
# Maybe because people patch mono with nerdfonts and that isn't compatible?
};
};
}

8
os/style/flower.svg Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="32.638" height="33.067" enable-background="new" version="1.1" viewBox="0 0 32.638 33.067" xml:space="preserve">
<g transform="translate(587.12 -740.77)">
<g transform="matrix(.57741 0 0 -.57741 -575.42 770.38)" fill="@color@">
<path d="m0 0c-0.977-2.42-2.724-3.975-5.139-3.018-2.419 0.957-3.087 3.466-2.009 7.53 2.051 6.483 8.06 10.28 14.171 15.72 2.007-7.532 4.018-15.062 1.968-21.548-0.205-3.289-3.595-4.748-5.24-4.662-2.415 0.957-3.187 1.824-3.751 5.978m-15.43 17.332c-3.287 0.177-4.829 1.911-4.729 3.555-0.669 2.508 1.951 4.84 4.466 5.531 6.68 1.284 13.925-1.586 21.172-4.454-6.111-5.439-11.448-11.744-17.254-12.254-3.389-1.463-6.577 0.359-7.25 2.872-0.668 2.506 0.204 3.284 3.595 4.75m8.001 22.651c-1.44 3.377-2.109 5.888-0.364 7.443 1.749 1.551 4.934-0.271 7.246-2.87 3.858-4.332 5.868-11.865 7.002-20.171-8.118 2.091-16.238 4.184-20.096 8.515-2.313 2.601-2.882 6.753-1.135 8.307 1.746 1.555 4.161 0.598 7.347-1.224m23.428 5.321c0.976 2.422 2.724 3.973 5.137 3.018 2.412-0.956 3.084-3.466 2.01-7.53-2.052-6.485-8.063-10.28-14.172-15.721-2.011 7.531-4.019 15.064-1.968 21.547 0.205 3.289 3.591 4.75 5.236 4.664 2.415-0.96 3.19-1.825 3.757-5.978m15.427-17.333c3.284-0.177 4.831-1.909 4.729-3.554 0.667-2.509-1.95-4.841-4.466-5.529-6.68-1.285-13.927 1.583-21.173 4.453 6.111 5.438 11.45 11.744 17.257 12.253 3.389 1.463 6.574-0.36 7.245-2.87 0.67-2.509-0.204-3.287-3.592-4.753m-8.002-22.651c1.439-3.378 2.113-5.885 0.368-7.442-1.747-1.552-4.935 0.27-7.251 2.87-3.857 4.332-5.865 11.864-6.999 20.173 8.117-2.094 16.237-4.185 20.095-8.518 2.313-2.599 2.883-6.754 1.136-8.309-1.746-1.554-4.161-0.595-7.349 1.226" fill="@color@" fill-rule="evenodd"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB