Compare commits
24 commits
5148b5872b
...
abadfa7dad
| Author | SHA1 | Date | |
|---|---|---|---|
| abadfa7dad | |||
| 77f9d5965b | |||
| fa1b1f8586 | |||
| a813ca634c | |||
| 73f43a390f | |||
| 2f8221f7a8 | |||
| 5825b26067 | |||
| 7df6bb5c36 | |||
| bfebe310ab | |||
| bfa5bba8b1 | |||
| 226de511ae | |||
| 8b83b5be5e | |||
| c0f398e868 | |||
| 46b52cda53 | |||
| b33d79d6a3 | |||
| 0bedd5ce71 | |||
| 39d393e7c9 | |||
| ad51d9fd4c | |||
| 49f938f432 | |||
| 641ef5f9c8 | |||
| bfd058da36 | |||
| f3f0cb6a34 | |||
| 635fddc338 | |||
| 96a76f8c7f |
27 changed files with 340 additions and 101 deletions
|
|
@ -15,6 +15,10 @@
|
|||
enable = true;
|
||||
};
|
||||
|
||||
nixf-diagnose = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
package = pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
jujutsu = {
|
||||
package = pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
tmux = {
|
||||
# I use scripts that use the passthrough sequence often on this host
|
||||
enablePassthrough = true;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
package = pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
jujutsu = {
|
||||
package = pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
tmux = {
|
||||
# I use scripts that use the passthrough sequence often on this host
|
||||
enablePassthrough = true;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
cfg.package
|
||||
];
|
||||
programs.calibre = {
|
||||
enable = true;
|
||||
|
||||
inherit (cfg) package;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
./gtk
|
||||
./htop
|
||||
./jq
|
||||
./jujutsu
|
||||
./keyboard
|
||||
./mail
|
||||
./mpv
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ in
|
|||
git = {
|
||||
enable = my.mkDisableOption "git integration";
|
||||
};
|
||||
|
||||
jujutsu = {
|
||||
enable = my.mkDisableOption "jujutsu integration";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
|
@ -20,6 +24,9 @@ in
|
|||
inherit (cfg) package;
|
||||
|
||||
enableGitIntegration = cfg.git.enable;
|
||||
# `jj log -p` does not use `delta`
|
||||
# https://github.com/jj-vcs/jj/issues/4142
|
||||
enableJujutsuIntegration = cfg.jujutsu.enable;
|
||||
|
||||
options = {
|
||||
features = "diff-highlight decorations";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ in
|
|||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
home.packages = [
|
||||
cfg.package
|
||||
];
|
||||
|
||||
|
|
|
|||
141
modules/home/jujutsu/default.nix
Normal file
141
modules/home/jujutsu/default.nix
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.jujutsu;
|
||||
|
||||
inherit (lib.my) mkMailAddress;
|
||||
in
|
||||
{
|
||||
options.my.home.jujutsu = with lib; {
|
||||
enable = my.mkDisableOption "jujutsu configuration";
|
||||
|
||||
package = mkPackageOption pkgs "jujutsu" { };
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
# For `jj git` commands
|
||||
assertion = cfg.enable -> config.my.home.git.enable;
|
||||
message = ''
|
||||
`config.my.home.jujutsu` relies on `config.my.home.git` being enabled.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
|
||||
inherit (cfg) package;
|
||||
|
||||
settings = {
|
||||
# Who am I?
|
||||
user = {
|
||||
name = "Bruno BELANYI";
|
||||
email = mkMailAddress "bruno" "belanyi.fr";
|
||||
};
|
||||
|
||||
aliases = {
|
||||
jj = [ ];
|
||||
# FIXME:
|
||||
# * still not a big fan of the template
|
||||
lol = [ "log" "-r" "..@" "-T" "builtin_log_oneline" ];
|
||||
lola = [ "lol" "-r" "all()" ];
|
||||
# FIXME: equivalent to `git switch -`
|
||||
# See https://github.com/jj-vcs/jj/issues/2871
|
||||
# Might be broken recently https://discord.com/channels/968932220549103686/1380272574709366989/1380432041983606855
|
||||
# TODO:
|
||||
# * `pick` (https://github.com/jj-vcs/jj/issues/5446): [ "util" "exec" "--" "bash" "-c" "jj log -p -r \"diff_contains($1)\"" "" ]
|
||||
# * `root`: `jj workspace root` (barely necessary then)
|
||||
};
|
||||
|
||||
ui = {
|
||||
# Stop nagging me about it, though I am not a fan of its UI.
|
||||
diff-editor = ":builtin";
|
||||
# I don't like word-diff
|
||||
diff-formatter = ":git";
|
||||
# Stop nagging me about it, though I am not a fan of its UI.
|
||||
merge-editor = ":builtin";
|
||||
# Does not honor `$PAGER` (anymore)
|
||||
pager = lib.mkDefault config.home.sessionVariables.PAGER;
|
||||
};
|
||||
|
||||
# FIXME: git equivalents
|
||||
# I'd like a better formatted blame (more like delta's?)
|
||||
# blame = {
|
||||
# coloring = "repeatedLines";
|
||||
# markIgnoredLines = true;
|
||||
# markUnblamables = true;
|
||||
# };
|
||||
# FIXME: log colors should probably match git
|
||||
# FIXME: patience diff?
|
||||
# FIXME: fetch prune/pruneTags?
|
||||
# FIXME: pull.rebase=true? Probably true TBH
|
||||
# FIXME: push.default=simple? Probably true TBH
|
||||
# FIXME: conflict style? ui.conflict-marker-style=git is diff3, not zdiff3. Default looks fine-ish
|
||||
|
||||
# FIXME: from ma_9's config, plus my own stuff
|
||||
# snapshot = {
|
||||
# auto-track = "none()";
|
||||
# };
|
||||
#
|
||||
# ui = {
|
||||
# movement = {
|
||||
# edit = false;
|
||||
# };
|
||||
# };
|
||||
|
||||
templates = {
|
||||
# Equivalent to `commit.verbose = true` in Git
|
||||
draft_commit_description = "commit_description_verbose(self)";
|
||||
};
|
||||
|
||||
template-aliases = {
|
||||
"commit_description_verbose(commit)" = ''
|
||||
concat(
|
||||
commit_description(commit),
|
||||
"JJ: ignore-rest\n",
|
||||
diff.git(),
|
||||
)
|
||||
'';
|
||||
# FIXME: use `diff.summary()` instead? Supported by syntax highlighting
|
||||
# See https://github.com/jj-vcs/jj/issues/1946#issuecomment-2572986485
|
||||
# FIXME: tree-sitter grammar isn't in `nvim-treesitter` (https://github.com/kareigu/tree-sitter-jjdescription)
|
||||
"commit_description(commit)" = ''
|
||||
concat(
|
||||
commit.description(), "\n",
|
||||
"JJ: This commit contains the following changes:\n",
|
||||
indent("JJ: ", diff.stat(72)),
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
"--scope" = [
|
||||
# Multiple identities
|
||||
{
|
||||
"--when" = {
|
||||
repositories = [ "~/git/EPITA/" ];
|
||||
};
|
||||
user = {
|
||||
name = "Bruno BELANYI";
|
||||
email = mkMailAddress "bruno.belanyi" "epita.fr";
|
||||
};
|
||||
}
|
||||
{
|
||||
"--when" = {
|
||||
repositories = [ "~/git/work/" ];
|
||||
};
|
||||
user = {
|
||||
name = "Bruno BELANYI";
|
||||
email = mkMailAddress "ambroisie" "google.com";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# To drop in a `local.toml` configuration, not-versioned
|
||||
xdg.configFile = {
|
||||
"jj/conf.d/.keep".text = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ let
|
|||
lib.mkDefault [ (lib.getExe pkgs.ambroisie.rbw-pass) "Mail" passName ];
|
||||
|
||||
address = mkMailAddress address domain;
|
||||
aliases = builtins.map (lib.flip mkMailAddress domain) aliases;
|
||||
aliases = map (lib.flip mkMailAddress domain) aliases;
|
||||
|
||||
inherit primary;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
home.packages = [
|
||||
cfg.package
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ in
|
|||
nvim-lspconfig # Easy LSP configuration
|
||||
lsp-format-nvim # Simplified formatting configuration
|
||||
none-ls-nvim # LSP integration for linters and formatters
|
||||
nvim-treesitter-legacy.withAllGrammars # Better highlighting
|
||||
nvim-treesitter-textobjects-legacy # More textobjects
|
||||
nvim-treesitter.withAllGrammars # Better highlighting
|
||||
nvim-treesitter-textobjects # More textobjects
|
||||
plenary-nvim # 'null-ls', 'telescope' dependency
|
||||
|
||||
# Completion
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ gitsigns.setup({
|
|||
})
|
||||
|
||||
local keys = {
|
||||
-- Navigation
|
||||
{ "[c", utils.partial(nav_hunk, "prev"), desc = "Previous hunk/diff" },
|
||||
{ "]c", utils.partial(nav_hunk, "next"), desc = "Next hunk/diff" },
|
||||
-- Commands
|
||||
{ "<leader>g", group = "Git" },
|
||||
{ "<leader>gb", gitsigns.toggle_current_line_blame, desc = "Toggle blame virtual text" },
|
||||
{ "<leader>gd", gitsigns.diffthis, desc = "Diff buffer" },
|
||||
|
|
@ -55,6 +51,12 @@ local keys = {
|
|||
{ "<leader>g]", utils.partial(gitsigns.nav_hunk, "next"), desc = "Next hunk" },
|
||||
}
|
||||
|
||||
local moves = {
|
||||
mode = { "n", "x", "o" },
|
||||
{ "[c", utils.partial(nav_hunk, "prev"), desc = "Previous hunk/diff" },
|
||||
{ "]c", utils.partial(nav_hunk, "next"), desc = "Next hunk/diff" },
|
||||
}
|
||||
|
||||
local objects = {
|
||||
mode = "o",
|
||||
{ "ih", gitsigns.select_hunk, desc = "git hunk" },
|
||||
|
|
@ -71,5 +73,6 @@ local visual = {
|
|||
}
|
||||
|
||||
wk.add(keys)
|
||||
wk.add(moves)
|
||||
wk.add(objects)
|
||||
wk.add(visual)
|
||||
|
|
|
|||
|
|
@ -1,54 +1,95 @@
|
|||
local ts_config = require("nvim-treesitter.configs")
|
||||
local treesitter = require("nvim-treesitter")
|
||||
local ts_select = require("nvim-treesitter-textobjects.select")
|
||||
local ts_move = require("nvim-treesitter-textobjects.move")
|
||||
local utils = require("ambroisie.utils")
|
||||
local wk = require("which-key")
|
||||
|
||||
ts_config.setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Avoid duplicate highlighting
|
||||
additional_vim_regex_highlighting = false,
|
||||
local function select_textobject(query)
|
||||
return utils.partial(ts_select.select_textobject, query)
|
||||
end
|
||||
|
||||
local function goto_next_start(query)
|
||||
return utils.partial(ts_move.goto_next_start, query)
|
||||
end
|
||||
local function goto_next_end(query)
|
||||
return utils.partial(ts_move.goto_next_end, query)
|
||||
end
|
||||
local function goto_previous_start(query)
|
||||
return utils.partial(ts_move.goto_previous_start, query)
|
||||
end
|
||||
local function goto_previous_end(query)
|
||||
return utils.partial(ts_move.goto_previous_end, query)
|
||||
end
|
||||
|
||||
local objects = {
|
||||
mode = { "x", "o" },
|
||||
{ "aa", select_textobject("@parameter.outer"), desc = "a parameter" },
|
||||
{ "ia", select_textobject("@parameter.inner"), desc = "inner parameter" },
|
||||
{ "ab", select_textobject("@block.outer"), desc = "a block" },
|
||||
{ "ib", select_textobject("@block.inner"), desc = "inner block" },
|
||||
{ "ac", select_textobject("@class.outer"), desc = "a class" },
|
||||
{ "ic", select_textobject("@class.inner"), desc = "inner class" },
|
||||
{ "af", select_textobject("@function.outer"), desc = "a function" },
|
||||
{ "if", select_textobject("@function.inner"), desc = "inner function" },
|
||||
{ "ak", select_textobject("@comment.outer"), desc = "a comment" },
|
||||
{ "aS", select_textobject("@statement.outer"), desc = "a statement" },
|
||||
}
|
||||
local moves = {
|
||||
mode = { "n", "x", "o" },
|
||||
-- Next start
|
||||
{ "]m", goto_next_start("@function.outer"), desc = "Next method start" },
|
||||
{ "]S", goto_next_start("@statement.outer"), desc = "Next statement start" },
|
||||
{ "]]", goto_next_start("@class.outer"), desc = "Next class start" },
|
||||
-- Next end
|
||||
{ "]M", goto_next_end("@function.outer"), desc = "Next method end" },
|
||||
{ "][", goto_next_end("@class.outer"), desc = "Next class end" },
|
||||
-- Previous start
|
||||
{ "[m", goto_previous_start("@function.outer"), desc = "Previous method start" },
|
||||
{ "[S", goto_previous_start("@statement.outer"), desc = "Previous statement start" },
|
||||
{ "[[", goto_previous_start("@class.outer"), desc = "Previous class start" },
|
||||
-- Previous end
|
||||
{ "[M", goto_previous_end("@function.outer"), desc = "Previous method end" },
|
||||
{ "[]", goto_previous_end("@class.outer"), desc = "Previous class end" },
|
||||
}
|
||||
wk.add(objects)
|
||||
wk.add(moves)
|
||||
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
-- Jump to matching text objects
|
||||
lookahead = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
-- Jump to matching text objects
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["aa"] = { query = "@parameter.outer", desc = "a parameter" },
|
||||
["ia"] = { query = "@parameter.inner", desc = "inner parameter" },
|
||||
["ab"] = { query = "@block.outer", desc = "a block" },
|
||||
["ib"] = { query = "@block.inner", desc = "inner block" },
|
||||
["ac"] = { query = "@class.outer", desc = "a class" },
|
||||
["ic"] = { query = "@class.inner", desc = "inner class" },
|
||||
["af"] = { query = "@function.outer", desc = "a function" },
|
||||
["if"] = { query = "@function.inner", desc = "inner function" },
|
||||
["ak"] = { query = "@comment.outer", desc = "a comment" },
|
||||
["aS"] = { query = "@statement.outer", desc = "a statement" },
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
-- Add to jump list
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]m"] = { query = "@function.outer", desc = "Next method start" },
|
||||
["]S"] = { query = "@statement.outer", desc = "Next statement start" },
|
||||
["]]"] = { query = "@class.outer", desc = "Next class start" },
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = { query = "@function.outer", desc = "Next method end" },
|
||||
["]["] = { query = "@class.outer", desc = "Next class end" },
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = { query = "@function.outer", desc = "Previous method start" },
|
||||
["[S"] = { query = "@statement.outer", desc = "Previous statement start" },
|
||||
["[["] = { query = "@class.outer", desc = "Previous class start" },
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = { query = "@function.outer", desc = "Previous method end" },
|
||||
["[]"] = { query = "@class.outer", desc = "Previous class end" },
|
||||
},
|
||||
},
|
||||
move = {
|
||||
-- Add to jump list
|
||||
set_jumps = true,
|
||||
},
|
||||
})
|
||||
|
||||
-- Automatically setup treesitter for supported filetypes
|
||||
local function treesitter_try_attach(buf, language)
|
||||
-- Try to load language
|
||||
-- NOTE: the best way I found to check if a filetype has a grammar
|
||||
if not vim.treesitter.language.add(language) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Syntax highlighting
|
||||
vim.treesitter.start(buf, language)
|
||||
-- Indentation
|
||||
vim.bo.indentexpr = "v:lua.require('nvim-treesitter').indentexpr()"
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
group = vim.api.nvim_create_augroup("treesitter_attach", { clear = true }),
|
||||
callback = function(args)
|
||||
local buf, filetype = args.buf, args.match
|
||||
local language = vim.treesitter.language.get_lang(filetype)
|
||||
if not language then
|
||||
return
|
||||
end
|
||||
treesitter_try_attach(buf, language)
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ in
|
|||
inactive_state = "Idle";
|
||||
};
|
||||
in
|
||||
builtins.map (block: defaults // block) cfg.vpn.blockConfigs
|
||||
map (block: defaults // block) cfg.vpn.blockConfigs
|
||||
)
|
||||
)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ in
|
|||
enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = builtins.map lib.hiPrio [
|
||||
environment.systemPackages = map lib.hiPrio [
|
||||
# Respect XDG conventions, leave my HOME alone
|
||||
(pkgs.writeShellScriptBin "steam" ''
|
||||
mkdir -p "${cfg.dataDir}"
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ in
|
|||
# Contains the UID/GID map, and other useful state
|
||||
"/var/lib/nixos"
|
||||
# SSH host keys (and public keys for convenience)
|
||||
(builtins.map (key: [ key.path "${key.path}.pub" ]) config.services.openssh.hostKeys)
|
||||
(map (key: [ key.path "${key.path}.pub" ]) config.services.openssh.hostKeys)
|
||||
];
|
||||
|
||||
services.restic.backups.backblaze = {
|
||||
|
|
|
|||
|
|
@ -188,14 +188,14 @@ in
|
|||
++ (lib.flip lib.mapAttrsToList cfg.virtualHosts (_: { subdomain, ... } @ args:
|
||||
let
|
||||
conflicts = [ "port" "root" "socket" "redirect" ];
|
||||
optionsNotNull = builtins.map (v: args.${v} != null) conflicts;
|
||||
optionsNotNull = map (v: args.${v} != null) conflicts;
|
||||
optionsSet = lib.filter lib.id optionsNotNull;
|
||||
in
|
||||
{
|
||||
assertion = builtins.length optionsSet == 1;
|
||||
message = ''
|
||||
Subdomain '${subdomain}' must have exactly one of ${
|
||||
lib.concatStringsSep ", " (builtins.map (v: "'${v}'") conflicts)
|
||||
lib.concatStringsSep ", " (map (v: "'${v}'") conflicts)
|
||||
} configured.
|
||||
'';
|
||||
}))
|
||||
|
|
@ -208,7 +208,7 @@ in
|
|||
assertion = args.websocketsLocations != [ ] -> proxyPassUsed;
|
||||
message = ''
|
||||
Subdomain '${subdomain}' can only use 'websocketsLocations' with one of ${
|
||||
lib.concatStringsSep ", " (builtins.map (v: "'${v}'") proxyPass)
|
||||
lib.concatStringsSep ", " (map (v: "'${v}'") proxyPass)
|
||||
}.
|
||||
'';
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options.my.services.servarr.bazarr = with lib; {
|
||||
enable = lib.mkEnableOption "Bazarr" // {
|
||||
enable = mkEnableOption "Bazarr" // {
|
||||
default = config.my.services.servarr.enableAll;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options.my.services.servarr.jackett = with lib; {
|
||||
enable = lib.mkEnableOption "Jackett" // {
|
||||
enable = mkEnableOption "Jackett" // {
|
||||
default = config.my.services.servarr.enableAll;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options.my.services.servarr.nzbhydra = with lib; {
|
||||
enable = lib.mkEnableOption "NZBHydra2" // {
|
||||
enable = mkEnableOption "NZBHydra2" // {
|
||||
default = config.my.services.servarr.enableAll;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ let
|
|||
in
|
||||
{
|
||||
options.my.services.servarr.prowlarr = with lib; {
|
||||
enable = lib.mkEnableOption "Prowlarr" // {
|
||||
enable = mkEnableOption "Prowlarr" // {
|
||||
default = config.my.services.servarr.enableAll;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ let
|
|||
in
|
||||
{
|
||||
options.my.services.servarr.${starr} = with lib; {
|
||||
enable = lib.mkEnableOption (lib.toSentenceCase starr) // {
|
||||
enable = mkEnableOption (lib.toSentenceCase starr) // {
|
||||
default = config.my.services.servarr.enableAll;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Automatically import all overlays in the directory
|
||||
let
|
||||
files = builtins.readDir ./.;
|
||||
overlays = builtins.removeAttrs files [ "default.nix" ];
|
||||
overlays = removeAttrs files [ "default.nix" ];
|
||||
in
|
||||
builtins.mapAttrs (name: _: import "${./.}/${name}") overlays
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
final: prev:
|
||||
let
|
||||
inherit (final) lib;
|
||||
overrides = final: prev:
|
||||
let
|
||||
hasLegacyPackage = prev ? nvim-treesitter-legacy;
|
||||
in
|
||||
{
|
||||
nvim-treesitter-textobjects-legacy = prev.nvim-treesitter-textobjects.overrideAttrs {
|
||||
dependencies = [ final.nvim-treesitter-legacy ];
|
||||
};
|
||||
} // (lib.optionalAttrs (!hasLegacyPackage) {
|
||||
nvim-treesitter-legacy = final.nvim-treesitter;
|
||||
});
|
||||
in
|
||||
{
|
||||
vimPlugins = prev.vimPlugins.extend (overrides);
|
||||
}
|
||||
|
|
@ -24,11 +24,15 @@ current_system() {
|
|||
nix eval --raw --impure --expr 'builtins.currentSystem'
|
||||
}
|
||||
|
||||
add_darwin() {
|
||||
FLAKE_OUTPUTS+=("darwinConfigurations.\"$1\".config.system.build.toplevel")
|
||||
}
|
||||
|
||||
add_home() {
|
||||
FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage")
|
||||
}
|
||||
|
||||
add_host() {
|
||||
add_nixos() {
|
||||
FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel")
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +41,10 @@ add_shell() {
|
|||
FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation")
|
||||
}
|
||||
|
||||
add_system() {
|
||||
FLAKE_OUTPUTS+=("systemConfigs.\"$1\".config.system.build.toplevel")
|
||||
}
|
||||
|
||||
usage() {
|
||||
print_err "Usage: $0 [option]... [-- [nix build option]...]"
|
||||
print_err ""
|
||||
|
|
@ -54,11 +62,15 @@ usage() {
|
|||
print_err " -p, --previous-rev"
|
||||
print_err " which git revision should be considered the 'previous' state,"
|
||||
print_err " defaults to HEAD~"
|
||||
print_err " --darwin [name]"
|
||||
print_err " specify the name of a nix-darwin output configuration whose"
|
||||
print_err " closure should be diffed, can be used multiple times"
|
||||
print_err " if no host name is given, defaults to current hostname"
|
||||
print_err " --home [name]"
|
||||
print_err " specify the name of a home-manager output configuration whose"
|
||||
print_err " closure should be diffed, can be used multiple times"
|
||||
print_err " if no configuration name is given, defaults to current username"
|
||||
print_err " --host [name]"
|
||||
print_err " --nixos [name]"
|
||||
print_err " specify the name of a NixOS output configuration whose"
|
||||
print_err " closure should be diffed, can be used multiple times"
|
||||
print_err " if no host name is given, defaults to current hostname"
|
||||
|
|
@ -66,6 +78,10 @@ usage() {
|
|||
print_err " specify a specific devShell configuration name whose closure"
|
||||
print_err " should be diffed, can be used multiple times"
|
||||
print_err " if no name is given, defaults to 'default'"
|
||||
print_err " --system [name]"
|
||||
print_err " specify the name of a system-manager output configuration whose"
|
||||
print_err " closure should be diffed, can be used multiple times"
|
||||
print_err " if no host name is given, defaults to current hostname"
|
||||
print_err ""
|
||||
print_err "when no flake outputs are specified, automatically queries for"
|
||||
print_err "all NixOS configurations, and devShells for current system"
|
||||
|
|
@ -101,6 +117,14 @@ parse_args() {
|
|||
PREVIOUS_REV="$(git rev-parse "$1")"
|
||||
shift
|
||||
;;
|
||||
--darwin)
|
||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||
add_darwin "$1"
|
||||
shift
|
||||
else
|
||||
add_darwin "$(hostname)"
|
||||
fi
|
||||
;;
|
||||
--home)
|
||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||
add_home "$1"
|
||||
|
|
@ -109,12 +133,12 @@ parse_args() {
|
|||
add_home "$USER"
|
||||
fi
|
||||
;;
|
||||
--host)
|
||||
--nixos)
|
||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||
add_host "$1"
|
||||
add_nixos "$1"
|
||||
shift
|
||||
else
|
||||
add_host "$(hostname)"
|
||||
add_nixos "$(hostname)"
|
||||
fi
|
||||
;;
|
||||
--shell)
|
||||
|
|
@ -125,6 +149,14 @@ parse_args() {
|
|||
add_shell "default"
|
||||
fi
|
||||
;;
|
||||
--system)
|
||||
if [ $# -gt 0 ] && ! is_option "$1"; then
|
||||
add_system "$1"
|
||||
shift
|
||||
else
|
||||
add_system "$(hostname)"
|
||||
fi
|
||||
;;
|
||||
--)
|
||||
NIX_BUILD_ARGS=("$@")
|
||||
break
|
||||
|
|
@ -138,6 +170,12 @@ parse_args() {
|
|||
done
|
||||
}
|
||||
|
||||
list_darwin_configurations() {
|
||||
nix eval '.#darwinConfigurations' \
|
||||
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||
--raw
|
||||
}
|
||||
|
||||
list_home_configurations() {
|
||||
nix eval '.#homeConfigurations' \
|
||||
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||
|
|
@ -156,6 +194,12 @@ list_dev_shells() {
|
|||
--raw
|
||||
}
|
||||
|
||||
list_system_configurations() {
|
||||
nix eval '.#systemConfigs' \
|
||||
--apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \
|
||||
--raw
|
||||
}
|
||||
|
||||
diff_output() {
|
||||
local PREV NEW
|
||||
PREV="$(mktemp --dry-run)"
|
||||
|
|
@ -175,15 +219,21 @@ diff_output() {
|
|||
parse_args "$@"
|
||||
|
||||
if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then
|
||||
for darwin in $(list_darwin_configurations); do
|
||||
add_darwin "$darwin"
|
||||
done
|
||||
for home in $(list_home_configurations); do
|
||||
add_home "$home"
|
||||
done
|
||||
for host in $(list_nixos_configurations); do
|
||||
add_host "$host"
|
||||
for nixos in $(list_nixos_configurations); do
|
||||
add_nixos "$nixos"
|
||||
done
|
||||
for shell in $(list_dev_shells); do
|
||||
add_shell "$shell"
|
||||
done
|
||||
for system in $(list_system_configurations); do
|
||||
add_system "$system"
|
||||
done
|
||||
fi
|
||||
|
||||
for out in "${FLAKE_OUTPUTS[@]}"; do
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
self.packages.${system}.project
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
packages = [
|
||||
self.checks.${system}.pre-commit.enabledPackages
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
self.packages.${system}.project
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
packages = [
|
||||
self.checks.${system}.pre-commit.enabledPackages
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue