about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/common/bat.nix36
-rw-r--r--modules/common/common/shell/default.nix266
-rw-r--r--modules/common/common/shell/functions.bash18
-rw-r--r--modules/common/emacs/default.nix48
-rw-r--r--modules/common/git.nix16
-rw-r--r--modules/common/mpv.nix252
-rw-r--r--modules/common/nmap.nix16
-rw-r--r--modules/common/profiles/dev/containers.nix97
-rw-r--r--modules/darwin/common/nix.nix2
-rw-r--r--modules/nixos/common/nix.nix6
-rw-r--r--modules/nixos/docker.nix9
-rw-r--r--modules/nixos/mpv.nix160
-rw-r--r--modules/nixos/podman.nix54
13 files changed, 463 insertions, 517 deletions
diff --git a/modules/common/bat.nix b/modules/common/bat.nix
index 7f78a59..d95f709 100644
--- a/modules/common/bat.nix
+++ b/modules/common/bat.nix
@@ -6,32 +6,22 @@
 with lib; let
   cfg = config.nixfiles.modules.bat;
 in {
-  options.nixfiles.modules.bat.enable =
-    mkEnableOption "bat, an alternative to cat";
+  options.nixfiles.modules.bat.enable = mkEnableOption "bat, an alternative to cat";
 
   config = mkIf cfg.enable {
-    hm.programs = {
-      bat = {
-        enable = true;
-        config = {
-          style = "plain";
-          tabs = "4";
-          theme = "base16";
-          wrap = "never";
-        };
-      };
-
-      bash = {
-        shellAliases = {
-          baj = "bat --language=json --tabs 2";
-          bay = "bat --language=yaml --tabs 2";
-          bas = "bat --language=syslog";
-        };
+    nixfiles.modules.common.shell.aliases = {
+      baj = "bat --language=json --tabs 2";
+      bay = "bat --language=yaml --tabs 2";
+      bas = "bat --language=syslog";
+    };
 
-        initExtra = mkAfter ''
-          _complete_alias bay _bat bat
-          _complete_alias baj _bat bat
-        '';
+    hm.programs.bat = {
+      enable = true;
+      config = {
+        style = "plain";
+        tabs = "4";
+        theme = "base16";
+        wrap = "never";
       };
     };
   };
diff --git a/modules/common/common/shell/default.nix b/modules/common/common/shell/default.nix
index b05b279..b50459d 100644
--- a/modules/common/common/shell/default.nix
+++ b/modules/common/common/shell/default.nix
@@ -1,150 +1,148 @@
 {
+  config,
   lib,
   pkgs,
-  pkgsStable,
   this,
   ...
 }:
-with lib; {
-  hm = {
-    programs = {
-      bash = {
-        enable = true;
-
-        shellOptions = [
-          "autocd"
-          "cdspell"
-          "checkjobs"
-          "checkwinsize"
-          "dirspell"
-          "extglob"
-          "globstar"
-          "histappend"
-          "histreedit"
-          "histverify"
-        ];
-
-        profileExtra = ''
-          export _PROFILE_SOURCED=1
-        '';
-
-        initExtra = ''
-          set -o notify
-
-          # Apropriated from the default NixOS prompt settings.
-          if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
-            PROMPT_COLOR="1;31m"
-            ((UID)) && PROMPT_COLOR="1;32m"
-            if [ -n "$INSIDE_EMACS" ] || [ "$TERM" = "eterm" ] || [ "$TERM" = "eterm-color" ]; then
-              PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
-            else
-              PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] "
-            fi
-            if test "$TERM" = "xterm"; then
-              PS1="\[\033]2;\h:\u:\w\007\]$PS1"
-            fi
-          fi
-
-          ${readFile ./functions.bash}
-
-          # https://github.com/garabik/grc?tab=readme-ov-file#bash
-          GRC_ALIASES=true
-          source ${pkgs.grc}/etc/profile.d/grc.sh
+with lib; let
+  cfg = config.nixfiles.modules.common.shell;
+in {
+  options.nixfiles.modules.common.shell.aliases = mkOption {
+    description = "An attribute set of shell aliases.";
+    type = with types; attrsOf str;
+    default = {};
+  };
 
-          # https://github.com/akermu/emacs-libvterm?tab=readme-ov-file#shell-side-configuration
-          vterm_printf() {
-            if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ]); then
-              printf "\ePtmux;\e\e]%s\007\e\\" "$1"
-            elif [ "''${TERM%%-*}" = "screen" ]; then
-              printf "\eP\e]%s\007\e\\" "$1"
-            else
-              printf "\e]%s\e\\" "$1"
+  config = {
+    hm = {
+      programs = {
+        bash = {
+          enable = true;
+
+          initExtra = let
+            aliasCompletions =
+              concatStringsSep "\n"
+              (mapAttrsToList
+                (name: _: "complete -F _complete_alias ${name}")
+                cfg.aliases);
+          in ''
+            # Apropriated from the default NixOS prompt settings.
+            if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
+                PROMPT_COLOR="1;31m"
+                ((UID)) && PROMPT_COLOR="1;32m"
+                if [ -n "$INSIDE_EMACS" ] || [ "$TERM" = "eterm" ] || [ "$TERM" = "eterm-color" ]; then
+                    PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
+                else
+                    PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] "
+                fi
+                if test "$TERM" = "xterm"; then
+                    PS1="\[\033]2;\h:\u:\w\007\]$PS1"
+                fi
             fi
-          }
-
-          # This makes sure we always source these tweaks for both interactive
-          # and login sessions.
-          if [ -z "$_PROFILE_SOURCED" ] && [ -f "$HOME/.profile" ]; then
-            source "$HOME/.profile"
-          fi
-        '';
-
-        shellAliases =
-          listToAttrs
-          (map
-            ({
-              name,
-              value,
-            }:
-              nameValuePair name (with pkgs; let
-                pkg =
-                  if this.isHeadful
-                  then
-                    # FIXME Update this to 9.3 when patches[1] become available
-                    #
-                    # [1]: https://github.com/jarun/advcpmv
-                    (pkgsStable.coreutils.overrideAttrs (_: _: {
-                      patches = [
-                        (fetchpatch {
-                          url = "https://raw.githubusercontent.com/jarun/advcpmv/ea268d870b475edd5960dcd55d5378abc9705958/advcpmv-0.9-9.1.patch";
-                          hash = "sha256-d+SRT/R4xmfHLAdOr7m4R3WFiW64P5ZH6iqDvErYCyg=";
-                        })
-                      ];
-                    }))
-                  else coreutils;
-              in "${pkg}/bin/coreutils --coreutils-prog=${value}"))
-            (
-              let
-                mkAlias = {
-                  name ? head command,
-                  command,
-                }: {
-                  inherit name;
-                  value = concatStringsSep " " command;
-                };
-
-                progressBar = optionalString this.isHeadful "--progress-bar";
-              in [
-                (mkAlias {command = ["cp" "--interactive" "--recursive" progressBar];})
-                (mkAlias {command = ["mv" "--interactive" progressBar];})
-                (mkAlias {command = ["rm" "--interactive=once"];})
-                (mkAlias {command = ["ln" "--interactive"];})
-                (mkAlias {command = ["mkdir" "--parents"];})
-                (mkAlias {command = ["rmdir" "--parents"];})
-                (mkAlias {
-                  name = "lower";
-                  command = ["tr" "'[:upper:]'" "'[:lower:]'"];
-                })
-                (mkAlias {
-                  name = "upper";
-                  command = ["tr" "'[:lower:]'" "'[:upper:]'"];
-                })
-              ]
-            ))
-          // genAttrs ["grep" "egrep" "fgrep"]
-          (name: "${pkgs.gnugrep}/bin/${name} --color=always");
 
-        historyControl = ["erasedups" "ignoredups" "ignorespace"];
+            source "${./functions.bash}"
+
+            source "${getExe' pkgs.complete-alias "complete_alias"}"
+            ${aliasCompletions}
+
+            # https://github.com/garabik/grc?tab=readme-ov-file#bash
+            GRC_ALIASES=true
+            source ${pkgs.grc}/etc/profile.d/grc.sh
+          '';
+
+          shellOptions = [
+            "autocd"
+            "cdspell"
+            "checkjobs"
+            "checkwinsize"
+            "dirspell"
+            "extglob"
+            "globstar"
+            "histappend"
+            "histreedit"
+            "histverify"
+          ];
+
+          historyControl = [
+            "erasedups"
+            "ignoredups"
+            "ignorespace"
+          ];
+
+          shellAliases =
+            listToAttrs
+            (map
+              ({
+                name,
+                value,
+              }:
+                nameValuePair name (with pkgs; let
+                  pkg =
+                    if this.isHeadful
+                    then
+                      (pkgs.coreutils.overrideAttrs (_: super: {
+                        patches =
+                          (super.patches or [])
+                          ++ [
+                            (fetchpatch {
+                              url = "https://raw.githubusercontent.com/jarun/advcpmv/a1f8b505e691737db2f7f2b96275802c45f65c59/advcpmv-0.9-9.3.patch";
+                              hash = "sha256-I25F7uHESUsMDZFYTv8/56eR8QwelIPpABRXTgvszQI=";
+                            })
+                          ];
+                      }))
+                    else coreutils;
+                in "${getExe' pkg "coreutils"} --coreutils-prog=${value}"))
+              (
+                let
+                  mkAlias = {
+                    name ? head command,
+                    command,
+                  }: {
+                    inherit name;
+                    value = concatStringsSep " " command;
+                  };
+
+                  progressBar = optionalString this.isHeadful "--progress-bar";
+                in [
+                  (mkAlias {command = ["cp" "--interactive" "--recursive" progressBar];})
+                  (mkAlias {command = ["mv" "--interactive" progressBar];})
+                  (mkAlias {command = ["rm" "--interactive=once"];})
+                  (mkAlias {command = ["ln" "--interactive"];})
+                  (mkAlias {command = ["mkdir" "--parents"];})
+                  (mkAlias {command = ["rmdir" "--parents"];})
+                  (mkAlias {
+                    name = "lower";
+                    command = ["tr" "'[:upper:]'" "'[:lower:]'"];
+                  })
+                  (mkAlias {
+                    name = "upper";
+                    command = ["tr" "'[:lower:]'" "'[:upper:]'"];
+                  })
+                ]
+              ))
+            // (genAttrs ["grep" "egrep" "fgrep"] (name: "${pkgs.gnugrep}/bin/${name} --color=always"))
+            // cfg.aliases;
+        };
+
+        command-not-found.enable = false;
+
+        dircolors.enable = true;
       };
 
-      command-not-found.enable = false;
-
-      dircolors.enable = true;
+      home.packages = with pkgs; [grc];
     };
 
-    home.packages = with pkgs; [grc];
-  };
-
-  environment = {
-    etc."grc.conf".source = "${pkgs.grc}/etc/grc.conf";
+    environment = {
+      etc."grc.conf".source = "${pkgs.grc}/etc/grc.conf";
 
-    systemPackages = with pkgs; [
-      bash-completion
-      bc
-      gawk
-      hr
-      moreutils
-      pv
-    ];
+      systemPackages = with pkgs; [
+        bc
+        gawk
+        hr
+        moreutils
+        pv
+      ];
+    };
   };
 }
diff --git a/modules/common/common/shell/functions.bash b/modules/common/common/shell/functions.bash
index c18104f..d947d0f 100644
--- a/modules/common/common/shell/functions.bash
+++ b/modules/common/common/shell/functions.bash
@@ -1,30 +1,16 @@
-_complete_alias() {
-    local alias_name=$1
-    local base_function=$2
-    local function_name=_alias_$alias_name
-    shift 2
-    eval "$function_name() {
-        COMP_WORDS=( ${*@Q} \"\${COMP_WORDS[@]:1}\" )
-        (( COMP_CWORD += $# - 1 ))
-        _completion_loader $1
-        $base_function
-    }"
-    complete -F "$function_name" "$alias_name"
-}
-
 function where() {
     local s
     s="$(type -P "$1")"
     realpath "$s"
 }
-_complete_alias where _complete complete
+complete -F _command where
 
 function what() {
     local s
     s="$(where "$1")"
     printf "%s\n" "${s%/*/*}"
 }
-_complete_alias what _complete complete
+complete -F _command what
 
 function cat() {
     if (($# == 1)) && [[ -d $1 ]]; then
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index fe2618d..3db4393 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -222,23 +222,37 @@ in {
         };
       };
 
-      programs.emacs = {
-        enable = true;
-        package =
-          (pkgs.emacs29.override (finalAttrs: {
-            stdenv = with pkgs;
-              useMoldLinker
-              (withCFlags ["-O3"]
-                (impureUseNativeOptimizations finalAttrs.stdenv));
-          }))
-          .overrideAttrs (_: final: {
-            configureFlags =
-              final.configureFlags
-              ++ [
-                "--without-mailutils"
-                "--without-pop"
-              ];
-          });
+      programs = {
+        emacs = {
+          enable = true;
+          package =
+            (pkgs.emacs29.override (finalAttrs: {
+              stdenv = pkgs.useMoldLinker finalAttrs.stdenv;
+            }))
+            .overrideAttrs (_: final: {
+              configureFlags =
+                (final.configureFlags or [])
+                ++ [
+                  "--without-mailutils"
+                  "--without-pop"
+                ];
+            });
+        };
+
+        bash.initExtra = mkAfter ''
+          # https://github.com/akermu/emacs-libvterm
+          if [[ "$INSIDE_EMACS" = vterm ]] && [[ -n "$EMACS_VTERM_PATH" ]] && [[ -f "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh" ]]; then
+              source "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh"
+
+              message() {
+                  vterm_cmd message "%s" "$*"
+              }
+
+              find-file() {
+                  vterm_cmd find-file "$(realpath "''${@:-.}")"
+              }
+          fi
+        '';
       };
     };
   };
diff --git a/modules/common/git.nix b/modules/common/git.nix
index aa157ed..fbd7ec7 100644
--- a/modules/common/git.nix
+++ b/modules/common/git.nix
@@ -31,6 +31,11 @@ in {
       };
     };
 
+    nixfiles.modules.common.shell.aliases = {
+      gl = "glab";
+      ht = "hut";
+    };
+
     hm = {
       home.packages = with pkgs; [
         git-extras
@@ -149,17 +154,6 @@ in {
           enable = true;
           settings.git_protocol = "ssh";
         };
-
-        bash = {
-          shellAliases = {
-            gl = "glab";
-            ht = "hut";
-          };
-          initExtra = mkAfter ''
-            _complete_alias gl __start_glab glab
-            _complete_alias ht __start_hut hut
-          '';
-        };
       };
     };
   };
diff --git a/modules/common/mpv.nix b/modules/common/mpv.nix
index 37fbe4c..596d163 100644
--- a/modules/common/mpv.nix
+++ b/modules/common/mpv.nix
@@ -10,143 +10,133 @@ in {
   options.nixfiles.modules.mpv.enable = mkEnableOption "mpv";
 
   config = mkIf cfg.enable {
-    hm.programs = {
-      mpv = {
-        enable = true;
-
-        package = with pkgs;
-          wrapMpv mpv-unwrapped {
-            scripts = with mpvScripts; [
-              autoload
-              sponsorblock
-            ];
-          };
-
-        bindings = {
-          "RIGHT" = "seek 10";
-          "LEFT" = "seek -10";
-          "UP" = "seek 60";
-          "DOWN" = "seek -60";
-
-          "Shift+RIGHT" = "no-osd seek 1 exact";
-          "Shift+LEFT" = "no-osd seek -1 exact";
-          "Shift+UP" = "no-osd seek 5 exact";
-          "Shift+DOWN" = "no-osd seek -5 exact";
-
-          "Alt+h" = "add sub-delay +1";
-          "Alt+l" = "add sub-delay -1";
-
-          "Alt+k" = "add sub-scale +0.1";
-          "Alt+j" = "add sub-scale -0.1";
-
-          "B" = ''cycle-values background "#000000" "#ffffff"'';
+    hm.programs.mpv = {
+      enable = true;
+
+      package = with pkgs;
+        wrapMpv mpv-unwrapped {
+          scripts = with mpvScripts; [
+            autoload
+            sponsorblock
+          ];
         };
 
-        profiles = {
-          "protocol.http".force-window = "immediate";
-          "protocol.https".profile = "protocol.http";
-
-          "extension.gif" = {
-            cache = false;
-            loop-file = true;
-          };
-          "extension.png" = {
-            profile = "extension.gif";
-            video-aspect-override = 0;
-          };
-          "extension.jpeg".profile = "extension.png";
-          "extension.jpg".profile = "extension.png";
-        };
+      bindings = {
+        "RIGHT" = "seek 10";
+        "LEFT" = "seek -10";
+        "UP" = "seek 60";
+        "DOWN" = "seek -60";
 
-        config = let
-          lang = concatStringsSep "," [
-            "Japanese"
-            "japanese"
-            "jp"
-            "jpn"
-            "jaJP"
-            "ja-JP"
-            "English"
-            "english"
-            "en"
-            "eng"
-            "enUS"
-            "en-US"
-            "Russian"
-            "russian"
-            "ru"
-            "rus"
-            "ruRU"
-            "ru-RU"
-          ];
-        in {
-          autofit-larger = "100%x95%";
-          cache = true;
-          cursor-autohide = 1000;
-          cursor-autohide-fs-only = true;
-          demuxer-max-back-bytes = "20M";
-          demuxer-max-bytes = "20M";
-          force-seekable = true;
-          fullscreen = true;
-          msg-color = true;
-          msg-module = true;
-          prefetch-playlist = true;
-          save-position-on-quit = true;
-          screenshot-format = "png";
-          screenshot-template = "%F [%p]";
-          stop-screensaver = true;
-          term-osd-bar = true;
-          use-filedir-conf = true;
-
-          osd-bar-align-y = 0;
-          osd-bar-h = 2;
-          osd-bar-w = 60;
-          osd-border-color = "#FF262626";
-          osd-border-size = 2;
-          osd-color = "#FFFFFFFF";
-          osd-duration = 1000;
-          osd-font-size = 40;
-          osd-fractions = true;
-          osd-level = 1;
-          osd-shadow-color = "#33000000";
-
-          osc = false;
-
-          blend-subtitles = true;
-          embeddedfonts = false;
-          sub-ass-force-margins = true;
-          sub-ass-force-style = "kerning=yes";
-          sub-auto = "fuzzy";
-          sub-border-color = "#FF262626";
-          sub-border-size = 2.5;
-          sub-color = "#FFFFFFFF";
-          sub-file-paths-append = "srt";
-          sub-fix-timing = true;
-          sub-font-size = 40;
-          sub-scale-with-window = true;
-          sub-shadow-color = "#33000000";
-          sub-shadow-offset = 1;
-          sub-spacing = 0.5;
-          sub-use-margins = true;
-
-          audio-file-auto = "fuzzy";
-          volume = 100;
-          volume-max = 200;
-
-          alang = lang;
-          slang = lang;
-
-          ytdl = true;
-          ytdl-raw-options = ''sub-lang="${lang}",write-sub='';
-        };
+        "Shift+RIGHT" = "no-osd seek 1 exact";
+        "Shift+LEFT" = "no-osd seek -1 exact";
+        "Shift+UP" = "no-osd seek 5 exact";
+        "Shift+DOWN" = "no-osd seek -5 exact";
+
+        "Alt+h" = "add sub-delay +1";
+        "Alt+l" = "add sub-delay -1";
+
+        "Alt+k" = "add sub-scale +0.1";
+        "Alt+j" = "add sub-scale -0.1";
+
+        "B" = ''cycle-values background "#000000" "#ffffff"'';
       };
 
-      bash = {
-        shellAliases.cam = "mpv av://v4l2:/dev/video0";
+      profiles = {
+        "protocol.http".force-window = "immediate";
+        "protocol.https".profile = "protocol.http";
+
+        "extension.gif" = {
+          cache = false;
+          loop-file = true;
+        };
+        "extension.png" = {
+          profile = "extension.gif";
+          video-aspect-override = 0;
+        };
+        "extension.jpeg".profile = "extension.png";
+        "extension.jpg".profile = "extension.png";
+      };
 
-        initExtra = mkAfter ''
-          _complete_alias cam _mpv mpv
-        '';
+      config = let
+        lang = concatStringsSep "," [
+          "Japanese"
+          "japanese"
+          "jp"
+          "jpn"
+          "jaJP"
+          "ja-JP"
+          "English"
+          "english"
+          "en"
+          "eng"
+          "enUS"
+          "en-US"
+          "Russian"
+          "russian"
+          "ru"
+          "rus"
+          "ruRU"
+          "ru-RU"
+        ];
+      in {
+        autofit-larger = "100%x95%";
+        cache = true;
+        cursor-autohide = 1000;
+        cursor-autohide-fs-only = true;
+        demuxer-max-back-bytes = "20M";
+        demuxer-max-bytes = "20M";
+        force-seekable = true;
+        fullscreen = true;
+        msg-color = true;
+        msg-module = true;
+        prefetch-playlist = true;
+        save-position-on-quit = true;
+        screenshot-format = "png";
+        screenshot-template = "%F [%p]";
+        stop-screensaver = true;
+        term-osd-bar = true;
+        use-filedir-conf = true;
+
+        osd-bar-align-y = 0;
+        osd-bar-h = 2;
+        osd-bar-w = 60;
+        osd-border-color = "#FF262626";
+        osd-border-size = 2;
+        osd-color = "#FFFFFFFF";
+        osd-duration = 1000;
+        osd-font-size = 40;
+        osd-fractions = true;
+        osd-level = 1;
+        osd-shadow-color = "#33000000";
+
+        osc = false;
+
+        blend-subtitles = true;
+        embeddedfonts = false;
+        sub-ass-force-margins = true;
+        sub-ass-force-style = "kerning=yes";
+        sub-auto = "fuzzy";
+        sub-border-color = "#FF262626";
+        sub-border-size = 2.5;
+        sub-color = "#FFFFFFFF";
+        sub-file-paths-append = "srt";
+        sub-fix-timing = true;
+        sub-font-size = 40;
+        sub-scale-with-window = true;
+        sub-shadow-color = "#33000000";
+        sub-shadow-offset = 1;
+        sub-spacing = 0.5;
+        sub-use-margins = true;
+
+        audio-file-auto = "fuzzy";
+        volume = 100;
+        volume-max = 200;
+
+        alang = lang;
+        slang = lang;
+
+        ytdl = true;
+        ytdl-raw-options = ''sub-lang="${lang}",write-sub='';
       };
     };
   };
diff --git a/modules/common/nmap.nix b/modules/common/nmap.nix
index ba06af3..6c6192c 100644
--- a/modules/common/nmap.nix
+++ b/modules/common/nmap.nix
@@ -11,6 +11,11 @@ in {
   options.nixfiles.modules.nmap.enable = mkEnableOption "Nmap";
 
   config = mkIf cfg.enable {
+    nixfiles.modules.common.shell.aliases = {
+      nmap-vulners = "nmap -sV --script=vulners/vulners.nse";
+      nmap-vulscan = "nmap -sV --script=vulscan/vulscan.nse";
+    };
+
     hm = {
       home = {
         file = {
@@ -25,17 +30,6 @@ in {
         '';
       };
 
-      programs.bash = {
-        shellAliases = {
-          nmap-vulners = "nmap -sV --script=vulners/vulners.nse";
-          nmap-vulscan = "nmap -sV --script=vulscan/vulscan.nse";
-        };
-        initExtra = mkAfter ''
-          _complete_alias nmap-vulners _nmap nmap
-          _complete_alias nmap-vulscan _nmap nmap
-        '';
-      };
-
       systemd.user = {
         services.update-nmap-vulscan-lists = {
           Service = {
diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix
index 6e9346a..027c685 100644
--- a/modules/common/profiles/dev/containers.nix
+++ b/modules/common/profiles/dev/containers.nix
@@ -14,63 +14,52 @@ in {
     };
 
   config = mkIf cfg.enable {
-    hm = {
-      home = {
-        sessionVariables = {
-          MINIKUBE_IN_STYLE = "false";
-          WERF_DEV = "true";
-          WERF_INSECURE_REGISTRY = "true";
-          WERF_LOG_DEBUG = "true";
-          WERF_LOG_PRETTY = "false";
-          WERF_LOG_VERBOSE = "true";
-          WERF_SYNCHRONIZATION = ":local";
-          WERF_TELEMETRY = "false";
-        };
+    nixfiles.modules.common.shell.aliases = {
+      b = "buildah";
+      h = "helm";
+      k = "kubectl";
+      kns = "kubens";
+      ktx = "kubectx";
+    };
 
-        packages = with pkgs; [
-          argocd
-          chart-testing
-          clusterctl
-          cmctl
-          datree
-          istioctl
-          k9s
-          kubeconform
-          kubectl
-          kubectl-doctor
-          kubectl-images
-          kubectl-tree
-          kubectx
-          kubelogin-oidc
-          kubent
-          kubernetes-helm
-          kubeseal
-          kubespy
-          minikube
-          skaffold
-          skopeo
-          stern
-          telepresence2
-          werf
-        ];
+    hm.home = {
+      sessionVariables = {
+        MINIKUBE_IN_STYLE = "false";
+        WERF_DEV = "true";
+        WERF_INSECURE_REGISTRY = "true";
+        WERF_LOG_DEBUG = "true";
+        WERF_LOG_PRETTY = "false";
+        WERF_LOG_VERBOSE = "true";
+        WERF_SYNCHRONIZATION = ":local";
+        WERF_TELEMETRY = "false";
       };
 
-      programs.bash = {
-        shellAliases = {
-          b = "buildah";
-          h = "helm";
-          k = "kubectl";
-          kns = "kubens";
-          ktx = "kubectx";
-        };
-        initExtra = mkAfter ''
-          _complete_alias b _buildah buildah
-          _complete_alias h __start_helm helm
-          _complete_alias k __start_kubectl kubectl
-          _complete_alias kns _kube_namespaces kubens
-          _complete_alias ktx _kube_contexts kubectx
-        '';
-      };
+      packages = with pkgs; [
+        argocd
+        chart-testing
+        clusterctl
+        cmctl
+        datree
+        istioctl
+        k9s
+        kubeconform
+        kubectl
+        kubectl-doctor
+        kubectl-images
+        kubectl-tree
+        kubectx
+        kubelogin-oidc
+        kubent
+        kubernetes-helm
+        kubeseal
+        kubespy
+        minikube
+        skaffold
+        skopeo
+        stern
+        telepresence2
+        werf
+      ];
     };
   };
 }
diff --git a/modules/darwin/common/nix.nix b/modules/darwin/common/nix.nix
index 0d216aa..10aeb03 100644
--- a/modules/darwin/common/nix.nix
+++ b/modules/darwin/common/nix.nix
@@ -11,8 +11,6 @@ with lib; {
     settings.extra-platforms = optionalString (this.system == "aarch64-darwin") ''
       x86_64-darwin aarch64-darwin
     '';
-
-    settings.trusted-users = ["@admin"];
   };
 
   services.nix-daemon.enable = true;
diff --git a/modules/nixos/common/nix.nix b/modules/nixos/common/nix.nix
index 0caf265..e21cc5c 100644
--- a/modules/nixos/common/nix.nix
+++ b/modules/nixos/common/nix.nix
@@ -2,6 +2,7 @@
   config,
   inputs,
   lib,
+  this,
   ...
 }:
 with lib; let
@@ -14,7 +15,10 @@ in {
   };
 
   config = {
-    nix.settings.trusted-users = ["@wheel"];
+    nix = mkIf this.isHeadless {
+      daemonCPUSchedPolicy = "idle";
+      daemonIOSchedClass = "idle";
+    };
 
     nixpkgs.config.allowUnfreePredicate = p: elem (getName p) cfg.allowedUnfreePackages;
 
diff --git a/modules/nixos/docker.nix b/modules/nixos/docker.nix
index 31c0dda..3b38ff1 100644
--- a/modules/nixos/docker.nix
+++ b/modules/nixos/docker.nix
@@ -18,6 +18,8 @@ in {
       }
     ];
 
+    nixfiles.modules.common.shell.aliases.d = "docker";
+
     secrets.containers-auth = {
       file = "${inputs.self}/secrets/containers-auth";
       path = "${config.my.home}/.docker/config.json";
@@ -30,12 +32,5 @@ in {
     environment.systemPackages = with pkgs; [docker-compose];
 
     my.extraGroups = ["docker"];
-
-    hm.programs.bash = {
-      shellAliases.d = "docker";
-      initExtra = mkAfter ''
-        _complete_alias d _docker docker
-      '';
-    };
   };
 }
diff --git a/modules/nixos/mpv.nix b/modules/nixos/mpv.nix
index efe1729..a2b73fa 100644
--- a/modules/nixos/mpv.nix
+++ b/modules/nixos/mpv.nix
@@ -7,83 +7,87 @@ with lib; let
   cfg = config.nixfiles.modules.mpv;
 in {
   config = mkIf cfg.enable {
-    nixfiles.modules.common.xdg.defaultApplications.mpv = let
-      audio = [
-        "audio/aac"
-        "audio/ac3"
-        "audio/basic"
-        "audio/flac"
-        "audio/midi"
-        "audio/mp4"
-        "audio/mpeg"
-        "audio/ogg"
-        "audio/opus"
-        "audio/vnd.dts"
-        "audio/vnd.dts.hd"
-        "audio/webm"
-        "audio/x-adpcm"
-        "audio/x-aifc"
-        "audio/x-aiff"
-        "audio/x-ape"
-        "audio/x-flac+ogg"
-        "audio/x-m4b"
-        "audio/x-m4r"
-        "audio/x-matroska"
-        "audio/x-mpegurl"
-        "audio/x-musepack"
-        "audio/x-opus+ogg"
-        "audio/x-speex"
-        "audio/x-speex+ogg"
-        "audio/x-vorbis+ogg"
-        "audio/x-wav"
-        "audio/x-wavpack"
-        "x-content/audio-cdda"
-        "x-content/audio-dvd"
-      ];
-      video = [
-        "video/3gpp"
-        "video/3gpp2"
-        "video/mkv"
-        "video/mp2t"
-        "video/mp4"
-        "video/mpeg"
-        "video/ogg"
-        "video/quicktime"
-        "video/vnd.mpegurl"
-        "video/vnd.radgamettools.bink"
-        "video/vnd.radgamettools.smacker"
-        "video/wavelet"
-        "video/webm"
-        "video/x-matroska"
-        "video/x-matroska-3d"
-        "video/x-mjpeg"
-        "video/x-msvideo"
-        "video/x-ogm+ogg"
-        "video/x-theora+ogg"
-        "x-content/video-bluray"
-        "x-content/video-dvd"
-        "x-content/video-hddvd"
-        "x-content/video-svcd"
-        "x-content/video-vcd"
-      ];
-      image = [
-        "image/avif"
-        "image/bmp"
-        "image/gif"
-        "image/jp2"
-        "image/jpeg"
-        "image/jpg"
-        "image/jpm"
-        "image/jpx"
-        "image/jxl"
-        "image/png"
-        "image/tiff"
-        "image/vnd.microsoft.icon"
-        "image/webp"
-        "image/webp"
-        "image/x-tga"
-      ];
-    in
-      audio ++ video ++ image;
+    nixfiles.modules.common = {
+      shell.aliases.cam = "mpv av://v4l2:/dev/video0";
+
+      xdg.defaultApplications.mpv = let
+        audio = [
+          "audio/aac"
+          "audio/ac3"
+          "audio/basic"
+          "audio/flac"
+          "audio/midi"
+          "audio/mp4"
+          "audio/mpeg"
+          "audio/ogg"
+          "audio/opus"
+          "audio/vnd.dts"
+          "audio/vnd.dts.hd"
+          "audio/webm"
+          "audio/x-adpcm"
+          "audio/x-aifc"
+          "audio/x-aiff"
+          "audio/x-ape"
+          "audio/x-flac+ogg"
+          "audio/x-m4b"
+          "audio/x-m4r"
+          "audio/x-matroska"
+          "audio/x-mpegurl"
+          "audio/x-musepack"
+          "audio/x-opus+ogg"
+          "audio/x-speex"
+          "audio/x-speex+ogg"
+          "audio/x-vorbis+ogg"
+          "audio/x-wav"
+          "audio/x-wavpack"
+          "x-content/audio-cdda"
+          "x-content/audio-dvd"
+        ];
+        video = [
+          "video/3gpp"
+          "video/3gpp2"
+          "video/mkv"
+          "video/mp2t"
+          "video/mp4"
+          "video/mpeg"
+          "video/ogg"
+          "video/quicktime"
+          "video/vnd.mpegurl"
+          "video/vnd.radgamettools.bink"
+          "video/vnd.radgamettools.smacker"
+          "video/wavelet"
+          "video/webm"
+          "video/x-matroska"
+          "video/x-matroska-3d"
+          "video/x-mjpeg"
+          "video/x-msvideo"
+          "video/x-ogm+ogg"
+          "video/x-theora+ogg"
+          "x-content/video-bluray"
+          "x-content/video-dvd"
+          "x-content/video-hddvd"
+          "x-content/video-svcd"
+          "x-content/video-vcd"
+        ];
+        image = [
+          "image/avif"
+          "image/bmp"
+          "image/gif"
+          "image/jp2"
+          "image/jpeg"
+          "image/jpg"
+          "image/jpm"
+          "image/jpx"
+          "image/jxl"
+          "image/png"
+          "image/tiff"
+          "image/vnd.microsoft.icon"
+          "image/webp"
+          "image/webp"
+          "image/x-tga"
+        ];
+      in
+        audio ++ video ++ image;
+    };
   };
 }
diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix
index 0f6db48..f6ee6bf 100644
--- a/modules/nixos/podman.nix
+++ b/modules/nixos/podman.nix
@@ -18,6 +18,8 @@ in {
       }
     ];
 
+    nixfiles.modules.common.shell.aliases.p = "podman";
+
     secrets.containers-auth = {
       file = "${inputs.self}/secrets/containers-auth";
       path = "${config.dirs.config}/containers/auth.json";
@@ -31,38 +33,26 @@ in {
 
     my.extraGroups = ["podman"];
 
-    hm = {
-      xdg.configFile = {
-        # This removes a really annoying registry search. 100% of the time I
-        # would need to look up stuff from the Docker and not Quay!
-        "containers/registries.conf".text = ''
-          [registries.search]
-          registries = ["docker.io"]
-        '';
-
-        # As for plain OverlayFS in Podman over ZFS[1]... I guess we are waiting
-        # for Podman to catch up now.
-        #
-        # [1]: https://github.com/openzfs/zfs/pull/14070#issuecomment-1309116666
-        "containers/storage.conf".text = optionalString config.boot.zfs.enabled ''
-          [storage]
-          driver = "overlay"
-
-          [storage.options]
-          mount_program = "${getExe' pkgs.fuse-overlayfs "fuse-overlayfs"}"
-          mountopt = "noatime,nodev,nosuid"
-        '';
-      };
-
-      programs.bash = {
-        shellAliases = {
-          podman = "grc -es ${getExe' pkgs.podman "podman"}";
-          p = "podman";
-        };
-        initExtra = mkAfter ''
-          _complete_alias p __start_podman podman
-        '';
-      };
+    hm.xdg.configFile = {
+      # This removes a really annoying registry search. 100% of the time I
+      # would need to look up stuff from the Docker and not Quay!
+      "containers/registries.conf".text = ''
+        [registries.search]
+        registries = ["docker.io"]
+      '';
+
+      # As for plain OverlayFS in Podman over ZFS[1]... I guess we are waiting
+      # for Podman to catch up now.
+      #
+      # [1]: https://github.com/openzfs/zfs/pull/14070#issuecomment-1309116666
+      "containers/storage.conf".text = optionalString config.boot.zfs.enabled ''
+        [storage]
+        driver = "overlay"
+
+        [storage.options]
+        mount_program = "${getExe' pkgs.fuse-overlayfs "fuse-overlayfs"}"
+        mountopt = "noatime,nodev,nosuid"
+      '';
     };
   };
 }

Consider giving Nix/NixOS a try! <3