about summary refs log tree commit diff
path: root/modules/common
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common')
-rw-r--r--modules/common/bat.nix3
-rw-r--r--modules/common/common/nix/default.nix38
-rw-r--r--modules/common/common/shell/default.nix2
-rw-r--r--modules/common/direnv.nix3
-rw-r--r--modules/common/git.nix35
-rw-r--r--modules/common/mpv.nix79
-rw-r--r--modules/common/profiles/email.nix2
-rw-r--r--modules/common/zathura.nix5
8 files changed, 136 insertions, 31 deletions
diff --git a/modules/common/bat.nix b/modules/common/bat.nix
index e2d5da1..7f78a59 100644
--- a/modules/common/bat.nix
+++ b/modules/common/bat.nix
@@ -23,8 +23,9 @@ in {
 
       bash = {
         shellAliases = {
-          bay = "bat --language=yaml --tabs 2";
           baj = "bat --language=json --tabs 2";
+          bay = "bat --language=yaml --tabs 2";
+          bas = "bat --language=syslog";
         };
 
         initExtra = mkAfter ''
diff --git a/modules/common/common/nix/default.nix b/modules/common/common/nix/default.nix
index a79a0c3..ad7e706 100644
--- a/modules/common/common/nix/default.nix
+++ b/modules/common/common/nix/default.nix
@@ -174,21 +174,25 @@ with lib; {
     variables.NIXFILES = "${config.my.home}/src/nixfiles";
   };
 
-  hm.home.file.".nix-defexpr/default.nix".text = let
-    hostname = strings.escapeNixIdentifier this.hostname;
-  in
-    optionalString this.isHeadful ''
-      let
-        self = builtins.getFlake "nixfiles";
-        configurations = self.nixosConfigurations;
-        local = configurations.${hostname};
-      in rec {
-        inherit self;
-        inherit (self) inputs lib;
-        inherit (lib) my;
-        this = my.configurations.${hostname};
-        inherit (local) config;
-        inherit (local.config.system.build) toplevel vm vmWithBootLoader manual;
-      } // configurations // local._module.args
-    '';
+  hm = {
+    home.file.".nix-defexpr/default.nix".text = let
+      hostname = strings.escapeNixIdentifier this.hostname;
+    in
+      optionalString this.isHeadful ''
+        let
+          self = builtins.getFlake "nixfiles";
+          configurations = self.nixosConfigurations;
+          local = configurations.${hostname};
+        in rec {
+          inherit self;
+          inherit (self) inputs lib;
+          inherit (lib) my;
+          this = my.configurations.${hostname};
+          inherit (local) config;
+          inherit (local.config.system.build) toplevel vm vmWithBootLoader manual;
+        } // configurations // local._module.args
+      '';
+
+    programs.bash.shellAliases.nix = "nix --verbose --print-build-logs";
+  };
 }
diff --git a/modules/common/common/shell/default.nix b/modules/common/common/shell/default.nix
index c3c29de..01db7a5 100644
--- a/modules/common/common/shell/default.nix
+++ b/modules/common/common/shell/default.nix
@@ -113,7 +113,7 @@ with lib; {
           // genAttrs ["grep" "egrep" "fgrep"]
           (name: "${pkgs.gnugrep}/bin/${name} --color=always");
 
-        historyControl = ["ignoredups" "ignorespace"];
+        historyControl = ["erasedups" "ignoredups" "ignorespace"];
       };
 
       command-not-found.enable = false;
diff --git a/modules/common/direnv.nix b/modules/common/direnv.nix
index 743f3cf..3429218 100644
--- a/modules/common/direnv.nix
+++ b/modules/common/direnv.nix
@@ -6,8 +6,7 @@
 with lib; let
   cfg = config.nixfiles.modules.direnv;
 in {
-  options.nixfiles.modules.direnv.enable =
-    mkEnableOption "direnv";
+  options.nixfiles.modules.direnv.enable = mkEnableOption "direnv";
 
   config = mkIf cfg.enable {
     hm = {
diff --git a/modules/common/git.nix b/modules/common/git.nix
index de401fb..da33eb2 100644
--- a/modules/common/git.nix
+++ b/modules/common/git.nix
@@ -59,17 +59,31 @@ in {
 
           extraConfig =
             {
-              advice.detachedHead = false;
               color.ui = true;
               core.whitespace = "trailing-space";
+              init.defaultBranch = "master";
+              status.submoduleSummary = true;
+              commit.verbose = 1;
+              push.autoSetupRemote = true;
+              pull.rebase = true;
+              rebase = {
+                autoStash = true;
+                autoSquash = true;
+              };
               diff = {
                 mnemonicPrefix = true;
                 renames = "copies";
                 submodule = "log";
               };
-              init.defaultBranch = "master";
-              push.autoSetupRemote = true;
-              status.submoduleSummary = true;
+              submodule.recurse = true;
+              sendemail = rec {
+                smtpServer = my.domain.shire;
+                smtpUser = "${my.username}@${smtpServer}";
+                smtpEncryption = "ssl";
+                smtpServerPort = 465;
+                annotate = true;
+                confirm = "always";
+              };
               github.user = my.username;
               gitlab.user = my.username;
             }
@@ -95,10 +109,14 @@ in {
             git = "${config.hm.programs.git.package}/bin/git";
             curl = "${pkgs.curl}/bin/curl";
           in {
-            fuck = "!${git} reset --hard && ${git} clean -fdx";
+            amend = "commit --amend";
+            cat = "cat-file -p";
+            fast = "clone --depth=1";
+            fixup = "commit --fixup";
+            fuck = "!${git} reset --hard && ${git} clean --force -dx";
+            get = "pull --all --recurse-submodules --autostash";
             gud = ''commit -m "git gud"'';
-            review = "!${git} lg @{push}..";
-            reword = "commit --amend";
+            refresh = "clean --force -X";
             tree = "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'";
             uncommit = "reset --soft HEAD~1";
             untrack = "rm --cache --";
@@ -106,8 +124,7 @@ in {
           };
 
           # All helper tools/editor generated files should go here. This must be
-          # kept relatively clean and void of any project-specific residual
-          # files.
+          # kept void of any project-specific or residual files.
           ignores = [
             "*~"
             ".DS_Store"
diff --git a/modules/common/mpv.nix b/modules/common/mpv.nix
index 37fbe4c..757ccd8 100644
--- a/modules/common/mpv.nix
+++ b/modules/common/mpv.nix
@@ -10,6 +10,85 @@ in {
   options.nixfiles.modules.mpv.enable = mkEnableOption "mpv";
 
   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;
+
     hm.programs = {
       mpv = {
         enable = true;
diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix
index 56fabe1..9064f70 100644
--- a/modules/common/profiles/email.nix
+++ b/modules/common/profiles/email.nix
@@ -57,7 +57,7 @@ in {
                   "'${toString line}!d'"
                 ]
               );
-        in rec {
+        in {
           shire = mkAccount rec {
             address = my.email;
             aliases = [address "frodo@rohan.net" "azahi@shire.net"];
diff --git a/modules/common/zathura.nix b/modules/common/zathura.nix
index f78a9e9..408f218 100644
--- a/modules/common/zathura.nix
+++ b/modules/common/zathura.nix
@@ -10,6 +10,11 @@ in {
     mkEnableOption "Zathura PDF reader";
 
   config = mkIf cfg.enable {
+    nixfiles.modules.common.xdg.defaultApplications."org.pwmt.zathura" = [
+      "application/pdf"
+      "application/epub+zip"
+    ];
+
     hm.programs.zathura = with config.nixfiles.modules; {
       enable = true;
 

Consider giving Nix/NixOS a try! <3