Compare commits

..

1 Commits

Author SHA1 Message Date
Moritz Böhme f46367fcd5
feat!: add stylix 2024-02-01 14:56:13 +01:00
64 changed files with 1674 additions and 2960 deletions

9
.nixd.json Normal file
View File

@ -0,0 +1,9 @@
{
"options": {
"enable": true,
"target": {
"args": [],
"installable": ".#nixosConfigurations.nixos-desktop.options"
}
}
}

1062
flake.lock

File diff suppressed because it is too large Load Diff

View File

@ -15,15 +15,16 @@
master.url = "github:nixos/nixpkgs"; master.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
stable.url = "github:nixos/nixpkgs/nixos-24.05"; stable.url = "github:nixos/nixpkgs/nixos-23.05";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
nix-index-database.url = "github:Mic92/nix-index-database"; nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
stylix.url = "github:danth/stylix";
stylix.inputs."home-manager".follows = "home-manager";
stylix.inputs."nixpkgs".follows = "nixpkgs";
# Programs # Programs
nix-super.url = "github:privatevoid-net/nix-super"; 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"; timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
# Neovim # Neovim
@ -33,32 +34,26 @@
nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim"; nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim";
nvim-lspconfig.flake = false; nvim-lspconfig.flake = false;
nvim-lspconfig.url = "github:neovim/nvim-lspconfig"; 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.flake = false;
smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim"; smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim";
telekasten-nvim.flake = false; telekasten-nvim.flake = false;
telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; telekasten-nvim.url = "github:renerocksai/telekasten.nvim";
none-ls-nvim.flake = false;
none-ls-nvim.url = "github:nvimtools/none-ls.nvim";
neotest-python.flake = false; neotest-python.flake = false;
neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search"; neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search";
statuscol-nvim.flake = false;
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";
none-ls-shellcheck-nvim.flake = false;
none-ls-shellcheck-nvim.url = "github:gbprod/none-ls-shellcheck.nvim";
cmp-vimtex.flake = false;
cmp-vimtex.url = "github:micangl/cmp-vimtex";
# river
river.url = "git+https://github.com/riverwm/river?submodules=1";
river.flake = false;
# Hyprland # Hyprland
hypr-contrib.url = "github:hyprwm/contrib"; hypr-contrib.url = "github:hyprwm/contrib";
hyprland = { hyprland.url = "github:hyprwm/Hyprland";
type = "git";
url = "https://github.com/hyprwm/Hyprland";
submodules = true;
};
# Laptop # Laptop
asus-touchpad-numpad-driver.url = "github:MoritzBoehme/asus-touchpad-numpad-driver/german-layout"; asus-touchpad-numpad-driver.url = "github:MoritzBoehme/asus-touchpad-numpad-driver/german-layout";
@ -70,8 +65,32 @@
}; };
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; } {
debug = true; # NOTE: for nixd
imports = [ imports = [
inputs.pre-commit-hooks.flakeModule inputs.pre-commit-hooks.flakeModule
inputs.devshell.flakeModule inputs.devshell.flakeModule
@ -79,6 +98,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 = [
@ -133,12 +158,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;
@ -148,12 +181,20 @@
modules = modules =
[ [
./modules ./modules
{
nixpkgs = {
overlays = finalOverlays;
config.allowUnfree = true;
};
}
{ {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit inputs self; }; extraSpecialArgs = { inherit inputs self; };
sharedModules = [ inputs.nix-lazy-nvim.homeManagerModules.default ]; sharedModules = [
inputs.nix-lazy-nvim.homeManagerModules.default
];
}; };
} }
inputs.agenix.nixosModules.age inputs.agenix.nixosModules.age
@ -161,6 +202,7 @@
inputs.home-manager.nixosModule inputs.home-manager.nixosModule
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.nix-index-database.nixosModules.nix-index inputs.nix-index-database.nixosModules.nix-index
inputs.stylix.nixosModules.stylix
path path
]; ];
}) })
@ -184,8 +226,10 @@
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org" "https://pre-commit-hooks.cachix.org"
"https://cache.privatevoid.net"
]; ];
extra-trusted-public-keys = [ extra-trusted-public-keys = [
"cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" "pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="

View File

@ -19,21 +19,21 @@
gaming.enable = true; gaming.enable = true;
personal.enable = true; personal.enable = true;
impermanence.enable = true; impermanence.enable = true;
webis.enable = true;
}; };
programs.hyprland.enable = true; programs.hyprland = {
programs.hyprland.nvidiaSupport = true; nvidiaSupport = true;
programs.hyprland.keyboardLayouts = [ "us" "de" ]; monitors = [ "HDMI-A-1,3840x2160,auto,1.2" ",preferred,auto,1" ];
programs.hyprland.monitors."HDMI-A-2" = { scale = 1.2; }; extraConfig = "exec=hyprctl keyword monitor HDMI-A-1,3840x2160@120,auto,1.2";
programs.exercism.enable = true; keyboardLayouts = [ "us" "de" ];
};
services.wallpaper.enable = true; services.wallpaper.enable = true;
services.ollama.enable = true;
programs.ledger.enable = true;
}; };
virtualisation.containers.cdi.dynamic.nvidia.enable = true;
home-manager.users.moritz.home.packages = with pkgs; [ home-manager.users.moritz.home.packages = with pkgs; [
anki anki
stable.calibre # NOTE: breaks often in unstable calibre
]; ];
hardware = { hardware = {
@ -42,6 +42,7 @@
opengl = { opengl = {
enable = true; enable = true;
driSupport32Bit = true; driSupport32Bit = true;
driSupport = true;
}; };
# sensors # sensors
@ -68,7 +69,7 @@
defaultGateway = "192.168.0.1"; defaultGateway = "192.168.0.1";
nameservers = [ "192.168.0.4" ]; nameservers = [ "192.168.0.4" ];
useDHCP = false; useDHCP = false;
interfaces.enp6s0 = { interfaces.enp42s0 = {
ipv4.addresses = [ ipv4.addresses = [
{ {
address = "192.168.0.14"; address = "192.168.0.14";

View File

@ -1,27 +1,23 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { config
, lib
, modulesPath
, ...
}: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
{ hardware.cpu.amd.updateMicrocode =
imports = lib.mkDefault config.hardware.enableRedistributableFirmware;
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@ -20,117 +20,7 @@
webis.enable = true; webis.enable = true;
impermanence.enable = true; impermanence.enable = true;
}; };
programs.river.enable = true; programs.hyprland.monitors = [ "HDMI-A-1,3840x2160,auto,1.2" ",preferred,auto,1" ];
programs.hyprland.enable = false;
programs.exercism.enable = true;
};
users.users.moritz.packages = [ pkgs.poetry ];
home-manager.users.moritz.services.kanshi.profiles = {
undocked = {
outputs = [
{
criteria = "eDP-1";
}
];
};
docked = {
outputs = [
{
criteria = "eDP-1";
position = "640,1800"; # NOTE: 2160 / 1.2 = 1800
}
{
criteria = "DP-3";
scale = 1.2;
position = "0,0";
}
];
};
};
services.kanata = {
enable = true;
keyboards = {
laptop = {
devices = [
"/dev/input/by-path/platform-i8042-serio-0-event-kbd"
];
config = "
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rctl
)
(deflayermap (default)
;; tarmak 1a
j n
n k
k e
;; tarmak 1b
h m
m h
;; tarmak 2a
b z
z x
x c
;; tarmak 2b
e f
f t
t b
;; tarmak 3
c d
d s
s r
;; tarmak 4
r p
p ;
; o
o y
y j
;; tarmak 5
u l
l i
i u
;; caps-word tap-dance
lsft (tap-dance 200 (_ (caps-word 2000) _ _))
;; change ctrl alt and meta
lctl lalt
lmet lctl
lalt (tap-dance 200 (lmet (multi lmet alt) lmet lmet))
;; hjkl layer
ralt (tap-hold 200 200 (layer-switch hjkl) (layer-while-held hjkl)) ;; tap: switch hold: switch while held
;; switch to normal keyboard layout
rctl (layer-switch normal)
)
(deflayermap (normal)
rctl (layer-switch default))
(deflayermap (hjkl)
h left
j down
k up
l right
ralt (layer-switch default))
";
};
};
}; };
# BOOT # BOOT
@ -141,8 +31,8 @@
# SERVICES # SERVICES
services = { services = {
libinput.enable = true; xserver.libinput.enable = true;
libinput.touchpad.disableWhileTyping = true; xserver.libinput.touchpad.disableWhileTyping = true;
printing.enable = true; printing.enable = true;
logind.lidSwitch = "hybrid-sleep"; logind.lidSwitch = "hybrid-sleep";
}; };

View File

@ -0,0 +1,75 @@
{ config, ... }:
{
age.secrets = {
root-password.file = ../../secrets/root-password.age;
moritz-password.file = ../../secrets/moritz-password.age;
};
users.users = {
root.hashedPasswordFile = config.age.secrets.root-password.path;
moritz.hashedPasswordFile = config.age.secrets.moritz-password.path;
};
users.mutableUsers = false;
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/etc/NetworkManager/system-connections"
"/var/db/dhcpcd/"
"/var/lib/NetworkManager/"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/var/log"
];
files = [
"/etc/machine-id"
"/etc/nix/id_rsa"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
users.moritz = {
directories = [
".SynologyDrive/data"
".SynologyDrive/log"
".cache/keepassxc"
".cache/nvim/luac"
".config/Nextcloud"
".config/keepassxc"
".local/share/direnv"
".local/share/nvim"
".local/share/zoxide"
".local/share/JetBrains"
".config/JetBrains"
".local/state/nvim"
".config/kdeconnect"
".cat_installer" # eduroam
".mozilla"
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".local/share/keyrings"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
];
files = [
".local/share/fish/fish_history"
".local/share/nix/trusted-settings.json"
".parallel/will-cite"
];
};
users.root = {
home = "/root";
directories = [
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
];
files = [
".local/share/nix/trusted-settings.json"
];
};
};
}

View File

@ -31,12 +31,6 @@
}: }:
{ {
my.programs.tofi.settings = {
text-color = "#${text}";
prompt-color = "#${red}";
selection-color = "#${yellow}";
background-color = "#${base}";
};
home-manager.users.moritz = { home-manager.users.moritz = {
programs = { programs = {
fzf.colors = { fzf.colors = {
@ -53,26 +47,6 @@
prompt = "#${mauve}"; prompt = "#${mauve}";
spinner = "#${rosewater}"; spinner = "#${rosewater}";
}; };
foot.settings.colors = {
foreground = text; # Text
background = base; # Base
regular0 = surface1; # Surface 1
regular1 = red; # red
regular2 = green; # green
regular3 = yellow; # yellow
regular4 = blue;
regular5 = pink;
regular6 = teal;
regular7 = subtext1;
bright0 = surface2;
bright1 = red;
bright2 = green;
bright3 = yellow;
bright4 = blue;
bright5 = pink;
bright6 = teal;
bright7 = subtext0;
};
kitty.extraConfig = '' kitty.extraConfig = ''
# vim:ft=kitty # vim:ft=kitty

View File

@ -9,7 +9,7 @@ in
(import ./_catppuccin.nix (import ./_catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;
flavor = "macchiato"; flavor = "mocha";
rosewater = "f4dbd6"; rosewater = "f4dbd6";
flamingo = "f0c6c6"; flamingo = "f0c6c6";
pink = "f5bde6"; pink = "f5bde6";

View File

@ -31,20 +31,6 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.programs.tofi.settings = {
font-size = "20";
font =
let
fontBasePath = pkgs.nerdfonts.override {
fonts = [ "FiraCode" ];
};
in
"${fontBasePath}/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf";
height = "360";
width = "720";
outline-width = "0";
border-width = "0";
};
home-manager.users.moritz = { home-manager.users.moritz = {
services.polybar = { services.polybar = {
config = { config = {
@ -53,7 +39,7 @@ in
monitor = "\${env:MONITOR}"; monitor = "\${env:MONITOR}";
bottom = true; bottom = true;
width = "100%"; width = "100%";
height = 15; heigth = 15;
border-size = 2; border-size = 2;

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

@ -44,7 +44,7 @@ let
gi = pkgs.writeFishApplication { gi = pkgs.writeFishApplication {
name = "gi"; name = "gi";
runtimeInputs = with pkgs; [ fzf gum curl coreutils-full ]; runtimeInputs = with pkgs; [ fzf gum curl ];
text = /* fish */ '' text = /* fish */ ''
set url https://www.gitignore.io/api set url https://www.gitignore.io/api
@ -57,12 +57,10 @@ let
set choice (string join "," $argv[1..]) set choice (string join "," $argv[1..])
end end
set contents "$(curl -sL $url/$choice | head -n -2 | tail -n +4)"
if gum confirm "Overwrite current .gitignore?" if gum confirm "Overwrite current .gitignore?"
echo "$contents" > .gitignore curl -sL $url/$choice > .gitignore
else else
echo "$contents" >> .gitignore curl -sL $url/$choice >> .gitignore
end end
''; '';
completions = /* fish */ '' completions = /* fish */ ''
@ -79,7 +77,7 @@ in
isNormalUser = true; isNormalUser = true;
home = "/home/moritz"; home = "/home/moritz";
extraGroups = [ "wheel" "networkmanager" "video" ]; extraGroups = [ "wheel" "networkmanager" "video" ];
# initialPassword = "password"; # CHANGE ME PLEASE initialPassword = "password"; # CHANGE ME PLEASE
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoAqa2m7hIzZ2LS96Z+RCIlRvhBM/j7h27tMBCwMT+a" # Moritz "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoAqa2m7hIzZ2LS96Z+RCIlRvhBM/j7h27tMBCwMT+a" # Moritz
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhtwHDGAZshiQWKkCcPWV9tC83b+bKBgjDcjP/N2CKO" # Laptop "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhtwHDGAZshiQWKkCcPWV9tC83b+bKBgjDcjP/N2CKO" # Laptop
@ -91,95 +89,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 = {
@ -249,17 +158,16 @@ in
parallel parallel
ripgrep ripgrep
vim vim
(viu.override { withSixel = true; }) viu
wget wget
]; ];
fonts = { fonts = {
enableDefaultPackages = true; enableDefaultPackages = true;
packages = [ packages = with pkgs; [
(pkgs.nerdfonts.override { (nerdfonts.override {
fonts = [ "FiraCode" ]; fonts = [ "FiraCode" ];
}) })
pkgs.master.intel-one-mono
]; ];
}; };
@ -283,6 +191,10 @@ in
}; };
home-manager.users.moritz = { home-manager.users.moritz = {
imports = [
# inputs.stylix.homeManagerModules.stylix
];
programs = { programs = {
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
home-manager.enable = true; home-manager.enable = true;

View File

@ -4,8 +4,8 @@
, ... , ...
}: }:
with lib;
let let
inherit (lib) mkEnableOption mkIf mkDefault;
cfg = config.my.profiles.desktop; cfg = config.my.profiles.desktop;
in in
{ {
@ -21,10 +21,6 @@ in
}; };
}; };
wallpapers.enable = mkDefault true; wallpapers.enable = mkDefault true;
theming = {
enable = mkDefault true;
scheme = mkDefault "catppuccin-macchiato";
};
virtualisation.podman.enable = mkDefault true; virtualisation.podman.enable = mkDefault true;
programs = { programs = {
@ -82,7 +78,8 @@ in
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs;
[
keepassxc keepassxc
pavucontrol pavucontrol
stable.libreoffice # NOTE breaks often stable.libreoffice # NOTE breaks often
@ -90,15 +87,6 @@ in
stable.texlive.combined.scheme-full # NOTE breaks often stable.texlive.combined.scheme-full # NOTE breaks often
thunderbird thunderbird
vlc vlc
(symlinkJoin {
name = "obsidian-wayland";
paths = [ obsidian ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/obsidian \
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
})
]; ];
programs.nix-ld.enable = true; programs.nix-ld.enable = true;

View File

@ -42,19 +42,18 @@ in
".SynologyDrive/log" ".SynologyDrive/log"
".cache/keepassxc" ".cache/keepassxc"
".cache/nvim/luac" ".cache/nvim/luac"
".cat_installer" # eduroam
".config/JetBrains"
".config/Nextcloud" ".config/Nextcloud"
".config/calibre"
".config/github-copilot"
".config/kdeconnect"
".config/keepassxc" ".config/keepassxc"
".java/.userPrefs/jetbrains/"
".local/share/JetBrains"
".local/share/direnv" ".local/share/direnv"
".local/share/nvim" ".local/share/nvim"
".local/share/zoxide" ".local/share/zoxide"
".local/share/JetBrains"
".config/JetBrains"
".config/calibre"
".local/state/nvim" ".local/state/nvim"
".config/kdeconnect"
".config/github-copilot"
".cat_installer" # eduroam
".mozilla" ".mozilla"
"Documents" "Documents"
"Downloads" "Downloads"
@ -69,7 +68,6 @@ in
".local/share/fish/fish_history" ".local/share/fish/fish_history"
".local/share/nix/trusted-settings.json" ".local/share/nix/trusted-settings.json"
".parallel/will-cite" ".parallel/will-cite"
".local/state/tofi-history"
]; ];
}; };
users.root = { users.root = {

View File

@ -0,0 +1,52 @@
{ pkgs, config, ... }:
{
stylix = {
image = ../config/wallpapers/wallpapers/red_beetle.jpg;
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-frappe.yaml";
opacity.terminal = 0.9;
fonts = {
monospace = {
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
name = "FiraCode Nerd Font";
};
sizes.terminal = 10;
};
polarity = "dark";
targets.fish.enable = false;
};
home-manager.users.moritz.stylix.targets = {
swaylock.enable = false;
kitty.variant256Colors = true;
fish.enable = false;
};
home-manager.users.moritz.xdg.configFile."fish/themes/base16.theme".text = with config.lib.stylix.colors; ''
fish_color_normal ${base05}
fish_color_command ${base0D}
fish_color_param ${base0F}
fish_color_keyword ${base08}
fish_color_quote ${base0B}
fish_color_redirection ${base0E}
fish_color_end ${base09}
fish_color_comment ${base04}
fish_color_error ${base08}
fish_color_gray ${base04}
fish_color_selection --background=${base02}
fish_color_search_match --background=${base02}
fish_color_option ${base0B}
fish_color_operator ${base0E}
fish_color_escape ${base08}
fish_color_autosuggestion ${base04}
fish_color_cancel ${base08}
fish_color_cwd ${base0A}
fish_color_user ${base0C}
fish_color_host ${base0D}
fish_color_host_remote ${base0B}
fish_color_status ${base08}
fish_pager_color_progress ${base04}
fish_pager_color_prefix ${base0E}
fish_pager_color_completion ${base05}
fish_pager_color_description ${base04}
'';
home-manager.users.moritz.programs.fish.interactiveShellInit = "fish_config theme choose base16";
}

View File

@ -4,23 +4,16 @@
, ... , ...
}: }:
with lib;
let let
cfg = config.my.profiles.webis; cfg = config.my.profiles.webis;
inherit (lib) mkEnableOption mkIf;
in in
{ {
options.my.profiles.webis.enable = mkEnableOption "webis profile"; options.my.profiles.webis.enable = mkEnableOption "webis profile";
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.programs = { my.programs.ssh.includeSecrets = [ ../../secrets/webis-ssh.age ];
ssh.includeSecrets = [ ../../secrets/webis-ssh.age ];
jetbrains = {
pycharm.enable = true;
pycharm.package = pkgs.jetbrains.pycharm-professional;
};
};
age.secrets.webis = { age.secrets.webis = {
file = ../../secrets/webis.age; file = ../../secrets/webis.age;
name = "webis.ovpn"; name = "webis.ovpn";
@ -32,6 +25,9 @@ in
updateResolvConf = true; updateResolvConf = true;
}; };
}; };
environment.systemPackages = with pkgs; [
jetbrains.pycharm-professional
];
programs.dconf.enable = true; programs.dconf.enable = true;
}; };
} }

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

@ -29,36 +29,19 @@ in
); );
}; };
}; };
package = mkOption { setSearchEngines = mkEnableOption "firefox search engines";
type = types.package;
default = pkgs.firefox;
example = pkgs.firefox-esr;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz.programs.firefox = { home-manager.users.moritz.programs.firefox = {
enable = true; enable = true;
policies = policies = mkIf cfg.setSearchEngines {
let SearchEngines = {
removeExtensions = [ "Google" "Amazon.de" "Bing" "Amazon" "Wikipedia (en)" "Wikipedia (de)" ];
convertName = name:
let
lower = toLower name;
escaped = replaceStrings [ "." ] [ "dot" ] lower;
sanitized = head (splitString " " escaped);
in
"${sanitized}@search.mozilla.org";
in
{
SearchEngines = mkIf (hasInfix "esr" cfg.package) {
Default = "Kagi"; Default = "Kagi";
Remove = removeExtensions; Remove = [ "Google" "Amazon.de" "Bing" ];
}; };
ExtensionSettings = genAttrs
(map convertName removeExtensions)
(_: { installation_mode = "blocked"; });
}; };
package = if cfg.setSearchEngines then pkgs.firefox-esr else pkgs.firefox;
profiles."default" = { profiles."default" = {
extraConfig = mkIf cfg.arkenfox.enable '' extraConfig = mkIf cfg.arkenfox.enable ''
// Arkenfox user.js // Arkenfox user.js

View File

@ -31,7 +31,7 @@ in
enable = true; enable = true;
shellAbbrs = shellConfig.abbreviations; shellAbbrs = shellConfig.abbreviations;
shellAliases = shellConfig.aliases; shellAliases = shellConfig.aliases;
shellInit = /* fish */ '' shellInit = ''
# Vi Mode # Vi Mode
fish_vi_key_bindings fish_vi_key_bindings
@ -62,7 +62,7 @@ in
end end
abbr --add dotdot --regex '^\.\.+$' --function multicd abbr --add dotdot --regex '^\.\.+$' --function multicd
abbr -a .P --position anywhere --set-cursor "% | $PAGER" abbr -a P --position anywhere --set-cursor "% | $PAGER"
function editor_edit function editor_edit
echo $EDITOR $argv echo $EDITOR $argv

View File

@ -1,29 +0,0 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.foot;
in
{
options.my.programs.foot.enable = mkEnableOption "foot";
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.foot = {
enable = true;
settings = {
main = {
term = "xterm-256color";
font = "FiraCode Nerd Font:size=10";
};
colors = {
alpha = 0.98;
};
};
};
};
};
}

View File

@ -1,5 +1,6 @@
{ config { config
, lib , lib
, pkgs
, ... , ...
}: }:
@ -29,24 +30,18 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.shell.abbreviations = { my.shell.abbreviations = {
g = "git";
gC = "git clone";
gF = "git pull";
gS = "git switch";
ga = "git add"; ga = "git add";
gap = "git add --patch"; gap = "git add --patch";
gr = "git restore";
grp = "git restore --patch";
gb = "git branch"; gb = "git branch";
gc = "git commit"; gc = "git commit";
gco = "git checkout"; gco = "git checkout";
gd = "git diff"; gd = "git diff";
gds = "git diff --staged"; gds = "git diff --staged";
gf = "git fetch";
gp = "git push"; gp = "git push";
gr = "git restore"; gf = "git fetch";
grm = "git rm --cached"; gF = "git pull";
grp = "git restore --patch";
grps = "git restore --patch --staged";
grs = "git restore --staged";
gs = "git status"; gs = "git status";
}; };
home-manager.users.moritz = { home-manager.users.moritz = {
@ -55,23 +50,21 @@ in
userName = cfg.identity.name; userName = cfg.identity.name;
userEmail = cfg.identity.email; userEmail = cfg.identity.email;
extraConfig = { extraConfig = {
commit.verbose = true;
diff.algorithm = "histogram";
fetch.fsckobjects = true;
init.defaultBranch = "main"; init.defaultBranch = "main";
merge.conflictstyle = "zdiff3"; merge.conflictstyle = "zdiff3";
diff.external = getExe pkgs.difftastic;
push.autoSetupRemote = true; push.autoSetupRemote = true;
receive.fsckObjects = true;
transfer.fsckobjects = true;
}; };
signing = mkIf cfg.signing { signing = mkIf cfg.signing {
key = "0x970C6E89EB0547A9"; key = "0x970C6E89EB0547A9";
signByDefault = true; signByDefault = true;
}; };
lfs.enable = true; lfs.enable = true;
delta.enable = true;
}; };
}; };
programs.git.enable = true; programs.git = {
enable = true;
config.safe.directory = "/home/moritz/.dotfiles";
};
}; };
} }

View File

@ -1,24 +0,0 @@
{ config
, pkgs
, lib
, ...
}:
let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.my.programs.gitbutler;
in
{
options.my.programs.gitbutler = {
enable = mkEnableOption "gitbutler";
package = mkOption {
default = pkgs.callPackage ./package.nix { };
type = types.package;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
};
}

View File

@ -1,16 +0,0 @@
{ fetchzip, appimageTools }:
let
pname = "git-butler";
version = "0.12.4";
buildNum = "994";
srcZipped = fetchzip {
url = "https://releases.gitbutler.com/releases/release/${version}-${buildNum}/linux/x86_64/git-butler_${version}_amd64.AppImage.tar.gz";
hash = "sha256-+QP+H0bVSLbobv/W6lFBbl08RnwKvG8BVo68bwMrAzM=";
};
in
appimageTools.wrapType2 {
inherit pname version;
src = "${srcZipped}/git-butler_${version}_amd64.AppImage";
}

View File

@ -20,7 +20,10 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
hardware = { hardware = {
opengl.enable = true; opengl = {
enable = true;
driSupport = true;
};
pulseaudio.enable = false; pulseaudio.enable = false;
}; };
services.xserver = { services.xserver = {

View File

@ -3,18 +3,10 @@
, ... , ...
}: }:
with lib;
let let
inherit (lib) concatStringsSep flip boolToString mapAttrsToList;
cfg = config.my.programs.hyprland; cfg = config.my.programs.hyprland;
mkMonitor = { name, resolution, position, scale, disabled, extra }:
if disabled
then "monitor=${name},disabled"
else "monitor=${name},${resolution},${position},${scale},${extra}";
monitorsList = mapAttrsToList (name: value: { name = name; } // value) cfg.monitors;
monitors = map mkMonitor monitorsList;
mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}"; mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}";
mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules); mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules);
in in
@ -25,14 +17,17 @@ in
# #
# See https://wiki.hyprland.org/Configuring/Monitors/ # See https://wiki.hyprland.org/Configuring/Monitors/
${concatStringsSep "\n" monitors} ${concatLines (map (x: "monitor=${x}") cfg.monitors)}
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input { input {
kb_layout = ${concatStringsSep "," cfg.keyboardLayouts} kb_layout = ${concatStringsSep "," cfg.keyboardLayouts}
kb_variant =
kb_model =
kb_options = grp:win_space_toggle,caps:escape kb_options = grp:win_space_toggle,caps:escape
kb_rules =
follow_mouse = 1 follow_mouse = 1
@ -52,11 +47,9 @@ in
col.active_border = rgba(1affffee) col.active_border = rgba(1affffee)
col.inactive_border = rgba(595959aa) col.inactive_border = rgba(595959aa)
layout = dwindle cursor_inactive_timeout = 1
}
cursor { layout = dwindle
inactive_timeout = 1
} }
decoration { decoration {
@ -109,7 +102,7 @@ in
master { master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
no_gaps_when_only = true no_gaps_when_only = true
new_on_top = false new_is_master = false
} }
gestures { gestures {
@ -124,22 +117,15 @@ in
force_default_wallpaper = 0 force_default_wallpaper = 0
} }
xwayland {
force_zero_scaling = true
}
# scale non native wayland gtk applications
env = GDK_SCALE,1.2
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# Firefox Sharing Indicator # Firefox Sharing Indicator
${mkRules ["float" "move 49% 40" "noborder"] ["title:^(.*Sharing Indicator.*)$"]} ${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator.*)$"]}
# Emacs # Emacs
windowrulev2 = opaque, class:^(emacs)$ windowrulev2 = opaque, class:^(emacs)$
# Fullscreen Applications # Fullscreen Applications
${mkRules ["opaque" "noblur" "noborder" "noshadow" "allowsinput"] ["fullscreen:1"]} ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]}
${mkRules ["tile" "opaque"] ["class:^(neovide)$"]} ${mkRules ["tile" "opaque"] ["class:^(neovide)$"]}
@ -147,7 +133,7 @@ in
windowrulev2 = rounding 0, xwayland:1, floating:1 windowrulev2 = rounding 0, xwayland:1, floating:1
windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$ windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$
windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$
windowrulev2 = nofocus, class:^jetbrains-(?!toolbox), floating:1, title:^win\d+$ ${mkRules ["opaque" "noshadow" "noblur" "noanim" "move cursor 5 5"] ["class:^(.*jetbrains-.*)$"]}
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
@ -168,8 +154,8 @@ in
bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle
bind = $mainMod , M , exec , hyprctl keyword general:layout master bind = $mainMod , M , exec , hyprctl keyword general:layout master
bind = $mainMod , R , exec , rofi -show combi bind = $mainMod , R , exec , rofi -show combi
# bind = $mainMod , RETURN , exec , systemctl --user is-active --quiet foot && footclient --no-wait || foot
bind = $mainMod , RETURN , exec , kitty bind = $mainMod , RETURN , exec , kitty
bind = $mainMod SHIFT , RETURN , exec , kitty -- tmux new "ts || tn home ~"
# XF86 keys # XF86 keys
binde = , XF86AudioLowerVolume , exec , pamixer -d 5 binde = , XF86AudioLowerVolume , exec , pamixer -d 5
@ -232,14 +218,6 @@ in
# Toggle waybar # Toggle waybar
bindr = $mainMod , SUPER_L , exec , pkill -USR1 waybar bindr = $mainMod , SUPER_L , exec , pkill -USR1 waybar
# Lid open/close
bindl=,switch:on:Lid Switch,exec,monitors="$(hyprctl monitors | grep -c '^Monitor')" && hyprctl keyword monitor "eDP-1, disable" && [ "$monitors" = 1 ] && loginctl lock-session
bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, preferred, auto"
# Lock Screen
bind=$mainMod ALT, L, exec, loginctl lock-session
# Extra Config # Extra Config
${cfg.extraConfig} ${cfg.extraConfig}
'' ''

View File

@ -5,11 +5,11 @@
, ... , ...
} @ args: } @ args:
with lib;
let let
inherit (lib) mkOption mkEnableOption mkIf types getExe genAttrs optionalAttrs optional;
cfg = config.my.programs.hyprland; cfg = config.my.programs.hyprland;
hyprland = inputs.hyprland.packages.${pkgs.system}.default; hyprland = config.programs.hyprland.finalPackage;
in in
{ {
options.my.programs.hyprland = { options.my.programs.hyprland = {
@ -31,35 +31,9 @@ in
default = [ "de" "us" ]; default = [ "de" "us" ];
}; };
monitors = mkOption { monitors = mkOption {
type = types.attrsOf (
let
sub = types.submodule {
options = {
resolution = mkOption {
type = types.strMatching "\(preferred\)|\([[:digit:]]+x[[:digit:]]+\(@[[:digit:]]+\)\?\)";
default = "preferred";
};
position = mkOption {
type = types.strMatching "\(auto\)|\(-\?[[:digit:]]+x-?[[:digit:]]+\)";
default = "auto";
};
disabled = mkEnableOption "disabled";
scale = mkOption {
type = types.oneOf [ types.float (types.strMatching "auto") ];
default = 1.0;
apply = x: if lib.isFloat x then lib.strings.floatToString x else x;
};
extra = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; description = "monitor settings";
apply = lib.concatStringsSep ","; default = [ ",preferred,auto,1" ];
};
};
};
in
sub
);
description = "monitor setting";
}; };
extraConfig = mkOption { extraConfig = mkOption {
type = types.str; type = types.str;
@ -69,31 +43,25 @@ 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;
# foot.enable = true;
kitty.enable = true; kitty.enable = true;
rofi.enable = true; rofi.enable = true;
hyprland.monitors."" = lib.mkDefault { };
hyprland.monitors."Unknown-1" = { disabled = true; };
}; };
wallpapers.enable = true; wallpapers.enable = true;
services = { services = {
dunst.enable = true; dunst.enable = true;
wallpaper = { # wallpaper = {
enable = true; # enable = true;
target = "hyprland-session.target"; # target = "hyprland-session.target";
}; # };
spotify-player.target = "hyprland-session.target"; spotify-player.target = "hyprland-session.target";
}; };
}; };
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
package = hyprland; package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
}; };
@ -113,14 +81,6 @@ in
# add waybar as a status bar # add waybar as a status bar
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch";
sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg=";
})
];
});
# start using systemd service # start using systemd service
systemd = { systemd = {
@ -133,7 +93,7 @@ in
start_hidden = true; start_hidden = true;
layer = "top"; layer = "top";
position = "top"; position = "top";
height = 24; height = 20;
modules-left = [ "hyprland/workspaces" ]; modules-left = [ "hyprland/workspaces" ];
modules-center = [ "hyprland/window" ]; modules-center = [ "hyprland/window" ];
modules-right = [ "hyprland/language" "network" "memory" "cpu" "battery" "clock" ]; modules-right = [ "hyprland/language" "network" "memory" "cpu" "battery" "clock" ];
@ -232,16 +192,17 @@ in
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = true; pulse.enable = true;
}; };
displayManager = { xserver = {
enable = true; enable = true;
displayManager = {
lightdm.enable = true;
autoLogin = { autoLogin = {
enable = true; enable = true;
user = "moritz"; user = "moritz";
}; };
defaultSession = "hyprland"; defaultSession = "hyprland";
}; };
xserver.enable = true; };
xserver.displayManager.lightdm.enable = true;
}; };
security.rtkit.enable = true; security.rtkit.enable = true;

View File

@ -1,38 +0,0 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) any filterAttrs mapAttrsToList mkEnableOption mkIf mkOption;
cfg = config.my.programs.jetbrains;
isEnabled = _: value: value.enable;
anyEnabled = any (x: x) (mapAttrsToList isEnabled cfg);
in
{
options.my.programs.jetbrains = {
pycharm = {
enable = mkEnableOption "pycharm";
package = mkOption {
default = pkgs.jetbrains.pycharm-community;
};
};
idea = {
enable = mkEnableOption "idea";
package = mkOption {
default = pkgs.jetbrains.idea-community;
};
};
};
config = mkIf anyEnabled {
home-manager.users.moritz = {
xdg.configFile."ideavim/ideavimrc" = {
source = ./ideavimrc;
};
home.packages =
let
enabledPackages = filterAttrs isEnabled cfg;
in
mapAttrsToList (_: value: value.package) enabledPackages;
};
};
}

View File

@ -1,90 +0,0 @@
""" Map leader to space ---------------------
let mapleader=" "
""" Plugins --------------------------------
set surround
set commentary
set NERDTree
""" Common settings -------------------------
set showmode
set so=5
set incsearch
set nu
set relativenumber
set number
""" Which-Key
set which-key
set timeoutlen=5000
""" Idea specific settings ------------------
set ideajoin
""" Mappings --------------------------------
"" Quick action
let g:WhichKeyDesc_quick_action = '<leader>q Quick action'
map <leader>q <Action>(ShowIntentionActions)
"" Refactor binds
let g:WhichKeyDesc_inline = '<leader>i Inline'
map <leader>i <Action>(Inline)
let g:WhichKeyDesc_extract = '<leader>e Extract'
let g:WhichKeyDesc_extract_variable = '<leader>ev Extract variable'
map <leader>ev <Action>(IntroduceVariable)
let g:WhichKeyDesc_extract_constant = '<leader>ec Extract constant'
map <leader>ec <Action>(IntroduceConstant)
let g:WhichKeyDesc_extract_field = '<leader>ef Extract field'
map <leader>ef <Action>(IntroduceField)
let g:WhichKeyDesc_extract_parameter = '<leader>ep Extract parameter'
map <leader>ep <Action>(IntroduceParameter)
let g:WhichKeyDesc_extract_method = '<leader>em Extract method'
map <leader>em <Action>(ExtractMethod)
let g:WhichKeyDesc_rename = '<leader>r Rename'
map <leader>r <Action>(RenameElement)
"" Navigation
let g:WhichKeyDesc_prev_buffer = ']b Previous buffer'
map [b <Action>(PreviousTab)
let g:WhichKeyDesc_next_buffer = ']b Next buffer'
map ]b <Action>(NextTab)
let g:WhichKeyDesc_goto_impl = 'gI Goto implementation'
map gI <Action>(GotoImplementation)
let g:WhichKeyDesc_goto_type = 'gt Goto type declaration'
map gt <Action>(GotoTypeDeclaration)
"" Other
let g:WhichKeyDesc_terminal = '<leader>t Terminal'
map <leader>t <Action>(ActivateTerminalToolWindow)
map = <Action>(ReformatCode)
"" Folding
let g:WhichKeyDesc_folding = 'z Folding'
let g:WhichKeyDesc_folding_toggle = 'za Toggle fold'
map za <Action>(ExpandCollapseToggleAction)
let g:WhichKeyDesc_folding_expand = 'zr Fold less'
map zr <Action>(ExpandRegion)
let g:WhichKeyDesc_folding_collapse = 'zR Open all folds'
map zR <Action>(ExpandAllRegions)
let g:WhichKeyDesc_folding_collapse = 'zm Fold more'
map zm <Action>(CollapseRegion)
let g:WhichKeyDesc_folding_collapse = 'zM Close all folds'
map zM <Action>(CollapseAllRegions)
let g:WhichKeyDesc_folding_collapse_doc = 'zc Collapse doc comments'
map zc <Action>(CollapseDocComments)
let g:WhichKeyDesc_folding_expand_doc = 'zC Expand doc comments'
map zC <Action>(ExpandDocComments)
let g:WhichKeyDesc_folding_expand_level_one = 'z1 Expand all to level 1'
map z1 <Action>(ExpandAllToLevel1)
let g:WhichKeyDesc_folding_expand_level_two = 'z2 Expand all to level 2'
map z2 <Action>(ExpandAllToLevel2)
let g:WhichKeyDesc_folding_expand_level_three = 'z3 Expand all to level 3'
map z3 <Action>(ExpandAllToLevel3)
let g:WhichKeyDesc_folding_expand_level_four = 'z4 Expand all to level 4'
map z4 <Action>(ExpandAllToLevel4)

View File

@ -21,18 +21,16 @@ in
cursor_shape = "underline"; cursor_shape = "underline";
window_padding_width = 3; window_padding_width = 3;
confirm_os_window_close = 0; confirm_os_window_close = 0;
background_opacity = "0.9"; # background_opacity = "0.9";
font_features = "IntelOneMono-Regular +ss01";
resize_in_steps = "yes";
}; };
keybindings = { keybindings = {
"ctrl+plus" = "change_font_size all +2.0"; "ctrl+plus" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0"; "ctrl+minus" = "change_font_size all -2.0";
}; };
font = { # font = {
name = "Intel One Mono"; # name = "FiraCode Nerd Font";
size = 10; # size = 10;
}; # };
}; };
}; };
}; };

View File

@ -6,16 +6,9 @@
, ... , ...
}: }:
with lib;
let let
inherit (lib) mkEnableOption mkOption types;
cfg = config.my.programs.nix; cfg = config.my.programs.nix;
mkNom = system: nix:
inputs.nix-monitored.packages.${system}.default.override
{
withNotify = false;
nix = nix;
};
in in
{ {
options.my.programs.nix = { options.my.programs.nix = {
@ -30,24 +23,10 @@ in
optimise.enable = mkEnableOption "nix-optimise"; optimise.enable = mkEnableOption "nix-optimise";
}; };
config = { config.nix = {
my.nixpkgs.overlays = [
(final: prev:
{
nixos-rebuild = prev.nixos-rebuild.override {
nix = mkNom final.system final.nix;
};
})
];
home-manager.users.moritz.programs.direnv.nix-direnv.package = pkgs.nix-direnv.override {
nix = config.nix.package;
};
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
package = pkgs.nix; package = inputs.nix-super.packages.${pkgs.system}.default;
extraOptions = "experimental-features = nix-command flakes"; extraOptions = "experimental-features = nix-command flakes";
@ -73,7 +52,6 @@ in
stable.flake = inputs.stable; stable.flake = inputs.stable;
dotfiles.flake = self; dotfiles.flake = self;
default.flake = self; default.flake = self;
d.flake = self;
}; };
settings = { settings = {
@ -87,5 +65,4 @@ in
trusted-users = [ "root" "@wheel" ]; trusted-users = [ "root" "@wheel" ];
}; };
}; };
};
} }

View File

@ -1,8 +1,7 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
with lib;
let let
inherit (lib) mkEnableOption mkIf readFile;
cfg = config.my.programs.nvim; cfg = config.my.programs.nvim;
in in
{ {
@ -12,13 +11,12 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz = { home-manager.users.moritz = {
xdg.configFile."nvim/snippets" = {
recursive = true;
source = ./plugins/snippets;
};
home.packages = with pkgs; [ home.packages = with pkgs; [
xdotool # for vimtex (
if config.my.programs.hyprland.enable
then neovide-hyprland
else neovide
)
]; ];
programs.neovim = { programs.neovim = {
@ -41,12 +39,12 @@ in
nixd nixd
nixpkgs-fmt nixpkgs-fmt
nodePackages.bash-language-server nodePackages.bash-language-server
python3Packages.python-lsp-server nodePackages.jsonlint
shellcheck shellcheck
shfmt shfmt
stable.yamlfix
statix statix
taplo taplo
stable.yamlfix
yamllint yamllint
]; ];
extraLuaConfig = readFile ./options.lua; extraLuaConfig = readFile ./options.lua;

View File

@ -1,28 +1,73 @@
{ pkgs, lib, inputs, ... }: { pkgs, lib, ... }:
let with builtins;
inherit (builtins) readFile;
in
{ {
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{ {
plugin = pkgs.vimPlugins.oil-nvim; plugin = oil-nvim;
lazy = false; lazy = false;
opts = { }; opts = { };
dependencies = [{ plugin = pkgs.vimPlugins.nvim-web-devicons; }]; dependencies = [
{ plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; }
];
} }
{ {
plugin = pkgs.vimPlugins.lualine-nvim; plugin = mini-nvim;
opts = { };
dependencies = [{ plugin = pkgs.vimPlugins.nvim-web-devicons; }];
}
{
plugin = pkgs.vimPlugins.mini-nvim;
lazy = false; lazy = false;
conf = readFile ./lua/mini-nvim.lua; conf = readFile ./lua/mini-nvim.lua;
} }
{ {
plugin = pkgs.vimPlugins.nvim-cmp; plugin = trouble-nvim;
cmd = [ "TodoTelescope" ];
keys = [
{
key = "<leader>cD";
cmd = "<cmd>TroubleToggle document_diagnostics<cr>";
desc = "Document Diagnostics (Trouble)";
}
{
key = "<leader>cW";
cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>";
desc = "Workspace Diagnostics (Trouble)";
}
{ key = "<leader>cl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; }
{ key = "<leader>cq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; }
{ key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
{
key = "[q";
func = /* lua */ ''
function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end
'';
desc = "Previous trouble/quickfix item";
}
{
key = "]q";
func = /* lua */ ''
function()
if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end
'';
desc = "Next trouble/quickfix item";
}
];
opts = { };
dependencies = [
{ plugin = nvim-web-devicons; }
];
}
{
plugin = nvim-cmp;
keys = [ keys = [
{ key = "<leader>tc"; cmd = "<cmd>CmpToggle<cr>"; desc = "Toggle Cmp sources"; } { key = "<leader>tc"; cmd = "<cmd>CmpToggle<cr>"; desc = "Toggle Cmp sources"; }
]; ];
@ -30,94 +75,82 @@ in
event = [ "InsertEnter" ]; event = [ "InsertEnter" ];
dependencies = [ dependencies = [
{ {
plugin = pkgs.vimPlugins.nvim-autopairs; plugin = nvim-autopairs;
opts = { }; opts = { };
} }
{ plugin = pkgs.vimPlugins.cmp-async-path; } { plugin = cmp-async-path; }
{ plugin = pkgs.vimPlugins.cmp-buffer; } { plugin = cmp-buffer; }
{ plugin = pkgs.vimPlugins.cmp-cmdline; } { plugin = cmp-cmdline; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; } { plugin = cmp-nvim-lsp; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp; } { plugin = cmp_luasnip; }
{ plugin = cmp-spell; }
{ plugin = cmp-nvim-lsp-signature-help; }
{ {
plugin = pkgs.vimUtils.buildVimPlugin { plugin = copilot-cmp;
pname = "cmp-vimtex"; opts = { };
version = lib.my.mkVersionInput inputs.cmp-vimtex; dependencies = [
src = inputs.cmp-vimtex; {
plugin = copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
}; };
} conf = /* lua */ ''
{ plugin = pkgs.vimPlugins.cmp_luasnip; } require("copilot").setup(opts)
# { vim.cmd("Copilot disable")
# plugin = pkgs.vimPlugins.copilot-cmp; '';
# opts = { };
# dependencies = [
# {
# plugin = pkgs.vimPlugins.copilot-lua;
# opts = {
# suggestion = { enabled = false; };
# panel = { enabled = false; };
# };
# conf = /* lua */ ''
# require("copilot").setup(opts)
# vim.cmd("Copilot disable")
# '';
# }
# ];
# }
{ plugin = pkgs.vimPlugins.friendly-snippets; }
{ plugin = pkgs.vimPlugins.lspkind-nvim; }
{
plugin = pkgs.vimPlugins.luasnip;
conf = readFile ./lua/luasnip.lua;
} }
]; ];
} }
{ plugin = friendly-snippets; }
{ plugin = lspkind-nvim; }
{ plugin = luasnip; }
];
}
{ {
plugin = pkgs.vimPlugins.direnv-vim; plugin = direnv-vim;
lazy = false; lazy = false;
} }
{ {
plugin = pkgs.vimPlugins.nvim-lspconfig.overrideAttrs (_: { plugin = nvim-lspconfig;
version = lib.my.mkVersionInput inputs.nvim-lspconfig;
src = inputs.nvim-lspconfig;
});
event = [ "BufRead" "BufNewFile" ]; event = [ "BufRead" "BufNewFile" ];
conf = readFile ./lua/nvim-lspconfig.lua; conf = readFile ./lua/nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ {
# TODO: add all required tools to neovim or silence warnings plugin = null-ls-nvim;
plugin = pkgs.vimPlugins.none-ls-nvim;
conf = readFile ./lua/null-ls-nvim.lua; conf = readFile ./lua/null-ls-nvim.lua;
dependencies = [ dependencies = [
{ { plugin = which-key-nvim; }
plugin = pkgs.vimUtils.buildVimPlugin { { plugin = plenary-nvim; }
pname = "none-ls-shellcheck.nvim";
version = lib.my.mkVersionInput inputs.none-ls-shellcheck-nvim;
src = inputs.none-ls-shellcheck-nvim;
};
}
]; ];
} }
{ plugin = pkgs.vimPlugins.lsp_lines-nvim; } { plugin = which-key-nvim; }
{ plugin = lsp_lines-nvim; }
{ {
plugin = pkgs.vimPlugins.inc-rename-nvim; plugin = nvim-ufo;
conf = readFile ./lua/nvim-ufo.lua;
dependencies = [
{ plugin = promise-async; }
];
}
{
plugin = neodev-nvim;
conf = readFile ./lua/neodev-nvim.lua;
}
{
plugin = inc-rename-nvim;
opts = { opts = {
input_buffer_type = "dressing"; input_buffer_type = "dressing";
}; };
dependencies = [ dependencies = [
{ plugin = pkgs.vimPlugins.dressing-nvim; } { plugin = dressing-nvim; }
];
}
{ plugin = actions-preview-nvim; }
]; ];
} }
{ {
plugin = pkgs.vimUtils.buildVimPlugin { plugin = vim-fugitive;
pname = "actions-preview-nvim";
version = lib.my.mkVersionInput inputs.actions-preview-nvim;
src = inputs.actions-preview-nvim;
};
}
];
}
{
plugin = pkgs.vimPlugins.vim-fugitive;
cmd = [ cmd = [
"G" "G"
"Git" "Git"
@ -143,16 +176,13 @@ in
"GDelete" "GDelete"
"GBrowse" "GBrowse"
]; ];
keys = [
{ key = "<leader>gg"; cmd = "<cmd>Gedit :<cr>"; desc = "Open Status"; }
];
} }
{ {
plugin = pkgs.vimPlugins.vim-tmux-navigator; plugin = vim-tmux-navigator;
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
} }
{ {
plugin = pkgs.vimPlugins.nvim-lastplace; plugin = nvim-lastplace;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { opts = {
lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ]; lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ];
@ -161,7 +191,7 @@ in
}; };
} }
{ {
plugin = pkgs.vimPlugins.telescope-nvim; plugin = telescope-nvim;
cmd = [ "Telescope" ]; cmd = [ "Telescope" ];
conf = builtins.readFile ./lua/telescope.lua; conf = builtins.readFile ./lua/telescope.lua;
keys = [ keys = [
@ -185,49 +215,178 @@ in
{ key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Recent files"; } { key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Recent files"; }
]; ];
dependencies = [ dependencies = [
{ plugin = pkgs.vimPlugins.plenary-nvim; } { plugin = plenary-nvim; }
{ plugin = pkgs.vimPlugins.telescope-fzf-native-nvim; } { plugin = telescope-fzf-native-nvim; }
]; ];
} }
{ {
plugin = pkgs.vimPlugins.vim-startuptime; plugin = vim-startuptime;
cmd = [ "StartupTime" ]; cmd = [ "StartupTime" ];
conf = readFile ./lua/vim-startuptime.lua; conf = readFile ./lua/vim-startuptime.lua;
} }
{ {
plugin = pkgs.vimPlugins.typst-vim; plugin = typst-vim;
ft = [ "typst" "typ" ]; ft = [ "typst" "typ" ];
} }
{ {
plugin = pkgs.vimPlugins.comment-nvim; plugin = comment-nvim;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { }; opts = { };
} }
{ {
plugin = pkgs.vimPlugins.nvim-surround; 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;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
opts = { }; opts = { };
} }
{ {
plugin = pkgs.vimPlugins.conform-nvim; plugin = zen-mode-nvim;
keys = [
{ key = "<leader>tz"; cmd = "<cmd>ZenMode<cr>"; desc = "Zen mode"; }
];
conf = /* lua */ ''
require("zen-mode").setup({
plugins = {
tmux = {
enabled = true,
},
},
})
'';
dependencies = [
{
plugin = twilight-nvim;
conf = /* lua */ ''
require("twilight").setup({
context = 20,
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
"function",
"function_definition",
"if_statement",
"method",
"method_definition",
"table",
},
})
'';
}
];
}
{
plugin = refactoring-nvim;
keys = [
{
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.
}
{
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;
keys = [ keys = [
{ key = "="; cmd = "<cmd>lua require('conform').format()<cr>"; desc = "format buffer"; mode = [ "n" "v" ]; } { key = "="; cmd = "<cmd>lua require('conform').format()<cr>"; desc = "format buffer"; mode = [ "n" "v" ]; }
]; ];
cmd = [ "ConformInfo" "Format" ]; cmd = [ "ConformInfo" "Format" ];
conf = readFile ./lua/conform.lua; conf = readFile ./lua/conform.lua;
} }
{ plugin = pkgs.vimPlugins.plantuml-syntax; }
{ {
plugin = pkgs.vimPlugins.vimtex; plugin = neogen;
lazy = false;
conf = /* lua */ ''
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_mappings_disable = vim.fn.executable("texlab") == 1 and { ["n"] = { "K" } } or {} -- disable `K` as it conflicts with LSP hover if texlab is in path
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
'';
keys = [ keys = [
{ key = "<localleader>l"; cmd = ""; desc = "+vimtex"; } { 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

@ -2,8 +2,6 @@ local conform = require("conform")
local formatters_by_ft = { local formatters_by_ft = {
["*"] = { "codespell", "trim_whitespace" }, ["*"] = { "codespell", "trim_whitespace" },
elixir = { "mix" },
gleam = { "gleam" },
go = { "gofmt" }, go = { "gofmt" },
json = { "jq" }, json = { "jq" },
lua = { "stylua" }, lua = { "stylua" },
@ -11,21 +9,12 @@ local formatters_by_ft = {
python = { { "ruff_fix", "isort" }, { "ruff_format", "black" } }, python = { { "ruff_fix", "isort" }, { "ruff_format", "black" } },
rust = { "rustfmt" }, rust = { "rustfmt" },
sh = { "shfmt" }, sh = { "shfmt" },
tex = { "latexindent" },
toml = { "taplo" }, toml = { "taplo" },
yaml = { "yamlfix" }, yaml = { "yamlfix" },
} }
conform.setup({ conform.setup({
formatters_by_ft = formatters_by_ft, 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) vim.api.nvim_create_user_command("Format", function(opts)

View File

@ -1,13 +1,15 @@
require("gitsigns").setup() require("gitsigns").setup()
require("which-key").add({ require("which-key").register({
{ "<leader>gP", "<cmd>Gitsigns preview_hunk<cr>", desc = "Preview hunk (float)" }, ["[h"] = { "<cmd>Gitsigns prev_hunk<cr>", "Previous hunk" },
{ "<leader>gR", "<cmd>Gitsigns reset_buffer<cr>", desc = "Reset buffer" }, ["]h"] = { "<cmd>Gitsigns next_hunk<cr>", "Next hunk" },
{ "<leader>gS", "<cmd>Gitsigns stage_buffer<cr>", desc = "Stage buffer" }, ["<leader>g"] = {
{ "<leader>gp", "<cmd>Gitsigns preview_hunk_inline<cr>", desc = "Preview hunk (inline)" }, s = { "<cmd>Gitsigns stage_hunk<cr>", "Stage hunk", mode = { "n", "v" } },
{ "<leader>gu", "<cmd>Gitsigns undo_stage_hunk<cr>", desc = "Undo stage hunk" }, r = { "<cmd>Gitsigns reset_hunk<cr>", "Reset hunk", mode = { "n", "v" } },
{ "[h", "<cmd>Gitsigns prev_hunk<cr>", desc = "Previous hunk" }, S = { "<cmd>Gitsigns stage_buffer<cr>", "Stage buffer" },
{ "]h", "<cmd>Gitsigns next_hunk<cr>", desc = "Next hunk" }, R = { "<cmd>Gitsigns reset_buffer<cr>", "Reset buffer" },
{ "<leader>gr", "<cmd>Gitsigns reset_hunk<cr>", desc = "Reset hunk", mode = { "n", "v" } }, u = { "<cmd>Gitsigns undo_stage_hunk<cr>", "Undo stage hunk" },
{ "<leader>gs", "<cmd>Gitsigns stage_hunk<cr>", desc = "Stage hunk", mode = { "n", "v" } }, p = { "<cmd>Gitsigns preview_hunk_inline<cr>", "Preview hunk (inline)" },
{ "ih", ":<C-U>Gitsigns select_hunk<cr>", desc = "gitsigns hunk", mode = { "o", "x" } }, P = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk (float)" },
},
["ih"] = { ":<C-U>Gitsigns select_hunk<cr>", "gitsigns hunk", mode = { "o", "x" } },
}) })

View File

@ -1,25 +0,0 @@
local ls = require("luasnip")
local types = require("luasnip.util.types")
-- Every unspecified option will be set to the default.
ls.setup({
history = true,
-- Update more often, :h events for more info.
update_events = "TextChanged,TextChangedI",
-- Snippets aren't automatically removed if their text is deleted.
-- `delete_check_events` determines on which events (:h events) a check for
-- deleted snippets is performed.
-- This can be especially useful when `history` is enabled.
delete_check_events = "TextChanged",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "<--", "Error" } },
},
},
},
ft_func = require("luasnip.extras.filetype_functions").from_pos_or_filetype,
})
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })

View File

@ -1 +1,47 @@
require("mini.align").setup() require("mini.align").setup()
require("mini.move").setup()
require("mini.statusline").setup({
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 75 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
local location = MiniStatusline.section_location({ trunc_width = 75 })
local mode_hl_inverse = mode_hl .. "Inverse"
-- Usage of `MiniStatusline.combine_groups()` ensures highlighting and
-- correct padding with spaces between groups (accounts for 'missing'
-- sections, etc.)
return MiniStatusline.combine_groups({
{ hl = mode_hl_inverse, strings = {} },
"",
{ hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { git, diagnostics } },
"%<", -- Mark general truncate point
{ hl = "MiniStatuslineFilename", strings = { filename } },
"%=", -- End left alignment
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
{ hl = mode_hl, strings = { location } },
{ hl = mode_hl_inverse, strings = {} },
"",
})
end,
},
})
local MiniStatuslineModes = {
"MiniStatuslineModeInsert",
"MiniStatuslineModeNormal",
"MiniStatuslineModeReplace",
"MiniStatuslineModeVisual",
"MiniStatuslineModeCommand",
"MiniStatuslineModeOther",
}
for _, mode_hl in ipairs(MiniStatuslineModes) do
local hl_table = vim.api.nvim_get_hl(0, { name = mode_hl })
local fg = hl_table.fg
hl_table.fg = hl_table.bg
hl_table.bg = fg
vim.api.nvim_set_hl(0, mode_hl .. "Inverse", hl_table)
end

View File

@ -3,14 +3,15 @@ local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
sources = { sources = {
-- Code actions -- Code actions
require("none-ls-shellcheck.code_actions"), null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.code_actions.statix, null_ls.builtins.code_actions.statix,
-- Diagnostics -- Diagnostics
null_ls.builtins.diagnostics.checkmake, null_ls.builtins.diagnostics.checkmake,
null_ls.builtins.diagnostics.deadnix, null_ls.builtins.diagnostics.deadnix,
null_ls.builtins.diagnostics.dotenv_linter, null_ls.builtins.diagnostics.dotenv_linter,
null_ls.builtins.diagnostics.fish, null_ls.builtins.diagnostics.fish,
require("none-ls-shellcheck.diagnostics"), null_ls.builtins.diagnostics.jsonlint,
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.statix, null_ls.builtins.diagnostics.statix,
null_ls.builtins.diagnostics.trail_space, null_ls.builtins.diagnostics.trail_space,
null_ls.builtins.diagnostics.yamllint, null_ls.builtins.diagnostics.yamllint,

View File

@ -2,6 +2,14 @@ local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end
cmp.setup({ cmp.setup({
formatting = { formatting = {
format = require("lspkind").cmp_format({ format = require("lspkind").cmp_format({
@ -9,7 +17,7 @@ cmp.setup({
maxwidth = 50, -- prevent the popup from showing more than provided characters maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = { symbol_map = {
-- Copilot = "", Copilot = "",
}, },
}), }),
}, },
@ -23,55 +31,36 @@ cmp.setup({
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<S-CR>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif luasnip.locally_jumpable(1) then elseif luasnip.expand_or_jumpable() then
luasnip.jump(1) luasnip.expand_or_jump()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if luasnip.choice_active() then
luasnip.change_choice(1)
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if luasnip.choice_active() then
luasnip.change_choice(-1)
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
}), }),
sources = cmp.config.sources({ sources = {
{ priority = 1, name = "async_path" }, { name = "async_path", priority = 1 },
{ priority = 1, name = "buffer" }, { name = "buffer", priority = 1 },
{ priority = 1, name = "spell" }, { name = "spell", priority = 1 },
{ priority = 2, name = "nvim_lsp" }, { name = "luasnip", priority = 2 },
-- { priority = 3, name = "copilot" }, { name = "copilot", priority = 3 },
{ priority = 3, name = "nvim_lsp_signature_help" }, { name = "nvim_lsp", priority = 3 },
{ priority = 4, name = "luasnip" }, { name = "nvim_lsp_signature_help", priority = 3 },
{ priority = 4, name = "vimtex" }, },
}),
}) })
-- Set configuration for specific filetype. -- Set configuration for specific filetype.

View File

@ -21,28 +21,37 @@ capabilities.didChangeWatchedFiles = {
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local on_attach_def = function(client, bufnr) local on_attach_def = function(client, bufnr)
require("which-key").add({ require("which-key").register({
{ "<leader>c", buffer = bufnr, group = "code" }, K = {
{ function()
"<leader>cr", local winid = require("ufo").peekFoldedLinesUnderCursor()
if not winid then
vim.lsp.buf.hover()
end
end,
"Hover",
},
["<leader>"] = {
c = {
name = "code",
c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } },
r = {
function() function()
return ":IncRename " .. vim.fn.expand("<cword>") return ":IncRename " .. vim.fn.expand("<cword>")
end, end,
buffer = bufnr, "Rename",
desc = "Rename",
expr = true, expr = true,
replace_keycodes = false,
}, },
{ f = {
"<leader>ti",
function() function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) vim.lsp.buf.format({ async = true })
end, end,
buffer = bufnr, "Format (lsp)",
desc = "LSP inlay hints", mode = { "n", "v" },
}, },
{ },
"<leader>tl", t = {
l = {
function() function()
lsp_lines.toggle() lsp_lines.toggle()
if vim.diagnostic.is_disabled() then if vim.diagnostic.is_disabled() then
@ -51,57 +60,49 @@ local on_attach_def = function(client, bufnr)
vim.diagnostic.disable() vim.diagnostic.disable()
end end
end, end,
buffer = bufnr, "LSP lines",
desc = "LSP lines",
}, },
{ "K", vim.lsp.buf.hover, buffer = bufnr, desc = "Hover" }, i = {
{ "[d", vim.diagnostic.goto_prev, buffer = bufnr, desc = "Previous diagnostic" }, function()
{ "]d", vim.diagnostic.goto_next, buffer = bufnr, desc = "Next diagnostic" }, vim.lsp.inlay_hint.enable(bufnr, not vim.lsp.inlay_hint.is_enabled(bufnr))
{ "gD", vim.lsp.buf.declaration, buffer = bufnr, desc = "Goto declaration" }, end,
{ "gI", "<cmd>Telescope lsp_implementations<cr>", buffer = bufnr, desc = "Goto implementation" }, "LSP inlay hints",
{ "gK", vim.lsp.buf.signature_help, buffer = bufnr, desc = "Signature help" }, },
{ },
"gd", },
g = {
d = {
function() function()
require("telescope.builtin").lsp_definitions({ reuse_win = true }) require("telescope.builtin").lsp_definitions({ reuse_win = true })
end, end,
buffer = bufnr, "Goto definition",
desc = "Goto definition",
}, },
{ "gr", "<cmd>Telescope lsp_references<cr>", buffer = bufnr, desc = "Goto references" }, t = {
{
"gt",
function() function()
require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
end, end,
buffer = bufnr, "Goto type definition",
desc = "Goto type definition",
}, },
{ r = { "<cmd>Telescope lsp_references<cr>", "Goto references" },
"<leader>cc", D = { vim.lsp.buf.declaration, "Goto declaration" },
require("actions-preview").code_actions, I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
buffer = bufnr, K = { vim.lsp.buf.signature_help, "Signature help" },
desc = "Code action",
mode = { "n", "v" },
}, },
{ ["["] = {
"<leader>cf", d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
function()
vim.lsp.buf.format({ async = true })
end,
buffer = bufnr,
desc = "Format (lsp)",
mode = { "n", "v" },
}, },
}) ["]"] = {
d = { vim.diagnostic.goto_next, "Next diagnostic" },
},
}, { buffer = bufnr, silent = true })
if client.server_capabilities.inlayHintProvider then if client.server_capabilities.inlayHintProvider then
local slow_lsp_servers = { local slow_lsp_servers = {
"rust_analyzer", "rust_analyzer",
} }
local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0 local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0
vim.defer_fn(function() vim.defer_fn(function()
vim.lsp.inlay_hint.enable(true, { bufnr }) vim.lsp.inlay_hint.enable(bufnr, true)
end, timeout) end, timeout)
end end
end end
@ -125,10 +126,10 @@ end
local servers = { local servers = {
"bashls", "bashls",
"gleam",
"gopls", "gopls",
"pylsp", "nil_ls",
"ruff", "nixd",
"ruff_lsp",
"templ", "templ",
"typst_lsp", "typst_lsp",
} }
@ -136,41 +137,6 @@ for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {}) lspconfig_setup(lsp, {})
end end
lspconfig_setup("elixirls", {
cmd = { "elixir-ls" },
})
lspconfig_setup("nil_ls", {
settings = {
flake = {
autoArchive = true,
autoEvalInputs = true,
nixpkgsInputName = "nixpkgs",
},
},
})
lspconfig_setup("nixd", {
settings = {
nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }",
},
options = {
nixos = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options',
},
["flake-parts"] = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).debug.options',
},
["flake-parts2"] = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options',
},
},
},
},
})
-- Add templ filetype -- Add templ filetype
vim.filetype.add({ extension = { templ = "templ" } }) vim.filetype.add({ extension = { templ = "templ" } })
@ -183,6 +149,18 @@ lspconfig_setup("tailwindcss", {
init_options = { userLanguages = { templ = "html" } }, init_options = { userLanguages = { templ = "html" } },
}) })
lspconfig_setup("pylsp", {
settings = {
pylsp = {
plugins = {
rope_autoimport = {
enabled = true,
},
},
},
},
})
lspconfig_setup("rust_analyzer", { lspconfig_setup("rust_analyzer", {
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {

View File

@ -0,0 +1,22 @@
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
local builtin = require("statuscol.builtin")
require("statuscol").setup({
segments = {
{
sign = { name = { ".*" }, auto = true },
click = "v:lua.ScSa",
},
{
text = { builtin.lnumfunc },
click = "v:lua.ScLa",
},
{
sign = { namespace = { "gitsigns*" }, auto = true },
click = "v:lua.ScSa",
},
{
text = { builtin.foldfunc, "" },
click = "v:lua.ScFa",
},
},
})

View File

@ -2,50 +2,60 @@ vim.o.timeout = true
vim.o.timeoutlen = 500 vim.o.timeoutlen = 500
-- Delete -- Delete
require("which-key").add({ require("which-key").register({
{ "<leader>d", group = "delete" }, d = {
{ "<leader>db", "<cmd>bd<cr>", desc = "Delete buffer" }, name = "delete",
{ "<leader>dw", "<C-w>c", desc = "Delete window" }, b = { "<cmd>bd<cr>", "Delete buffer" },
}) w = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
-- buffer -- buffer
require("which-key").add({ require("which-key").register({
{ "[b", "<cmd>bprevious<cr>", desc = "Previous buffer" }, ["["] = {
{ "]b", "<cmd>bnext<cr>", desc = "Next buffer" }, b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
}) })
-- window -- window
require("which-key").add({ require("which-key").register({
{ "<leader>w", group = "window" }, w = {
{ "<leader>w-", "<C-w>s", desc = "Split window vertically" }, name = "window",
{ "<leader>ww", "<C-w>w", desc = "Switch window" }, ["|"] = { "<C-w>v", "Split window horizontally" },
{ "<leader>w|", "<C-w>v", desc = "Split window horizontally" }, ["-"] = { "<C-w>s", "Split window vertically" },
}) w = { "<C-w>w", "Switch window" },
},
}, { prefix = "<leader>" })
-- better descriptions for navigation -- better descriptions for navigation
require("which-key").add({ require("which-key").register({
{ "<leader>c", group = "code" }, ["<leader>"] = {
{ "<leader>f", group = "file/find" }, f = { name = "file/find" },
{ "<leader>g", group = "git" }, g = { name = "git" },
{ "<leader>s", group = "search" }, c = { name = "code" },
{ "<leader>t", group = "toggle" }, s = { name = "search" },
{ "[", group = "prev" }, t = { name = "toggle" },
{ "]", group = "next" }, },
{ "g", group = "goto" }, ["["] = { name = "prev" },
["]"] = { name = "next" },
g = { name = "goto" },
}) })
-- Clear search with <esc> -- Clear search with <esc>
require("which-key").add({ require("which-key").register({
{ "<esc>", "<cmd>noh<cr><esc>", desc = "Escape and clear hlsearch", mode = { "i", "n" } }, ["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
}) })
-- better indenting -- better indenting
require("which-key").add({ require("which-key").register({
{ "<", "<gv", desc = "Shift left", mode = "v" }, ["<"] = { "<gv", "Shift left" },
{ ">", ">gv", desc = "Shift right", mode = "v" }, [">"] = { ">gv", "Shift right" },
}) }, { mode = "v" })
-- better yank in visual mode -- better yank in visual mode
require("which-key").add({ require("which-key").register({
{ "y", "ygv<esc>", desc = "Yank", mode = "v" }, y = { "ygv<esc>", "Yank" },
}) }, { mode = "v" })

View File

@ -1,46 +0,0 @@
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 def_template = [[
def {fname}({args}) do
{final}
end
]]
local def = s(
"def",
fmt(def_template, {
fname = i(1, "fname"),
args = i(2),
final = i(3),
}, { priority = 1001 })
)
return {
def,
}

View File

@ -1,120 +0,0 @@
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,
}

View File

@ -1,138 +0,0 @@
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 pe = s(
"pe",
fmt("<%= {final} %>", {
final = i(1),
}, { priority = 1001 })
)
local ln = s(
"ln",
fmt(
[[
<.link navigate={{~p"{path}"}}">{final}</.link>
]],
{ path = i(1, "/"), final = i(2) },
{ priority = 1001 }
)
)
local lp = s(
"lp",
fmt(
[[
<.link patch={{~p"{path}"}}">{final}</.link>
]],
{ path = i(1, "/"), final = i(2) },
{ priority = 1001 }
)
)
local if_ = s(
"if",
fmt("<%= if {condition} do %>{final}<% end %>", { condition = i(1, "condition"), final = i(2) }, { priority = 1001 })
)
local ife = s(
"ife",
fmt(
[[
<%= if {condition} do %>
{when}
<% else %>
{final}
<% end %>"
]],
{ condition = i(1, "condition"), when = i(2), final = i(3) },
{ priority = 1001 }
)
)
local for_ = s(
"for",
fmt(
[[
<%= for {item} <- {list} do %>
{final}
<% end %>
]],
{ item = i(1, "item"), list = i(2, "items"), final = i(3) },
{ priority = 1001 }
)
)
local lc =
s("lc", fmt("<.live_component module={{{module}}} id={{{id}}} />", { module = i(1), id = i(2) }, { priority = 1001 }))
local slot = s(
"slot",
fmt("<:slot>{final}</:slot>", {
final = i(1),
}, { priority = 1001 })
)
local socketp = s(
"socketp",
fmt(
[[
socket =
socket
|> {final}
]],
{ final = i(1) },
{ priority = 1001 }
)
)
local fl = s(
"fl",
fmt(
[[
<{elem} :for={{{item} <- {list}}} class="{class}">
{final}
</{elem}>
]],
{ elem = i(1, "div"), item = i(2, "item"), list = i(3, "items"), class = i(4), final = i(5) },
{ priority = 1001, repeat_duplicates = true }
)
)
return {
pe,
ln,
lp,
if_,
ife,
for_,
lc,
slot,
socketp,
fl,
}

View File

@ -1,242 +0,0 @@
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 arg_template = [[
{arg}: {type}
]]
local function pyarg()
return sn(
nil,
fmt(arg_template, {
arg = i(1, "arg"),
type = i(2, "Any"),
})
)
end
local function pyargs(_, _, _, user_args)
local choices = {
sn(nil, i(1)),
sn(nil, {
not user_args and t(", ") or t(""),
d(1, pyarg),
d(2, pyargs, { user_args = { false } }),
}),
}
-- switch order for first call
if user_args then
local fst, snd = unpack(choices)
choices = { snd, fst }
end
return sn(nil, c(1, choices))
end
local def_template = [[
def {fname}({args}) -> {rtype}:
"""
{docs}
"""
{final}
]]
local def = s(
"def",
fmt(def_template, {
fname = i(1, "fname"),
args = d(2, pyargs, nil, { user_args = { true } }),
rtype = i(3, "None"),
docs = i(4, "Documentation"),
final = i(5, "pass"),
}, { priority = 1001 })
)
local defs_template = [[
def {mname}(self, {args}) -> {rtype}:
"""
{docs}
"""
{final}
]]
local defs = s(
"defs",
fmt(defs_template, {
mname = i(1, "mname"),
args = d(2, pyargs, nil, { user_args = { true } }),
rtype = i(3, "None"),
docs = i(4, "Documentation"),
final = i(5, "pass"),
}, { priority = 1001 })
)
local enum_template = [[
for {i}, {value} in enumerate({iter}):
{final}
]]
local dot_enum = postfix(".enum", {
d(1, function(_, parent)
return sn(
1,
fmt(enum_template, {
i = i(1, "i"),
value = i(2, "value"),
iter = t(parent.env.POSTFIX_MATCH),
final = i(3, "pass"),
})
)
end),
})
local enum = s(
"enum",
fmt(enum_template, {
i = i(1, "i"),
value = i(2, "value"),
iter = i(3, "iter"),
final = i(4, "pass"),
})
)
local for_template = [[
for {item} in {iter}:
{final}
]]
local dot_for = postfix(".for", {
d(1, function(_, parent)
return sn(
1,
fmt(for_template, {
item = i(1, "item"),
iter = t(parent.env.POSTFIX_MATCH),
final = i(2, "pass"),
})
)
end),
})
local items_template = [[
for {key}, {value} in {iter}:
{final}
]]
local dot_items = postfix(".items", {
d(1, function(_, parent)
return sn(
1,
fmt(items_template, {
key = i(1, "key"),
value = i(2, "value"),
iter = t(parent.env.POSTFIX_MATCH),
final = i(3, "pass"),
})
)
end),
})
local try_template = [[
try:
{raises}
except {exception} as {ename}:
{final}
]]
local dot_try = postfix(".try", {
d(1, function(_, parent)
return sn(
1,
fmt(try_template, {
raises = t(parent.env.POSTFIX_MATCH),
exception = i(1, "Exception"),
ename = i(2, "e"),
final = i(3, "pass"),
})
)
end),
})
local parr = s(
"parr",
fmt(
[[
:param {name}: {description}
:type {name}: {type}
]],
{
name = i(1, "name"),
description = i(2, "description"),
type = i(3, "type"),
},
{
repeat_duplicates = true,
}
)
)
local retr = s(
"retr",
fmt(
[[
:return: {description}
:rtype: {rtype}
]],
{
description = i(1, "description"),
rtype = i(2, "rtype"),
}
)
)
local raisr = s(
"raisr",
fmt(
[[
:raises {exception}: {description}
]],
{
exception = i(1, "Exception"),
description = i(2, "description"),
}
)
)
return {
def,
defs,
dot_enum,
dot_for,
dot_items,
dot_try,
enum,
parr,
retr,
raisr,
}

View File

@ -1,13 +1,13 @@
{ pkgs, inputs, lib, ... }: { pkgs, config, ... }:
with builtins;
{ {
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
( (
let let
nvim-treesitter = pkgs.vimPlugins.nvim-treesitter;
parserDir = pkgs.symlinkJoin { parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all"; name = "tresitter-grammars-all";
paths = nvim-treesitter.withAllGrammars.dependencies; paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
}; };
in in
{ {
@ -18,7 +18,6 @@
auto_install = false; auto_install = false;
highlight = { highlight = {
enable = true; enable = true;
disable = [ "latex" ];
}; };
textobjects = textobjects =
{ {
@ -52,17 +51,31 @@
}; };
}; };
conf = conf =
/* lua */ '' ''
vim.opt.runtimepath:append("${parserDir}")
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" }) local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
require('nvim-treesitter.configs').setup(final_opts) require('nvim-treesitter.configs').setup(final_opts)
''; '';
init = ''
local runtimepath = vim.opt.runtimepath:get()
table.insert(runtimepath, 4, "${parserDir}")
vim.opt.runtimepath = runtimepath
'';
priority = 100; priority = 100;
dependencies = [ dependencies = [
{ plugin = pkgs.vimPlugins.nvim-treesitter-textobjects; } { plugin = nvim-treesitter-textobjects; }
{ plugin = pkgs.vimPlugins.nvim-ts-context-commentstring; opts = { }; } { plugin = nvim-ts-context-commentstring; opts = { }; }
]; ];
} }
) )
{
plugin = nvim-treesitter-textsubjects;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/nvim-treesitter-textsubjects.lua;
}
{
plugin = nvim-treesitter-context;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
]; ];
} }

View File

@ -1,84 +1,47 @@
{ pkgs, lib, inputs, ... }: { pkgs, ... }:
let with builtins;
inherit (lib) readFile;
in
{ {
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{ {
plugin = pkgs.vimPlugins.which-key-nvim; plugin = which-key-nvim;
lazy = false; lazy = false;
conf = readFile ./lua/which-key-nvim.lua; conf = readFile ./lua/which-key-nvim.lua;
} }
{ {
plugin = pkgs.vimPlugins.catppuccin-nvim; plugin = catppuccin-nvim;
conf = readFile ./lua/catppuccin-nvim.lua; conf = readFile ./lua/catppuccin-nvim.lua;
lazy = false; lazy = false;
priority = 99; priority = 99;
} }
{ {
plugin = pkgs.vimPlugins.todo-comments-nvim; plugin = todo-comments-nvim;
dependencies = [{ plugin = pkgs.vimPlugins.plenary-nvim; }]; event = [ "BufReadPost" "BufNewFile" ];
dependencies = [{ plugin = plenary-nvim; }];
opts = { }; opts = { };
} }
{ {
plugin = pkgs.vimPlugins.dressing-nvim; plugin = statuscol-nvim;
event = [ "VeryLazy" ];
conf = readFile ./lua/statuscol-nvim.lua;
}
{
plugin = smartcolumn-nvim;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
colorcolumn = "120";
disabled_filetypes = [ "help" "text" "markdown" "dashboard" ];
};
}
{
plugin = dressing-nvim;
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
} }
{ {
plugin = pkgs.vimPlugins.gitsigns-nvim; plugin = gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/gitsigns-nvim.lua; conf = readFile ./lua/gitsigns-nvim.lua;
dependencies = [{ plugin = pkgs.vimPlugins.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 = pkgs.vimPlugins.plenary-nvim; }
{ plugin = pkgs.vimPlugins.nvim-treesitter; }
];
}
{
plugin = pkgs.vimPlugins.zen-mode-nvim;
keys = [
{ key = "<leader>tz"; cmd = "<cmd>ZenMode<cr>"; desc = "Zen mode"; }
];
conf = /* lua */ ''
require("zen-mode").setup({
plugins = {
tmux = {
enabled = true,
},
},
})
'';
dependencies = [
{
plugin = pkgs.vimPlugins.twilight-nvim;
keys = [
{ key = "<leader>tZ"; cmd = "<cmd>Twilight<cr>"; desc = "Twilight mode"; }
];
conf = /* lua */ ''
require("twilight").setup({
context = 20,
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
"function",
"function_definition",
"if_statement",
"method",
"method_definition",
"table",
},
})
'';
}
];
} }
]; ];
} }

View File

@ -4,13 +4,11 @@
, ... , ...
}: }:
with lib;
let let
inherit (lib) range filterAttrs attrNames foldl' head tail mkOption mkEnableOption intersectLists genAttrs flip getAttr;
inherit (lib.types) listOf enum package;
cfg = config.my.programs.python; cfg = config.my.programs.python;
pythonVersions = map (version: "3${toString version}") (range 8 13); pythonVersions = map (version: "3${toString version}") (range 8 11);
enabledVersions = filterAttrs (_: value: value.enable) cfg.versions; enabledVersions = filterAttrs (_: value: value.enable) cfg.versions;
pythonPackages = version: attrNames pkgs."python${version}Packages"; pythonPackages = version: attrNames pkgs."python${version}Packages";
@ -25,7 +23,7 @@ let
enable = mkEnableOption (toString version); enable = mkEnableOption (toString version);
pythonPackages = mkOption { pythonPackages = mkOption {
default = [ ]; default = [ ];
type = listOf (enum (pythonPackages version)); type = with types; listOf (enum (pythonPackages version));
}; };
}; };
in in
@ -34,11 +32,11 @@ in
versions = genAttrs pythonVersions versionOpts; versions = genAttrs pythonVersions versionOpts;
defaultPackages = mkOption { defaultPackages = mkOption {
default = [ ]; default = [ ];
type = listOf (enum commonPackages); type = with types; listOf (enum commonPackages);
}; };
extraPackages = mkOption { extraPackages = mkOption {
default = [ ]; default = [ ];
type = listOf package; type = with types; listOf package;
}; };
}; };

View File

@ -1,293 +0,0 @@
{ config
, lib
, pkgs
, ...
}:
let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.my.programs.river;
in
{
options.my.programs.river = {
enable = mkEnableOption "river";
keyboardLayouts = mkOption {
type = types.listOf types.str;
description = "list of keyboard layouts";
default = [ "us" "de" ];
};
nvidiaSupport = mkEnableOption "nvidiaSupport";
};
config = mkIf cfg.enable {
programs.river.enable = true;
my = {
programs = {
wallpaper.enable = true;
kitty.enable = true;
tofi.enable = true;
};
wallpapers.enable = true;
services = {
dunst.enable = true;
wallpaper = {
enable = true;
target = "river-session.target";
};
spotify-player.target = "river-session.target";
};
};
home-manager.users.moritz = {
home.packages = with pkgs; [
rivercarro
];
services.kanshi = {
enable = true;
systemdTarget = "river-session.target";
};
wayland.windowManager.river = {
enable = true;
settings = {
border-width = 2;
declare-mode = [
"locked"
"normal"
"passthrough"
];
map = {
normal = {
"Super Q" = "close";
"Super Return" = "spawn kitty";
"Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' '';
"Super W" = ''spawn "pkill -USR1 waybar"'';
"Super+Shift R" = "spawn ~/.config/river/init";
# Focus view
"Super J" = "focus-view next";
"Super K" = "focus-view previous";
# swap the focused view
"Super+Shift J" = "swap next";
"Super+Shift K" = "swap previous";
# focus output
"Super Period" = "focus-output next";
"Super Comma" = "focus-output previous";
# send to output
"Super+Shift Period" = "send-to-output next";
"Super+Shift Comma" = "send-to-output previous";
# bump in layout stack
"Super Z" = "zoom";
# lock screen
"Super+Alt L" = ''spawn "loginctl lock-session"'';
} //
# tags
(
let
numbers = lib.range 1 9;
toTag = num: "$((1 << (${toString num} - 1)))";
mkMappings = num:
let
numStr = toString num;
tag = toTag num;
in
[
# Super+Control+[1-9] to toggle focus of tag [0-8]
{ name = "Super ${numStr}"; value = "set-focused-tags ${tag}"; }
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
{ name = "Super+Shift ${numStr}"; value = "toggle-view-tags ${tag}"; }
];
mappings = lib.flatten (map mkMappings numbers);
in
lib.listToAttrs mappings
);
};
map-pointer = {
normal = {
"Super BTN_LEFT" = "move-view";
"Super BTN_RIGHT" = "resize-view";
"Super BTN_MIDDLE" = "toggle-float";
};
};
attach-mode = "bottom";
default-layout = "rivercarro";
focus-follows-cursor = "normal";
hide-cursor = {
timeout = "1500";
when-typing = "enabled";
};
set-cursor-warp = "on-focus-change";
keyboard-layout = "-options grp:win_space_toggle,caps:escape ${lib.concatStringsSep "," cfg.keyboardLayouts}";
};
extraConfig = /* bash */ ''
rivercarro_pid="$(pidof rivercarro)"
if [[ -z $rivercarro_pid ]]; then
rivercarro -inner-gaps 4 -outer-gaps 4 &
fi
'';
};
# add waybar as a status bar
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch";
sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg=";
})
];
});
# start using systemd service
systemd = {
enable = true;
target = "river-session.target";
};
settings = {
mainBar = {
start_hidden = true;
layer = "top";
position = "top";
height = 20;
modules-left = [ "river/tags" ];
modules-center = [ "river/window" ];
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
};
};
style = lib.readFile ./style.css;
};
# lock screen after timeout
programs.swaylock = {
enable = true;
settings = {
color = "000000";
};
};
services.swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "${lib.getExe pkgs.swaylock} -fF";
}
{
event = "lock";
command = "${lib.getExe pkgs.swaylock} -fF";
}
];
timeouts =
let
lockTimeout = 10;
in
[
{
timeout = lockTimeout * 60 - 10;
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
}
{
timeout = lockTimeout * 60 + 10;
command = "${pkgs.systemd}/bin/loginctl lock-session";
}
];
systemdTarget = "river-session.target";
};
};
# adds pam module for swaylock
security.pam.services.swaylock = { };
# add user packages for wayland and hyprland in particular
users.users.moritz.packages = with pkgs; [
brightnessctl # control brightness
grimblast # screenshot tool for hyprland
pamixer # pulse audio cli
playerctl # control media playback
slurp # region select for wayland (for screensharing)
wdisplays # manage monitors
wl-clipboard # clipboard tool for wayland
];
# additional environment variables
environment.sessionVariables =
{
XDG_CURRENT_DESKTOP = "river";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "river";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland;xcb";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct";
_JAVA_AWT_WM_NONEREPARENTING = "1";
} // (lib.optionalAttrs cfg.nvidiaSupport
{
GBM_BACKEND = "nvidia-drm";
GDK_BACKEND = "wayland";
LIBVA_DRIVER_NAME = "nvidia";
MOZ_ENABLE_WAYLAND = "1";
WLR_DRM_DEVICES = "/dev/dri/card0";
WLR_DRM_NO_ATOMIC = "1";
WLR_NO_HARDWARE_CURSORS = "1";
XDG_CURRENT_DESKTOP = "river";
_GL_GSYNC_ALLOWED = "0";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
__GL_VRR_ALLOWED = "0";
});
services = {
dbus.enable = true;
# use pipewire (needed for screensharing)
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
displayManager = {
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "river";
};
xserver = {
enable = true;
displayManager.lightdm.enable = true;
};
};
security.rtkit.enable = true;
home-manager.users.moritz.systemd.user.services =
let
units = [ "waybar" ];
mkAfter = _: {
Unit = {
After = [ "river-session.target" ];
Wants = [ "river-session.target" ];
};
};
in
lib.genAttrs units mkAfter;
systemd.user.services =
let
units = [ "pipewire" "xdg-desktop-portal" "wireplumber" ];
mkAfter = _: {
after = [ "river-session.target" ];
wants = [ "river-session.target" ];
};
in
lib.genAttrs units mkAfter;
};
}

View File

@ -1,339 +0,0 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}
#tags button {
color: black;
}
#tags button.occupied {
color: white;
}
#tags button.focused {
background-color: grey;
}

View File

@ -12,8 +12,10 @@ in
options.my.programs.sway.enable = mkEnableOption "sway"; options.my.programs.sway.enable = mkEnableOption "sway";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
hardware.opengl.enable = true; hardware.opengl = {
enable = true;
driSupport = true;
};
environment.loginShellInit = '' environment.loginShellInit = ''
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway exec sway

View File

@ -1,44 +0,0 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.tofi;
configText =
let
settingsStrings = mapAttrsToList (name: value: "${name} = ${value}") cfg.settings;
in
concatLines settingsStrings;
in
{
options.my.programs.tofi = {
enable = mkEnableOption "tofi";
settings = mkOption {
type = with types; attrsOf str;
default = { };
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
(lib.mkIf config.networking.networkmanager.enable networkmanager_dmenu)
# (lib.mkIf config.hardware.bluetooth.enable rofi-bluetooth)
# rofi-power-menu
];
home-manager.users.moritz = {
home.packages = with pkgs; [ tofi ];
xdg = {
enable = true;
configFile."tofi/config".text = configText;
configFile."networkmanager-dmenu/config.ini".text = ''
[dmenu]
dmenu_command = tofi
'';
};
};
};
}

View File

@ -8,14 +8,7 @@ let
script = pkgs.writeShellApplication { script = pkgs.writeShellApplication {
name = "wallpaper"; name = "wallpaper";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [ findutils coreutils feh swaybg fzf viu ];
findutils
coreutils
feh
swaybg
fzf
(viu.override { withSixel = true; })
];
text = builtins.readFile ./wallpaper.sh; text = builtins.readFile ./wallpaper.sh;
}; };
in in

View File

@ -1,6 +1,5 @@
{ config { config
, lib , lib
, pkgs
, ... , ...
}: { }: {
## System security tweaks ## System security tweaks
@ -70,7 +69,6 @@
# SSH # SSH
services.openssh = { services.openssh = {
package = pkgs.master.openssh; # HACK: to fix CVE-2024-6387
settings = { settings = {
# Disable ssh password login # Disable ssh password login
PasswordAuthentication = lib.mkDefault false; PasswordAuthentication = lib.mkDefault false;

View File

@ -13,8 +13,8 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager.users.moritz.services.dunst.enable = true; home-manager.users.moritz.services.dunst.enable = true;
home-manager.users.moritz.services.dunst.settings.global = { # home-manager.users.moritz.services.dunst.settings.global = {
font = "Monospace 10"; # font = "Monospace 10";
}; # };
}; };
} }

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;
} }