feat: add moritz-desktop

This commit is contained in:
Moritz Böhme 2025-03-31 08:11:10 +00:00
parent 375cec3c73
commit 74bf4b184d
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
145 changed files with 8891 additions and 17 deletions

9
.gitattributes vendored Normal file
View file

@ -0,0 +1,9 @@
modules/moritz/config/wallpapers/wallpapers/blender_pink_blue.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/elephants.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/forest_road.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/red_beetle.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/stardust.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/a_short_walk.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/little-ships.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/old-hardware.jpg filter=lfs diff=lfs merge=lfs -text
modules/moritz/config/wallpapers/wallpapers/whale_in_sky.jpg filter=lfs diff=lfs merge=lfs -text

1034
flake.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,9 @@
{
inputs =
{
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
master.url = "github:nixos/nixpkgs";
stable.url = "github:nixos/nixpkgs/nixos-24.11";
# New flake-parts input
flake-parts.url = "github:hercules-ci/flake-parts";
@ -13,6 +15,46 @@
# New
inputs.flake-parts.follows = "flake-parts";
};
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
impermanence.url = "github:nix-community/impermanence";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
nur.url = "github:nix-community/NUR";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-monitored.url = "github:ners/nix-monitored";
nix-monitored.inputs.nixpkgs.follows = "nixpkgs";
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
# Programs
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
filetags.url = "git+https://gitea.moritzboeh.me/moritz/filetags.git";
# Neovim
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.flake-parts.follows = "flake-parts";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
# Niri
niri.url = "github:sodiboo/niri-flake";
niri.inputs.nixpkgs.follows = "nixpkgs";
# Laptop
asus-touchpad-numpad-driver.url = "github:MoritzBoehme/asus-touchpad-numpad-driver/german-layout";
asus-touchpad-numpad-driver.flake = false;
# Firefox user.js
arkenfox-userjs.url = "github:arkenfox/user.js";
arkenfox-userjs.flake = false;
};
outputs = inputs@{ flake-parts, ... }:
@ -39,6 +81,21 @@
meta.name = "cool-clan"; # Ensure to choose a unique name.
machines = { };
specialArgs = {
inherit inputs self;
};
inventory = {
services.zerotier.default = {
roles.controller.machines = [
"moritz-server"
];
roles.peer.machines = [
"moritz-desktop"
];
};
};
};
});
}

View file

@ -0,0 +1,138 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ pkgs
, config
, inputs
, ...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./disko.nix
../../modules/moritz/default.nix
../../modules/shared.nix
];
# This is your user login name.
users.users.user.name = "moritz";
users.users.root.openssh.authorizedKeys.keys = [
''
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHlemuKagHwz2T5rEwgJNlVUdUdOXyPtCEzD73CrwY2zmpR4AMj7y9u3Rm7HwHUDjLap1ZFwg+53bAsVP6HFZccCXoIfO/8BL0WDGQJrfgb+A+UiRhSqSvyZ77bGJkadbBkadguz3qR3PHcb41DOlhuqVcHxsY8ceHMxAuyb0pLJVJLeytMD+CHS/r7hoj2hckTNAZ+VhCXBtdZfZ7uPUBxLfluYRNNMmdwCglsg3RUS242nJUzy3A84+CXIGeWmNG9Fu45IDkwMthxSW9klyU9R38R9DBDcugkyb6vz+JKSuRVAa47qh/kmtsYekfL3ul9D2JN32P8S+6ZoXx+gXupGJ0ltwJWAFkhLJ+yeXj9kCOv/mIUmCB14jMGsvKiSwV25O/twyjqe2LEkMVgimgrjEYoHu+ZTyp0iFtUvSrFo4tsAhfWPV9yj4F/hUksW7xKIwq5Niyx7he5M/XddudtnAximyiBDGCdJm1Ejl0UaGa6ZQv7y6VZdx0PyZuraT7l9ub8so6JlE4cVgSSU9vE0IS2QqBuHhsIjh8RVksoTR2NQbeDdGaGpGnq2C8y0rDXwE/EJA4LK45khX/GPn73n8F0kBG8dBrWgRDAEODpmebScO7d5mCeM0z3lPcRmh+3e3DPnVVOl+uR7udlc7NauLzl7q913UtxZaF1PlD7Q== cardno:15_584_308
''
];
# Set this for clan commands use ssh i.e. `clan machines update`
# If you change the hostname, you need to update this line to root@<new-hostname>
# This only works however if you have avahi running on your admin machine else use IP
clan.core.networking.targetHost = "root@192.168.0.14";
my = {
ai.enable = true;
profiles = {
desktop.enable = true;
gaming.enable = true;
personal.enable = true;
personal.mail = true;
impermanence.enable = true;
webis.enable = true;
};
programs.prismlauncher.enable = true;
programs.aider.enable = true;
services.wallpaper.enable = true;
};
home-manager.users.moritz.home.packages = with pkgs; [
anki
stable.calibre # NOTE: breaks often in unstable
];
home-manager.users.moritz.services.kanshi.settings = [
{
profile.name = "default";
profile.outputs = [
{
adaptiveSync = true;
criteria = "*";
scale = 1.2;
}
];
}
];
hardware = {
keyboard.qmk.enable = true;
nvidia = {
modesetting.enable = true;
open = true;
};
nvidia-container-toolkit.enable = true;
graphics = {
enable = true;
enable32Bit = true;
};
bluetooth.enable = true;
};
boot = {
# BOOT
supportedFilesystems = [ "zfs" "btrfs" "ntfs" ];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
};
# NETWORKING
networking = {
defaultGateway = {
address = "192.168.0.1";
interface = "enp6s0";
};
nameservers = [ "192.168.0.4" ];
useDHCP = false;
interfaces.enp6s0 = {
ipv4.addresses = [
{
address = "192.168.0.14";
prefixLength = 24;
}
];
ipv6.addresses = [
{
address = "fe80::60fb:ffc:df6f:e29e";
prefixLength = 64;
}
];
};
networkmanager.enable = true;
};
services = {
xserver.videoDrivers = [ "nvidia" ];
xserver.xrandrHeads = [
{ output = "HDMI-1"; }
{
output = "HDMI-0";
primary = true;
}
];
# Powersaving
tlp.enable = true;
};
powerManagement.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
}

View file

@ -0,0 +1,114 @@
{ lib, pkgs, ... }:
{
# needed for zfs pool
networking.hostId = "1f8b8073";
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_500GB_S2RBNX0J351943M";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
encryptedSwap = {
size = "8G";
content = {
type = "swap";
randomEncryption = true;
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
rootFsOptions = {
compression = "zstd";
"com.sun:auto-snapshot" = "false";
"acltype" = "posixacl"; # NOTE: needed for systemd https://github.com/NixOS/nixpkgs/issues/16954
};
mountpoint = null;
datasets = {
encrypted = {
type = "zfs_fs";
options = {
mountpoint = "none";
encryption = "aes-256-gcm";
keyformat = "passphrase";
};
# use this to read the key during boot
postCreateHook = ''
zfs set keylocation="prompt" "zroot/$name";
'';
};
"encrypted/root" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/";
postCreateHook = "zfs snapshot zroot/encrypted/root@blank";
};
"encrypted/nix" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/nix";
};
"encrypted/persist" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist";
options."com.sun:auto-snapshot" = "true";
};
};
};
};
};
# rollback to blank
boot.initrd.systemd.services.rollback = {
description = "Rollback ZFS datasets to a pristine state";
wantedBy = [
"initrd.target"
];
after = [
"zfs-import-zroot.service"
];
before = [
"sysroot.mount"
];
path = with pkgs; [
zfs
];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete"
'';
};
boot.initrd.systemd.enable = true;
fileSystems."/persist".neededForBoot = true;
# HACK: to fix issue of agenix running before impermanence
services.zfs = {
autoScrub.enable = true;
trim.enable = true;
autoSnapshot.enable = true;
};
}

View file

@ -0,0 +1,27 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(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";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -37,8 +37,4 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHlemuKagHwz2T5rEwgJNlVUdUdOXyPtCEzD73CrwY2zmpR4AMj7y9u3Rm7HwHUDjLap1ZFwg+53bAsVP6HFZccCXoIfO/8BL0WDGQJrfgb+A+UiRhSqSvyZ77bGJkadbBkadguz3qR3PHcb41DOlhuqVcHxsY8ceHMxAuyb0pLJVJLeytMD+CHS/r7hoj2hckTNAZ+VhCXBtdZfZ7uPUBxLfluYRNNMmdwCglsg3RUS242nJUzy3A84+CXIGeWmNG9Fu45IDkwMthxSW9klyU9R38R9DBDcugkyb6vz+JKSuRVAa47qh/kmtsYekfL3ul9D2JN32P8S+6ZoXx+gXupGJ0ltwJWAFkhLJ+yeXj9kCOv/mIUmCB14jMGsvKiSwV25O/twyjqe2LEkMVgimgrjEYoHu+ZTyp0iFtUvSrFo4tsAhfWPV9yj4F/hUksW7xKIwq5Niyx7he5M/XddudtnAximyiBDGCdJm1Ejl0UaGa6ZQv7y6VZdx0PyZuraT7l9ub8so6JlE4cVgSSU9vE0IS2QqBuHhsIjh8RVksoTR2NQbeDdGaGpGnq2C8y0rDXwE/EJA4LK45khX/GPn73n8F0kBG8dBrWgRDAEODpmebScO7d5mCeM0z3lPcRmh+3e3DPnVVOl+uR7udlc7NauLzl7q913UtxZaF1PlD7Q== cardno:15_584_308
''
];
# Zerotier needs one controller to accept new nodes. Once accepted
# the controller can be offline and routing still works.
clan.core.networking.zerotier.controller.enable = true;
}

80
modules/lib.nix Normal file
View file

@ -0,0 +1,80 @@
{ lib, ... }:
rec {
mkDate = longDate: lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
];
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
mkVersionInput = input:
let
date = mkDate (input.lastModifiedDate or "19700101");
rev = input.shortRev or "dirty";
in
"unstable-${date}_${rev}";
mapModules = f: dir:
let
filterModules = name: type:
let
isPublic = !(lib.hasPrefix "_" name);
isSomething = type != null;
isModule =
let
path = "${toString dir}/${name}";
isDefault = type == "directory" && builtins.pathExists "${path}/default.nix";
isFile = type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix";
in
isDefault || isFile;
in
isPublic && isSomething && isModule;
modulesInDir = lib.filterAttrs filterModules (builtins.readDir dir);
mkModule = name: _:
let
path = "${toString dir}/${name}";
normalizedName =
if name == "default.nix"
then name
else lib.removeSuffix ".nix" name;
in
lib.nameValuePair normalizedName (f path);
in
lib.mapAttrs' mkModule modulesInDir;
mapModules' = f: dir: lib.attrValues (mapModules f dir);
listModules = mapModules' (path: path);
mapModulesRec = f: dir:
let
filterDirs = name: type:
let
isPublic = !(lib.hasPrefix "_" name);
isSomething = type != null;
isDir = type == "directory";
isDefault = isDir && builtins.pathExists "${toString dir}/${name}/default.nix";
in
isPublic && isSomething && isDir && !isDefault;
subDirs = lib.filterAttrs filterDirs (builtins.readDir dir);
mkSubModule = name: _:
let
path = "${toString dir}/${name}";
in
lib.nameValuePair name (mapModulesRec f path);
in
mapModules f dir //
(lib.mapAttrs' mkSubModule subDirs);
mapModulesRec' = f: dir:
let
attrValuesRec = attrs: map (values: if lib.isAttrs values then attrValuesRec values else values) (lib.attrValues attrs);
in
lib.flatten (attrValuesRec (mapModulesRec f dir));
listModulesRec = mapModulesRec' (path: path);
}

View file

@ -0,0 +1,26 @@
{ lib
, config
, ...
}:
let
cfg = config.my.ai;
in
{
options.my.ai.enable = lib.mkEnableOption "AI stuff";
config = lib.mkIf cfg.enable {
clan.core.vars.generators.moritz-openai = {
prompts.api-key.description = "the openai api key";
prompts.api-key.type = "hidden";
prompts.api-key.persist = true;
share = true;
};
clan.core.vars.generators.moritz-anthropic = {
prompts.api-key.description = "the anthropic api key";
prompts.api-key.type = "hidden";
prompts.api-key.persist = true;
share = true;
};
};
}

View file

@ -0,0 +1,22 @@
{ lib
, ...
}:
with lib;
{
options.my.shell = {
abbreviations = mkOption {
default = { };
type = with types; attrsOf str;
example = { gs = "git status"; };
};
aliases = mkOption {
default = { };
type = with types; attrsOf str;
};
variables = mkOption {
default = { };
type = with types; attrsOf str;
};
};
}

View file

@ -0,0 +1,14 @@
{ lib
, ...
}:
with lib;
{
options.my.terminal = {
package = mkOption {
description = "Terminal emulator package to use. Gets converted to path of bin automatically.";
type = types.package;
apply = lib.getExe;
};
};
}

View file

@ -0,0 +1,458 @@
{ config
, pkgs
, flavor
, rosewater
, flamingo
, pink
, mauve
, red
, maroon
, peach
, yellow
, green
, teal
, sky
, sapphire
, blue
, lavender
, text
, subtext1
, subtext0
, overlay2
, overlay1
, overlay0
, surface2
, surface1
, surface0
, base
, mantle
, crust
, ...
}:
{
my.programs.tofi.settings = {
text-color = "#${text}";
prompt-color = "#${red}";
selection-color = "#${yellow}";
background-color = "#${base}";
};
home-manager.users.moritz = {
programs = {
fzf.colors = {
"bg+" = "#${surface0}";
"fg+" = "#${text}";
"hl+" = "#${red}";
bg = "#${base}";
fg = "#${text}";
header = "#${red}";
hl = "#${red}";
info = "#${mauve}";
marker = "#${rosewater}";
pointer = "#${rosewater}";
prompt = "#${mauve}";
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 = ''
# vim:ft=kitty
## name: Catppuccin-Frappe
## author: Pocco81 (https://github.com/Pocco81)
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/frappe.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #${text}
background #${base}
selection_foreground #${base}
selection_background #${rosewater}
# Cursor colors
cursor #${rosewater}
cursor_text_color #${base}
# URL underline color when hovering with mouse
url_color #${rosewater}
# Kitty window border colors
active_border_color #${lavender}
inactive_border_color #${overlay0}
bell_border_color #${yellow}
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #${crust}
active_tab_background #${mauve}
inactive_tab_foreground #${text}
inactive_tab_background #${mantle}
tab_bar_background #${crust}
# Colors for marks (marked text in the terminal)
mark1_foreground #${base}
mark1_background #${lavender}
mark2_foreground #${base}
mark2_background #${mauve}
mark3_foreground #${base}
mark3_background #${sapphire}
# The 16 terminal colors
# black
color0 #${surface1}
color8 #${surface2}
# red
color1 #${red}
color9 #${red}
# green
color2 #${green}
color10 #${green}
# yellow
color3 #${yellow}
color11 #${yellow}
# blue
color4 #${blue}
color12 #${blue}
# magenta
color5 #${pink}
color13 #${pink}
# cyan
color6 #${teal}
color14 #${teal}
# white
color7 #${subtext1}
color15 #${subtext0}
'';
tmux.plugins = with pkgs.tmuxPlugins; [
{
plugin = catppuccin;
extraConfig = "set -g @catppuccin_flavour '${flavor}'";
}
];
zathura.extraConfig = ''
set window-title-basename "true"
set selection-clipboard "clipboard"
set default-fg "#${text}"
set default-bg "#${base}"
set completion-bg "#${surface0}"
set completion-fg "#${text}"
set completion-highlight-bg "#575268"
set completion-highlight-fg "#${text}"
set completion-group-bg "#${surface0}"
set completion-group-fg "#${blue}"
set statusbar-fg "#${text}"
set statusbar-bg "#${surface0}"
set notification-bg "#${surface0}"
set notification-fg "#${text}"
set notification-error-bg "#${surface0}"
set notification-error-fg "#${red}"
set notification-warning-bg "#${surface0}"
set notification-warning-fg "#FAE3B0"
set inputbar-fg "#${text}"
set inputbar-bg "#${surface0}"
set recolor-lightcolor "#${base}"
set recolor-darkcolor "#${text}"
set index-fg "#${text}"
set index-bg "#${base}"
set index-active-fg "#${text}"
set index-active-bg "#${surface0}"
set render-loading-bg "#${base}"
set render-loading-fg "#${text}"
set highlight-color "#575268"
set highlight-fg "#${pink}"
set highlight-active-color "#${pink}"
'';
rofi = {
theme = "custom";
extraConfig = {
show-icons = true;
terminal = "alacritty";
drun-display-format = "{icon} {name}";
location = 0;
disable-history = false;
hide-scrollbar = true;
display-drun = " Apps ";
display-run = " Run ";
display-window = " Window";
display-Network = " 󰤨 Network";
sidebar-mode = true;
};
};
};
xsession.windowManager.bspwm.settings = {
focused_border_color = "#${mauve}";
normal_border_color = "#${base}";
active_border_color = "#${base}";
};
services = {
dunst.settings = {
global = {
# Defines color of the frame around the notification window.
frame_color = "#${blue}";
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = "frame";
};
urgency_low = {
background = "#${base}";
foreground = "#${text}";
};
urgency_normal = {
background = "#${base}";
foreground = "#${text}";
};
urgency_critical = {
background = "#${base}";
foreground = "#${text}";
frame_color = "#${peach}";
};
};
polybar = {
config = {
"bar/bottom" = {
background = base;
foreground = text;
border-color = base;
};
"module/bspwm" = {
label-focused-foreground = pink;
label-occupied-foreground = overlay1;
label-urgent-foreground = maroon;
label-empty-foreground = overlay1;
label-separator-foreground = base;
};
"module/cpu" = {
format-foreground = base;
format-background = green;
};
"module/time" = {
format-foreground = base;
format-background = blue;
};
"module/date" = {
format-foreground = base;
format-background = peach;
};
"module/memory" = {
format-foreground = base;
format-background = blue;
};
"module/pulseaudio" = {
format-volume-foreground = base;
format-volume-background = mauve;
label-muted = " muted";
format-muted-foreground = base;
format-muted-background = red;
};
"module/network" = {
format-connected-foreground = base;
format-connected-background = mauve;
};
"module/battery" = {
format-charging-foreground = base;
format-charging-background = green;
format-full-foreground = base;
format-full-background = green;
format-discharging-foreground = base;
format-discharging-background = red;
};
};
};
};
xdg.configFile = {
"fish/conf.d/theme.fish".text = ''
# Catppuccin color palette
# --> special
set -l foreground ${text}
set -l selection ${surface0}
# --> palette
set -l teal ${teal}
set -l flamingo ${flamingo}
set -l mauve ${mauve}
set -l pink ${pink}
set -l red ${red}
set -l peach ${peach}
set -l green ${green}
set -l yellow ${yellow}
set -l blue ${blue}
set -l gray ${overlay0}
# Syntax Highlighting
set -g fish_color_normal $foreground
set -g fish_color_command $blue
set -g fish_color_param $flamingo
set -g fish_color_keyword $red
set -g fish_color_quote $green
set -g fish_color_redirection $pink
set -g fish_color_end $peach
set -g fish_color_error $red
set -g fish_color_gray $gray
set -g fish_color_selection --background=$selection
set -g fish_color_search_match --background=$selection
set -g fish_color_operator $pink
set -g fish_color_escape $flamingo
set -g fish_color_autosuggestion $gray
set -g fish_color_cancel $red
# Prompt
set -g fish_color_cwd $yellow
set -g fish_color_user $teal
set -g fish_color_host $blue
# Completion Pager
set -g fish_pager_color_progress $gray
set -g fish_pager_color_prefix $pink
set -g fish_pager_color_completion $foreground
set -g fish_pager_color_description $gray
'';
"rofi/custom.rasi".text = ''
* {
bg-col: #${base};
bg-col-light: #${base};
border-col: #${base};
selected-col: #${base};
blue: #${blue};
fg-col: #${text};
fg-col2: #${red};
grey: #${overlay0};
width: 900;
font: "JetBrainsMono Nerd Font 14";
}
element-text, element-icon , mode-switcher {
background-color: inherit;
text-color: inherit;
}
window {
height: 360px;
border: 3px;
border-color: @border-col;
background-color: @bg-col;
}
mainbox {
background-color: @bg-col;
}
inputbar {
children: [prompt,entry];
background-color: @bg-col;
border-radius: 5px;
padding: 2px;
}
prompt {
background-color: @blue;
padding: 6px;
text-color: @bg-col;
border-radius: 3px;
margin: 20px 0px 0px 20px;
}
textbox-prompt-colon {
expand: false;
str: ":";
}
entry {
padding: 6px;
margin: 20px 0px 0px 10px;
text-color: @fg-col;
background-color: @bg-col;
}
listview {
border: 0px 0px 0px;
padding: 6px 0px 0px;
margin: 10px 0px 0px 20px;
columns: 2;
lines: 5;
background-color: @bg-col;
}
element {
padding: 5px;
background-color: @bg-col;
text-color: @fg-col ;
}
element-icon {
size: 25px;
}
element selected {
background-color: @selected-col ;
text-color: @fg-col2 ;
}
mode-switcher {
spacing: 0;
}
button {
padding: 10px;
background-color: @bg-col-light;
text-color: @grey;
vertical-align: 0.5;
horizontal-align: 0.5;
}
button selected {
background-color: @bg-col;
text-color: @blue;
}
'';
};
};
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-frappe")
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";
rosewater = "f2d5cf";
flamingo = "eebebe";
pink = "f4b8e4";
mauve = "ca9ee6";
red = "e78284";
maroon = "ea999c";
peach = "ef9f76";
yellow = "e5c890";
green = "a6d189";
teal = "81c8be";
sky = "99d1db";
sapphire = "85c1dc";
blue = "8caaee";
lavender = "babbf1";
text = "c6d0f5";
subtext1 = "b5bfe2";
subtext0 = "a5adce";
overlay2 = "949cbb";
overlay1 = "838ba7";
overlay0 = "737994";
surface2 = "626880";
surface1 = "51576d";
surface0 = "414559";
base = "303446";
mantle = "292c3c";
crust = "232634";
});
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-latte")
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";
rosewater = "dc8a78";
flamingo = "dd7878";
pink = "ea76cb";
mauve = "8839ef";
red = "d20f39";
maroon = "e64553";
peach = "fe640b";
yellow = "df8e1d";
green = "40a02b";
teal = "179299";
sky = "04a5e5";
sapphire = "209fb5";
blue = "1e66f5";
lavender = "7287fd";
text = "4c4f69";
subtext1 = "5c5f77";
subtext0 = "6c6f85";
overlay2 = "7c7f93";
overlay1 = "8c8fa1";
overlay0 = "9ca0b0";
surface2 = "acb0be";
surface1 = "bcc0cc";
surface0 = "ccd0da";
base = "eff1f5";
mantle = "e6e9ef";
crust = "dce0e8";
});
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-macchiato")
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "macchiato";
rosewater = "f4dbd6";
flamingo = "f0c6c6";
pink = "f5bde6";
mauve = "c6a0f6";
red = "ed8796";
maroon = "ee99a0";
peach = "f5a97f";
yellow = "eed49f";
green = "a6da95";
teal = "8bd5ca";
sky = "91d7e3";
sapphire = "7dc4e4";
blue = "8aadf4";
lavender = "b7bdf8";
text = "cad3f5";
subtext1 = "b8c0e0";
subtext0 = "a5adcb";
overlay2 = "939ab7";
overlay1 = "8087a2";
overlay0 = "6e738d";
surface2 = "5b6078";
surface1 = "494d64";
surface0 = "363a4f";
base = "24273a";
mantle = "1e2030";
crust = "181926";
});
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-mocha")
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";
rosewater = "f5e0dc";
flamingo = "f2cdcd";
pink = "f5c2e7";
mauve = "cba6f7";
red = "f38ba8";
maroon = "eba0ac";
peach = "fab387";
yellow = "f9e2af";
green = "a6e3a1";
teal = "94e2d5";
sky = "89dceb";
sapphire = "74c7ec";
blue = "89b4fa";
lavender = "b4befe";
text = "cdd6f4";
subtext1 = "bac2de";
subtext0 = "a6adc8";
overlay2 = "9399b2";
overlay1 = "7f849c";
overlay0 = "6c7086";
surface2 = "585b70";
surface1 = "45475a";
surface0 = "494d64";
base = "1e1e2e";
mantle = "181825";
crust = "11111b";
});
}

View file

@ -0,0 +1,218 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.theming;
in
{
imports = [
./dracula.nix
./catppuccin-frappe.nix
./catppuccin-latte.nix
./catppuccin-macchiato.nix
./catppuccin-mocha.nix
];
options.my.theming = {
enable = mkEnableOption "theming";
scheme = mkOption {
type = types.enum [
"dracula"
"catppuccin-latte"
"catppuccin-frappe"
"catppuccin-macchiato"
"catppuccin-mocha"
];
};
};
config = mkIf cfg.enable {
my.programs.tofi.settings = {
font-size = "20";
font =
let
fontBasePath = pkgs.nerd-fonts.fira-code;
in
"${fontBasePath}/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf";
height = "360";
width = "720";
outline-width = "0";
border-width = "0";
};
my.programs.ghostty.settings.theme = cfg.scheme;
home-manager.users.moritz = {
services.polybar = {
config = {
"bar/bottom" = {
# position
monitor = "\${env:MONITOR}";
bottom = true;
width = "100%";
height = 15;
border-size = 2;
separator = " ";
font-0 = "FiraCode Nerd Font:size=8;0";
font-1 = "FiraCode Nerd Font:size=8;1";
font-2 = "FiraCode Nerd Font:size=8;2";
modules-left = "cpu memory network battery";
modules-center = "bspwm";
modules-right = "pulseaudio date time";
tray-position = "right";
tray-padding = 2;
wm-restack = "bspwm";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
};
"module/battery" = {
type = "internal/battery";
battery = "BATT";
adapter = "ACAD";
time-format = "%H:%M";
format-charging = "<animation-charging> <label-charging>";
format-charging-padding = 1;
format-discharging = "<animation-discharging> <label-discharging>";
format-discharging-padding = 1;
format-full = " <label-full>";
format-full-padding = 1;
label-charging = "%percentage%% %time% remaining";
label-discharging = "%percentage%% %time% remaining";
label-full = "Fully charged";
animation-charging-0 = " ";
animation-charging-1 = " ";
animation-charging-2 = " ";
animation-charging-3 = " ";
animation-charging-4 = " ";
animation-charging-framerate = 500;
animation-discharging-0 = " ";
animation-discharging-1 = " ";
animation-discharging-2 = " ";
animation-discharging-3 = " ";
animation-discharging-4 = " ";
animation-discharging-framerate = 500;
};
"module/bspwm" = {
type = "internal/bspwm";
label-focused = "";
label-focused-padding = 1;
label-occupied = "";
label-occupied-padding = 1;
label-urgent = "";
label-urgent-padding = 1;
label-empty = "";
label-empty-padding = 1;
label-separator = " ";
label-separator-padding = 1;
pin-workspaces = true;
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<ramp-load><label>";
format-padding = 1;
format-font = 3;
ramp-load-0 = " ";
ramp-load-1 = " ";
ramp-load-2 = " ";
ramp-load-3 = " ";
label = "%percentage:2%%";
};
"module/time" = {
type = "internal/date";
interval = 1;
time = "%H:%M";
time-alt = "%H:%M:%S";
label = "%time%";
format-prefix = " ";
format-prefix-font = 2;
format-padding = 1;
label-font = 3;
};
"module/date" = {
type = "internal/date";
interval = 5;
format = "<label>";
format-prefix = " ";
format-prefix-font = 2;
format-padding = 1;
format-font = 3;
date = "%A";
date-alt = "%Y-%m-%d";
label = "%date%";
label-font = 3;
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format = "<label>";
format-prefix = " ";
format-padding = 1;
format-font = 2;
label = "%gb_used%";
label-font = 3;
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<ramp-volume> <label-volume>";
label-volume = "%percentage%%";
format-volume-padding = 1;
format-volume-font = 2;
format-muted-padding = 1;
format-muted-font = 2;
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "奔";
ramp-volume-3 = "";
ramp-volume-4 = "";
click-middle = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"module/network" = {
type = "internal/network";
interface =
builtins.head (builtins.attrNames config.networking.interfaces);
interval = 3;
format-connected = "<label-connected>";
label-connected = "%{T2}%{T3} %upspeed% %{T2}%{T3} %downspeed%";
format-connected-padding = 1;
format-connected-font = 3;
};
};
};
};
};
}

View file

@ -0,0 +1,444 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.theming;
background = "282a36";
currentLine = "44475a";
foreground = "f8f8f2";
comment = "6272a4";
cyan = "8be9fd";
green = "50fa7b";
orange = "ffb86c";
pink = "ff79c6";
purple = "bd93f9";
red = "ff5555";
yellow = "f1fa8c";
in
{
config = mkIf (cfg.enable && cfg.scheme == "dracula") {
home-manager.users.moritz = {
programs = {
fzf.colors = {
"bg+" = "#${currentLine}";
"fg+" = "#${foreground}";
"hl+" = "#${purple}";
bg = "#${background}";
fg = "#${foreground}";
header = "#${comment}";
hl = "#${purple}";
info = "#${orange}";
marker = "#${pink}";
pointer = "#${pink}";
prompt = "#${green}";
spinner = "#${orange}";
};
kitty.extraConfig =
''
# https://draculatheme.com/kitty
foreground #f8f8f2
background #282a36
selection_foreground #ffffff
selection_background #44475a
url_color #8be9fd
# black
color0 #21222c
color8 #6272a4
# red
color1 #ff5555
color9 #ff6e6e
# green
color2 #50fa7b
color10 #69ff94
# yellow
color3 #f1fa8c
color11 #ffffa5
# blue
color4 #bd93f9
color12 #d6acff
# magenta
color5 #ff79c6
color13 #ff92df
# cyan
color6 #8be9fd
color14 #a4ffff
# white
color7 #f8f8f2
color15 #ffffff
# Cursor colors
cursor #f8f8f2
cursor_text_color background
# Tab bar colors
active_tab_foreground #282a36
active_tab_background #f8f8f2
inactive_tab_foreground #282a36
inactive_tab_background #6272a4
# Marks
mark1_foreground #282a36
mark1_background #ff5555
# Splits/Windows
active_border_color #f8f8f2
inactive_border_color #6272a4
'';
tmux.plugins = with pkgs.tmuxPlugins; [
dracula
];
zathura.extraConfig = ''
set window-title-basename "true"
set selection-clipboard "clipboard"
# Dracula color theme for Zathura
# Swaps Foreground for Background to get a light version if the user prefers
#
# Dracula color theme
#
set notification-error-bg "#ff5555" # Red
set notification-error-fg "#f8f8f2" # Foreground
set notification-warning-bg "#ffb86c" # Orange
set notification-warning-fg "#44475a" # Selection
set notification-bg "#282a36" # Background
set notification-fg "#f8f8f2" # Foreground
set completion-bg "#282a36" # Background
set completion-fg "#6272a4" # Comment
set completion-group-bg "#282a36" # Background
set completion-group-fg "#6272a4" # Comment
set completion-highlight-bg "#44475a" # Selection
set completion-highlight-fg "#f8f8f2" # Foreground
set index-bg "#282a36" # Background
set index-fg "#f8f8f2" # Foreground
set index-active-bg "#44475a" # Current Line
set index-active-fg "#f8f8f2" # Foreground
set inputbar-bg "#282a36" # Background
set inputbar-fg "#f8f8f2" # Foreground
set statusbar-bg "#282a36" # Background
set statusbar-fg "#f8f8f2" # Foreground
set highlight-color "#ffb86c" # Orange
set highlight-active-color "#ff79c6" # Pink
set default-bg "#282a36" # Background
set default-fg "#f8f8f2" # Foreground
set render-loading true
set render-loading-fg "#282a36" # Background
set render-loading-bg "#f8f8f2" # Foreground
#
# Recolor mode settings
#
set recolor-lightcolor "#282a36" # Background
set recolor-darkcolor "#f8f8f2" # Foreground
#
# Startup options
#
set adjust-open width
set recolor true
'';
rofi.theme = "dracula";
};
xsession.windowManager.bspwm = {
settings = {
focused_border_color = "#${purple}";
normal_border_color = "#${background}";
active_border_color = "#${background}";
};
};
services = {
dunst.settings = {
global = {
# Defines color of the frame around the notification window.
frame_color = "#282a36";
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = "frame";
};
urgency_low = {
background = "#282a36";
foreground = "#6272a4";
timeout = 10;
};
urgency_normal = {
background = "#282a36";
foreground = "#bd93f9";
timeout = 10;
};
urgency_critical = {
background = "#ff5555";
foreground = "#f8f8f2";
timeout = 0;
};
};
polybar = {
config = {
"bar/bottom" = {
background = "#${background}";
foreground = "#${foreground}";
border-color = "#${background}";
};
"module/bspwm" = {
label-focused-foreground = "#${pink}";
label-occupied-foreground = "#${comment}";
label-urgent-foreground = "#${red}";
label-empty-foreground = "#${currentLine}";
label-separator-foreground = "#${background}";
};
"module/cpu" = {
format-foreground = "#${background}";
format-background = "#${green}";
};
"module/time" = {
format-foreground = "#${background}";
format-background = "#${cyan}";
};
"module/date" = {
format-foreground = "#${background}";
format-background = "#${yellow}";
};
"module/memory" = {
format-foreground = "#${background}";
format-background = "#${cyan}";
};
"module/pulseaudio" = {
format-volume-foreground = "#${background}";
format-volume-background = "#${purple}";
label-muted = "%{F#${red}} %{F#${background}}muted";
format-muted-foreground = "#${background}";
format-muted-background = "#${red}";
};
"module/network" = {
format-connected-foreground = "#${background}";
format-connected-background = "#${purple}";
};
};
};
};
xdg.configFile = {
"fish/conf.d/theme.fish".text = ''
# Dracula Color Palette
set -l foreground f8f8f2
set -l selection 44475a
set -l comment 6272a4
set -l red ff5555
set -l orange ffb86c
set -l yellow f1fa8c
set -l green 50fa7b
set -l purple bd93f9
set -l cyan 8be9fd
set -l pink ff79c6
# Syntax Highlighting Colors
set -gx fish_color_normal $foreground
set -gx fish_color_command $cyan
set -gx fish_color_keyword $pink
set -gx fish_color_quote $yellow
set -gx fish_color_redirection $foreground
set -gx fish_color_end $orange
set -gx fish_color_error $red
set -gx fish_color_param $purple
set -gx fish_color_comment $comment
set -gx fish_color_selection --background=$selection
set -gx fish_color_search_match --background=$selection
set -gx fish_color_operator $green
set -gx fish_color_escape $pink
set -gx fish_color_autosuggestion $comment
set -gx fish_color_cancel $red --reverse
set -gx fish_color_option $orange
# Default Prompt Colors
set -gx fish_color_cwd $green
set -gx fish_color_host $purple
set -gx fish_color_host_remote $purple
set -gx fish_color_user $cyan
# Completion Pager Colors
set -gx fish_pager_color_progress $comment
set -gx fish_pager_color_background
set -gx fish_pager_color_prefix $cyan
set -gx fish_pager_color_completion $foreground
set -gx fish_pager_color_description $comment
set -gx fish_pager_color_selected_background --background=$selection
set -gx fish_pager_color_selected_prefix $cyan
set -gx fish_pager_color_selected_completion $foreground
set -gx fish_pager_color_selected_description $comment
set -gx fish_pager_color_secondary_background
set -gx fish_pager_color_secondary_prefix $cyan
set -gx fish_pager_color_secondary_completion $foreground
set -gx fish_pager_color_secondary_description $comment
'';
"rofi/dracula.rasi".text = ''
* {
/* Dracula theme colour palette */
drac-bgd: #282a36;
drac-cur: #44475a;
drac-fgd: #f8f8f2;
drac-cmt: #6272a4;
drac-cya: #8be9fd;
drac-grn: #50fa7b;
drac-ora: #ffb86c;
drac-pnk: #ff79c6;
drac-pur: #bd93f9;
drac-red: #ff5555;
drac-yel: #f1fa8c;
font: "FiraCode Nerd Font Mono 13";
foreground: @drac-fgd;
background-color: @drac-bgd;
active-background: @drac-pnk;
urgent-foreground: @foreground;
urgent-background: @drac-red;
selected-background: @active-background;
selected-urgent-background: @urgent-background;
selected-active-background: @active-background;
separatorcolor: @active-background;
bordercolor: #6272a4;
}
#window {
background-color: @background-color;
border: 3;
border-radius: 6;
border-color: @bordercolor;
padding: 5;
}
#mainbox {
border: 0;
padding: 5;
}
#message {
border: 1px dash 0px 0px ;
border-color: @separatorcolor;
padding: 1px ;
}
#textbox {
text-color: @foreground;
}
#listview {
fixed-height: 0;
border: 2px dash 0px 0px ;
border-color: @bordercolor;
spacing: 2px ;
scrollbar: false;
padding: 2px 0px 0px ;
}
#element {
border: 0;
padding: 1px ;
}
#element.normal.normal {
background-color: @background-color;
text-color: @foreground;
}
#element.normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
#element.normal.active {
background-color: @active-background;
text-color: @background-color;
}
#element.selected.normal {
background-color: @selected-background;
text-color: @foreground;
}
#element.selected.urgent {
background-color: @selected-urgent-background;
text-color: @foreground;
}
#element.selected.active {
background-color: @selected-active-background;
text-color: @background-color;
}
#element.alternate.normal {
background-color: @background-color;
text-color: @foreground;
}
#element.alternate.urgent {
background-color: @urgent-background;
text-color: @foreground;
}
#element.alternate.active {
background-color: @active-background;
text-color: @foreground;
}
#scrollbar {
width: 2px ;
border: 0;
handle-width: 8px ;
padding: 0;
}
#sidebar {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}
#button.selected {
background-color: @selected-background;
text-color: @foreground;
}
#inputbar {
spacing: 0;
text-color: @foreground;
padding: 1px ;
}
#case-indicator {
spacing: 0;
text-color: @foreground;
}
#entry {
spacing: 0;
text-color: @drac-cya;
}
#prompt {
spacing: 0;
text-color: @drac-grn;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
#textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
text-color: @drac-grn;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}
'';
};
};
};
}

View file

@ -0,0 +1,24 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.wallpapers;
in
{
options.my.wallpapers.enable = mkEnableOption "wallpapers";
config = mkIf cfg.enable {
home-manager.users.moritz.xdg = {
enable = true;
configFile = {
"wallpapers/" = {
source = ./wallpapers;
recursive = true;
};
};
};
};
}

BIN
modules/moritz/config/wallpapers/wallpapers/a_short_walk.jpg (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/elephants.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/forest_road.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/little-ships.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/old-hardware.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/red_beetle.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/stardust.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
modules/moritz/config/wallpapers/wallpapers/whale_in_sky.jpg (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,7 @@
{ lib, ... }:
let
myLib = import ../lib.nix { inherit lib; };
in
{
imports = myLib.listModulesRec ./.;
}

View file

@ -0,0 +1,61 @@
{ 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;
config.allowUnfree = true;
overlays = optional cfg.overlaysForAllChannels cfg.overlays;
}
)
cfg.channels;
in
cfg.overlays ++ [ channelOverlays ];
config.allowUnfree = true;
};
}

View file

@ -0,0 +1,142 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
{
imports = [
inputs.home-manager.nixosModules.default
];
users.users.moritz = {
isNormalUser = true;
home = "/home/moritz";
extraGroups = [ "wheel" "networkmanager" "video" ];
};
my = {
nixpkgs = {
overlays = [
(_: prev:
{
nur = import inputs.nur {
pkgs = prev;
nurpkgs = prev;
};
}
)
];
channels = {
master = inputs.master;
stable = inputs.stable;
};
};
shell = {
abbreviations = {
us = "systemctl --user";
rs = "sudo systemctl";
uj = "journalctl --user";
rj = "sudo journalctl";
};
aliases = {
ls = "${getExe pkgs.eza} -lh --icons --git";
cat = "bat";
rm = "rm -i";
mv = "mv -i";
};
variables = { EDITOR = "vim"; };
};
programs = {
lazygit.enable = true;
direnv.enable = true;
fish.enable = true;
git.enable = true;
gpg.enable = true;
nix = {
gc.enable = true;
optimise.enable = true;
};
tmux.enable = true;
tmux.keybinds = {
prefix = {
"-" = "split-window -v";
"|" = "split-window -h";
"C-l" = "send-keys C-l";
"R" = "source-file $XDG_CONFIG_HOME/tmux/tmux.conf \\; display-message 'Reloaded tmux.conf'";
"f" = "new-window ts";
"a" = "new-window ta";
};
copy-mode-vi = {
"v" = "send -X begin-selection";
"V" = "send -X select-line";
"C-v" = "send -X rectangle-toggle";
};
};
};
};
environment.systemPackages = with pkgs; [
# archives
ouch
# monitoring
bottom
# utils
(viu.override { withSixel = true; })
bat
cht-sh
fd
ripgrep
vim
wget
];
programs = {
mtr.enable = true;
command-not-found.enable = false;
};
i18n.extraLocaleSettings = {
# LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
home-manager.users.moritz = {
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
fzf = {
enable = true;
defaultOptions = [
"--height 50%"
"--bind alt-j:preview-down,alt-k:preview-up"
];
};
zoxide = {
enable = true;
options = [
"--cmd c"
];
};
starship.enable = true;
};
home = {
username = "moritz";
homeDirectory = "/home/moritz";
stateVersion = "21.05";
};
xdg.userDirs.enable = true;
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
}

View file

@ -0,0 +1,148 @@
{ lib
, config
, pkgs
, inputs
, ...
}:
let
inherit (lib) mkEnableOption mkIf mkDefault;
cfg = config.my.profiles.desktop;
in
{
options.my.profiles.desktop.enable = mkEnableOption "desktop profile";
config = mkIf cfg.enable {
my = {
wallpapers.enable = mkDefault true;
theming = {
enable = mkDefault true;
scheme = mkDefault "catppuccin-macchiato";
};
virtualisation.podman.enable = mkDefault true;
programs = {
chromium.enable = mkDefault true;
firefox.enable = mkDefault true;
gpg.enable = mkDefault true;
ghostty.settings = {
font-family = "IntoneMono Nerd Font";
window-decoration = false;
font-feature = [ "ss01" "ss02" ];
};
niri.enable = mkDefault true;
nvim.enable = mkDefault true;
python.versions."311".enable = mkDefault true;
spotify-player = {
enable = mkDefault true;
package = pkgs.spotify-player.overrideAttrs (old: {
buildFeatures = lib.lists.remove "notify" (old.buildFeatures or [ ]);
});
config = {
client_id = "3172dbeaf64949728920c58b823bc24b";
copy_command = {
command = "wl-copy";
args = [ ];
};
enable_cover_image_cache = true;
default_device = "spotify-player-daemon";
enable_streaming = false;
playback_window_position = "Bottom";
cover_img_length = 20;
cover_img_width = 10;
};
};
ssh.enable = mkDefault true;
thunar.enable = mkDefault true;
wallpaper.enable = mkDefault true;
zathura.enable = mkDefault true;
};
services = {
dunst.enable = mkDefault true;
gammastep.enable = true;
kdeconnect.enable = mkDefault true;
printing.enable = true;
spotify-player = {
enable = mkDefault true;
config = {
client_id = "3172dbeaf64949728920c58b823bc24b";
device = {
name = "spotify-player-daemon";
device_type = "computer";
volume = 70;
bitrate = 320;
audio_cache = true;
};
};
};
timers.enable = true;
wireguard.enable = true;
};
};
environment.systemPackages = with pkgs; [
(inputs.filetags.packages.${pkgs.system}.default)
keepassxc
pavucontrol
stable.libreoffice # NOTE breaks often
stable.signal-desktop # NOTE breaks often
thunderbird
vlc
(symlinkJoin {
name = "obsidian-wayland";
paths = [ obsidian ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/obsidian \
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
})
];
fonts = {
enableDefaultPackages = true;
packages = [
pkgs.nerd-fonts.fira-code
pkgs.nerd-fonts.intone-mono
];
};
programs.nix-ld.enable = true;
home-manager.users.moritz = {
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
systemd.user.services.nextcloud-client.Service = {
RestartSec = "500ms";
Restart = "on-failure";
};
};
services = {
illum.enable = true;
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
# faster startup https://majiehong.com/post/2021-07-30_slow_nixos_startup/
networking = {
# no need to wait interfaces to have an IP to continue booting
dhcpcd.wait = "background";
# avoid checking if IP is already taken to boot a few seconds faster
dhcpcd.extraConfig = "noarp";
};
# disable network-online.target
systemd.services.NetworkManager-wait-online.enable = false;
boot = {
consoleLogLevel = 0;
kernelParams = [ "quiet" "udev.log_level=3" ];
};
};
}

View file

@ -0,0 +1,40 @@
{ lib
, config
, inputs
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.gaming;
in
{
imports = [
inputs.jovian.nixosModules.default
];
options.my.profiles.gaming.enable = mkEnableOption "Enable gaming profile";
config = mkIf cfg.enable {
specialisation.gaming.configuration = {
imports = [ inputs.jovian.nixosModules.default ];
environment.persistence."/persist".users.moritz.directories = [
".cache/lutris/"
".config/gamescope"
".local/share/Steam/"
".local/share/lutris/"
];
users.users.moritz.packages = [ pkgs.lutris ];
jovian.steam.enable = true;
jovian.steam.autoStart = true;
jovian.steam.user = "moritz";
jovian.steam.desktopSession = "niri";
my.programs.niri.autoStart = false;
environment.sessionVariables = {
DXVK_HDR = "1";
ENABLE_HDR_WSI = "1";
ENABLE_GAMESCOPE_WSI = "1";
};
};
};
}

View file

@ -0,0 +1,87 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.my.profiles.impermanence;
in
{
options.my.profiles.impermanence.enable = mkEnableOption "impermanence";
imports = [
{ environment.persistence."/persist".enable = cfg.enable; }
inputs.impermanence.nixosModules.impermanence
];
config = mkIf cfg.enable {
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"
"/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 = [
".cache/keepassxc"
".cat_installer" # eduroam
".config/Nextcloud"
".config/Signal/"
".config/calibre"
".config/keepassxc"
".config/sops"
".local/share/zoxide"
".mozilla"
".steam"
"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"
".local/state/tofi-history"
];
};
users.root = {
home = "/root";
directories = [
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
];
files = [
".local/share/nix/trusted-settings.json"
];
};
};
environment.systemPackages = [
(
pkgs.writeShellApplication {
name = "zfs-diff";
runtimeInputs = with pkgs; [ zfs coreutils parallel tree ];
text = ''
zfs diff -F zroot/encrypted/root@blank | awk '$2 == "F" && system("test -e /persist/"$3) != 0 { print $3 }' 2>/dev/null | tree --fromfile . "$@"
'';
}
)
];
};
}

View file

@ -0,0 +1,47 @@
{ lib
, config
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{
options.my.profiles.personal.enable = mkEnableOption "personal profile";
config = mkIf cfg.enable {
my = {
services = {
openconnect.enable = true;
synology-drive.enable = true;
};
programs = {
# ssh.includeSecrets = [ ../../secrets/ssh-home.age ]; # FIXME: add this
git.signing = mkDefault true;
firefox.arkenfox = {
enable = mkDefault true;
overrides = mkDefault {
## arkenfox overrides
# automatic search
"keyword.enabled" = true;
"browser.search.suggest.enabled" = true;
"browser.urlbar.suggest.searches" = true;
# Restore previous session on startup
"browser.startup.page" = 3;
# drm
"media.eme.enabled" = true;
# sanitisation
"privacy.clearOnShutdown.history" = false;
# disable letterboxing
"privacy.resistFingerprinting.letterboxing" = false;
};
};
};
};
};
}

View file

@ -0,0 +1,57 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{
options.my.profiles.personal.calendar = mkEnableOption "calendar";
config = mkIf cfg.contacts {
environment.persistence."/persist".users.moritz.directories = [
".local/share/vdirsyncer/"
];
home-manager.users.moritz = {
programs.khal.enable = true;
programs.vdirsyncer.enable = true;
services.vdirsyncer.enable = true;
accounts.calendar = {
basePath = "Documents/Calendar";
accounts.personal = {
local = {
type = "filesystem";
fileExt = ".ics";
};
remote = {
passwordCommand = [ "cat" config.clan.core.vars.generators.moritz-nextcloud.files.password.path ];
url = "https://nextcloud.moritzboeh.me/remote.php/dav";
type = "caldav";
userName = "moritz";
};
primaryCollection = "personal";
khal.enable = true;
khal.type = "discover";
vdirsyncer.enable = true;
vdirsyncer.collections = [
"personal" # Personal
"einkaufsliste" # Einkaufsliste
"9b8be6f3-d85c-4c1e-b006-00910f56bf5d" # Tasks
"contact_birthdays" # Contact birthdays
"f71a1a0f-08c5-45de-84e8-e7f16b748ba5" # Uni
"32c96d6f-a575-48b1-949a-6ae548f7a779" # Work
];
};
};
};
clan.core.vars.generators.moritz-nextcloud = {
prompts.password.description = "the nextcloud password";
prompts.password.type = "hidden";
prompts.password.persist = true;
share = true;
};
};
}

View file

@ -0,0 +1,55 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{
options.my.profiles.personal.contacts = mkEnableOption "contacts";
config = mkIf cfg.contacts {
environment.persistence."/persist".users.moritz.directories = mkIf (!cfg.calendar) [
".local/share/vdirsyncer/"
];
home-manager.users.moritz = {
programs.khard.enable = true;
programs.vdirsyncer.enable = true;
services.vdirsyncer.enable = true;
programs.aerc.extraConfig.compose.address-book-cmd = "khard email --remove-first-line --parsable %s";
accounts.contact = {
basePath = "Documents/Contacts";
accounts.personal = {
local = {
type = "filesystem";
fileExt = ".vcf";
};
remote = {
passwordCommand = [ "cat" config.clan.core.vars.generators.moritz-nextcloud.files.password.path ];
url = "https://nextcloud.moritzboeh.me/remote.php/dav";
type = "carddav";
userName = "moritz";
};
khard.enable = true;
khard.defaultCollection = "contacts";
vdirsyncer.enable = true;
vdirsyncer.collections = [
# "z-app-generated--contactsinteraction--recent" # Recently contacted
# "z-server-generated--system" # Accounts
"contacts" # Contacts
];
vdirsyncer.conflictResolution = [ "vimdiff" ];
};
};
};
clan.core.vars.generators.moritz-nextcloud = {
prompts.password.description = "the nextcloud password";
prompts.password.type = "hidden";
prompts.password.persist = true;
share = true;
};
};
}

View file

@ -0,0 +1,76 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
filterHtml = pkgs.writeScript "filter_html" ''
${lib.getExe pkgs.w3m} -T text/html \
-cols $(tput cols) \
-dump \
-o display_image=false \
-o display_link_number=true "$@"
'';
in
{
options.my.profiles.personal.mail = mkEnableOption "personal email";
config = mkIf cfg.mail {
home-manager.users.moritz = {
home.packages = with pkgs; [
w3m
];
programs.aerc = {
enable = true;
extraConfig = {
general.unsafe-accounts-conf = true;
viewer = {
alternatives = "text/plain,text/html";
header-layout = "From,To,Cc,Bcc,Date,Subject";
};
filters = {
"text/html" = "${filterHtml}";
"text/plain" = "colorize";
"text/calendar" = "calendar";
"message/delivery-status" = "colorize";
"message/rfc822" = "colorize";
".headers" = "colorize";
};
};
};
services.mbsync.enable = true;
services.imapnotify.enable = true;
programs.mbsync.enable = true;
accounts.email.accounts.personal = {
imapnotify.enable = true;
imapnotify.boxes = [ "Inbox" ];
imapnotify.onNotify = "${lib.getExe' pkgs.systemd "systemctl"} start --user mbsync.service";
primary = true;
address = "mail@moritzboeh.me";
userName = "mail@moritzboeh.me";
aerc.enable = true;
gpg.signByDefault = true;
gpg.key = "0xE4F362A3F5C338A0";
imap.host = "mail.your-server.de";
smtp.host = "mail.your-server.de";
realName = "Moritz Böhme";
mbsync.enable = true;
mbsync.create = "both";
mbsync.remove = "both";
mbsync.expunge = "both";
passwordCommand = "${lib.getExe' pkgs.coreutils "cat"} ${config.clan.core.vars.generators.moritz-email.files.password.path}";
};
accounts.email.maildirBasePath = "Documents/Mail";
};
clan.core.vars.generators.moritz-email = {
prompts.password.description = "the email password";
prompts.password.type = "hidden";
prompts.password.persist = true;
share = true;
};
};
}

View file

@ -0,0 +1,23 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.ripping;
in
{
options.my.profiles.ripping.enable = mkEnableOption "ripping profile";
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
# ripping
abcde
handbrake
picard
];
};
}

View file

@ -0,0 +1,39 @@
{ lib
, config
, pkgs
, ...
}:
let
cfg = config.my.profiles.webis;
inherit (lib) mkEnableOption mkIf;
in
{
options.my.profiles.webis.enable = mkEnableOption "webis profile";
config = mkIf cfg.enable {
clan.core.vars.generators.moritz-webis = {
prompts.openvpn.description = "the webis openvpn config";
prompts.openvpn.type = "multiline";
prompts.openvpn.persist = true;
share = true;
};
my.programs = {
jetbrains = {
pycharm.enable = true;
pycharm.package = pkgs.jetbrains.pycharm-professional;
};
};
services.openvpn.servers = {
webis = {
config = "config ${config.clan.core.vars.generators.moritz-webis.files.openvpn.path}";
autoStart = false;
updateResolvConf = true;
};
};
programs.dconf.enable = true;
};
}

View file

@ -0,0 +1,44 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.yubikey;
in
{
options.my.profiles.yubikey = {
enable = mkEnableOption "yubikey";
luksSupport = {
enable = mkEnableOption "fido2 luks support";
devices = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of luks devices to enable fido2 support for.";
};
};
};
config = mkIf cfg.enable {
services.udev.packages = [ pkgs.yubikey-personalization ];
environment.systemPackages = with pkgs; [
# cli
yubikey-manager
yubikey-personalization
paperkey
# graphical
yubikey-manager-qt
yubikey-personalization-gui
];
boot = mkIf cfg.luksSupport.enable {
initrd.systemd.enable = true;
initrd.luks.devices = genAttrs cfg.luksSupport.devices (_: {
crypttabExtraOpts = [ "fido2-device=auto" ];
});
};
};
}

View file

@ -0,0 +1,17 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.adb;
in
{
options.my.programs.adb.enable = mkEnableOption "adb";
config = mkIf cfg.enable {
programs.adb.enable = true;
users.users.moritz.extraGroups = [ "adbusers" ];
};
}

View file

@ -0,0 +1,28 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.aider;
wrapped = pkgs.writeShellApplication {
name = "aider";
text = ''
aider --openai-api-key "$(cat /run/agenix/openai)" --anthropic-api-key "$(cat /run/agenix/anthropic)" --no-attribute-author --no-attribute-committer "$@"
'';
runtimeInputs = [ cfg.package ];
};
in
{
options.my.programs.aider = {
enable = mkEnableOption "ssh";
package = mkPackageOption pkgs "aider-chat" { };
};
config = mkIf cfg.enable {
environment.systemPackages = [ wrapped ];
};
}

View file

@ -0,0 +1,26 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.chromium;
in
{
options.my.programs.chromium = {
enable = mkEnableOption "chromium";
package = mkOption {
type = types.package;
default = pkgs.stable.chromium;
defaultText = "pkgs.chromium";
description = "Chromium package to install.";
};
};
config = mkIf cfg.enable {
programs.chromium.enable = true;
environment.systemPackages = [ cfg.package ];
};
}

View file

@ -0,0 +1,65 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.code;
in
{
options.my.programs.code = {
enable = mkEnableOption "code";
package = mkOption {
type = types.package;
default = pkgs.vscode;
};
extensions = mkOption {
type = types.listOf types.package;
default = with pkgs.vscode-extensions; [
bbenoist.nix
vscodevim.vim
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "copilot-nightly";
publisher = "GitHub";
version = "1.86.118";
sha256 = "04nspnmd5cfnv3m9igww6h6la6pvhdqzqmdnbm1znapxqiw2m927";
}
{
name = "copilot-chat";
publisher = "GitHub";
version = "0.1.2023052602";
sha256 = "0anlzzs4g7c9mmw7yxy5bgjcs0niwa3bswgvhwspf5fh8bbq5n44";
}
];
};
wayland = mkOption {
type = types.bool;
default = true;
};
};
config = mkIf cfg.enable {
environment.systemPackages =
let
withExtensions = pkgs.vscode-with-extensions.override {
vscode = cfg.package;
vscodeExtensions = cfg.extensions;
};
maybeExtensions = if cfg.extensions == [ ] then cfg.package else withExtensions;
withWayland = pkgs.symlinkJoin {
name = "${maybeExtensions.name}-wayland";
paths = [ maybeExtensions ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/code* \
--set NIXOS_OZONE_WL 1
'';
};
final = if cfg.wayland then withWayland else maybeExtensions;
in
[ final ];
};
}

View file

@ -0,0 +1,41 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.direnv;
in
{
options.my.programs.direnv.enable = mkEnableOption "direnv";
config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".local/share/direnv"
];
home-manager.users.moritz.programs.direnv = {
enable = true;
nix-direnv.enable = true;
stdlib = ''
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi
local VENV=$(poetry env info --path)
if [[ -z $VENV || ! -d $VENV/bin ]]; then
log_error 'No poetry virtual environment found. Use `poetry install` to create one first.'
exit 2
fi
export VIRTUAL_ENV=$VENV
export POETRY_ACTIVE=1
PATH_add "$VENV/bin"
}
'';
};
};
}

View file

@ -0,0 +1,181 @@
{ config
, lib
, inputs
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.firefox;
arkenfox = builtins.readFile "${inputs.arkenfox-userjs}/user.js";
in
{
options.my.programs.firefox = {
enable = mkEnableOption "firefox";
arkenfox = {
enable = mkEnableOption "arkenfox";
overrides = mkOption {
default = { };
type = with types; attrsOf (oneOf [ str bool int ]);
apply = overrides: concatStrings (
mapAttrsToList
(
name: value: ''
user_pref("${name}", ${builtins.toJSON value});
''
)
overrides
);
};
};
package = mkOption {
type = types.package;
default = pkgs.firefox;
example = pkgs.firefox-esr;
};
};
config = mkIf cfg.enable {
home-manager.users.moritz.programs.firefox = {
enable = true;
policies =
let
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";
Remove = removeExtensions;
};
ExtensionSettings = genAttrs
(map convertName removeExtensions)
(_: { installation_mode = "blocked"; });
};
profiles."default" = {
extraConfig = mkIf cfg.arkenfox.enable ''
// Arkenfox user.js
${arkenfox}
// Overrides
${cfg.arkenfox.overrides}
'';
extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
darkreader
firefox-color
istilldontcareaboutcookies
kagi-search
keepassxc-browser
languagetool
multi-account-containers
sponsorblock
temporary-containers
ublock-origin
vimium
];
settings = {
# Disable Pocket
"extensions.pocket.enabled" = false;
# Disable Activity Stream
# https://wiki.mozilla.org/Firefox/Activity_Stream
"browser.newtabpage.activity-stream.enabled" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = "";
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = "";
"browser.newtabpage.pinned" = "[]";
# Disable new tab tile ads & preload
# http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox
# http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331
# https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source
# https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping
"browser.newtabpage.enhanced" = false;
"browser.newtabpage.introShown" = true;
"browser.newtab.preload" = false;
"browser.newtabpage.directory.ping" = "";
"browser.newtabpage.directory.source" = "data:text/plain,{}";
# Disable some not so useful functionality.
"browser.disableResetPrompt" = true; # "Looks like you haven't started Firefox in a while."
"browser.onboarding.enabled" = false; # "New to Firefox? Let's get started!" tour
"browser.aboutConfig.showWarning" = false; # Warning when opening about:config
"extensions.shield-recipe-client.enabled" = false;
# do not offer to save passwords = nor allow the user to enable the feature
"signon.rememberSignons" = false;
"signon.rememberSignons.visibilityToggle" = false;
# send do not track header
"privacy.donottrackheader.enabled" = true;
# Hide bookmarks
"browser.toolbars.bookmarks.visibility" = "never";
# Smooth scrolling
"general.smoothScroll.lines.durationMaxMS" = 125;
"general.smoothScroll.lines.durationMinMS" = 125;
"general.smoothScroll.mouseWheel.durationMaxMS" = 200;
"general.smoothScroll.mouseWheel.durationMinMS" = 100;
"general.smoothScroll.msdPhysics.enabled" = true;
"general.smoothScroll.other.durationMaxMS" = 125;
"general.smoothScroll.other.durationMinMS" = 125;
"general.smoothScroll.pages.durationMaxMS" = 125;
"general.smoothScroll.pages.durationMinMS" = 125;
"mousewheel.min_line_scroll_amount" = 40;
"mousewheel.system_scroll_override_on_root_content.enabled" = true;
"mousewheel.system_scroll_override_on_root_content.horizontal.factor" = 175;
"mousewheel.system_scroll_override_on_root_content.vertical.factor" = 175;
"toolkit.scrollbox.horizontalScrollDistance" = 6;
"toolkit.scrollbox.verticalScrollDistance" = 2;
# Do not check if Firefox is the default browser
"browser.shell.checkDefaultBrowser" = false;
# Reduce search engine noise in the urlbar's completion window. The
# shortcuts and suggestions will still work, but Firefox won't clutter
# its UI with reminders that they exist.
"browser.urlbar.suggest.searches" = false;
"browser.urlbar.shortcuts.bookmarks" = false;
"browser.urlbar.shortcuts.history" = false;
"browser.urlbar.shortcuts.tabs" = false;
"browser.urlbar.showSearchSuggestionsFirst" = false;
"browser.urlbar.speculativeConnect.enabled" = false;
# https://bugzilla.mozilla.org/1642623
"browser.urlbar.dnsResolveSingleWordsAfterSearch" = 0;
# https://blog.mozilla.org/data/2021/09/15/data-and-firefox-suggest/
"browser.urlbar.suggest.quicksuggest.nonsponsored" = false;
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
# Show whole URL in address bar
"browser.urlbar.trimURLs" = false;
# auto enable addons
"extensions.autoDisableScopes" = 0;
# Disable Form autofill
# https://wiki.mozilla.org/Firefox/Features/Form_Autofill
"browser.formfill.enable" = false;
"extensions.formautofill.addresses.enabled" = false;
"extensions.formautofill.available" = "off";
"extensions.formautofill.creditCards.available" = false;
"extensions.formautofill.creditCards.enabled" = false;
"extensions.formautofill.heuristics.enabled" = false;
};
};
};
};
}

View file

@ -0,0 +1,121 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.fish;
shellConfig = config.my.shell;
exportedVariables =
let
exportVariables =
lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables;
in
lib.concatStringsSep "\n" exportVariables;
in
{
options.my.programs.fish.enable = mkEnableOption "fish";
config = lib.mkIf cfg.enable {
# set as default shell
users.users.moritz.shell = pkgs.fish;
environment.systemPackages = with pkgs.fishPlugins; [ fzf-fish pisces ];
# needed for nix completions
programs.fish.enable = true;
home-manager.users.moritz = {
programs = {
fish = {
enable = true;
shellAbbrs = shellConfig.abbreviations;
shellAliases = shellConfig.aliases;
shellInit = /* fish */ ''
# Vi Mode
fish_vi_key_bindings
# Emulates vim's cursor shape behavior
# Set the normal and visual mode cursors to a block
set fish_cursor_default block
# Set the insert mode cursor to a line
set fish_cursor_insert line
# Set the replace mode cursor to an underscore
set fish_cursor_replace_one underscore
# The following variable can be used to configure cursor shape in
# visual mode, but due to fish_cursor_default, is redundant here
set fish_cursor_visual block
# Complex abbreviations
function last_history_item
echo $history[1]
end
abbr -a !! --position anywhere --function last_history_item
function sed_history_item
echo $history[1] | perl -p -e (string trim -l --chars=! $argv)
end
abbr -a sed_history --position command --regex '^!s/.+/.*/g?' --function sed_history_item
function multicd
echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
end
abbr --add dotdot --regex '^\.\.+$' --function multicd
abbr -a .P --position anywhere --set-cursor "% | $PAGER"
function editor_edit
echo $EDITOR $argv
end
abbr -a editor_edit_files --position command --regex ".+\.(txt|md|org)" --function editor_edit
function editor
echo $EDITOR
end
abbr -a e --function editor
# Completions
complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")'
${optionalString config.virtualisation.podman.dockerCompat /* fish */ "complete -c docker -w podman"}
complete -c nom -fn "not __fish_seen_subcommand_from build shell develop" -a "build shell develop"
complete -c nom -fn "__fish_seen_subcommand_from build" -w "nix build"
complete -c nom -fn "__fish_seen_subcommand_from shell" -w "nix shell"
complete -c nom -fn "__fish_seen_subcommand_from develop" -w "nix develop"
complete -c timers \
-n "__fish_seen_subcommand_from toggle" \
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
complete -c timers \
-n "__fish_seen_subcommand_from remove" \
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
# Variables
${exportedVariables}
'';
functions = {
fish_greeting = "";
cheat = "cht.sh $argv | bat -p";
sourceenv = ''
set -f envfile "$argv"
if not test -f "$envfile"
echo "Unable to load $envfile"
return 1
end
printf "exported"
while read line
if not string match -qr '^#|^$' "$line"
set item (string split -m 1 '=' $line)
printf " $item[1]"
set -gx "$item[1]" "$item[2]"
end
end < "$envfile"
printf "\n"
'';
};
};
starship.enableTransience = true;
};
};
};
}

View file

@ -0,0 +1,29 @@
{ 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

@ -0,0 +1,33 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.ghostty;
format = pkgs.formats.keyValue {
listsAsDuplicateKeys = true;
};
in
{
options.my.programs.ghostty.enable = mkEnableOption "Ghostty";
options.my.programs.ghostty.package = (mkPackageOption pkgs "ghostty" { });
options.my.programs.ghostty.settings = mkOption {
inherit (format) type;
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/ghostty/config`.
'';
default = { };
};
config = mkIf cfg.enable {
my.terminal.package = cfg.package;
home-manager.users.moritz = {
home.packages = [ cfg.package ];
xdg.configFile."ghostty/config".source = format.generate "ghostty-config" cfg.settings;
};
};
}

View file

@ -0,0 +1,77 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.git;
in
{
options.my.programs.git = {
enable = mkEnableOption "git";
signing = mkOption {
default = false;
type = types.bool;
example = true;
};
identity = {
name = mkOption {
default = "Moritz Böhme";
type = types.str;
};
email = mkOption {
default = "mail@moritzboeh.me";
type = types.str;
};
};
};
config = mkIf cfg.enable {
my.shell.abbreviations = {
g = "git";
gC = "git clone";
gF = "git pull";
gS = "git switch";
ga = "git add";
gap = "git add --patch";
gb = "git branch";
gc = "git commit";
gco = "git checkout";
gd = "git diff";
gds = "git diff --staged";
gf = "git fetch";
gp = "git push";
gr = "git restore";
grm = "git rm --cached";
grp = "git restore --patch";
grps = "git restore --patch --staged";
grs = "git restore --staged";
gs = "git status";
};
home-manager.users.moritz = {
programs.git = {
enable = true;
userName = cfg.identity.name;
userEmail = cfg.identity.email;
extraConfig = {
commit.verbose = true;
diff.algorithm = "histogram";
fetch.fsckobjects = true;
init.defaultBranch = "main";
merge.conflictstyle = "zdiff3";
push.autoSetupRemote = true;
receive.fsckObjects = true;
transfer.fsckobjects = true;
};
signing = mkIf cfg.signing {
key = "0x970C6E89EB0547A9";
signByDefault = true;
};
lfs.enable = true;
delta.enable = true;
};
};
programs.git.enable = true;
};
}

View file

@ -0,0 +1,72 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.gnome;
extensions = with pkgs.gnomeExtensions; [
gsconnect
vitals
blur-my-shell
pop-shell
];
in
{
options.my.programs.gnome.enable = mkEnableOption "gnome";
config = lib.mkIf cfg.enable {
hardware = {
opengl.enable = true;
pulseaudio.enable = false;
};
services.xserver = {
layout = "de";
displayManager = {
autoLogin = {
enable = true;
user = "moritz";
};
gdm.enable = true;
};
enable = true;
desktopManager.gnome.enable = true;
};
environment.systemPackages = extensions;
home-manager.users.moritz.dconf.settings = {
"org/gnome/shell" = {
disable-user-extensions = false;
enabled-extensions = map (p: p.extensionUuid or p.uuid) extensions ++ [
"launch-new-instance@gnome-shell-extensions.gcampax.github.com"
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
];
};
"org/gnome/shell/extensions/pop-shell".tile-by-default = true;
"org/gnome/desktop/interface".enable-hot-corners = false;
"org/gnome/desktop/wm/preferences".focus-mode = "sloppy";
"org.gnome.mutter".focus-change-on-pointer-rest = false;
"org/gnome/desktop/wm/keybindings".close = [ "<Super>q" ];
"org/gnome/desktop/wm/keybindings".minimize = [ ];
"org/gnome/desktop/wm/keybindings".move-to-monitor-down = [ "<Shift><Super>j" ];
"org/gnome/desktop/wm/keybindings".move-to-monitor-left = [ "<Shift><Super>h" ];
"org/gnome/desktop/wm/keybindings".move-to-monitor-right = [ "<Shift><Super>l" ];
"org/gnome/desktop/wm/keybindings".move-to-monitor-up = [ "<Shift><Super>k" ];
"org/gnome/desktop/wm/keybindings".move-to-workspace-1 = [ "<Shift><Super>1" ];
"org/gnome/desktop/wm/keybindings".move-to-workspace-2 = [ "<Shift><Super>2" ];
"org/gnome/desktop/wm/keybindings".move-to-workspace-3 = [ "<Shift><Super>3" ];
"org/gnome/desktop/wm/keybindings".move-to-workspace-4 = [ "<Shift><Super>4" ];
"org/gnome/desktop/wm/keybindings".switch-to-workspace-1 = [ "<Super>1" ];
"org/gnome/desktop/wm/keybindings".switch-to-workspace-2 = [ "<Super>2" ];
"org/gnome/desktop/wm/keybindings".switch-to-workspace-3 = [ "<Super>3" ];
"org/gnome/desktop/wm/keybindings".switch-to-workspace-4 = [ "<Super>4" ];
"org/gnome/mutter".dynamic-workspaces = false;
"org/gnome/mutter/wayland/keybindings".restore-shortcuts = [ ];
"org/gnome/settings-daemon/plugins/media-keys".screensaver = [ "<Super>Escape" ];
"org/gnome/shell".favorite-apps = [ ];
"org/gnome/desktop/wm/preferences".num-workspaces = 4;
};
};
}

View file

@ -0,0 +1,28 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.gpg;
in
{
options.my.programs.gpg.enable = mkEnableOption "gpg";
config = mkIf cfg.enable {
home-manager.users.moritz.programs.gpg.enable = true;
environment.shellInit = ''
export GPG_TTY="$(tty)"
gpg-connect-agent /bye
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
'';
programs = {
ssh.startAgent = false;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
};
}

View file

@ -0,0 +1,44 @@
{ 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 {
environment.persistence."/persist".users.moritz.directories = [
".config/JetBrains"
".java/.userPrefs/jetbrains/"
".local/share/JetBrains"
];
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

@ -0,0 +1,95 @@
""" 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_prev_problem = '[x Previous problem'
map [x <Action>(PreviousOccurence)
let g:WhichKeyDesc_next_problem = ']x Next problem'
map ]x <Action>(NextOccurence)
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

@ -0,0 +1,40 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.kitty;
in
{
options.my.programs.kitty.enable = mkEnableOption "kitty";
config = mkIf cfg.enable {
my.terminal.package = config.home-manager.users.moritz.programs.kitty.package;
my.shell.aliases.ssh = "TERM=xterm-256color command ssh";
home-manager.users.moritz = {
programs.kitty = {
enable = true;
settings = {
scrollback_lines = 10000;
enable_audio_bell = false;
cursor_shape = "underline";
window_padding_width = 3;
confirm_os_window_close = 0;
background_opacity = "0.9";
font_features = "IntelOneMono-Regular +ss01";
resize_in_steps = "yes";
};
keybindings = {
"ctrl+plus" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
};
font = {
name = "Intel One Mono";
size = 10;
};
};
};
};
}

View file

@ -0,0 +1,95 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.lazygit;
wrapper = pkgs.writeShellApplication {
name = "lg";
text = ''
export LAZYGIT_NEW_DIR_FILE="$HOME/.lazygit/newdir"
lazygit "$@"
if [ -f "$LAZYGIT_NEW_DIR_FILE" ]; then
cd "$(cat "$LAZYGIT_NEW_DIR_FILE")"
rm -f "$LAZYGIT_NEW_DIR_FILE" > /dev/null
fi
'';
runtimeInputs = [ pkgs.lazygit ];
};
in
{
options.my.programs.lazygit.enable = mkEnableOption "lazygit";
config = mkIf cfg.enable {
home-manager.users.moritz.home.packages = [
wrapper
];
home-manager.users.moritz.programs.lazygit = {
enable = true;
settings = {
customCommands = [
{
key = "<c-v>";
context = "global";
description = "Create new conventional commit";
prompts = [
{
type = "menu";
key = "Type";
title = "Type of change";
options = [
{ name = "build"; description = "Changes that affect the build system or external dependencies"; value = "build"; }
{ name = "feat"; description = "A new feature"; value = "feat"; }
{ name = "fix"; description = "A bug fix"; value = "fix"; }
{ name = "chore"; description = "Other changes that don't modify src or test files"; value = "chore"; }
{ name = "ci"; description = "Changes to CI configuration files and scripts"; value = "ci"; }
{ name = "docs"; description = "Documentation only changes"; value = "docs"; }
{ name = "perf"; description = "A code change that improves performance"; value = "perf"; }
{ name = "refactor"; description = "A code change that neither fixes a bug nor adds a feature"; value = "refactor"; }
{ name = "revert"; description = "Reverts a previous commit"; value = "revert"; }
{ name = "style"; description = "Changes that do not affect the meaning of the code"; value = "style"; }
{ name = "test"; description = "Adding missing tests or correcting existing tests"; value = "test"; }
];
}
{
type = "input";
title = "Scope";
key = "Scope";
initialValue = "";
}
{
type = "menu";
key = "Breaking";
title = "Breaking change";
options = [
{ name = "no"; value = ""; }
{ name = "yes"; value = "!"; }
];
}
{
type = "input";
title = "message";
key = "Message";
initialValue = "";
}
{
type = "confirm";
key = "Confirm";
title = "Commit";
body = "Are you sure you want to commit?";
}
];
command = "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'";
loadingText = "Creating conventional commit...";
}
];
};
};
};
}

View file

@ -0,0 +1,54 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.ledger;
in
{
options.my.programs.ledger.enable = mkEnableOption "ledger";
config = mkIf cfg.enable {
my.shell = {
variables = {
LEDGER_FILE = "/home/moritz/Nextcloud/Notes/ledger/main.ledger";
};
aliases =
let
applyCommon = _: command: "${command} --payee note --strict --explicit";
in
mapAttrs applyCommon {
bal = "ledger bal";
balcash = "ledger bal -R -X --current --flat ^assets:bank ^liabilities";
balnet = "ledger bal -R -X --current --depth 2 ^assets ^liabilities";
bud = ''ledger bal --budget --unbudgeted -p "this month"'';
budr = ''ledger reg --budget --unbudgeted -p "this month"'';
reg = "ledger reg -R -V --tail 15";
};
};
environment.systemPackages = with pkgs; let
reg-copy = writeShellApplication {
name = "reg-copy";
runtimeInputs = [ ledger xclip ];
text = ''
table="$(printf '%-10s %-30s %8s %8s\n' Datum Beschreibung Einzeln Gesamt && ledger reg -V --format '%10D %.30P %8t %8T\n' "$@")"
echo "$table"
echo "$table" | xclip -selection clipboard
'';
};
in
[ ledger reg-copy hledger hledger-ui hledger-web ];
home-manager.users.moritz = {
xdg.configFile = {
"fish/completions/ledger.fish" = {
text = builtins.readFile ./ledger.fish;
};
};
};
};
}

View file

@ -0,0 +1,344 @@
# ledger completion
function __fish_ledger_needs_command
set cmd (commandline -opc)
set skip_next 0
test (count $cmd) -eq 1
and return 0
for item in $cmd[2..-1]
test $skip_next -eq 1
and set skip_next 0
and continue
switch $item
case '-D' '-F'
# These take an argument
set skip_next 1
case '-*' '*:*'
# Do nothing
case '*'
# Action found
echo $item
return 1
end
end
return 0
end
function __fish_ledger_command_is
set cmd (__fish_ledger_needs_command)
test -z "$cmd"
and return 1
contains -- $cmd $argv
and return 0
return 1
end
function __fish_complete_ledger_commands
for target in \
"accounts\\tList accounts of matching postings\\n" \
"args\\tPrint how args are evaluated\\n" \
"balance\\tBalance report\\n" \
"budget\\tBudget report\\n" \
"cleared\\tCleared report\\n" \
"commodities\\tCommodities report\\n" \
"convert\\tConvert from CSV\\n" \
"csv\\tPrint output in CSV format\\n" \
"emacs\\tPrint output in Lisp form\\n" \
"entry\\tGenerate entry from template\\n" \
"equity\\tEquity report\\n" \
"eval\\tEvaluate the arguments\\n" \
"expr\\tPrint how given value expr is evaluated\\n" \
"format\\tPrint how given format is evaluated\\n" \
"generate\\tGenerate random ledger data for tests\\n" \
"org\\tExport to Org Mode\\n" \
"parse\\tPrint how given value expr is evaluated\\n" \
"payees\\tList payees of matching posting\\n" \
"period\\tPrint how given period is interpreted\\n" \
"pop\\tUnset option in the REPL\\n" \
"pricedb\\tPrices report based on ~/.pricedb\\n" \
"pricemap\\tGraph of commodities relationships\\n" \
"prices\\tPrices report\\n" \
"print\\tPrint full transactions\\n" \
"push\\tSet option in the REPL\\n" \
"python\\tRun given file in Python inerpreter\\n" \
"query\\tPrint how args are evaluated\\n" \
"register\\tList matching postings\\n" \
"reload\\tReload all data files for current session\\n" \
"select\\tUse an SQL query to print postings\\n" \
"server\\tStarts HTTP server\\n" \
"source\\tCheck journal file for errors\\n" \
"stats\\tPrint summary info on matching postings\\n" \
"template\\tShow insertion template generated by xcat command\\n" \
"xact\\tGenerate entry from template\\n" \
"xml\\tPrint report in XML format\\n" \
printf $target
end
end
function __fish_complete_ledger_expr
set -l tail (commandline -tc)
string match -q -r -- '^-' "$tail"
and return 0
string match -q -r -- '[()!]' "$tail"
# Complete "ledger echo \(foo"
and set -l head (string match -r -- '.*[()!]' "$tail"; true)
and set head (string replace -r -a -- '[\\\]' '\\' "$head"; true)
and set tail (string match -r -- '[^()!]*$' "$tail"; true)
and set -l items (complete -C"ledger echo $tail")
and for item in $items
printf '%s%s\n' "$head" "$item"
end
and return 0
# Expression words
printf '(\tStart enclosed expression\n'
printf ')\tEnd enclosed expression\n'
printf '!\tLogical negation\n'
printf 'and\tLogical conjunction\n'
printf 'or\tLogical disjunction\n'
printf 'not\tLogical negation\n'
# Pseudo-portnames
set -l pseudo "all" "current" "active" "inactive" "installed" "uninstalled" \
"outdated" "obsolete" "requested" "unrequested" "leaves"
for item in $pseudo
printf '%s\tPseudo-portname\n' $item
end
# Pseudo-portname selectors
set -l selectors "depof:" "rdepof:" "depends:" "rdepends:" "dependentof:" \
"rdependentof:" "name:" "version:" "revision:" "epoch:" "variant:" \
"variants:" "category:" "categories:" "maintainer:" "maintainers:" \
"platform:" "platforms:" "description:" "long_description:" "homepage:" \
"license:" "portdir:"
for item in $selectors
printf '%s\tSelector\n' $item
end
test -z "$tail"
# Listing all ports is too slow, just stop here if empty
and return 0
# Globbing characters
printf '%s*\tGlob pattern\n' "$tail"
printf '%s?\tGlob pattern\n' "$tail"
# Portnames
test "$argv[1]" = "all"
# This might take long, try to limit the output
and set -l portexpr "*$tail*"
or set -l portexpr $argv[1]
set portnames (ledger -q echo $portexpr | string replace -r -- ' *@.*' '' \
| string replace -a -- ' ' '')
for item in $portnames
printf '%s\tPortname\n' $item
end
return 0
end
function __fish_complete_ledger_help
complete -C"ledger "
printf '%s\t%s\n' macports.conf "Configuration file of the MacPorts system"
printf '%s\t%s\n' portfile "MacPorts description file reference"
printf '%s\t%s\n' portgroup "MacPorts PortGroup command reference"
printf '%s\t%s\n' portstyle "Style guide for Portfiles"
printf '%s\t%s\n' porthier "Layout of the ports-filesystems"
end
function __fish_complete_ledger_select
set cmd (commandline -opc)
set count 0
for item in $cmd
switch $item
case '-*'
test $item = "--set"
and set is_set 1
or set is_set = 0
set count 0
case '*'
set count (math $count + 1)
set group $item
end
end
test $count -eq 0
and for name in (ledger select --summary | awk 'NR>2{print $1}')
printf '%s\tGroup name\n' $name
end
and return 0
test $count -eq 1
and test "$is_set" -eq 1
and for name in (ledger -q select --list $group)
string match -q -r -- '(active)' "$name"
and printf '%s\tActive\n' (string match -r -- '^\s*[^ \t]+' "$name")
or printf '%s\tInactive\n' "$name"
end
end
complete -e -c ledger
complete -f -c ledger
# --option | -o
complete -f -c ledger -s A -l average -d "Print average values over the number of transactions instead of running totals."
complete -f -c ledger -s B -l basis -d "Report the cost basis on all posting. Alias for --cost"
complete -f -c ledger -s L -l actual -d "Report only real transactions, with no automated or virtual transactions used."
complete -f -c ledger -s j -l amount-data -d "On a register report print only the dates and amount of post- ings. Useful for graphing and spreadsheet applications."
complete -f -c ledger -s P -l by-payee -d "Group postings in the register report by common payee names."
complete -f -c ledger -s C -l cleared -d "Display only cleared postings."
complete -f -c ledger -s n -l collapse -d "Print only the top level accounts."
complete -f -c ledger -s c -l current -d "Shorthand for --limit 'date <= today'."
complete -f -c ledger -s D -l daily -d "Shorthand for --period daily."
complete -f -c ledger -s E -l empty -d "Include empty accounts in report."
complete -f -c ledger -s G -l gain -d "Report net gain or loss for commodities that have a price his- tory."
complete -f -c ledger -s V -l market -d "Use the latest market value for all commodities."
complete -f -c ledger -s M -l monthly -d "Shorthand for --period monthly."
complete -f -c ledger -s % -l percent -d "Calculate the percentage value of each account in a balance reports. Only works for account that have a single commodity."
complete -f -c ledger -s I -l price -d "Use the price of the commodity purchase for performing calcula- tions."
complete -f -c ledger -s O -l quantity -d "Report commodity totals (this is the default)."
complete -f -c ledger -s R -l real -d "Account using only real transactions ignoring virtual and auto- matic transactions."
complete -f -c ledger -s r -l related -d "In a register report show the related account. This is the other side of the transaction."
complete -f -c ledger -s s -l subtotal -d "Report register as a single subtotal."
complete -f -c ledger -s J -l total-data -d "Show only dates and totals to format the output for plots."
complete -f -c ledger -s U -l uncleared -d "Use only uncleared transactions in calculations and reports."
complete -f -c ledger -s Y -l yearly -d "Shorthand for --period yearly."
complete -f -c ledger -s w -l wide -d "Assume 132 columns instead of the TTY width."
complete -f -c ledger -s W -l weekly -d "Shorthand for --period weekly."
# --option
complete -f -c ledger -l version -d "Print version information and exit."
complete -f -c ledger -l verify-memory -d "Verify that every constructed object is properly destructed. This is for debugging purposes only."
complete -f -c ledger -l verify -d "Enable additional assertions during run-time. This causes a significant slowdown. When combined with --debug CODE ledger will produce memory trace information."
complete -f -c ledger -l verbose -d "Print detailed information on the execution of ledger."
complete -f -c ledger -l values -d "Show the values used by each tag when used in combination with the tags command."
complete -f -c ledger -l unround -d "Perform all calculations without rounding and display results to full precision."
complete -f -c ledger -l unrealized-losses -d "Allow the user to specify what account name should be used for unrealized losses. Defaults to Equity:Unrealized Losses. Often set in one's ~/.ledgerrc file to change the default."
complete -f -c ledger -l unrealized-gains -d "Allow the user to specify what account name should be used for unrealized gains. Defaults to Equity:Unrealized Gains. Often set in one's ~/.ledgerrc file to change the default."
complete -f -c ledger -l unrealized -d "Show generated unrealized gain and loss accounts in the balance report."
complete -f -c ledger -l unbudgeted -d "Show only un-budgeted postings."
complete -f -c ledger -l time-report -d "Add two columns to the balance report to show the earliest checkin and checkout times for timelog entries."
complete -f -c ledger -l time-colon -d "Display the value for commodities based on seconds as hours and minutes. Thus 8100s will be displayed as 2:15h instead of 2.25h."
complete -f -c ledger -l strict -d "Accounts, tags or commodities not previously declared will cause warnings."
complete -f -c ledger -l sort-xacts -d "Sort the posting within transactions using the given value expression."
complete -f -c ledger -l rich-data -d "When generating a ledger transaction from a CSV file using the convert command, add CSV, Imported, and UUID meta-data."
complete -f -c ledger -l revalued-total -d "Display the sum of the revalued postings as the running total, which serves to show unrealized capital in a gain/losses report."
complete -f -c ledger -l revalued-only -d "Show only <Revalued> postings."
complete -f -c ledger -l revalued -d "Report discrepancy in values for manual reports by inserting <Revalued> postings. This is implied when using the --exchange (-X) or --market (-V) option."
complete -f -c ledger -l related-all -d "Show all postings in a transaction, similar to --related but show both sides of each transaction."
complete -f -c ledger -l recursive-aliases -d "Causes ledger to try to expand aliases recursively, i.e. try to expand the result of an earlier expansion again, until no more expansions apply."
complete -f -c ledger -l raw -d "In the print report, show transactions using the exact same syn- tax as specified by the user in their data file. Don't do any massaging or interpreting. Can be useful for minor cleanups, like just aligning amounts."
complete -f -c ledger -l quarterly -d "Shorthand for --period quarterly."
complete -f -c ledger -l primary-date -d "Show primary dates for all calculations. Alias for --actual-dates"
complete -f -c ledger -l permissive -d "Quiet balance assertions."
complete -f -c ledger -l period-sort -d "Sort the posting within transactions using the given value expression."
complete -f -c ledger -l pending -d "Use only postings that are marked pending."
complete -f -c ledger -l pedantic -d "Accounts, tags or commodities not previously declared will cause errors."
complete -f -c ledger -l payee -d "Sets a value expression for formatting the payee. In the register report this prevents the second entry from having a date and payee for each transaction."
complete -f -c ledger -l options -d "Display the options in effect for this ledger invocation, along with their values and the source of those values."
complete -f -c ledger -l no-total -d "Suppress printing the final total line in a balance report."
complete -f -c ledger -l no-titles -d "Suppress the output of group titles."
complete -f -c ledger -l no-rounding -d "Don't output \"<Adjustment>\" postings. Note that this will cause the running total to often not add up! Its main use is for --amount-data (-j) and --total-data (-J) reports."
complete -f -c ledger -l no-revalued -d "Stop ledger from showing <Revalued> postings."
complete -f -c ledger -l no-pager -d "Disables the pager on TTY output."
complete -f -c ledger -l no-color -d "Suppress any color TTY output."
complete -f -c ledger -l no-aliases -d "Aliases are completely ignored."
complete -f -c ledger -l lots-actual -d "Preserve the uniqueness of commodities so they aren't merged during reporting without printing the lot annotations."
complete -f -c ledger -l lots -d "Report the date and price at which each commodity was purchased in a balance report."
complete -f -c ledger -l lot-prices -d "Report the price at which each commodity in a balance report was purchased."
complete -f -c ledger -l lot-notes -d "Report the tag attached to each commodity in a balance report."
complete -f -c ledger -l lot-dates -d "Report the date on which each commodity in a balance report was purchased."
complete -f -c ledger -l invert -d "Change the sign of all reported values."
complete -f -c ledger -l immediate -d "Evaluate calculations immediately rather than lazily."
complete -f -c ledger -l help -d "Print this man page. --generated Include auto-generated postings (such as those from automated transactions) in the report, in cases where you normally wouldn't want them."
complete -f -c ledger -l force-pager -d "Force ledger to paginate its output."
complete -f -c ledger -l force-color -d "Output TTY color codes even if the TTY doesn't support them. Useful for TTYs that don't advertise their capabilities cor- rectly."
complete -f -c ledger -l flat -d "Force the full names of accounts to be used in the balance report. The balance report will not use an indented tree."
complete -f -c ledger -l explicit -d "Direct ledger to require pre-declarations for entities (such as accounts, commodities and tags) rather than taking entities from cleared transactions as defined."
complete -f -c ledger -l exact -d "Report beginning and ending of periods by the date of the first and last posting occurring in that period."
complete -f -c ledger -l equity -d "Related to the equity command. Gives current account balances in the form of a register report."
complete -f -c ledger -l effective -d "Show auxiliary dates for all calculations. Alias for --aux-date."
complete -f -c ledger -l download -d "Cause quotes to be automagically downloaded, as needed, by run- ning a script named getquote and expecting that script to return a value understood by ledger. A sample implementation of a getquote script, implemented in Perl, is provided in the distri- bution. Downloaded quote price are then appended to the price database, usually specified using the environment variable LEDGER_PRICE_DB."
complete -f -c ledger -l dow -d "Group transactions by the days of the week. Alias for --days-of-week."
complete -f -c ledger -l deviation -d "Report each posting's deviation from the average. It is only meaningful in the register and prices reports."
complete -f -c ledger -l detail -d "Related to convert command. Synonym to --rich-data option."
complete -f -c ledger -l decimal-comma -d "Direct ledger to parse journals using the European standard comma as decimal separator, vice a period."
complete -f -c ledger -l dc -d "Display register or balance in debit/credit format If you use --dc with either the register or balance commands, you will now get separate columns for debits and credits."
complete -f -c ledger -l days-of-week -d "Group transactions by the days of the week. Alias for --dow."
complete -f -c ledger -l day-break -d "Break up register report of timelog entries that span multiple days by day."
complete -f -c ledger -l count -d "Direct ledger to report the number of items when appended to the commodities, accounts or payees commands."
complete -f -c ledger -l cost -d "Report the cost basis on all posting. Alias for --basis. --color Use color if the terminal supports it. Alias for --ansi"
complete -f -c ledger -l collapse-if-zero -d "Collapse the account display only if it has a zero balance."
complete -f -c ledger -l check-payees -d "Enable strict and pedantic checking for payees as well as accounts, commodities and tags."
complete -f -c ledger -l budget -d "Only display budgeted items. In a register report this displays transaction in the budget, in a balance report this displays accounts in the budget."
complete -f -c ledger -l base -d "Reduce convertible commodities down the bottom of the conver- sion, e.g. display time in seconds."
complete -f -c ledger -l aux-date -d "Show auxiliary dates for all calculations. Alias for --effective"
complete -f -c ledger -l auto-match -d "When generating a ledger transaction from a CSV file using the convert command, automatically match an account from the Ledger journal."
complete -f -c ledger -l args-only -d "Ignore init files and environment variables for the ledger run."
complete -f -c ledger -l ansi -d "Use color if the terminal supports it. Alias for --color --anon Anonymize registry output, mostly for sending in bug reports."
complete -f -c ledger -l add-budget -d "Show only un-budgeted postings."
complete -f -c ledger -l abbrev-len -d "INT Set the minimum length an account can be abbreviated to if it doesn't fit inside the account-width. If INT is zero, then the account name will be truncated on the right. If INT is greater than account-width then the account will be truncated on the left, with no shortening of the account names in order to fit into the desired width."
complete -f -c ledger -l account -a "(__fish_complete_ledger_opt_args EXPR)" -d "Prepend EXPR to all accounts reported. That is, the option --account \"'Personal'\" would tack Personal: and --account \"tag('VAT')\" would tack the value of the VAT tag to the begin- ning of every account reported in a balance or register report."
complete -f -c ledger -l value-expr -a "(__fish_complete_ledger_opt_args EXPR)" -d "Set a global value expression annotation."
complete -f -c ledger -l only -a "(__fish_complete_ledger_opt_args EXPR)" -d "This is a postings predicate that applies after certain trans- forms have been executed, such as periodic gathering."
complete -f -c ledger -l group-by -a "(__fish_complete_ledger_opt_args EXPR)" -d "Group transaction together in the register report. EXPR can be anything, although most common would be payee or commodity. The tag() function is also useful here."
complete -f -c ledger -l forecast-while -a "(__fish_complete_ledger_opt_args EXPR)" -d "Continue forecasting while VEXPR is true. Alias for --forecast."
complete -f -c ledger -l display-total -a "(__fish_complete_ledger_opt_args EXPR)" -d "Apply a transformation to the displayed total. This occurs after calculations occur."
complete -f -c ledger -l display-amount -a "(__fish_complete_ledger_opt_args EXPR)" -d "Apply a transformation to the displayed amount. This occurs after calculations occur."
complete -f -c ledger -l date -a "(__fish_complete_ledger_opt_args EXPR)" -d "Transform the date of the transaction using EXPR."
complete -f -c ledger -l bold-if -a "(__fish_complete_ledger_opt_args EXPR)" -d "Print the entire line in bold if the given value expression is true."
complete -f -c ledger -l group-title-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Set the format for the headers that separate reports section of a grouped report. Only has effect with a --group-by EXPR regis- ter report."
complete -f -c ledger -l register-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Define the output format for the register report."
complete -f -c ledger -l pricedb-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Set the format expected for the historical price file."
complete -f -c ledger -l prices-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Set the format for the prices report."
complete -f -c ledger -l prepend-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Prepend FMT to every line of the output."
complete -f -c ledger -l plot-total-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Define the output format for a total data plot."
complete -f -c ledger -l plot-amount-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Define the output format for an amount data plot."
complete -f -c ledger -l csv-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Format csv report according to FMT."
complete -f -c ledger -l cleared-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Specify the format to use for the cleared report"
complete -f -c ledger -l budget-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Specify the format to use for the budget report."
complete -f -c ledger -l balance-format -a "(__fish_complete_ledger_opt_args FMT)" -d "Specify the format to use for the balance report."
complete -f -c ledger -l account-width -a "(__fish_complete_ledger_opt_args INT)" -d "Set the width of the account column in the register report to INT characters."
complete -f -c ledger -l trace -a "(__fish_complete_ledger_opt_args INT)" -d "Enable tracing. The INT specifies the level of trace desired."
complete -f -c ledger -l total-width -a "(__fish_complete_ledger_opt_args INT)" -d "Set the width of the total field in the register report."
complete -f -c ledger -l tail -a "(__fish_complete_ledger_opt_args INT)" -d "Report only the last INT entries. Only useful on a register report. Alias for --last INT"
complete -f -c ledger -l seed -a "(__fish_complete_ledger_opt_args INT)" -d "Set the random seed to INT for the generate command. Used as part of development testing."
complete -f -c ledger -l prepend-width -a "(__fish_complete_ledger_opt_args INT)" -d "Reserve INT spaces at the beginning of each line of the output."
complete -f -c ledger -l payee-width -a "(__fish_complete_ledger_opt_args INT)" -d "Set the number of columns dedicated to the payee in the register report to INT."
complete -f -c ledger -l meta-width -a "(__fish_complete_ledger_opt_args INT)" -d "Specify the width of the Meta column used for the --meta TAG options."
complete -f -c ledger -l last -a "(__fish_complete_ledger_opt_args INT)" -d "Report only the last INT entries. Opposite of --first INT. Only useful on a register report. Alias for --tail."
complete -f -c ledger -l head -a "(__fish_complete_ledger_opt_args INT)" -d "Print the first INT entries. Opposite of --tail INT. Alias for --first"
complete -f -c ledger -l forecast-years -a "(__fish_complete_ledger_opt_args INT)" -d "Forecast at most INT years into the future."
complete -f -c ledger -l first -a "(__fish_complete_ledger_opt_args INT)" -d "Print the first INT entries. Opposite of --last INT. Alias for --head."
complete -f -c ledger -l depth -a "(__fish_complete_ledger_opt_args INT)" -d "Limit the depth of the account tree. In a balance report, for example, --depth 2 will print balances only for accounts with two levels, i.e. Expenses:Entertainment but not Expenses:Entertainment:Dining. This is a display predicate, which means it only affects display, not the total calculations."
complete -f -c ledger -l date-width -a "(__fish_complete_ledger_opt_args INT)" -d "Specify the width, in characters, of the date column in the register report."
complete -f -c ledger -l columns -a "(__fish_complete_ledger_opt_args INT)" -d "Make the register report INT characters wide. By default ledger will use all available columns in your terminal."
complete -f -c ledger -l amount-width -a "(__fish_complete_ledger_opt_args INT)" -d "Set the width in characters of the amount column in the register report."
complete -f -c ledger -l datetime-format -a "(__fish_complete_ledger_opt_args DATETIMEFMT)" -d "Print datetimes using DATETIMEFMT. Refer to strftime(3) for details on the format string syntax."
complete -f -c ledger -l debug -a "(__fish_complete_ledger_opt_args STR)" -d "If ledger has been built with debug options this will provide extra data during the run."
complete -f -c ledger -l truncate -a "(__fish_complete_ledger_opt_args STR)" -d "Indicates how truncation should happen when the contents of col- umns exceed their width. Valid arguments for STR are leading, middle, and trailing. The default is smarter than any of these three, as it considers sub-names within the account name (that style is called \"abbreviate\")."
complete -f -c ledger -l start-of-week -a "(__fish_complete_ledger_opt_args STR)" -d "Use STR as the particular day of the week to start when using the --weekly option. STR can be day names, their abbreviations like \"Mon\", or the weekday number starting at 0 for Sunday."
complete -f -c ledger -l pager -a "(__fish_complete_ledger_opt_args STR)" -d "Use STR as the pager program."
complete -f -c ledger -l meta -a "(__fish_complete_ledger_opt_args STR)" -d "In the register report, prepend the transaction with the value of the given tag STR."
complete -f -c ledger -l master-account -a "(__fish_complete_ledger_opt_args STR)" -d "Prepend all account names with STR"
complete -f -c ledger -l inject -a "(__fish_complete_ledger_opt_args STR)" -d "Use STR amounts in calculations. In case you know what amount a transaction should be, but the actual transaction has the wrong value you can use metadata STR to specify the expected amount."
complete -f -c ledger -l script -a "(__fish_complete_ledger_opt_args FILE)" -d "Execute a ledger script."
complete -f -c ledger -l import -a "(__fish_complete_ledger_opt_args FILE)" -d "Import FILE as Python module."
complete -f -c ledger -l input-date-format -a "(__fish_complete_ledger_opt_args DATEFMT)" -d "Specify the input date format for journal entries."
complete -f -c ledger -l now -a "(__fish_complete_ledger_opt_args DATE)" -d "Use DATE as the current date. This affects the output when using --period, --begin, --end, or --current to decide which dates lie in the past or future."
complete -f -c ledger -l pivot -a "(__fish_complete_ledger_opt_args TAG)" -d "Produce a balance pivot report "around" the given TAG."
complete -f -c ledger -s T -l total -a "(__fish_complete_ledger_opt_args EXPR)" -d "Define a value expression used to calculate the total in reports."
complete -f -c ledger -s t -l amount -a "(__fish_complete_ledger_opt_args EXPR)" -d "Apply the given value expression to the posting amount. Using --amount EXPR you can apply an arbitrary transformation to the postings."
complete -f -c ledger -s d -l display -a "(__fish_complete_ledger_opt_args EXPR)" -d "Display lines that satisfy the expression EXPR."
complete -f -c ledger -s l -l limit -a "(__fish_complete_ledger_opt_args EXPR)" -d "Limit postings in calculations."
complete -f -c ledger -s S -l sort -a "(__fish_complete_ledger_opt_args EXPR)" -d "Sort the register report based on the value expression EXPR."
complete -f -c ledger -s f -l file -a "(__fish_complete_ledger_opt_args FILE)" -d "Read journal data from FILE."
complete -f -c ledger -s Z -l price-db -a "(__fish_complete_ledger_opt_args FILE)" -d "Set the expected freshness of price quotes, in INT minutes. That is, if the last known quote for any commodity is older than this value, and if --download is being used, then the Internet will be consulted again for a newer price. Otherwise, the old price is still considered to be fresh enough. Alias for --leeway."
complete -f -c ledger -s i -l init-file -a "(__fish_complete_ledger_opt_args FILE)" -d "Read FILE before any other ledger file. This file may not con- tain any postings, but it may contain option settings. To spec- ify options in the init file, use the same syntax as the com- mand-line, but put each option on its own line."
complete -f -c ledger -s o -l output -a "(__fish_complete_ledger_opt_args FILE)" -d "Redirect the output of ledger to FILE."
complete -f -c ledger -s Z -l price-exp -a "(__fish_complete_ledger_opt_args STR)" -d "Set the expected freshness of price quotes, in INT minutes. That is, if the last known quote for any commodity is older than this value, and if --download is being used, then the Internet will be consulted again for a newer price. Otherwise, the old price is still considered to be fresh enough. Alias for --leeway."
complete -f -c ledger -s p -l period -a "(__fish_complete_ledger_opt_args PERIOD)" -d "Define a period expression that sets the time period during which transactions are to be accounted. For a register report only the transactions that satisfy the period expression with be displayed. For a balance report only those transactions will be accounted in the final balances."
complete -f -c ledger -s Z -l leeway -a "(__fish_complete_ledger_opt_args INT)" -d "Alias for --price-expr."
complete -f -c ledger -s F -l format -a "(__fish_complete_ledger_opt_args FMT)" -d "Use the given format string FMT to print output."
complete -f -c ledger -s X -l exchange -a "(__fish_complete_ledger_opt_args COMMODITY)" -d "Display values in terms of the given COMMODITY. The latest available price is used."
complete -f -c ledger -s e -l end -a "(__fish_complete_ledger_opt_args DATE)" -d "Constrain the report so that transactions on or after DATE are not considered."
complete -f -c ledger -s b -l begin -a "(__fish_complete_ledger_opt_args DATE)" -d "Specify the start DATE of all calculations. Transactions before that date will be ignored."
complete -f -c ledger -s y -l date-format -a "(__fish_complete_ledger_opt_args DATEFMT)" -d "Print dates using DATEFMT. Refer to strftime(3) for details on the format string syntax."
complete -f -c ledger -n '__fish_ledger_needs_command' -a '(__fish_complete_ledger_commands)'
complete -f -c ledger -n "__fish_ledger_command_is search" -a "(__fish_complete_ledger_expr all)"

View file

@ -0,0 +1,20 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.logseq;
in
{
options.my.programs.logseq.enable = mkEnableOption "logseq";
config = mkIf cfg.enable {
users.users.moritz.packages = with pkgs; [
logseq-wayland
];
xdg.mime.defaultApplications."x-scheme-handler/logseq" = "logseq.desktop";
};
}

View file

@ -0,0 +1,23 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.miracast;
in
{
options.my.programs.miracast.enable = mkEnableOption "miracast";
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ 7236 7250 ];
allowedUDPPorts = [ 7236 5353 ];
};
users.users.moritz.packages = with pkgs; [
gnome-network-displays
];
};
}

View file

@ -0,0 +1,6 @@
% tmux, reptyr
# send background process to tmux
bg <process> && disown <process> && tmux new -d "$SHELL -c 'reptyr <process>'"
$ process: ps x -eo pid,tty,stat | awk '$2 ~ /pts/' | awk '$3 ~ /T/' | cut -d" " -f1 --- --preview "ps -p {} -o cmd"

View file

@ -0,0 +1,20 @@
{ config, lib, ... }:
with lib;
let
cfg = config.my.programs.navi;
in
{
options.my.programs.navi.enable = mkEnableOption "navi";
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.navi.enable = true;
xdg.dataFile."navi/cheats/personal" = {
enable = true;
recursive = true;
source = ./cheats;
};
};
};
}

View file

@ -0,0 +1,286 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
let
cfg = config.my.programs.niri;
inherit (config.home-manager.users.moritz.lib.niri) actions;
inherit (lib) mkEnableOption getExe mkIf;
in
{
imports = [
inputs.niri.nixosModules.niri
];
options.my.programs.niri.enable = mkEnableOption "niri";
options.my.programs.niri.autoStart = mkEnableOption "auto start niri" // {
default = true;
};
config = mkIf cfg.enable {
users.users.moritz.packages = with pkgs; [
brightnessctl # control brightness
grimblast # screenshot tool
pamixer # pulse audio cli
playerctl # control media playback
slurp # region select for wayland (for screensharing)
wdisplays # manage monitors
wl-clipboard # clipboard tool for wayland
];
# adds pam module for swaylock
security.pam.services.swaylock = { };
programs.niri.enable = true;
my = {
programs = {
wallpaper.enable = true;
ghostty.enable = true;
tofi.enable = true;
};
wallpapers.enable = true;
services = {
dunst.enable = true;
wallpaper = {
enable = true;
target = "niri.service";
};
spotify-player.target = "niri.service";
};
};
home-manager.users.moritz = {
programs.waybar = {
enable = true;
# start using systemd service
systemd = {
enable = true;
target = "niri.service";
};
settings = {
mainBar = {
start_hidden = true;
layer = "top";
position = "top";
height = 20;
modules-left = [ "niri/workspaces" ];
modules-center = [ "niri/window" ];
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
};
};
};
# 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 = "niri.service";
};
home.packages = with pkgs; [
wlr-randr
jq
];
services.kanshi = {
enable = true;
systemdTarget = "niri.service";
};
programs.niri = {
settings = {
environment = {
"NIXOS_OZONE_WL" = "1";
"QT_QPA_PLATFORM" = "wayland";
};
binds = {
# spawn different programs
"Mod+Return".action.spawn = config.my.terminal.package;
"Mod+Shift+escape".action.spawn = [ "loginctl" "lock-session" ];
"Mod+R".action.spawn = "${lib.getExe pkgs.fuzzel}";
# keyboard layout
"Mod+Space".action = actions.switch-layout "next";
"Mod+I".action = actions.show-hotkey-overlay;
"Mod+Q".action = actions.close-window;
"Mod+Shift+Q".action = actions.quit;
"Mod+Shift+C".action = actions.screenshot;
# resizing / swapping / switching
"Mod+F".action = actions.fullscreen-window;
"Mod+Shift+H".action.set-column-width = "-5%";
"Mod+Shift+L".action.set-column-width = "+5%";
"Mod+J".action = actions.focus-window-down-or-column-right;
"Mod+K".action = actions.focus-window-up-or-column-left;
"Mod+H".action = actions.move-column-left-or-to-monitor-left;
"Mod+L".action = actions.move-column-right-or-to-monitor-right;
"Mod+W".action.spawn = [ "pkill" "-USR1" "waybar" ];
"Mod+C".action = actions.consume-window-into-column;
"Mod+E".action = actions.expel-window-from-column;
"Mod+comma".action = actions.focus-monitor-up;
"Mod+period".action = actions.focus-monitor-down;
"Mod+Shift+comma".action = actions.move-workspace-to-monitor-up;
"Mod+Shift+period".action = actions.move-workspace-to-monitor-down;
"Mod+T".action = actions.switch-preset-column-width;
"Mod+Shift+1".action.move-window-to-workspace = 1;
"Mod+Shift+2".action.move-window-to-workspace = 2;
"Mod+Shift+3".action.move-window-to-workspace = 3;
"Mod+Shift+4".action.move-window-to-workspace = 4;
"Mod+Shift+5".action.move-window-to-workspace = 5;
"Mod+Shift+6".action.move-window-to-workspace = 6;
"Mod+Shift+7".action.move-window-to-workspace = 7;
"Mod+Shift+8".action.move-window-to-workspace = 8;
"Mod+Shift+9".action.move-window-to-workspace = 9;
"Mod+Shift+0".action.move-window-to-workspace = 10;
"Mod+1".action.focus-workspace = 1;
"Mod+2".action.focus-workspace = 2;
"Mod+3".action.focus-workspace = 3;
"Mod+4".action.focus-workspace = 4;
"Mod+5".action.focus-workspace = 5;
"Mod+6".action.focus-workspace = 6;
"Mod+7".action.focus-workspace = 7;
"Mod+8".action.focus-workspace = 8;
"Mod+9".action.focus-workspace = 9;
"Mod+0".action.focus-workspace = 10;
# audio
"XF86_AudioMute".action.spawn = [ "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle" ];
"XF86AudioRaiseVolume".action.spawn = [ "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+" "-l" "1.0" ];
"XF86AudioLowerVolume".action.spawn = [ "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-" ];
# TODO(mangoiv): mic mute toggle
};
environment = {
DISPLAY = ":0";
};
layout = {
border.enable = false;
focus-ring.enable = false;
default-column-width.proportion = 2.0 / 3.0;
preset-column-widths = [
{ proportion = 1.0 / 3.0; }
{ proportion = 2.0 / 3.0; }
{ proportion = 1.0 / 1.0; }
];
gaps = 3;
};
animations = {
enable = true;
slowdown = 0.5;
};
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
window-rules = [
{
matches = [
{ title = "^.*1Password.*$"; }
{ title = "^.*Bitwarden.*$"; }
{ title = "^.*KeePassXC.*$"; }
];
block-out-from = "screen-capture";
}
{
clip-to-geometry = true;
geometry-corner-radius = {
bottom-left = 5.0;
bottom-right = 5.0;
top-left = 5.0;
top-right = 5.0;
};
}
];
switch-events = {
lid-close.action.spawn = [ "loginctl" "lock-session" ];
};
input = {
touchpad.natural-scroll = false;
focus-follows-mouse.enable = true;
warp-mouse-to-focus = true;
keyboard = {
xkb.layout = "us, de";
};
};
};
};
};
systemd.user.services.xwayland-satellite = {
description = "Xwayland outside your Wayland";
after = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
bindsTo = [ "graphical-session.target" ];
requisite = [ "graphical-session.target" ];
serviceConfig = {
Type = "notify";
Restart = "always";
RestartSec = "1s";
ExecStart = "${getExe pkgs.xwayland-satellite}";
StandardOutput = "journal";
NotifyAccess = "all";
};
};
services = {
dbus.enable = true;
# use pipewire (needed for screensharing)
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
displayManager = mkIf cfg.autoStart {
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "niri";
};
xserver = mkIf cfg.autoStart {
enable = true;
displayManager.lightdm.enable = true;
};
};
security.rtkit.enable = true;
};
}

View file

@ -0,0 +1,82 @@
{ config
, lib
, inputs
, self
, pkgs
, ...
}:
let
inherit (lib) mkEnableOption mkOption types;
cfg = config.my.programs.nix;
in
{
options.my.programs.nix = {
gc = {
enable = mkEnableOption "nix-gc";
minimumFreedGB = mkOption {
default = 32;
type = types.int;
apply = number: toString (number * 1024 * 1024 * 1024);
};
};
optimise.enable = mkEnableOption "nix-optimise";
};
config = {
home-manager.users.moritz.programs.direnv.nix-direnv.package = pkgs.nix-direnv.override {
nix = config.nix.package;
};
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
package = pkgs.lix;
extraOptions = ''
experimental-features = nix-command flakes
'';
gc = {
automatic = cfg.gc.enable;
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";
dates = "weekly";
};
optimise = {
automatic = cfg.optimise.enable;
dates = [ "weekly" ];
};
registry = {
master-upstream.to = {
type = "github";
owner = "nixos";
repo = "nixpkgs";
};
master.flake = inputs.master;
nixpkgs.flake = inputs.nixpkgs;
stable.flake = inputs.stable;
dotfiles.flake = self;
default.flake = self;
d.flake = self;
};
settings = {
substituters = [
"https://cache.nixos.org?priority=1"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
trusted-users = [ "root" "@wheel" ];
# https://bmcgee.ie/posts/2023/12/til-how-to-optimise-substitutions-in-nix/
http-connections = 128;
max-substitution-jobs = 128;
};
};
};
}

View file

@ -0,0 +1,56 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
myLib = import ../../../lib.nix { inherit lib; };
cfg = config.my.programs.nvim;
in
{
imports = (myLib.listModulesRec ./plugins) ++ [
{
home-manager.sharedModules = [
inputs.nixvim.homeManagerModules.nixvim
];
}
];
options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".cache/nvim/luac"
".config/github-copilot"
".local/share/nvim"
".local/state/nvim"
];
home-manager.users.moritz = {
home.packages = with pkgs; [
xdotool # for vimtex
];
programs.nixvim = {
enable = true;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
vimAlias = true;
extraConfigLuaPre = readFile ./options.lua;
luaLoader.enable = true;
performance = {
byteCompileLua = {
enable = true;
configs = true;
initLua = true;
nvimRuntime = true;
plugins = true;
};
combinePlugins.enable = true;
combinePlugins.standalonePlugins = [
"plenary.nvim"
];
};
};
};
};
}

View file

@ -0,0 +1,44 @@
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.opt.autoindent = true
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/backup/" } -- don't store backup in files dir
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
vim.opt.conceallevel = 2
vim.opt.expandtab = true -- spaces instead of tabs
vim.opt.ignorecase = true
vim.opt.mouse = "a" -- mouse for all modes
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.scrolloff = 4 -- lines of context
vim.opt.shiftround = true -- round indent
vim.opt.shiftwidth = 0 -- use tabstop value
vim.opt.shortmess:append({ c = true })
vim.opt.signcolumn = "yes"
vim.opt.smartcase = true
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.tabstop = 2
vim.opt.termguicolors = true
vim.opt.undofile = true
vim.opt.undolevels = 10000
vim.opt.updatetime = 300
vim.opt.foldlevel = 99
vim.opt_local.spell = true
vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling
-- Abbreviations for common typos
vim.cmd("cnoreabbrev W! w!")
vim.cmd("cnoreabbrev Q! q!")
vim.cmd("cnoreabbrev Qall! qall!")
vim.cmd("cnoreabbrev Wq wq")
vim.cmd("cnoreabbrev Wa wa")
vim.cmd("cnoreabbrev wQ wq")
vim.cmd("cnoreabbrev WQ wq")
vim.cmd("cnoreabbrev W w")
vim.cmd("cnoreabbrev Q q")
if vim.g.neovide then
vim.opt.guifont = "Fira Code Nerd Font:h10"
vim.g.neovide_scale_factor = 0.7
end

View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf;
cfg = config.my.ai;
in
{
config = mkIf cfg.enable {
home-manager.users.moritz.programs.nixvim.plugins = {
render-markdown = {
enable = true;
settings.file_types = [ "markdown" "Avante" ];
};
nui.enable = true;
dressing.enable = true;
avante = {
enable = true;
settings = {
provider = "openai";
openai = {
api_key_name = "cmd:cat ${config.clan.core.vars.generators.moritz-openai.files.api-key.path}";
};
};
lazyLoad.settings.event = [ "DeferredUIEnter" ];
};
};
};
}

View file

@ -0,0 +1,36 @@
{ lib, pkgs, inputs, ... }:
{
home-manager.users.moritz.programs.nixvim = {
plugins.blink-compat.enable = true;
plugins.lsp.capabilities = /* lua */ ''
capabilities = require('blink.cmp').get_lsp_capabilities(capabilities)
'';
plugins.blink-cmp = {
enable = true;
settings = {
keymap = {
preset = "default";
};
appearance.nerd_font_variant = "mono";
sources = {
default = [
"lsp"
"path"
"snippets"
"buffer"
"vimtex"
];
providers.vimtex = {
name = "vimtex";
module = "blink.compat.source";
};
};
signature.enabled = true;
completion.documentation.auto_show = true;
completion.accept.auto_brackets.enabled = true;
snippets.preset = "luasnip";
};
};
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
colorschemes.catppuccin = {
enable = true;
settings.flavour = "macchiato";
settings.default_integrations = true;
};
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.comment.enable = true;
};
}

View file

@ -0,0 +1,74 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.conform-nvim = {
enable = true;
settings.formatters_by_ft = {
"*" = [ "codespell" "trim_whitespace" ];
elixir = [ "mix" ];
gleam = [ "gleam" ];
go = [ "gofmt" ];
json = [ "jq" ];
lua = [ "stylua" ];
nix = [ "nixpkgs_fmt" ];
python.__raw = ''
function(bufnr)
return { first(bufnr, "ruff_organize_imports", "isort"), first(bufnr, "ruff_format", "black")}
end
'';
rust = [ "rustfmt" ];
sh = [ "shfmt" ];
tex = [ "latexindent" ];
toml = [ "taplo" ];
yaml = [ "yamlfix" ];
markdown = [ "injected" ];
};
};
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
extraConfigLuaPre = ''
---@param bufnr integer
---@param ... string
---@return string
local function first(bufnr, ...)
local conform = require("conform")
for i = 1, select("#", ...) do
local formatter = select(i, ...)
if conform.get_formatter_info(formatter, bufnr).available then
return formatter
end
end
return select(1, ...)
end
vim.api.nvim_create_user_command("Format", function(opts)
require("conform").format({ formatters = opts.fargs })
end, {
nargs = "+",
complete = function()
local formatters_by_ft = require("conform").formatters_by_ft
local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {}
names = vim.list_extend(names, formatters_by_ft["*"] or {})
names = vim.tbl_flatten(names)
local formatters = vim.tbl_map(require("conform").get_formatter_info, names)
formatters = vim.tbl_filter(function(formatter)
return formatter.available
end, formatters)
return vim.tbl_map(function(formatter_info)
return formatter_info.name
end, formatters)
end,
})
'';
performance.combinePlugins.standalonePlugins = [
"conform.nvim"
];
keymaps = [
{ key = "="; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; }
];
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.crates.enable = true;
plugins.crates.lazyLoad.settings.event = [ "BufRead Cargo.toml" ];
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.direnv.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.friendly-snippets.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.fugitive.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.gitsigns.enable = true;
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.helpview.enable = true;
performance.combinePlugins.standalonePlugins = [ "helpview.nvim" ];
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.hmts.enable = true;
performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ];
};
}

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; }
{ key = "<"; action = "<gv"; options.desc = "Shift left"; mode = [ "v" ]; }
{ key = ">"; action = ">gv"; options.desc = "Shift right"; mode = [ "v" ]; }
{ key = "y"; action = "ygv<esc>"; options.desc = "Yank"; mode = [ "v" ]; }
];
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.lastplace.enable = true;
};
}

View file

@ -0,0 +1,68 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
elixir-tools-nvim
];
extraConfigLuaPost = ''
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
elixir.setup {
nextls = {
enable = true,
cmd = vim.fn.exepath("nextls"),
},
elixirls = {
enable = true,
cmd = vim.fn.exepath("elixir-ls"),
settings = elixirls.settings {
dialyzerEnabled = true,
enableTestLenses = true,
},
on_attach = function(client, bufnr)
vim.keymap.set("n", "<localleader>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("n", "<localleader>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("v", "<localleader>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
end,
},
}
'';
plugins.lsp = {
enable = true;
inlayHints = true;
servers.rust_analyzer = {
enable = true;
installRustc = false;
installCargo = false;
settings.files.watcher = "server";
};
servers.lexical.enable = true;
servers.lua_ls.enable = true;
servers.nil_ls.enable = true;
servers.nixd.enable = true;
servers.nixd.extraOptions.settings.nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }";
};
options = {
nixos = {
expr = ''builtins.head (builtins.attrValues ((builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations).options'';
};
"flake-parts" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options'';
};
"flake-parts2" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options'';
};
};
};
};
};
}

View file

@ -0,0 +1,45 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins = {
lspsaga = {
enable = true;
codeAction.keys.quit = "<esc>";
lightbulb.virtualText = false;
};
web-devicons.enable = true;
};
keymapsOnEvents = {
LspAttach = [
{
key = "<leader>q";
action = "<cmd>Lspsaga code_action<cr>";
options.desc = "Quickfix";
options.buffer = true;
}
{
key = "gd";
action = "<cmd>Lspsaga goto_definition<cr>";
options.desc = "Goto Definition";
options.buffer = true;
}
{
key = "<leader>r";
action = "<cmd>Lspsaga rename<cr>";
options.desc = "Rename";
options.buffer = true;
}
{
key = "K";
action = "<cmd>Lspsaga hover_doc<cr>";
options.desc = "Hover";
options.buffer = true;
}
];
};
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.lualine = {
enable = true;
lazyLoad.settings.event = [ "DeferredUIEnter" ];
};
}

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz = {
xdg.configFile."nvim/snippets" = {
recursive = true;
source = ../snippets;
};
programs.nixvim = {
plugins.luasnip = {
lazyLoad.settings.event = [ "InsertEnter" ];
lazyLoad.settings.after = /* lua */ ''
function()
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
require("luasnip.loaders.from_snipmate").lazy_load({ paths = "~/.config/nvim/snippets" })
require("luasnip.loaders.from_vscode").lazy_load()
end
'';
enable = true;
settings = {
history = true;
update_events = "TextChanged,TextChangedI";
delete_check_events = "TextChanged";
ext_opts.__raw = ''
{
[require("luasnip.util.types").choiceNode] = {
active = {
virt_text = { { "<--", "Error" } },
},
},
}
'';
ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype'';
};
};
};
};
}

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.lz-n.enable = true;
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.markdown-preview.enable = true;
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.marks = {
enable = true;
defaultMappings = false;
};
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.mini = {
enable = true;
modules = {
align = { };
};
};
performance.combinePlugins.standalonePlugins = [ "mini.nvim" ];
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.nvim-autopairs.enable = true;
};
}

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.nvim-ufo.enable = true;
}

View file

@ -0,0 +1,36 @@
_:
{
home-manager.users.moritz.programs.nixvim = {
plugins.obsidian = {
enable = true;
settings = {
ui.enable = false;
dir = "~/Documents/Nextcloud/Notes/zettelkasten/";
note_id_func.__raw = ''
function(title)
if title ~= nil then
return title
else
suffix = ""
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
return tostring(os.date("%Y-%m-%d")) .. "-" .. suffix
end
end
'';
mappings = {
"<localleader>n" = { action.__raw = ''function() return vim.cmd("ObsidianNew") end''; opts.desc = "New Note"; opts.buffer = true; };
"<localleader>q" = { action.__raw = ''function() return vim.cmd("ObsidianQuickSwitch") end''; opts.desc = "Quick Switch"; opts.buffer = true; };
"<localleader>b" = { action.__raw = ''function() return vim.cmd("ObsidianBacklinks") end''; opts.desc = "Backlinks"; opts.buffer = true; };
"<localleader>l" = { action.__raw = ''function() return vim.cmd("ObsidianLink") end''; opts.desc = "Link"; opts.buffer = true; };
"<localleader>e" = { action.__raw = ''function() return vim.cmd("ObsidianExtractNote") end''; opts.desc = "Extract Note"; opts.buffer = true; };
"<localleader>r" = { action.__raw = ''function() return vim.cmd("ObsidianRename") end''; opts.desc = "Rename"; opts.buffer = true; };
"<cr>" = { action.__raw = ''function() return require("obsidian").util.smart_action() end''; opts.buffer = true; opts.expr = true; };
"gf" = { action.__raw = ''function() return require("obsidian").util.gf_passthrough() end''; opts = { noremap = false; expr = true; buffer = true; }; };
};
};
};
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.oil.enable = true;
performance.combinePlugins.standalonePlugins = [
"oil.nvim"
];
};
}

View file

@ -0,0 +1,7 @@
_:
{
home-manager.users.moritz.programs.nixvim.plugins.otter = {
enable = true;
};
}

View file

@ -0,0 +1,12 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.render-markdown = {
enable = true;
settings.latex.enable = false;
lazyLoad.settings.event = "BufRead *.md";
};
}

View file

@ -0,0 +1,25 @@
_:
{
home-manager.users.moritz.programs.nixvim = {
keymaps = [
{
key = "<leader>g";
action.__raw = ''
function()
require("snacks").lazygit()
end
'';
options.desc = "Lazygit";
}
];
plugins.snacks = {
enable = true;
settings = {
bigfile.enable = true;
lazygit.enable = true;
};
};
};
}

View file

@ -0,0 +1,62 @@
_:
{
home-manager.users.moritz.programs.nixvim = {
autoCmd = [
{
event = [ "VimEnter" ];
callback.__raw = ''
function()
if vim.fn.len(vim.api.nvim_get_vvar("argv")) <= 8 then
require("telescope.builtin").find_files()
end
end
'';
}
];
plugins = {
telescope = {
enable = true;
extensions.fzf-native.enable = true;
settings.defaults.__raw = ''
require("telescope.themes").get_ivy({
layout_config = {
height = 0.75
}
})
'';
keymaps = {
"<leader>ff" = {
action = "find_files";
options.desc = "Find files";
};
"<leader>fb" = {
action = "buffers";
options.desc = "Find buffers";
};
"<leader>fl" = {
action = "current_buffer_fuzzy_find";
options.desc = "Search lines";
};
"<leader>fg" = {
action = "live_grep";
options.desc = "Live grep";
};
"<leader>fh" = {
action = "help_tags";
options.desc = "Help tags";
};
"<leader>fr" = {
action = "oldfiles";
options.desc = "Recent files";
};
"<leader>fc" = {
action = "commands";
options.desc = "Commands";
};
};
};
web-devicons.enable = true;
};
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.todo-comments = {
enable = true;
keymaps.todoTelescope.key = "<leader>ft";
};
};
}

View file

@ -0,0 +1,91 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.treesitter-textobjects = {
enable = true;
move = {
enable = true;
gotoNext = {
"]f" = {
desc = "Next function";
query = "@function.outer";
};
"]c" = {
desc = "Next class";
query = "@class.outer";
};
"]b" = {
desc = "Next block";
query = "@block.outer";
};
"]P" = {
desc = "Next parameter";
query = "@parameter.outer";
};
};
gotoPrevious = {
"[f" = {
desc = "Previous function";
query = "@function.outer";
};
"[c" = {
desc = "Previous class";
query = "@class.outer";
};
"[b" = {
desc = "Previous block";
query = "@block.outer";
};
"[P" = {
desc = "Previous parameter";
query = "@parameter.outer";
};
};
};
select = {
enable = true;
keymaps = {
"af" = {
desc = "function";
query = "@function.outer";
};
"if" = {
desc = "inner function";
query = "@function.inner";
};
"ac" = {
desc = "class";
query = "@class.outer";
};
"ic" = {
desc = "inner class";
query = "@class.inner";
};
"ab" = {
desc = "block";
query = "@block.outer";
};
"ib" = {
desc = "inner block";
query = "@block.inner";
};
"aP" = {
desc = "parameter";
query = "@parameter.outer";
};
"iP" = {
desc = "inner parameter";
query = "@parameter.inner";
};
};
};
};
performance.combinePlugins.standalonePlugins = [
"nvim-treesitter-textobjects"
];
};
}

View file

@ -0,0 +1,26 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.treesitter = {
enable = true;
folding = true;
nixvimInjections = true;
settings.indent.enable = true;
settings.highlight.enable = true;
settings.incremental_selection = {
enable = true;
keymaps.init_selection = "gn";
keymaps.node_decremental = "gp";
keymaps.node_incremental = "gn";
};
lazyLoad.settings.event = [ "DeferredUIEnter" ];
};
performance.combinePlugins.standalonePlugins = [
"nvim-treesitter"
];
};
}

Some files were not shown because too many files have changed in this diff Show more