Compare commits

..

No commits in common. "386da4ccb9eae319605d1f21a7d201cb00cc677b" and "a14f999ab9c839516de431ca2b8e82413a7c4dd4" have entirely different histories.

21 changed files with 353 additions and 257 deletions

View File

@ -348,22 +348,6 @@
"type": "github" "type": "github"
} }
}, },
"hawtkeys-nvim": {
"flake": false,
"locked": {
"lastModified": 1706046129,
"narHash": "sha256-mbMmepQ6TXdsqQ1X8mybvcasPRCHGYMQ+6N3IXP75sM=",
"owner": "tris203",
"repo": "hawtkeys.nvim",
"rev": "a6ca6e4a4d07386a7ab327646c1dbf5155f09c44",
"type": "github"
},
"original": {
"owner": "tris203",
"repo": "hawtkeys.nvim",
"type": "github"
}
},
"hercules-ci-effects": { "hercules-ci-effects": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_3",
@ -1025,7 +1009,6 @@
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"gen-nvim": "gen-nvim", "gen-nvim": "gen-nvim",
"hawtkeys-nvim": "hawtkeys-nvim",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hypr-contrib": "hypr-contrib", "hypr-contrib": "hypr-contrib",
"hyprland": "hyprland", "hyprland": "hyprland",

View File

@ -47,8 +47,6 @@
statuscol-nvim.url = "github:luukvbaal/statuscol.nvim/0.10"; # HACK: fix for neovim-nightly statuscol-nvim.url = "github:luukvbaal/statuscol.nvim/0.10"; # HACK: fix for neovim-nightly
gen-nvim.flake = false; gen-nvim.flake = false;
gen-nvim.url = "github:David-Kunz/gen.nvim"; gen-nvim.url = "github:David-Kunz/gen.nvim";
hawtkeys-nvim.flake = false;
hawtkeys-nvim.url = "github:tris203/hawtkeys.nvim";
# Hyprland # Hyprland
hypr-contrib.url = "github:hyprwm/contrib"; hypr-contrib.url = "github:hyprwm/contrib";
@ -64,6 +62,31 @@
}; };
outputs = inputs@{ self, flake-parts, ... }: outputs = inputs@{ self, flake-parts, ... }:
let
defaultOverlays = [
inputs.hypr-contrib.overlays.default
self.overlays.default
];
finalOverlays = defaultOverlays ++ [
(
_: prev: {
master = import inputs.master {
inherit (prev) system;
overlays = defaultOverlays;
};
stable = import inputs.stable {
inherit (prev) system;
overlays = defaultOverlays;
};
nur = import inputs.nur {
pkgs = prev;
nurpkgs = prev;
};
}
)
];
in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ imports = [
inputs.pre-commit-hooks.flakeModule inputs.pre-commit-hooks.flakeModule
@ -72,6 +95,12 @@
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: { perSystem = { config, self', inputs', pkgs, system, ... }: {
_module.args.pkgs =
import inputs.nixpkgs {
inherit system;
overlays = finalOverlays;
};
devshells.default = { devshells.default = {
devshell.startup.pre-commit-hook.text = config.pre-commit.installationScript; devshell.startup.pre-commit-hook.text = config.pre-commit.installationScript;
commands = [ commands = [
@ -126,12 +155,20 @@
legacyPackages = pkgs; legacyPackages = pkgs;
packages =
self.lib.filterAttrs (_: self.lib.isDerivation)
(self.overlays.default pkgs pkgs);
}; };
flake = { flake = {
lib = inputs.nixpkgs.lib.extend lib = inputs.nixpkgs.lib.extend
(self: _: { my = import ./lib { lib = self; }; }); (self: _: { my = import ./lib { lib = self; }; });
overlays.default = import ./overlays {
inherit inputs;
inherit (self) lib;
};
nixosConfigurations = self.lib.my.mapModules nixosConfigurations = self.lib.my.mapModules
(path: self.lib.nixosSystem { (path: self.lib.nixosSystem {
inherit (self) lib; inherit (self) lib;
@ -141,6 +178,12 @@
modules = modules =
[ [
./modules ./modules
{
nixpkgs = {
overlays = finalOverlays;
config.allowUnfree = true;
};
}
{ {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;

View File

@ -21,7 +21,6 @@
impermanence.enable = true; impermanence.enable = true;
}; };
programs.hyprland.monitors = [ "HDMI-A-1,3840x2160,auto,1.2" ",preferred,auto,1" ]; programs.hyprland.monitors = [ "HDMI-A-1,3840x2160,auto,1.2" ",preferred,auto,1" ];
programs.exercism.enable = true;
}; };
# BOOT # BOOT

View File

@ -1,60 +0,0 @@
{ config, lib, ... }:
with lib;
let
cfg = config.my.nixpkgs;
overlayType = mkOptionType {
name = "nixpkgs-overlay";
description = "nixpkgs overlay";
check = lib.isFunction;
merge = lib.mergeOneOption;
};
in
{
options.my.nixpkgs = {
overlays = mkOption {
default = [ ];
type = types.listOf overlayType;
example = literalExpression
''
[
(self: super: {
openssh = super.openssh.override {
hpnSupport = true;
kerberos = self.libkrb5;
};
})
]
'';
};
channels = mkOption {
default = { };
example = literalExpression ''
{
stable = inputs.nixpkgs-stable;
}
'';
type = with types; attrsOf package;
};
overlaysForAllChannels = mkEnableOption "apply overlays for all channels";
};
config.nixpkgs = {
overlays =
let
channelOverlays = _: prev:
mapAttrs
(_: value:
import value {
inherit (prev) system;
overlays = optional cfg.overlaysForAllChannels cfg.overlays;
}
)
cfg.channels;
in
cfg.overlays ++ [ channelOverlays ];
config.allowUnfree = true;
};
}

View File

@ -1,7 +1,6 @@
{ config { config
, lib , lib
, pkgs , pkgs
, inputs
, ... , ...
}: }:
@ -89,95 +88,6 @@ in
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
my = { my = {
nixpkgs = {
overlays = [
(_: prev:
{
nur = import inputs.nur {
pkgs = prev;
nurpkgs = prev;
};
}
)
(
final: _:
with final.lib;
rec {
fishFile =
{ name
, destination
, content
, checkPhase ? null
}:
final.writeTextFile {
inherit name destination;
executable = true;
allowSubstitutes = true;
preferLocalBuild = false;
text = ''
#!${getExe final.fish}
${content}
'';
checkPhase =
if checkPhase == null then ''
runHook preCheck
${getExe final.fish} -n "$target"
runHook postCheck
''
else checkPhase;
};
writeFishApplication =
{ name
, text
, completions ? null
, runtimeInputs ? [ ]
, checkPhase ? null
}:
let
runtimeHeader = optionalString (runtimeInputs != [ ])
''export PATH="${makeBinPath runtimeInputs}:$PATH"'';
script = fishFile {
inherit checkPhase;
name = "${name}_script";
destination = "/bin/${name}";
content = concatLines [ runtimeHeader text ];
};
completions_file = fishFile {
inherit checkPhase;
name = "${name}_completions";
destination = "/share/fish/vendor_completions.d/${name}.fish";
content = concatLines [ runtimeHeader completions ];
};
in
final.symlinkJoin {
inherit name;
paths = [
script
] ++ optional (completions != null) completions_file;
};
}
)
(
_: prev: {
xorg = prev.xorg // {
lndir = prev.xorg.lndir.overrideAttrs (_: {
meta.mainProgram = "lndir";
});
};
}
)
];
channels = {
master = inputs.master;
stable = inputs.stable;
};
};
bin.enable = true; bin.enable = true;
shell = { shell = {
abbreviations = { abbreviations = {

View File

@ -1,19 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.my.programs.exercism;
in
{
options.my.programs.exercism.enable = mkEnableOption "Exercism";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ exercism ];
age.secrets.exercism = {
path = "/home/moritz/.config/exercism/user.json";
file = ../../secrets/exercism.age;
owner = "1000";
mode = "500";
};
};
}

View File

@ -43,9 +43,6 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
my = { my = {
nixpkgs.overlays = [
inputs.hypr-contrib.overlays.default
];
programs = { programs = {
wallpaper.enable = true; wallpaper.enable = true;
kitty.enable = true; kitty.enable = true;

View File

@ -10,27 +10,15 @@ in
options.my.programs.nvim.enable = mkEnableOption "nvim"; options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.nixpkgs.overlays = [ home-manager.users.moritz = {
home.packages = with pkgs; [
( (
_: prev: if config.my.programs.hyprland.enable
with lib.my; then neovide-hyprland
{ else neovide
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" = { xdg.configFile."nvim/snippets" = {
recursive = true; recursive = true;
source = ./plugins/snippets; source = ./plugins/snippets;

View File

@ -1,4 +1,4 @@
{ pkgs, lib, inputs, ... }: { pkgs, lib, ... }:
with builtins; with builtins;
{ {
@ -103,10 +103,7 @@ with builtins;
conf = readFile ./lua/nvim-lspconfig.lua; conf = readFile ./lua/nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ {
plugin = pkgs.vimPlugins.null-ls-nvim.overrideAttrs (_: { plugin = null-ls-nvim;
version = lib.my.mkVersionInput inputs.none-ls-nvim;
src = inputs.none-ls-nvim;
});
conf = readFile ./lua/null-ls-nvim.lua; conf = readFile ./lua/null-ls-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
@ -135,13 +132,7 @@ with builtins;
{ plugin = dressing-nvim; } { plugin = dressing-nvim; }
]; ];
} }
{ { plugin = actions-preview-nvim; }
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "actions-preview-nvim";
version = lib.my.mkVersionInput inputs.actions-preview-nvim;
src = inputs.actions-preview-nvim;
};
}
]; ];
} }
{ {
@ -228,6 +219,22 @@ with builtins;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { }; opts = { };
} }
{
plugin = telekasten-nvim;
dependencies = [
{ plugin = telescope-nvim; }
{ plugin = which-key-nvim; }
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
];
cmd = [ "Telekasten" ];
keys = [
{ key = "<leader>fz"; cmd = "<cmd>Telekasten<cr>"; desc = "Zettelkasten"; }
];
conf = builtins.readFile ./lua/zettelkasten-nvim.lua;
}
{ {
plugin = nvim-surround; plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
@ -267,13 +274,62 @@ with builtins;
]; ];
} }
{ {
plugin = pkgs.vimUtils.buildVimPlugin { plugin = refactoring-nvim;
pname = "nvim-puppeteer"; keys = [
version = lib.my.mkVersionInput inputs.nvim-puppeteer; {
src = inputs.nvim-puppeteer; key = "<leader>cR";
}; cmd = "<cmd>lua require('telescope').extensions.refactoring.refactors()<cr>";
desc = "Refactor";
mode = [ "x" "n" ];
}
];
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; }
];
opts = { };
}
{
plugin = harpoon;
keys = [
{ key = "<leader>ha"; cmd = "<cmd>lua require('harpoon.mark').add_file()<cr>"; desc = "Add file"; }
{ key = "<leader>hh"; cmd = "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>"; desc = "Harpoon"; }
{ key = "<leader>1"; cmd = "<cmd>lua require('harpoon.ui').nav_file(1)<cr>"; desc = "Harpoon file 1"; }
{ key = "<leader>2"; cmd = "<cmd>lua require('harpoon.ui').nav_file(2)<cr>"; desc = "Harpoon file 2"; }
{ key = "<leader>3"; cmd = "<cmd>lua require('harpoon.ui').nav_file(3)<cr>"; desc = "Harpoon file 3"; }
{ key = "<leader>4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
];
opts = { };
init = /* lua */ ''
require("which-key").register({
["<leader>h"] = {
name = "harpoon",
},
})
'';
dependencies = [
{ plugin = which-key-nvim; }
];
}
{
plugin = nvim-puppeteer;
lazy = false; # NOTE: plugin lazy-loads itself. lazy = false; # NOTE: plugin lazy-loads itself.
} }
{
plugin = neotest;
keys = [
{ key = "<leader>ct"; cmd = "<cmd>lua require('neotest').summary.toggle()<cr>"; desc = "Test"; }
];
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = FixCursorHold-nvim; }
# adapters
{ plugin = neotest-python; }
];
conf = readFile ./lua/neotest.lua;
}
{ {
plugin = conform-nvim; plugin = conform-nvim;
keys = [ keys = [
@ -282,5 +338,41 @@ with builtins;
cmd = [ "ConformInfo" "Format" ]; cmd = [ "ConformInfo" "Format" ];
conf = readFile ./lua/conform.lua; conf = readFile ./lua/conform.lua;
} }
{
plugin = neogen;
keys = [
{ key = "<leader>cg"; cmd = "<cmd>Neogen<cr>"; desc = "Test"; }
];
opts = {
languages = {
python = {
template = {
annotation_convention = "reST";
};
};
};
};
cmd = [ "Neogen" ];
}
{
plugin = gen-nvim;
init = /* lua */ ''
require("gen").setup({
model = "zephyr:7b-beta", -- The default model to use.
display_mode = "float", -- The display mode. Can be "float" or "split".
show_prompt = false, -- Shows the Prompt submitted to Ollama.
show_model = false, -- Displays which model you are using at the beginning of your chat session.
no_auto_close = false, -- Never closes the window automatically.
init = function(options) end,
-- Function to initialize Ollama
command = "${lib.getExe pkgs.curl} --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body",
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
-- This can also be a lua function returning a command string, with options as the input parameter.
-- The executed command must return a JSON object with { response, context }
-- (context property is optional).
debug = false -- Prints errors and the command which is run.
})
'';
}
]; ];
} }

View File

@ -126,7 +126,6 @@ end
local servers = { local servers = {
"bashls", "bashls",
"gleam",
"gopls", "gopls",
"nil_ls", "nil_ls",
"nixd", "nixd",

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, config, ... }:
with builtins; with builtins;
{ {

View File

@ -1,4 +1,4 @@
{ pkgs, lib, inputs, ... }: { pkgs, ... }:
with builtins; with builtins;
{ {
@ -21,19 +21,12 @@ with builtins;
opts = { }; opts = { };
} }
{ {
plugin = pkgs.vimPlugins.statuscol-nvim.overrideAttrs (_: { plugin = statuscol-nvim;
version = lib.my.mkVersionInput inputs.statuscol-nvim;
src = inputs.statuscol-nvim;
});
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
conf = readFile ./lua/statuscol-nvim.lua; conf = readFile ./lua/statuscol-nvim.lua;
} }
{ {
plugin = pkgs.vimUtils.buildVimPlugin { plugin = smartcolumn-nvim;
pname = "smartcolumn-nvim";
version = lib.my.mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { opts = {
colorcolumn = "120"; colorcolumn = "120";
@ -50,18 +43,5 @@ with builtins;
conf = readFile ./lua/gitsigns-nvim.lua; conf = readFile ./lua/gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }]; dependencies = [{ plugin = which-key-nvim; }];
} }
{
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "hawtkeys-nvim";
version = lib.my.mkVersionInput inputs.hawtkeys-nvim;
src = inputs.hawtkeys-nvim;
};
cmd = [ "Hawtkeys" "HawtkeysAll" "HawtkeysDupes" ];
opts = { };
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = nvim-treesitter; }
];
}
]; ];
} }

62
overlays/builders.nix Normal file
View File

@ -0,0 +1,62 @@
_:
final: _:
with final.lib;
rec {
fishFile =
{ name
, destination
, content
, checkPhase ? null
}:
final.writeTextFile {
inherit name destination;
executable = true;
allowSubstitutes = true;
preferLocalBuild = false;
text = ''
#!${getExe final.fish}
${content}
'';
checkPhase =
if checkPhase == null then ''
runHook preCheck
${getExe final.fish} -n "$target"
runHook postCheck
''
else checkPhase;
};
writeFishApplication =
{ name
, text
, completions ? null
, runtimeInputs ? [ ]
, checkPhase ? null
}:
let
runtimeHeader = optionalString (runtimeInputs != [ ])
''export PATH="${makeBinPath runtimeInputs}:$PATH"'';
script = fishFile {
inherit checkPhase;
name = "${name}_script";
destination = "/bin/${name}";
content = concatLines [ runtimeHeader text ];
};
completions_file = fishFile {
inherit checkPhase;
name = "${name}_completions";
destination = "/share/fish/vendor_completions.d/${name}.fish";
content = concatLines [ runtimeHeader completions ];
};
in
final.symlinkJoin {
inherit name;
paths = [
script
] ++ optional (completions != null) completions_file;
};
}

4
overlays/default.nix Normal file
View File

@ -0,0 +1,4 @@
{ lib, ... }@args:
lib.composeManyExtensions
(lib.my.mapModules' (file: import file args) ./.)

16
overlays/fixes.nix Normal file
View File

@ -0,0 +1,16 @@
{ lib, ... }:
final: prev: {
# python-poetry/poetry#5929
poetry = final.symlinkJoin {
name = "poetry";
paths = [ prev.poetry ];
postBuild =
let
regex = "s/'([a-z]*[[:blank:]][a-z]*)''/\1'/g";
in
''
${lib.getExe final.gnused} -i -E "${regex}" "$out/share/fish/vendor_completions.d/poetry.fish"
'';
};
}

5
overlays/lib.nix Normal file
View File

@ -0,0 +1,5 @@
{ lib, ... }:
_: _: {
inherit lib;
}

10
overlays/packages.nix Normal file
View File

@ -0,0 +1,10 @@
_:
_: prev:
{
xorg = prev.xorg // {
lndir = prev.xorg.lndir.overrideAttrs (_: {
meta.mainProgram = "lndir";
});
};
}

63
overlays/vimPlugins.nix Normal file
View File

@ -0,0 +1,63 @@
{ inputs, lib }:
_: prev:
with lib.my;
{
vimPlugins = prev.vimPlugins // {
smartcolumn-nvim = prev.vimUtils.buildVimPlugin {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
telekasten-nvim = prev.vimUtils.buildVimPlugin {
pname = "telekasten-nvim";
version = mkVersionInput inputs.telekasten-nvim;
src = inputs.telekasten-nvim;
};
actions-preview-nvim = prev.vimUtils.buildVimPlugin {
pname = "actions-preview-nvim";
version = mkVersionInput inputs.actions-preview-nvim;
src = inputs.actions-preview-nvim;
};
nvim-treesitter = prev.vimPlugins.nvim-treesitter.overrideAttrs (_: {
version = mkVersionInput inputs.nvim-treesitter;
src = inputs.nvim-treesitter;
});
statuscol-nvim = prev.vimPlugins.statuscol-nvim.overrideAttrs (_: {
version = mkVersionInput inputs.statuscol-nvim;
src = inputs.statuscol-nvim;
});
# 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;
});
nvim-puppeteer = prev.vimUtils.buildVimPlugin {
pname = "nvim-puppeteer";
version = mkVersionInput inputs.nvim-puppeteer;
src = inputs.nvim-puppeteer;
};
null-ls-nvim = prev.vimPlugins.null-ls-nvim.overrideAttrs (_: {
version = mkVersionInput inputs.none-ls-nvim;
src = inputs.none-ls-nvim;
});
neotest-python = prev.vimPlugins.neotest-python.overrideAttrs (_: {
version = mkVersionInput inputs.neotest-python;
src = inputs.neotest-python;
});
gen-nvim = prev.vimUtils.buildVimPlugin {
pname = "gen-nvim";
version = mkVersionInput inputs.gen-nvim;
src = inputs.gen-nvim;
};
};
}

25
overlays/wayland.nix Normal file
View File

@ -0,0 +1,25 @@
_:
final: prev: {
neovide-hyprland = final.symlinkJoin {
name = "neovide-hyprland-${final.neovide.version}";
paths = [ final.neovide ];
nativeBuildInputs = [ final.makeWrapper ];
postBuild = ''
rm $out/bin/neovide
makeWrapper ${final.neovide}/bin/neovide $out/bin/neovide --set WINIT_UNIX_BACKEND x11
'';
meta = final.neovide.meta // {
mainProgram = "neovide";
};
};
logseq-wayland = prev.symlinkJoin {
name = "logseq-wayland";
paths = [ prev.logseq ];
nativeBuildInputs = [ prev.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/logseq \
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
};
}

Binary file not shown.

View File

@ -23,7 +23,6 @@ in
"wireguard-private-key.age".publicKeys = personal; "wireguard-private-key.age".publicKeys = personal;
"webis.age".publicKeys = hosts-personal ++ [ scadspc25 moritz ]; "webis.age".publicKeys = hosts-personal ++ [ scadspc25 moritz ];
"webis-ssh.age".publicKeys = hosts-personal ++ [ scadspc25 moritz ]; "webis-ssh.age".publicKeys = hosts-personal ++ [ scadspc25 moritz ];
"root-password.age".publicKeys = personal; "root-password.age".publicKeys = hosts-personal ++ [ moritz ];
"moritz-password.age".publicKeys = personal; "moritz-password.age".publicKeys = hosts-personal ++ [ moritz ];
"exercism.age".publicKeys = personal;
} }