ctucx.git: nixfiles

ctucx' nixfiles

commit 174261d184fc82c066af6e1dbfbc37f100b1e129
parent ca60ad4c8fc5aad9b4c1c3f8b922face9b4e2802
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 19 Dec 2023 16:39:18 +0100

configuration/common/programs: big refactor! now modular :3
25 files changed, 678 insertions(+), 428 deletions(-)
M
configurations/common/default.nix
|
20
++------------------
M
configurations/common/programs/bash.nix
|
136
+++++++++++++++++++++++++++++++++++++++++--------------------------------------
A
configurations/common/programs/default.nix
|
44
++++++++++++++++++++++++++++++++++++++++++++
A
configurations/common/programs/eza.nix
|
28
++++++++++++++++++++++++++++
M
configurations/common/programs/git.nix
|
61
+++++++++++++++++++++++++++++++++++++------------------------
M
configurations/common/programs/gpg.nix
|
189
++++++++++++++++++++++++++++++++++++++++++-------------------------------------
M
configurations/common/programs/htop.nix
|
87
++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
M
configurations/common/programs/mcfly.nix
|
31
++++++++++++++++++++-----------
M
configurations/common/programs/micro.nix
|
47
+++++++++++++++++++++++++++++------------------
D
configurations/common/programs/network-utilities.nix
|
27
---------------------------
A
configurations/common/programs/networkUtilities.nix
|
38
++++++++++++++++++++++++++++++++++++++
A
configurations/common/programs/ocrmypdf.nix
|
20
++++++++++++++++++++
M
configurations/common/programs/password-store.nix
|
55
++++++++++++++++++++++++++++++++++---------------------
A
configurations/common/programs/phockup.nix
|
20
++++++++++++++++++++
A
configurations/common/programs/shellUtilities.nix
|
60
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M
configurations/common/programs/ssh.nix
|
46
+++++++++++++++++++++-------------------------
M
configurations/common/programs/starship.nix
|
35
++++++++++++++++++++++-------------
M
configurations/common/programs/texlive.nix
|
17
+++++++++++++----
M
configurations/common/programs/tmux.nix
|
33
+++++++++++++++++++++------------
D
configurations/common/programs/utilities.nix
|
59
-----------------------------------------------------------
A
configurations/common/programs/yt-dlp.nix
|
27
+++++++++++++++++++++++++++
M
configurations/darwin/default.nix
|
12
++++++++----
M
machines/blechkasten/darwin-configuration.nix
|
3
+++
M
machines/briefkasten/configuration.nix
|
5
+++++
M
machines/wanderduene/configuration.nix
|
6
++++++
diff --git a/configurations/common/default.nix b/configurations/common/default.nix
@@ -8,30 +8,14 @@ in {
   imports = (builtins.concatLists [
     [
       ../../modules
-
-      ./programs/bash.nix
-      ./programs/micro.nix
-      ./programs/tmux.nix
-      ./programs/ssh.nix
-      ./programs/git.nix
-      ./programs/htop.nix
-      ./programs/utilities.nix
-      ./programs/network-utilities.nix
-      ./programs/scripts.nix
+      ./programs
     ]
     (if (currentSystem == "x86_64-linux") then [
       inputs.home-manager.nixosModules.home-manager
-
       ../linux
     ] else [])
-    (if (currentSystem == "aarch64-darwin") then [
+    (if (currentSystem == "aarch64-darwin") || (currentSystem == "x86_64-darwin") then [
       inputs.home-manager.darwinModules.home-manager
-
-      ../darwin
-    ] else [])
-    (if (currentSystem == "x86_64-darwin") then [
-      inputs.home-manager.darwinModules.home-manager
-
       ../darwin
     ] else [])
   ]);
diff --git a/configurations/common/programs/bash.nix b/configurations/common/programs/bash.nix
@@ -1,89 +1,93 @@
-{ pkgs, lib, ... }:
+{ config, pkgs, lib, ... }:
 
-{
-  imports = [
-    ./starship.nix
-    ./mcfly.nix
-  ];
+let
+  cfg = config.ctucxConfig.bash;
 
-  home-manager.users.leah = {
-    programs = {
-      bash = {
-        enable               = true;
-        enableVteIntegration = lib.mkIf pkgs.stdenv.isLinux true;
+in {
 
-        historyFileSize = 999999;
-        historyControl  = [ "ignoredups" "ignorespace" ];
-        historyIgnore   = [ "ls" "clear" "exit" ];
+  options = {
+    ctucxConfig.bash = {
+      enable = lib.mkEnableOption "bash";
+    };
+  };
 
-        shellAliases    = {
-          ".."         = "cd ..";
-          "..."        = "cd ../..";
+  config = lib.mkIf cfg.enable {
+    ctucxConfig.starship.enable = true;
+    ctucxConfig.mcfly.enable    = true;
+    ctucxConfig.eza.enable      = true;
 
-          rm           = "rm -i";
+    home-manager.users.leah = {
+      programs = {
+        bash = {
+          enable               = true;
+          enableVteIntegration = lib.mkIf pkgs.stdenv.isLinux true;
 
-          ls           = "eza";
-          ll           = "eza -l";
-          la           = "eza -a";
-          lt           = "eza --tree";
-          lla          = "eza -la";
+          historyFileSize = 999999;
+          historyControl  = [ "ignoredups" "ignorespace" ];
+          historyIgnore   = [ "ls" "clear" "exit" ];
 
-          cat          = "bat -p";
-          grep         = "rg";
-          find         = "fd";
+          shellAliases    = {
+            ".."         = "cd ..";
+            "..."        = "cd ../..";
 
-          diff         = "diff --color";
+            rm           = "rm -i";
 
-          killall      = "pkill";
+            cat          = lib.mkIf (builtins.elem "bat" config.home-manager.users.leah.home.packages) "bat -p";
+            grep         = lib.mkIf (builtins.elem "rg" config.home-manager.users.leah.home.packages)  "rg";
+            find         = lib.mkIf (builtins.elem "rd" config.home-manager.users.leah.home.packages)  "fd";
 
-          reinitgit    = "rm -rf .git && git init && git add -A && git commit -m 'init'";
+            diff         = "diff --color";
 
-          zzz          = (
-            if pkgs.stdenv.isLinux then
-              "sleep 1 && systemctl suspend"
-            else
-              "pmset sleepnow"
-          );
+            killall      = "pkill";
 
-          backgrounditems     = "bgiparser -f  \"\$HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm\" -c";
+            reinitgit    = "rm -rf .git && git init && git add -A && git commit -m 'init'";
 
-          yt-dlp-audio        = "yt-dlp --format bestaudio -x --audio-format opus --add-metadata --embed-thumbnail";
+            zzz          = (
+              if pkgs.stdenv.isLinux then
+                "sleep 1 && systemctl suspend"
+              else
+                "pmset sleepnow"
+            );
 
-        };
+            backgrounditems     = "bgiparser -f  \"\$HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm\" -c";
+
+          };
 
-        bashrcExtra = ''
-          use() {
-            declare -a all
-            for p in "$@"; do
-              all+=("''${NIXPKGS_PATH}#$p")
-            done
-            eval nix shell ''${all[@]}
-          }
-        '' + lib.optionalString pkgs.stdenv.isDarwin ''
-          if [ "$TERM" != "dumb" ]; then
-            source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
-            nullglobStatus=$(shopt -p nullglob)
-            shopt -s nullglob
-            for p in $NIX_PROFILES; do
-              for m in "$p/etc/bash_completion.d/"*; do
-                source $m
+          bashrcExtra = ''
+            use() {
+              declare -a all
+              for p in "$@"; do
+                all+=("''${NIXPKGS_PATH}#$p")
               done
-            done
-            eval "$nullglobStatus"
-            unset nullglobStatus p m
-          fi
+              eval nix shell ''${all[@]}
+            }
+          '' + lib.optionalString pkgs.stdenv.isDarwin ''
+            if [ "$TERM" != "dumb" ]; then
+              source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
+              nullglobStatus=$(shopt -p nullglob)
+              shopt -s nullglob
+              for p in $NIX_PROFILES; do
+                for m in "$p/etc/bash_completion.d/"*; do
+                  source $m
+                done
+              done
+              eval "$nullglobStatus"
+              unset nullglobStatus p m
+            fi
 
-          # Make bash check its window size after a process completes
-          shopt -s checkwinsize
+            # Make bash check its window size after a process completes
+            shopt -s checkwinsize
 
-          ${if pkgs.system == "aarch64-darwin" then ''
-          eval "$(/opt/homebrew/bin/brew shellenv)"
-          '' else ''
-          eval "$(/usr/local/bin/brew shellenv)"
-          ''}
-        '';
+            ${if pkgs.system == "aarch64-darwin" then ''
+            eval "$(/opt/homebrew/bin/brew shellenv)"
+            '' else ''
+            eval "$(/usr/local/bin/brew shellenv)"
+            ''}
+          '';
 
+        };
       };
     };
   };
+
 }
diff --git a/configurations/common/programs/default.nix b/configurations/common/programs/default.nix
@@ -0,0 +1,44 @@
+{ config, lib, ... }:
+
+{
+
+  imports = [
+    ./bash.nix
+
+    ./eza.nix
+    ./starship.nix
+    ./mcfly.nix
+    ./micro.nix
+    ./tmux.nix
+    ./htop.nix
+
+    ./ssh.nix
+    ./git.nix
+    ./gpg.nix
+
+    ./shellUtilities.nix
+    ./networkUtilities.nix
+
+    ./yt-dlp.nix
+    ./ocrmypdf.nix
+    ./phockup.nix
+    ./texlive.nix
+    ./password-store.nix
+
+    ./scripts.nix
+  ];
+
+  ctucxConfig.bash.enable             = lib.mkDefault true;
+
+  ctucxConfig.shellUtilities.enable   = lib.mkDefault true;
+  ctucxConfig.networkUtilities.enable = lib.mkDefault true;
+
+  ctucxConfig.htop.enable             = lib.mkDefault true;
+  ctucxConfig.tmux.enable             = lib.mkDefault true;
+  ctucxConfig.micro.enable            = lib.mkDefault true;
+
+  ctucxConfig.git.enable              = lib.mkDefault true;
+  ctucxConfig.gpg.enable              = lib.mkDefault true;
+  ctucxConfig.ssh.enable              = lib.mkDefault true;
+
+}
diff --git a/configurations/common/programs/eza.nix b/configurations/common/programs/eza.nix
@@ -0,0 +1,28 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.eza;
+
+in {
+
+  options = {
+    ctucxConfig.eza = {
+      enable = lib.mkEnableOption "eza";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.home.packages = with pkgs; [
+      eza
+    ];
+
+    home-manager.users.leah.home.shellAliases = {
+      ls  = "eza";
+      ll  = "eza -l";
+      la  = "eza -a";
+      lt  = "eza --tree";
+      lla = "eza -la";          
+    };
+  };
+
+}
diff --git a/configurations/common/programs/git.nix b/configurations/common/programs/git.nix
@@ -1,37 +1,50 @@
-{ pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
-{
-  home-manager.users.leah = {
-#    home.packages = [ pkgs.gitui ];
+let
+  cfg = config.ctucxConfig.git;
 
-    programs = {
-#      bash.shellAliases.lazygit = "gitui";
-      lazygit.enable = true;
-      git = {
-        enable    = true;
+in {
 
-        package = pkgs.gitFull;
+  options = {
+    ctucxConfig.git = {
+      enable = lib.mkEnableOption "git";
+    };
+  };
 
-        userName  = "Leah (ctucx)";
-        userEmail = "git@ctu.cx";
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah = {
+#      home.packages = [ pkgs.gitui ];
 
-        delta.enable = true;
+      programs = {
+#        bash.shellAliases.lazygit = "gitui";
+        lazygit.enable = true;
+        git = {
+          enable    = true;
 
-        ignores = [
-          ".DS_Store"
-          "*.swp"
-        ];
+          package = pkgs.gitFull;
 
-        aliases = {
-          log-gpg = "log --show-signature";
-          pfusch  = "push";
-        };
+          userName  = "Leah (ctucx)";
+          userEmail = "git@ctu.cx";
+
+          delta.enable = true;
 
-        extraConfig = {
-          features.manyFiles = true;
-          pull.rebase        = false;
+          ignores = [
+            ".DS_Store"
+            "*.swp"
+          ];
+
+          aliases = {
+            log-gpg = "log --show-signature";
+            pfusch  = "push";
+          };
+
+          extraConfig = {
+            features.manyFiles = true;
+            pull.rebase        = false;
+          };
         };
       };
     };
   };
+
 }
diff --git a/configurations/common/programs/gpg.nix b/configurations/common/programs/gpg.nix
@@ -1,111 +1,124 @@
 { config, pkgs, lib, ... }:
 
-{
-  services = {
-    pcscd.enable  = (if pkgs.stdenv.isLinux then true else false);
-    udev.packages = (if pkgs.stdenv.isLinux then (with pkgs; [ libu2f-host yubikey-personalization ]) else []);
-    dbus.packages = (if pkgs.stdenv.isLinux then (with pkgs; [ gcr ]) else []);
-  };
-
-  home-manager.users.leah = {
-    home = {
-      packages = lib.mkIf pkgs.stdenv.isLinux [ pkgs.pcsctools ];
+let
+  cfg = config.ctucxConfig.gpg;
 
-      sessionVariables = {
-        GNUPGHOME     = lib.mkForce "$HOME/.gnupg";
-      };
+in {
 
-      shellAliases = {
-        gpg-card-relearn = "gpg-connect-agent 'scd serialno' 'learn --force' /bye";
-      };
+  options = {
+    ctucxConfig.gpg = {
+      enable = lib.mkEnableOption "gpg";
+    };
+  };
 
-      file = lib.mkIf pkgs.stdenv.isDarwin {
-        ".gnupg/gpg-agent.conf".text = ''
-          enable-ssh-support
-          pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
-        '';
-      };
+  config = lib.mkIf cfg.enable {
+    services = {
+      pcscd.enable  = (if pkgs.stdenv.isLinux then true else false);
+      udev.packages = (if pkgs.stdenv.isLinux then (with pkgs; [ libu2f-host yubikey-personalization ]) else []);
+      dbus.packages = (if pkgs.stdenv.isLinux then (with pkgs; [ gcr ]) else []);
     };
 
-    wayland.windowManager.sway.extraConfig = ''
-      exec_always 'gpgconf --kill gpg-agent'
-    '';
-
-    programs = {
-      gpg = {
-        enable       = true;
-        mutableTrust = false;
-        mutableKeys  = false;
-
-        publicKeys = [
-
-          # my own key
-          {
-            trust = "ultimate";
-            source = (pkgs.fetchurl {
-              url    = "https://ctu.cx/gpg_pubkey.asc";
-              sha256 = "sha256-3PnQemWZWnD8Qhphs15ny8zZPQHcTlL8XSl5cye0pTM";
-            });
-          }
-
-          # my second gpg key (ipad)
-          {
-            trust = "ultimate";
-            source = (pkgs.fetchurl {
-              url    = "https://ctu.cx/gpg_pubkey_ipad.asc";
-              sha256 = "sha256-TXiVGKg4iKLTY1gHNaJEz5hXp2FGGHRASgaK6RjL5SA";
-            });
-          }
-
-          # f2k1de's key
-          {
-            trust = "full";
-            source = (pkgs.fetchurl {
-              url    = "https://f2k1.de/gpg-key.asc";
-              sha256 = "sha256-N5Y3knDtsF9KNnhHiRFTTtjvLkPEIMfFxYigh9z1fSI";
-            });
-          }
-
-        ];
-
-        settings = {
-          keyserver = "hkps://keyserver.ubuntu.com:443";
+    home-manager.users.leah = {
+      home = {
+        packages = lib.mkIf pkgs.stdenv.isLinux [ pkgs.pcsctools ];
+
+        sessionVariables = {
+          GNUPGHOME     = lib.mkForce "$HOME/.gnupg";
         };
 
-        scdaemonSettings = {
-          disable-ccid = true;
+        shellAliases = {
+          gpg-card-relearn = "gpg-connect-agent 'scd serialno' 'learn --force' /bye";
         };
-      };
 
-      git = {
-        signing = {
-          key           = "725B65F21DB1C2C4";
-          signByDefault = true;
+        file = lib.mkIf pkgs.stdenv.isDarwin {
+          ".gnupg/gpg-agent.conf".text = ''
+            enable-ssh-support
+            pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
+          '';
         };
       };
 
-      bash.initExtra = lib.mkIf pkgs.stdenv.isDarwin ''
-        export GPG_TTY=$(tty)
-        export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
-        gpgconf --launch gpg-agent
+      wayland.windowManager.sway.extraConfig = ''
+        exec_always 'gpgconf --kill gpg-agent'
       '';
-  	};
 
-    services = lib.mkIf pkgs.stdenv.isLinux {
-      gpg-agent = {
-        enable             = true;
-        enableSshSupport   = true;
-        enableExtraSocket  = true;
+      programs = {
+        gpg = {
+          enable       = true;
+          mutableTrust = false;
+          mutableKeys  = false;
+
+          publicKeys = [
+
+            # my own key
+            {
+              trust = "ultimate";
+              source = (pkgs.fetchurl {
+                url    = "https://ctu.cx/gpg_pubkey.asc";
+                sha256 = "sha256-xsLpZkcTDPpXrX9gRki5z13KxwBDznJr/mn9MZIo5CQ";
+              });
+            }
+
+            # my second gpg key (ipad)
+            {
+              trust = "ultimate";
+              source = (pkgs.fetchurl {
+                url    = "https://ctu.cx/gpg_pubkey_ipad.asc";
+                sha256 = "sha256-TXiVGKg4iKLTY1gHNaJEz5hXp2FGGHRASgaK6RjL5SA";
+              });
+            }
+
+            # f2k1de's key
+            {
+              trust = "full";
+              source = (pkgs.fetchurl {
+                url    = "https://f2k1.de/gpg-key.asc";
+                sha256 = "sha256-N5Y3knDtsF9KNnhHiRFTTtjvLkPEIMfFxYigh9z1fSI";
+              });
+            }
+
+          ];
+
+          settings = {
+            keyserver = "hkps://keyserver.ubuntu.com:443";
+          };
+
+          scdaemonSettings = {
+            disable-ccid = true;
+          };
+        };
 
-        pinentryFlavor     = "gnome3";
+        git = {
+          signing = {
+            key           = "725B65F21DB1C2C4";
+            signByDefault = true;
+          };
+        };
+
+        bash.initExtra = lib.mkIf pkgs.stdenv.isDarwin ''
+          export GPG_TTY=$(tty)
+          export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
+          gpgconf --launch gpg-agent
+        '';
+    	};
 
-        defaultCacheTtl    = 600;
-        defaultCacheTtlSsh = 600;
+      services = lib.mkIf pkgs.stdenv.isLinux {
+        gpg-agent = {
+          enable             = true;
+          enableSshSupport   = true;
+          enableExtraSocket  = true;
 
-        sshKeys = [
-          "8C11B9BF8B535049F6C87A9CF0C595421E6B8798"
-        ];
+          pinentryFlavor     = "gnome3";
+
+          defaultCacheTtl    = 600;
+          defaultCacheTtlSsh = 600;
+
+          sshKeys = [
+            "8C11B9BF8B535049F6C87A9CF0C595421E6B8798"
+          ];
+        };
       };
     };
   };
+
 }
diff --git a/configurations/common/programs/htop.nix b/configurations/common/programs/htop.nix
@@ -1,49 +1,60 @@
-{ pkgs, lib, currentSystem, ... }:
+{ config, pkgs, lib, currentSystem, ... }:
 
-{
+let
+  cfg = config.ctucxConfig.htop;
 
-  home-manager.users.leah = {
-    programs = {
-      htop = {
-        enable   = true;
-        package = (
-          if pkgs.stdenv.isDarwin then
-            pkgs.htop
-          else
-            pkgs.htop.override {
-              sensorsSupport = true;
-            }
-        );
-        settings = {
-          hide_userland_threads = 1;
-          tree_view             = 1;
-          show_program_path     = 0;
-          show_cpu_frequency    = (if currentSystem == "aarch64-darwin" then 0 else 1);
+in {
+
+  options = {
+    ctucxConfig.htop = {
+      enable = lib.mkEnableOption "htop";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah = {
+      programs = {
+        htop = {
+          enable   = true;
+          package = (
+            if pkgs.stdenv.isDarwin then
+              pkgs.htop
+            else
+              pkgs.htop.override {
+                sensorsSupport = true;
+              }
+          );
+          settings = {
+            hide_userland_threads = 1;
+            tree_view             = 1;
+            show_program_path     = 0;
+            show_cpu_frequency    = (if currentSystem == "aarch64-darwin" then 0 else 1);
+          };
         };
       };
-    };
 
-    xdg = (
-      if pkgs.stdenv.isDarwin then
-        {}
-      else
-        {
-          desktopEntries = {
-            htop = {
-              name        = "Htop";
-              genericName = "Process Viewer";
-              icon        = "htop";
-              exec        = "htop";
-              terminal    = true;
-              categories  = [ "ConsoleOnly" "System" ];
-              settings    = {
-                NoDisplay = "true";
+      xdg = (
+        if pkgs.stdenv.isDarwin then
+          {}
+        else
+          {
+            desktopEntries = {
+              htop = {
+                name        = "Htop";
+                genericName = "Process Viewer";
+                icon        = "htop";
+                exec        = "htop";
+                terminal    = true;
+                categories  = [ "ConsoleOnly" "System" ];
+                settings    = {
+                  NoDisplay = "true";
+                };
               };
             };
-          };
-        }
-    );
+          }
+      );
 
+    };
   };
 
 }
diff --git a/configurations/common/programs/mcfly.nix b/configurations/common/programs/mcfly.nix
@@ -1,14 +1,23 @@
-{ ... }:
-
-{
-  home-manager.users.leah = {
-    programs = {
-      mcfly = {
-        enable                = true;
-        enableBashIntegration = true;
-        enableZshIntegration  = true;
-        fuzzySearchFactor     = 2;
-      };
+{ config, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.mcfly;
+
+in {
+
+  options = {
+    ctucxConfig.mcfly = {
+      enable = lib.mkEnableOption "mcfly";
     };
   };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.programs.mcfly = {
+      enable                = true;
+      enableBashIntegration = true;
+      enableZshIntegration  = true;
+      fuzzySearchFactor     = 2;
+    };
+  };
+
 }
diff --git a/configurations/common/programs/micro.nix b/configurations/common/programs/micro.nix
@@ -1,26 +1,37 @@
-{ pkgs, lib, ... }:
+{ config, pkgs, lib, ... }:
 
-{
+let
+  cfg = config.ctucxConfig.micro;
 
-  home-manager.users.leah = {
-    programs.micro = {
-      enable   = true;
-      settings = {
-        "*.nix".tabstospaces = true;
-        "*.nix".tabmovement  = true;
-        "*.nix".tabsize      = 2;
-        "*.nim".tabstospaces = true;
-        "*.nim".tabmovement  = true;
-        "*.nim".tabsize      = 2;
+in {
 
-        scrollbar  = true;
-        eofnewline = false;
-      };
+  options = {
+    ctucxConfig.micro = {
+      enable = lib.mkEnableOption "micro";
     };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah = {
+      programs.micro = {
+        enable   = true;
+        settings = {
+          "*.nix".tabstospaces = true;
+          "*.nix".tabmovement  = true;
+          "*.nix".tabsize      = 2;
+          "*.nim".tabstospaces = true;
+          "*.nim".tabmovement  = true;
+          "*.nim".tabsize      = 2;
 
-    home = {
-      sessionVariables.EDITOR = "micro";
-      shellAliases.nano       = "micro";
+          scrollbar  = true;
+          eofnewline = false;
+        };
+      };
+
+      home = {
+        sessionVariables.EDITOR = "micro";
+        shellAliases.nano       = "micro";
+      };
     };
   };
 
diff --git a/configurations/common/programs/network-utilities.nix b/configurations/common/programs/network-utilities.nix
@@ -1,27 +0,0 @@
-{ pkgs, lib, ... }:
-
-{
-
-  programs.mtr.enable        = (if pkgs.stdenv.isLinux then true else false);
-  programs.traceroute.enable = (if pkgs.stdenv.isLinux then true else false);
-
-  home-manager.users.leah.home = {
-    packages = with pkgs; [
-      dnsutils
-      whois
-      nmap-unfree
-      tcpdump
-      iperf3
-    ] ++ (if pkgs.stdenv.isDarwin then [
-      mtr
-      spoof-mac
-    ] else [
-      macchanger
-    ]);
-
-    shellAliases = lib.mkIf pkgs.stdenv.isDarwin {
-      mtr = "sudo mtr";
-    };
-  };
-
-}
diff --git a/configurations/common/programs/networkUtilities.nix b/configurations/common/programs/networkUtilities.nix
@@ -0,0 +1,38 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.networkUtilities;
+
+in {
+
+  options = {
+    ctucxConfig.networkUtilities = {
+      enable = lib.mkEnableOption "some networking related utilities";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    programs.mtr.enable        = (if pkgs.stdenv.isLinux then true else false);
+    programs.traceroute.enable = (if pkgs.stdenv.isLinux then true else false);
+
+    home-manager.users.leah.home = {
+      packages = with pkgs; [
+        dnsutils
+        nmap-unfree
+        tcpdump
+        iperf3
+      ] ++ (if pkgs.stdenv.isDarwin then [
+        mtr
+        spoof-mac
+      ] else [
+        whois
+        macchanger
+      ]);
+
+      shellAliases = lib.mkIf pkgs.stdenv.isDarwin {
+        mtr = "sudo mtr";
+      };
+    };
+  };
+
+}
diff --git a/configurations/common/programs/ocrmypdf.nix b/configurations/common/programs/ocrmypdf.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.ocrmypdf;
+
+in {
+
+  options = {
+    ctucxConfig.ocrmypdf = {
+      enable = lib.mkEnableOption "OCRmyPDF";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.home.packages = with pkgs; [
+      ocrmypdf
+    ];
+  };
+
+}
diff --git a/configurations/common/programs/password-store.nix b/configurations/common/programs/password-store.nix
@@ -1,30 +1,43 @@
-{ pkgs, lib, ... }:
-
-{
-  home-manager.users.leah = {
-    home = {
-      packages         = [ pkgs.pwgen ];
-      sessionVariables = {
-        PASSWORD_STORE_DIR = lib.mkForce "\$HOME/.local/share/password-store";
-      };
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.password-store;
+
+in {
+
+  options = {
+    ctucxConfig.password-store = {
+      enable = lib.mkEnableOption "passwordStore";
     };
+  };
 
-    programs = {
-      password-store = {
-        enable  = true;
-        package = pkgs.pass.withExtensions (exts: [
-          exts.pass-otp
-          exts.pass-update
-          exts.pass-genphrase
-        ]);
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah = {
+      home = {
+        packages         = [ pkgs.pwgen ];
+        sessionVariables = {
+          PASSWORD_STORE_DIR = lib.mkForce "\$HOME/.local/share/password-store";
+        };
       };
 
-      browserpass = {
-        enable   = true;
-        browsers = [ "firefox" ];
+      programs = {
+        password-store = {
+          enable  = true;
+          package = pkgs.pass.withExtensions (exts: [
+            exts.pass-otp
+            exts.pass-update
+            exts.pass-genphrase
+          ]);
+        };
+
+        browserpass = {
+          enable   = true;
+          browsers = [ "firefox" ];
+        };
+
       };
 
     };
-
   };
+
 }
diff --git a/configurations/common/programs/phockup.nix b/configurations/common/programs/phockup.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.phockup;
+
+in {
+
+  options = {
+    ctucxConfig.phockup = {
+      enable = lib.mkEnableOption "phockup";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.home.packages = with pkgs; [
+      phockup
+    ];
+  };
+
+}
diff --git a/configurations/common/programs/shellUtilities.nix b/configurations/common/programs/shellUtilities.nix
@@ -0,0 +1,60 @@
+{ config, inputs, currentSystem, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.shellUtilities;
+
+in {
+
+  options = {
+    ctucxConfig.shellUtilities = {
+      enable = lib.mkEnableOption "basic shell utilities";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah = {
+      home = {
+        packages = with pkgs; [
+          coreutils
+          inputs.colmena.packages."${currentSystem}".colmena
+
+          agenix
+          age
+
+          wget
+          curl
+          rsync
+
+          eza
+          bat
+          ripgrep
+          fd
+          file
+          bc
+
+          unzip
+
+          smartmontools
+
+          e2fsprogs
+          dosfstools
+
+          gptfdisk
+
+        ] ++ (if pkgs.stdenv.isLinux then [
+          usbutils
+          pciutils
+
+          lm_sensors
+        ] else [
+        ]);
+      };
+
+      programs = {
+        bat.enable      = true;
+        jq.enable       = true;
+      };
+    };
+  };
+
+}
diff --git a/configurations/common/programs/ssh.nix b/configurations/common/programs/ssh.nix
@@ -1,35 +1,31 @@
-{ ... }:
+{ config, lib, ... }:
 
-{
-  home-manager.users.leah = {
-    programs = {
-      ssh = {
-        enable         = true;
-        compression    = true;
+let
+  cfg = config.ctucxConfig.ssh;
 
-        controlMaster  = "auto";
-        controlPersist = "2m";
+in {
 
-        matchBlocks = {
-          "*.petabyte.dev" = {
-            user     = "leah";
-            port     = 62954;
-          };
+  options = {
+    ctucxConfig.ssh = {
+      enable = lib.mkEnableOption "ssh";
+    };
+  };
 
-          "osterei-forwardAgents" = {
-            hostname     = "osterei.ctu.cx";
-            forwardAgent = true;
-            extraOptions = {
-              RemoteForward = "/run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra";
-            };
-          };
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.programs.ssh = {
+      enable         = true;
+      compression    = true;
 
-          "ctucx-git" = {
-            user     = "git";
-            hostname = "trabbi.ctu.cx";
-          };
+      controlMaster  = "auto";
+      controlPersist = "2m";
+
+      matchBlocks = {
+        "ctucx-git" = {
+          user     = "git";
+          hostname = "trabbi.ctu.cx";
         };
       };
     };
   };
+
 }
diff --git a/configurations/common/programs/starship.nix b/configurations/common/programs/starship.nix
@@ -1,19 +1,28 @@
-{ ... }:
+{ config, lib, ... }:
 
-{
-  home-manager.users.leah = {
-    programs = {
-      starship = {
-        enable                = true;
-        enableBashIntegration = true;
-        enableZshIntegration  = true;
-        settings = {
-          add_newline = false;
-          status = {
-            disabled = false;
-          };
+let
+  cfg = config.ctucxConfig.starship;
+
+in {
+
+  options = {
+    ctucxConfig.starship = {
+      enable = lib.mkEnableOption "starship";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.programs.starship = {
+      enable                = true;
+      enableBashIntegration = true;
+      enableZshIntegration  = true;
+      settings = {
+        add_newline = false;
+        status = {
+          disabled = false;
         };
       };
     };
   };
+  
 }
diff --git a/configurations/common/programs/texlive.nix b/configurations/common/programs/texlive.nix
@@ -1,9 +1,18 @@
-{ pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
-{
+let
+  cfg = config.ctucxConfig.texlive;
 
-  home-manager.users.leah = {
-    home.packages = with pkgs; [
+in {
+
+  options = {
+    ctucxConfig.texlive = {
+      enable = lib.mkEnableOption "texlive full";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.home.packages = with pkgs; [
       texlive.combined.scheme-full
     ];
   };
diff --git a/configurations/common/programs/tmux.nix b/configurations/common/programs/tmux.nix
@@ -1,16 +1,25 @@
-{ ... }:
+{ config, lib, ... }:
 
-{
-  home-manager.users.leah = {
-    programs = {
-      tmux = {
-        enable      = true;
-        clock24     = true;
-        terminal    = "xterm-256color";
-        extraConfig = ''
-          set -g mouse on
-        '';
-      };
+let
+  cfg = config.ctucxConfig.tmux;
+
+in {
+
+  options = {
+    ctucxConfig.tmux = {
+      enable = lib.mkEnableOption "tmux";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.programs.tmux = {
+      enable      = true;
+      clock24     = true;
+      terminal    = "xterm-256color";
+      extraConfig = ''
+        set -g mouse on
+      '';
     };
   };
+
 }
diff --git a/configurations/common/programs/utilities.nix b/configurations/common/programs/utilities.nix
@@ -1,59 +0,0 @@
-{ inputs, currentSystem, pkgs, config, ... }:
-
-{
-
-  home-manager.users.leah = {
-    home = {
-      packages = with pkgs; [
-        coreutils
-        inputs.colmena.packages."${currentSystem}".colmena
-
-        wget
-        curl
-        rsync
-
-        eza
-        bat
-        ripgrep
-        fd
-        file
-        bc
-
-        unzip
-
-        smartmontools
-
-        e2fsprogs
-        dosfstools
-
-        gptfdisk
-
-      ] ++ (if pkgs.stdenv.isLinux then [
-        usbutils
-        pciutils
-
-        lm_sensors
-      ] else [
-      ]) ++ (if config.networking.hostName != "wanderduene" then [
-        agenix
-        age
-
-        bitwarden-cli
-
-        ocrmypdf
-        phockup
-
-        yt-dlp
-        (pkgs.writeShellScriptBin "youtube-dl" ''
-          exec ${pkgs.yt-dlp}/bin/yt-dlp --compat-options youtube-dl "$@"
-        '')
-      ] else []);
-    };
-
-    programs = {
-      bat.enable      = true;
-
-      jq.enable       = true;
-    };
-  };
-}
diff --git a/configurations/common/programs/yt-dlp.nix b/configurations/common/programs/yt-dlp.nix
@@ -0,0 +1,27 @@
+{ config, pkgs, lib, ... }:
+
+let
+  cfg = config.ctucxConfig.yt-dlp;
+
+in {
+
+  options = {
+    ctucxConfig.yt-dlp = {
+      enable = lib.mkEnableOption "yt-dlp";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.leah.home.packages = with pkgs; [
+      yt-dlp
+      (pkgs.writeShellScriptBin "youtube-dl" ''
+        exec ${pkgs.yt-dlp}/bin/yt-dlp --compat-options youtube-dl "$@"
+      '')
+    ];
+
+    home-manager.users.leah.home.shellAliases = {
+      yt-dlp-audio = "yt-dlp --format bestaudio -x --audio-format opus --add-metadata --embed-thumbnail";
+    };
+  };
+
+}
diff --git a/configurations/darwin/default.nix b/configurations/darwin/default.nix
@@ -18,12 +18,16 @@
     ./homebrew.nix
     ./macAppStore.nix
     ./programs
-
-    ../common/programs/gpg.nix
-    ../common/programs/password-store.nix
-    ../common/programs/texlive.nix
   ];
 
+  ctucxConfig = {
+    password-store.enable = true;
+    texlive.enable        = true;
+    yt-dlp.enable         = true;
+    ocrmypdf.enable       = true;
+    phockup.enable        = true;
+  };
+
   services.nix-daemon.enable = true;
 
   home-manager = {
diff --git a/machines/blechkasten/darwin-configuration.nix b/machines/blechkasten/darwin-configuration.nix
@@ -8,6 +8,9 @@
   networking.hostName     = "blechkasten";
   networking.computerName = config.networking.hostName;
 
+  #currently broken in nixpkgs-darwin
+  ctucxConfig.ocrmypdf.enable = lib.mkForce false;
+
   home-manager.users.leah.home.stateVersion = "22.05";
   system.stateVersion = 4;
 
diff --git a/machines/briefkasten/configuration.nix b/machines/briefkasten/configuration.nix
@@ -189,6 +189,11 @@
     };
   };
 
+  ctucxConfig = {
+    yt-dlp.enable   = true;
+    ocrmypdf.enable = true;
+  };
+
   system.stateVersion = "22.11"; # Did you read the comment?
   home-manager.users.leah.home.stateVersion = "22.11";
 
diff --git a/machines/wanderduene/configuration.nix b/machines/wanderduene/configuration.nix
@@ -140,6 +140,12 @@
     '';
   };
 
+  ctucxConfig = {
+    gpg.enable    = false;
+    ssh.enable    = false;
+    git.enable    = false;
+  };
+
   services.iperf3 = {
     enable = true;
     bind   = "172.17.0.1";