1

Nixos: Cleanup modules

This commit is contained in:
2024-10-11 22:09:58 +02:00
parent b297eb310e
commit 539020f04c
3 changed files with 33 additions and 51 deletions

View File

@ -7,10 +7,11 @@
username, username,
lib, lib,
mylib, mylib,
nixosConfig,
config, config,
pkgs, pkgs,
... ...
} @ inputs: }:
# This is a HM module. # This is a HM module.
# Because no imports/options/config is defined explicitly, everything is treated as config: # Because no imports/options/config is defined explicitly, everything is treated as config:
# { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly. # { inputs, lib, ... }: { ... } gets turned into { inputs, lib, ... }: { config = { ... }; } implicitly.
@ -144,6 +145,7 @@ rec {
}; };
kitty.enable = true; kitty.enable = true;
latex.enable = true;
neovim = { neovim = {
enable = true; enable = true;
@ -171,12 +173,12 @@ rec {
html.enable = false; html.enable = false;
}; };
# Make fonts installed through user packages available to applications # Make fonts installed through user packages available to applications.
# NOTE: I don't think I need this anymore as all fonts are installed through the system config but let's keep this just in case # Also updates the font-cache.
fonts.fontconfig.enable = true; # Also updates the font-cache fonts.fontconfig.enable = true;
# This only works when HM is installed as a system module, # This only works when HM is installed as a system module,
# as nixosConfig won't be available otherwise # as nixosConfig won't be available otherwise.
xdg = { xdg = {
mime.enable = true; mime.enable = true;
mimeApps = { mimeApps = {
@ -222,20 +224,6 @@ rec {
in in
formatted; formatted;
# TODO: If mpv enabled
".config/mpv" = {
recursive = true;
source = ../../config/mpv;
};
# TODO: Latex module
# "texmf/tex/latex/custom/christex.sty".source = ../../config/latex/christex.sty;
# "Notes/Obsidian/Chriphost/christex.sty".source = ../../config/latex/christex.sty; # For obsidian notes
".indentconfig.yaml".source = ../../config/latex/.indentconfig.yaml;
".indentsettings.yaml".source = ../../config/latex/.indentsettings.yaml;
"Notes/Obsidian/Chriphost/latex_snippets.json".source = ../../config/obsidian/latex_snippets.json; # TODO: Symlink
"Notes/Obsidian/Chriphost/.obsidian/snippets/latex_preview.css".source = ../../config/obsidian/css_snippets/latex_preview.css;
# TODO: If navi enabled # TODO: If navi enabled
".local/share/navi/cheats/christoph.cheat".source = ../../config/navi/christoph.cheat; # TODO :Symlink ".local/share/navi/cheats/christoph.cheat".source = ../../config/navi/christoph.cheat; # TODO :Symlink
}; };
@ -252,7 +240,6 @@ rec {
# Add stuff for your user as you see fit: # Add stuff for your user as you see fit:
packages = with pkgs; [ packages = with pkgs; [
# TODO: Make a module for standard UNIX replacements
# Shell utils # Shell utils
(ripgrep.override {withPCRE2 = true;}) # fast as fuck (ripgrep.override {withPCRE2 = true;}) # fast as fuck
gdu # Alternative to du-dust (I like it better) gdu # Alternative to du-dust (I like it better)
@ -290,15 +277,12 @@ rec {
imagemagick # Convert image (magic) imagemagick # Convert image (magic)
# Document utils # Document utils
# TODO: Latex module with individual packages or HomeManager
texliveFull
poppler_utils # pdfunite poppler_utils # pdfunite
graphviz # generate graphs from code graphviz # generate graphs from code
plantuml # generate diagrams plantuml # generate diagrams
gnuplot # generate function plots gnuplot # generate function plots
pdf2svg # extract vector graphics from pdf pdf2svg # extract vector graphics from pdf
pandoc # document converting madness pandoc # document converting madness
inkscape # for latex
# Networking # Networking
dig # Make DNS requests dig # Make DNS requests
@ -406,7 +390,6 @@ rec {
git = { git = {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;
delta.enable = false; # TODO: Build failure
userEmail = "christoph.urlacher@protonmail.com"; userEmail = "christoph.urlacher@protonmail.com";
userName = "Christoph Urlacher"; userName = "Christoph Urlacher";

View File

@ -1,6 +1,5 @@
{ {
config, config,
nixosConfig,
lib, lib,
mylib, mylib,
pkgs, pkgs,
@ -89,7 +88,7 @@ in {
}; };
plugins = [ plugins = [
# oh-my-fish plugins are stored in their own repositories, which # Oh-my-fish plugins are stored in their own repositories, which
# makes them simple to import into home-manager. # makes them simple to import into home-manager.
# NOTE: Currently, HM ignores theme plugins # NOTE: Currently, HM ignores theme plugins
# { # {
@ -111,18 +110,21 @@ in {
shellAbbrs = let shellAbbrs = let
# Only add " | bat" if bat is installed # Only add " | bat" if bat is installed
batify = command: command + (optionalString config.programs.bat.enable " | bat"); batify = command: command + (optionalString config.programs.bat.enable " | bat");
# Same as above but with args for bat # Same as above but with args for bat
batifyWithArgs = command: args: command + (optionalString config.programs.bat.enable (" | bat " + args)); batifyWithArgs = command: args: command + (optionalString config.programs.bat.enable (" | bat " + args));
# NOTE: These can be used for my config.modules and for HM config.programs, as both of these add the package to home.packages # These can be used for my config.modules and for HM config.programs,
# as both of these add the package to home.packages
hasHomePackage = package: (contains config.home.packages package); hasHomePackage = package: (contains config.home.packages package);
# Only add fish abbr if package is installed # Only add fish abbr if package is installed
abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr); abbrify = package: abbr: (optionalAttrs (hasHomePackage package) abbr);
in in
mkMerge [ mkMerge [
# Default abbrs, always available # Abbrs that are always available are defined here.
{ {
# Shell basic # Shell basics
c = "clear"; c = "clear";
q = "exit"; q = "exit";
@ -130,7 +132,7 @@ in {
h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish h = batifyWithArgs "history" "-l fish"; # -l fish sets syntax highlighting to fish
listabbrs = batifyWithArgs "abbr" "-l fish"; listabbrs = batifyWithArgs "abbr" "-l fish";
# tools # Tools
cd = "z"; # zoxide for quickjump to previously visited locations cd = "z"; # zoxide for quickjump to previously visited locations
b = "z -"; # jump to previous dir b = "z -"; # jump to previous dir
mkdir = "mkdir -p"; # also create parents (-p) mkdir = "mkdir -p"; # also create parents (-p)
@ -141,7 +143,7 @@ in {
np = "nnncd -a -P p"; np = "nnncd -a -P p";
ssh = "kitty +kitten ssh"; ssh = "kitty +kitten ssh";
# systemd # Systemd
failed = "systemctl --failed"; failed = "systemctl --failed";
errors = "journalctl -p 3 -xb"; errors = "journalctl -p 3 -xb";
kernelerrors = "journalctl -p 3 -xb -k"; kernelerrors = "journalctl -p 3 -xb -k";
@ -149,7 +151,6 @@ in {
useruniterrors = "journalctl -xb --user-unit="; useruniterrors = "journalctl -xb --user-unit=";
# NFS shares # NFS shares
# TODO: Make a rofi menu out of this? Maybe general purpose menu? Or menu for all abbrs?
msusenet = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Usenet /media/Stash-Usenet"; msusenet = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Usenet /media/Stash-Usenet";
mspicture = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Picture /media/Stash-Picture"; mspicture = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Picture /media/Stash-Picture";
msvideo = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Video /media/Stash-Video"; msvideo = "sudo mount.nfs4 192.168.86.20:/mnt/WD\\ Blue\\ Stripe\\ 2T/Video /media/Stash-Video";
@ -159,28 +160,34 @@ in {
mmusic = "sudo mount.nfs4 192.168.86.20:/mnt/SG\\ Exos\\ Mirror\\ 18TB/Music /media/Music"; mmusic = "sudo mount.nfs4 192.168.86.20:/mnt/SG\\ Exos\\ Mirror\\ 18TB/Music /media/Music";
musenet = "sudo mount.nfs4 192.168.86.20:/mnt/SG\\ Exos\\ Mirror\\ 18TB/Usenet /media/Usenet"; musenet = "sudo mount.nfs4 192.168.86.20:/mnt/SG\\ Exos\\ Mirror\\ 18TB/Usenet /media/Usenet";
# disassemble # Disassemble
disassemble = "objdump -d -S -M intel"; disassemble = "objdump -d -S -M intel";
} }
# Abbrs only available if package is installed # Abbrs only available if package is installed
(abbrify pkgs.btop {top = "btop";}) (abbrify pkgs.btop {top = "btop";})
(abbrify pkgs.duf { (abbrify pkgs.duf {
df = "duf"; df = "duf";
disksummary = "duf"; disksummary = "duf";
}) })
(abbrify pkgs.eza { (abbrify pkgs.eza {
ls = "eza --color=always --group-directories-first -F --git --icons=always"; # color-ls ls = "eza --color=always --group-directories-first -F --git --icons=always"; # color-ls
lsl = "eza --color=always --group-directories-first -F -l --git --icons=always --octal-permissions"; lsl = "eza --color=always --group-directories-first -F -l --git --icons=always --octal-permissions";
lsa = "eza --color=always --group-directories-first -F -l -a --git --icons=always --octal-permissions"; lsa = "eza --color=always --group-directories-first -F -l -a --git --icons=always --octal-permissions";
tre = "eza --color=always --group-directories-first -F -T -L 2 ---icons=always"; tre = "eza --color=always --group-directories-first -F -T -L 2 ---icons=always";
}) })
(abbrify pkgs.fd {find = "fd";}) (abbrify pkgs.fd {find = "fd";})
(abbrify pkgs.fzf {fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";}) (abbrify pkgs.fzf {fuzzy = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";})
(abbrify pkgs.gdu { (abbrify pkgs.gdu {
du = "gdu"; du = "gdu";
storageanalysis = "gdu"; storageanalysis = "gdu";
}) })
(abbrify pkgs.git { (abbrify pkgs.git {
gs = "git status"; gs = "git status";
gcm = "git commit -m"; gcm = "git commit -m";
@ -188,29 +195,20 @@ in {
glg = "git log --graph --decorate --oneline"; glg = "git log --graph --decorate --oneline";
gcl = "git clone"; gcl = "git clone";
}) })
(abbrify pkgs.gping {ping = "gping";}) (abbrify pkgs.gping {ping = "gping";})
(abbrify pkgs.lazygit {lg = "lazygit";}) (abbrify pkgs.lazygit {lg = "lazygit";})
# (abbrify pkgs.navi {n = "navi";})
(abbrify pkgs.notmuch {
mailrefresh = "notmuch new";
mailsearch = "notmuch search";
})
(abbrify pkgs.protonvpn-cli {
vpnon = "protonvpn-cli c -f";
vpnat = "protonvpn-cli c --cc at";
vpnch = "protonvpn-cli c --cc ch";
vpnlu = "protonvpn-cli c --cc lu";
vpnus = "protonvpn-cli c --cc us";
vpnhk = "protonvpn-cli c --cc hk";
vpnkr = "protonvpn-cli c --cc kr";
vpnoff = "protonvpn-cli d";
})
(abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";}) (abbrify pkgs.ranger {r = "ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR";})
(abbrify pkgs.rsync { (abbrify pkgs.rsync {
# cp = "rsync -ahv --inplace --partial --info=progress2"; copy = "rsync -ahv --inplace --partial --info=progress2";
rsync = "rsync -ahv --inplace --partial --info=progress2"; rsync = "rsync -ahv --inplace --partial --info=progress2";
}) })
(abbrify pkgs.sd {sed = "sd";}) (abbrify pkgs.sd {sed = "sd";})
(abbrify pkgs.yt-dlp { (abbrify pkgs.yt-dlp {
mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults mp4 = "yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' --recode-video mp4"; # the -f options are yt-dlp defaults
mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3"; mp3 = "yt-dlp -f 'ba' --extract-audio --audio-format mp3";

View File

@ -6,8 +6,9 @@
lib, lib,
mylib, mylib,
pkgs, pkgs,
nixosConfig,
... ...
} @ inputs: let }: let
cfg = config.modules.hyprland; cfg = config.modules.hyprland;
in { in {
options.modules.hyprland = import ./options.nix {inherit lib mylib;}; options.modules.hyprland = import ./options.nix {inherit lib mylib;};
@ -17,7 +18,7 @@ in {
{ {
# This assertion is not possible if HM is used standalone, # This assertion is not possible if HM is used standalone,
# because nixosConfig won't be available. # because nixosConfig won't be available.
assertion = inputs.nixosConfig.programs.hyprland.enable; assertion = nixosConfig.programs.hyprland.enable;
message = "Can't enable Hyprland module with Hyprland disabled!"; message = "Can't enable Hyprland module with Hyprland disabled!";
} }
]; ];