Merge remote-tracking branch 'refs/remotes/origin/nixos' into nixos
This commit is contained in:
commit
ac9b136e6c
14 changed files with 270 additions and 128 deletions
71
flake.lock
71
flake.lock
|
@ -715,6 +715,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1705332318,
|
||||
"narHash": "sha256-kcw1yFeJe9N4PjQji9ZeX47jg0p9A0DuU4djKvg1a7I=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "3449dc925982ad46246cfc36469baf66e1b64f17",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -750,6 +765,27 @@
|
|||
"url": "https://git.moritzboeh.me/moritz/NixLazy.nvim"
|
||||
}
|
||||
},
|
||||
"nix-monitored": {
|
||||
"inputs": {
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1708169437,
|
||||
"narHash": "sha256-qR3UF6xf+ts/lCY2UlacKtNzZq/9jxsgsdXxiQ5gcPU=",
|
||||
"owner": "ners",
|
||||
"repo": "nix-monitored",
|
||||
"rev": "382ed0cad468cb0b5426bf0905da573efa96c218",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ners",
|
||||
"repo": "nix-monitored",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-super": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
|
@ -1013,38 +1049,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-puppeteer": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1710266483,
|
||||
"narHash": "sha256-rRsLPeLaJNvOxzwGO+LOXW8FMhHpVkjuccTZdaK3O7c=",
|
||||
"owner": "chrisgrieser",
|
||||
"repo": "nvim-puppeteer",
|
||||
"rev": "ea340595967919222f3ba5c6c6def0787a336c82",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "chrisgrieser",
|
||||
"repo": "nvim-puppeteer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1711032686,
|
||||
"narHash": "sha256-jkZ8NuCUjUqHmpr8v1g/dbPDBTO6WRWmEhEJHY9HZWM=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"rev": "722617e6726c1508adadf83d531f54987c703be0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_3",
|
||||
|
@ -1088,13 +1092,12 @@
|
|||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nix-lazy-nvim": "nix-lazy-nvim",
|
||||
"nix-monitored": "nix-monitored",
|
||||
"nix-super": "nix-super",
|
||||
"nixpkgs": "nixpkgs_7",
|
||||
"none-ls-nvim": "none-ls-nvim",
|
||||
"nur": "nur",
|
||||
"nvim-lspconfig": "nvim-lspconfig",
|
||||
"nvim-puppeteer": "nvim-puppeteer",
|
||||
"nvim-treesitter": "nvim-treesitter",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"smartcolumn-nvim": "smartcolumn-nvim",
|
||||
"stable": "stable",
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
# Programs
|
||||
nix-super.url = "github:privatevoid-net/nix-super";
|
||||
nix-monitored.url = "github:ners/nix-monitored";
|
||||
nix-monitored.inputs.nixpkgs.follows = "nixpkgs";
|
||||
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
|
||||
|
||||
# Neovim
|
||||
|
@ -31,10 +33,6 @@
|
|||
nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim";
|
||||
nvim-lspconfig.flake = false;
|
||||
nvim-lspconfig.url = "github:neovim/nvim-lspconfig";
|
||||
nvim-puppeteer.flake = false;
|
||||
nvim-puppeteer.url = "github:chrisgrieser/nvim-puppeteer";
|
||||
nvim-treesitter.flake = false;
|
||||
nvim-treesitter.url = "github:nvim-treesitter/nvim-treesitter";
|
||||
smartcolumn-nvim.flake = false;
|
||||
smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim";
|
||||
telekasten-nvim.flake = false;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
gaming.enable = true;
|
||||
personal.enable = true;
|
||||
impermanence.enable = true;
|
||||
webis.enable = true;
|
||||
};
|
||||
programs.hyprland = {
|
||||
nvidiaSupport = true;
|
||||
|
@ -26,9 +27,8 @@
|
|||
extraConfig = "exec=hyprctl keyword monitor HDMI-A-1,3840x2160@120,auto,1.2";
|
||||
keyboardLayouts = [ "us" "de" ];
|
||||
};
|
||||
programs.exercism.enable = true;
|
||||
services.wallpaper.enable = true;
|
||||
services.ollama.enable = true;
|
||||
programs.ledger.enable = true;
|
||||
};
|
||||
|
||||
home-manager.users.moritz.home.packages = with pkgs; [
|
||||
|
|
|
@ -44,7 +44,7 @@ let
|
|||
|
||||
gi = pkgs.writeFishApplication {
|
||||
name = "gi";
|
||||
runtimeInputs = with pkgs; [ fzf gum curl ];
|
||||
runtimeInputs = with pkgs; [ fzf gum curl coreutils-full ];
|
||||
text = /* fish */ ''
|
||||
set url https://www.gitignore.io/api
|
||||
|
||||
|
@ -57,10 +57,12 @@ let
|
|||
set choice (string join "," $argv[1..])
|
||||
end
|
||||
|
||||
set contents "$(curl -sL $url/$choice | head -n -2 | tail -n +4)"
|
||||
|
||||
if gum confirm "Overwrite current .gitignore?"
|
||||
curl -sL $url/$choice > .gitignore
|
||||
echo "$contents" > .gitignore
|
||||
else
|
||||
curl -sL $url/$choice >> .gitignore
|
||||
echo "$contents" >> .gitignore
|
||||
end
|
||||
'';
|
||||
completions = /* fish */ ''
|
||||
|
|
|
@ -90,6 +90,19 @@ in
|
|||
stable.texlive.combined.scheme-full # NOTE breaks often
|
||||
thunderbird
|
||||
vlc
|
||||
(symlinkJoin {
|
||||
name = "obsidian-wayland";
|
||||
paths = [ obsidian ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/obsidian \
|
||||
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
"electron-25.9.0" # obsidian
|
||||
];
|
||||
|
||||
programs.nix-ld.enable = true;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
|
@ -50,21 +49,23 @@ in
|
|||
userName = cfg.identity.name;
|
||||
userEmail = cfg.identity.email;
|
||||
extraConfig = {
|
||||
commit.verbose = true;
|
||||
diff.algorithm = "histogram";
|
||||
fetch.fsckobjects = true;
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
diff.external = getExe pkgs.difftastic;
|
||||
push.autoSetupRemote = true;
|
||||
receive.fsckObjects = true;
|
||||
transfer.fsckobjects = true;
|
||||
};
|
||||
signing = mkIf cfg.signing {
|
||||
key = "0x970C6E89EB0547A9";
|
||||
signByDefault = true;
|
||||
};
|
||||
lfs.enable = true;
|
||||
delta.enable = true;
|
||||
};
|
||||
};
|
||||
programs.git = {
|
||||
enable = true;
|
||||
config.safe.directory = "/home/moritz/.dotfiles";
|
||||
};
|
||||
programs.git.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,6 +9,23 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.nix;
|
||||
|
||||
mkSuper = system: nix:
|
||||
if cfg.useSuper
|
||||
then inputs.nix-super.packages.${system}.default
|
||||
else nix;
|
||||
|
||||
mkNom = system: nix:
|
||||
if cfg.useNom
|
||||
then
|
||||
inputs.nix-monitored.packages.${system}.default.override
|
||||
{
|
||||
withNotify = false;
|
||||
nix = nix;
|
||||
}
|
||||
else nix;
|
||||
|
||||
mkNix = system: nix: mkNom system (mkSuper system nix);
|
||||
in
|
||||
{
|
||||
options.my.programs.nix = {
|
||||
|
@ -21,48 +38,65 @@ in
|
|||
};
|
||||
};
|
||||
optimise.enable = mkEnableOption "nix-optimise";
|
||||
useSuper = mkEnableOption "use nix super" // { default = true; };
|
||||
useNom = mkEnableOption "use nix output monitor by default" // { default = true; };
|
||||
};
|
||||
|
||||
config.nix = {
|
||||
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||
config = {
|
||||
my.nixpkgs.overlays = [
|
||||
(final: prev:
|
||||
{
|
||||
nixos-rebuild = prev.nixos-rebuild.override {
|
||||
nix = mkNom final.system final.nix;
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
package = inputs.nix-super.packages.${pkgs.system}.default;
|
||||
|
||||
extraOptions = "experimental-features = nix-command flakes";
|
||||
|
||||
gc = {
|
||||
automatic = cfg.gc.enable;
|
||||
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
|
||||
dates = "weekly";
|
||||
home-manager.users.moritz.programs.direnv.nix-direnv.package = pkgs.nix-direnv.override {
|
||||
nix = config.nix.package;
|
||||
};
|
||||
|
||||
optimise = {
|
||||
automatic = cfg.optimise.enable;
|
||||
dates = [ "weekly" ];
|
||||
};
|
||||
nix = {
|
||||
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||
|
||||
registry = {
|
||||
master-upstream.to = {
|
||||
type = "github";
|
||||
owner = "nixos";
|
||||
repo = "nixpkgs";
|
||||
package = mkNix pkgs.system pkgs.nix;
|
||||
|
||||
extraOptions = "experimental-features = nix-command flakes";
|
||||
|
||||
gc = {
|
||||
automatic = cfg.gc.enable;
|
||||
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
|
||||
dates = "weekly";
|
||||
};
|
||||
master.flake = inputs.master;
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
stable.flake = inputs.stable;
|
||||
dotfiles.flake = self;
|
||||
default.flake = self;
|
||||
};
|
||||
|
||||
settings = {
|
||||
substituters = [
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
];
|
||||
optimise = {
|
||||
automatic = cfg.optimise.enable;
|
||||
dates = [ "weekly" ];
|
||||
};
|
||||
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
registry = {
|
||||
master-upstream.to = {
|
||||
type = "github";
|
||||
owner = "nixos";
|
||||
repo = "nixpkgs";
|
||||
};
|
||||
master.flake = inputs.master;
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
stable.flake = inputs.stable;
|
||||
dotfiles.flake = self;
|
||||
default.flake = self;
|
||||
};
|
||||
|
||||
settings = {
|
||||
substituters = [
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
];
|
||||
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,26 +10,6 @@ in
|
|||
options.my.programs.nvim.enable = mkEnableOption "nvim";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
my.nixpkgs.overlays = [
|
||||
(
|
||||
_: prev:
|
||||
with lib.my;
|
||||
{
|
||||
vimPlugins = prev.vimPlugins // {
|
||||
nvim-treesitter = prev.vimPlugins.nvim-treesitter.overrideAttrs (_: {
|
||||
version = mkVersionInput inputs.nvim-treesitter;
|
||||
src = inputs.nvim-treesitter;
|
||||
});
|
||||
|
||||
# HACK: to fix error in nixpkgs version of nvim-lspconfig
|
||||
nvim-lspconfig = prev.vimPlugins.nvim-lspconfig.overrideAttrs (_: {
|
||||
version = mkVersionInput inputs.nvim-lspconfig;
|
||||
src = inputs.nvim-lspconfig;
|
||||
});
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
home-manager.users.moritz = {
|
||||
xdg.configFile."nvim/snippets" = {
|
||||
recursive = true;
|
||||
|
|
|
@ -98,7 +98,10 @@ with builtins;
|
|||
lazy = false;
|
||||
}
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
plugin = pkgs.vimPlugins.nvim-lspconfig.overrideAttrs (_: {
|
||||
version = lib.my.mkVersionInput inputs.nvim-lspconfig;
|
||||
src = inputs.nvim-lspconfig;
|
||||
});
|
||||
event = [ "BufRead" "BufNewFile" ];
|
||||
conf = readFile ./lua/nvim-lspconfig.lua;
|
||||
dependencies = [
|
||||
|
@ -266,14 +269,6 @@ with builtins;
|
|||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "nvim-puppeteer";
|
||||
version = lib.my.mkVersionInput inputs.nvim-puppeteer;
|
||||
src = inputs.nvim-puppeteer;
|
||||
};
|
||||
lazy = false; # NOTE: plugin lazy-loads itself.
|
||||
}
|
||||
{
|
||||
plugin = conform-nvim;
|
||||
keys = [
|
||||
|
|
|
@ -11,10 +11,19 @@ local formatters_by_ft = {
|
|||
sh = { "shfmt" },
|
||||
toml = { "taplo" },
|
||||
yaml = { "yamlfix" },
|
||||
gleam = { "gleam" },
|
||||
}
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = formatters_by_ft,
|
||||
formatters = {
|
||||
gleam = {
|
||||
command = "gleam",
|
||||
args = { "format", "--stdin" },
|
||||
stdin = true,
|
||||
cwd = require("conform.util").root_file({ "gleam.toml" }),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("Format", function(opts)
|
||||
|
|
|
@ -28,7 +28,7 @@ cmp.setup({
|
|||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif luasnip.jumpable(1) then
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
|
@ -37,7 +37,7 @@ cmp.setup({
|
|||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif luasnip.jumpable(-1) then
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
|
|
|
@ -130,6 +130,7 @@ local servers = {
|
|||
"gopls",
|
||||
"nil_ls",
|
||||
"nixd",
|
||||
"pylsp",
|
||||
"ruff_lsp",
|
||||
"templ",
|
||||
"typst_lsp",
|
||||
|
@ -150,18 +151,6 @@ lspconfig_setup("tailwindcss", {
|
|||
init_options = { userLanguages = { templ = "html" } },
|
||||
})
|
||||
|
||||
lspconfig_setup("pylsp", {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig_setup("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
|
|
120
modules/programs/nvim/plugins/snippets/gleam.lua
Normal file
120
modules/programs/nvim/plugins/snippets/gleam.lua
Normal file
|
@ -0,0 +1,120 @@
|
|||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require("luasnip.util.events")
|
||||
local ai = require("luasnip.nodes.absolute_indexer")
|
||||
local extras = require("luasnip.extras")
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require("luasnip.extras.expand_conditions")
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require("luasnip.util.types")
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require("luasnip.nodes.key_indexer").new_key
|
||||
local matches = require("luasnip.extras.postfix").matches
|
||||
|
||||
local case_template = [[
|
||||
case {expression} {{
|
||||
{pattern1} -> {result1}
|
||||
{pattern2} -> {result2}{final}
|
||||
}}
|
||||
]]
|
||||
|
||||
local dot_case = postfix({ filetype = "gleam", trig = ".case", match_pattern = matches.line }, {
|
||||
d(1, function(_, parent)
|
||||
return sn(
|
||||
1,
|
||||
fmt(case_template, {
|
||||
expression = t(parent.env.POSTFIX_MATCH),
|
||||
pattern1 = i(1, "pattern"),
|
||||
result1 = i(2, "todo"),
|
||||
pattern2 = i(3, "_"),
|
||||
result2 = i(4, "todo"),
|
||||
final = i(0),
|
||||
})
|
||||
)
|
||||
end),
|
||||
})
|
||||
|
||||
local case = s(
|
||||
{ filetype = "gleam", trig = "case" },
|
||||
fmt(case_template, {
|
||||
expression = i(1),
|
||||
pattern1 = i(2),
|
||||
result1 = i(3, "todo"),
|
||||
pattern2 = i(4, "_"),
|
||||
result2 = i(5, "todo"),
|
||||
final = i(0),
|
||||
})
|
||||
)
|
||||
|
||||
local fn_template = [[
|
||||
fn {name}({args}) -> {rtype} {{
|
||||
{body}
|
||||
}}
|
||||
]]
|
||||
|
||||
local fn = s(
|
||||
{ filetype = "gleam", trig = "fn" },
|
||||
fmt(fn_template, {
|
||||
name = i(1),
|
||||
args = i(2),
|
||||
rtype = i(3),
|
||||
body = i(0),
|
||||
})
|
||||
)
|
||||
|
||||
local pfn = s(
|
||||
{ filetype = "gleam", trig = "pfn" },
|
||||
fmt("pub " .. fn_template, {
|
||||
name = i(1),
|
||||
args = i(2),
|
||||
rtype = i(3),
|
||||
body = i(0),
|
||||
})
|
||||
)
|
||||
|
||||
local type_template = [[
|
||||
type {name} {{
|
||||
{body}
|
||||
}}
|
||||
]]
|
||||
|
||||
local type = s(
|
||||
{ filetype = "gleam", trig = "type" },
|
||||
fmt(type_template, {
|
||||
name = i(1),
|
||||
body = i(0),
|
||||
})
|
||||
)
|
||||
|
||||
local ptype = s(
|
||||
{ filetype = "gleam", trig = "ptype" },
|
||||
fmt("pub " .. type_template, {
|
||||
name = i(1),
|
||||
body = i(0),
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
case,
|
||||
dot_case,
|
||||
fn,
|
||||
pfn,
|
||||
type,
|
||||
ptype,
|
||||
}
|
|
@ -56,9 +56,7 @@ with builtins;
|
|||
require('nvim-treesitter.configs').setup(final_opts)
|
||||
'';
|
||||
init = ''
|
||||
local runtimepath = vim.opt.runtimepath:get()
|
||||
table.insert(runtimepath, 4, "${parserDir}")
|
||||
vim.opt.runtimepath = runtimepath
|
||||
vim.opt.runtimepath:prepend("${parserDir}")
|
||||
'';
|
||||
priority = 100;
|
||||
dependencies = [
|
||||
|
|
Loading…
Reference in a new issue