Compare commits

...

6 commits

21 changed files with 257 additions and 353 deletions

View file

@ -348,6 +348,22 @@
"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",
@ -1009,6 +1025,7 @@
"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,6 +47,8 @@
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";
@ -62,31 +64,6 @@
}; };
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
@ -95,12 +72,6 @@
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 = [
@ -155,20 +126,12 @@
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;
@ -178,12 +141,6 @@
modules = modules =
[ [
./modules ./modules
{
nixpkgs = {
overlays = finalOverlays;
config.allowUnfree = true;
};
}
{ {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;

View file

@ -21,6 +21,7 @@
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

60
modules/nixpkgs.nix Normal file
View file

@ -0,0 +1,60 @@
{ 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,6 +1,7 @@
{ config { config
, lib , lib
, pkgs , pkgs
, inputs
, ... , ...
}: }:
@ -88,6 +89,95 @@ 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

@ -0,0 +1,19 @@
{ 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,6 +43,9 @@ 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,15 +10,27 @@ in
options.my.programs.nvim.enable = mkEnableOption "nvim"; options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz = { my.nixpkgs.overlays = [
home.packages = with pkgs; [
( (
if config.my.programs.hyprland.enable _: prev:
then neovide-hyprland with lib.my;
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, ... }: { pkgs, lib, inputs, ... }:
with builtins; with builtins;
{ {
@ -103,7 +103,10 @@ with builtins;
conf = readFile ./lua/nvim-lspconfig.lua; conf = readFile ./lua/nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ {
plugin = null-ls-nvim; plugin = pkgs.vimPlugins.null-ls-nvim.overrideAttrs (_: {
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; }
@ -132,7 +135,13 @@ 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;
};
}
]; ];
} }
{ {
@ -219,22 +228,6 @@ 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" ];
@ -274,62 +267,13 @@ with builtins;
]; ];
} }
{ {
plugin = refactoring-nvim; plugin = pkgs.vimUtils.buildVimPlugin {
keys = [ pname = "nvim-puppeteer";
{ version = lib.my.mkVersionInput inputs.nvim-puppeteer;
key = "<leader>cR"; src = inputs.nvim-puppeteer;
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 = [
@ -338,41 +282,5 @@ 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,6 +126,7 @@ end
local servers = { local servers = {
"bashls", "bashls",
"gleam",
"gopls", "gopls",
"nil_ls", "nil_ls",
"nixd", "nixd",

View file

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

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, lib, inputs, ... }:
with builtins; with builtins;
{ {
@ -21,12 +21,19 @@ with builtins;
opts = { }; opts = { };
} }
{ {
plugin = statuscol-nvim; plugin = pkgs.vimPlugins.statuscol-nvim.overrideAttrs (_: {
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 = smartcolumn-nvim; plugin = pkgs.vimUtils.buildVimPlugin {
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";
@ -43,5 +50,18 @@ 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; }
];
}
]; ];
} }

View file

@ -1,62 +0,0 @@
_:
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;
};
}

View file

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

View file

@ -1,16 +0,0 @@
{ 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"
'';
};
}

View file

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

View file

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

View file

@ -1,63 +0,0 @@
{ 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;
};
};
}

View file

@ -1,25 +0,0 @@
_:
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"
'';
};
}

BIN
secrets/exercism.age Normal file

Binary file not shown.

View file

@ -23,6 +23,7 @@ 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 = hosts-personal ++ [ moritz ]; "root-password.age".publicKeys = personal;
"moritz-password.age".publicKeys = hosts-personal ++ [ moritz ]; "moritz-password.age".publicKeys = personal;
"exercism.age".publicKeys = personal;
} }