about summary refs log tree commit diff
path: root/modules/nixos
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
commitedf7cc355cb1f55a9301283ebec15e01dc4ffe62 (patch)
treebf7745040efadac618168b7a9a764acb482acb07 /modules/nixos
parent2023-11-16 (diff)
2023-11-19
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/common/documentation.nix2
-rw-r--r--modules/nixos/dwm.nix5
-rw-r--r--modules/nixos/emacs.nix8
-rw-r--r--modules/nixos/matrix/dendrite.nix4
-rw-r--r--modules/nixos/mpd.nix2
-rw-r--r--modules/nixos/podman.nix4
-rw-r--r--modules/nixos/profiles/dev/default.nix13
-rw-r--r--modules/nixos/psd.nix10
-rw-r--r--modules/nixos/rtorrent.nix7
-rw-r--r--modules/nixos/shadowsocks.nix2
-rw-r--r--modules/nixos/soju.nix2
-rw-r--r--modules/nixos/solaar.nix5
-rw-r--r--modules/nixos/unbound.nix3
-rw-r--r--modules/nixos/xmonad.nix2
14 files changed, 39 insertions, 30 deletions
diff --git a/modules/nixos/common/documentation.nix b/modules/nixos/common/documentation.nix
index f909108..cb66818 100644
--- a/modules/nixos/common/documentation.nix
+++ b/modules/nixos/common/documentation.nix
@@ -25,7 +25,7 @@ with lib; {
 
     environment.sessionVariables = {
       MANOPT = "--no-hyphenation";
-      MANPAGER = "${pkgs.less}/bin/less -+F";
+      MANPAGER = "${getExe pkgs.less} -+F";
     };
   };
 }
diff --git a/modules/nixos/dwm.nix b/modules/nixos/dwm.nix
index 618d8ed..459aae5 100644
--- a/modules/nixos/dwm.nix
+++ b/modules/nixos/dwm.nix
@@ -89,7 +89,7 @@ in {
               NULL,
             };
             static const char *termcmd[] = {
-              "${pkgs.alacritty}/bin/alacritty",
+              "${getExe pkgs.alacritty}",
               NULL,
             };
 
@@ -143,7 +143,8 @@ in {
             };
           '';
         };
-      in "${pkg}/bin/dwm";
+      in
+        getExe' pkg "dwm";
     };
 
     hm.services.dwm-status = {
diff --git a/modules/nixos/emacs.nix b/modules/nixos/emacs.nix
index 8163c45..c851389 100644
--- a/modules/nixos/emacs.nix
+++ b/modules/nixos/emacs.nix
@@ -8,7 +8,7 @@ with lib; let
 in {
   config = mkIf cfg.enable {
     nixfiles.modules = {
-      common.xdg.defaultApplications.emacsclient = [
+      common.xdg.defaultApplications.emacs = [
         "application/atom+xml"
         "application/json"
         "application/rss+xml"
@@ -21,11 +21,5 @@ in {
 
       x11.enable = true;
     };
-
-    hm.services.emacs = {
-      enable = true;
-      client.enable = true;
-      socketActivation.enable = true;
-    };
   };
 }
diff --git a/modules/nixos/matrix/dendrite.nix b/modules/nixos/matrix/dendrite.nix
index efeef3c..7528792 100644
--- a/modules/nixos/matrix/dendrite.nix
+++ b/modules/nixos/matrix/dendrite.nix
@@ -178,12 +178,12 @@ in {
             };
           in
             concatStringsSep " " [
-              "${pkgs.envsubst}/bin/envsubst"
+              (getExe pkgs.envsubst)
               "-i ${(pkgs.formats.yaml {}).generate "dendrite.yaml" settings}"
               "-o /run/dendrite/dendrite.yaml"
             ];
           ExecStart = concatStringsSep " " [
-            "${pkgs.dendrite}/bin/dendrite"
+            (getExe' pkgs.dendrite "dendrite")
             "--config /run/dendrite/dendrite.yaml"
             "--http-bind-address 127.0.0.1:${toString cfg.port}"
           ];
diff --git a/modules/nixos/mpd.nix b/modules/nixos/mpd.nix
index 6db83f8..485cde3 100644
--- a/modules/nixos/mpd.nix
+++ b/modules/nixos/mpd.nix
@@ -138,7 +138,7 @@ in {
 
           mouse_support = false;
 
-          external_editor = "${config.programs.vim.package}/bin/vim";
+          external_editor = getExe' config.programs.vim.package "vim";
           use_console_editor = true;
 
           colors_enabled = true;
diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix
index ec9b346..0f6db48 100644
--- a/modules/nixos/podman.nix
+++ b/modules/nixos/podman.nix
@@ -49,14 +49,14 @@ in {
           driver = "overlay"
 
           [storage.options]
-          mount_program = "${pkgs.fuse-overlayfs}/bin/fuse-overlayfs"
+          mount_program = "${getExe' pkgs.fuse-overlayfs "fuse-overlayfs"}"
           mountopt = "noatime,nodev,nosuid"
         '';
       };
 
       programs.bash = {
         shellAliases = {
-          podman = "grc -es ${pkgs.podman}/bin/podman";
+          podman = "grc -es ${getExe' pkgs.podman "podman"}";
           p = "podman";
         };
         initExtra = mkAfter ''
diff --git a/modules/nixos/profiles/dev/default.nix b/modules/nixos/profiles/dev/default.nix
index bba8ebd..5253e95 100644
--- a/modules/nixos/profiles/dev/default.nix
+++ b/modules/nixos/profiles/dev/default.nix
@@ -1,10 +1,11 @@
 {
   config,
   lib,
+  pkgs,
   ...
 }:
 with lib; let
-  cfg = config.nixfiles.modules.profiles.dev.default;
+  cfg = config.nixfiles.modules.profiles.dev;
 in {
   imports = [
     ./containers.nix
@@ -16,6 +17,14 @@ in {
       messages = "C";
     };
 
-    my.extraGroups = ["kvm"];
+    programs.wireshark = {
+      enable = true;
+      package = pkgs.wireshark;
+    };
+
+    my.extraGroups = [
+      "kvm"
+      "wireshark"
+    ];
   };
 }
diff --git a/modules/nixos/psd.nix b/modules/nixos/psd.nix
index 77d3c66..eb5a1a8 100644
--- a/modules/nixos/psd.nix
+++ b/modules/nixos/psd.nix
@@ -20,7 +20,9 @@ in {
     };
 
     systemd.user = {
-      services = {
+      services = let
+        exe = getExe' pkgs.profile-sync-daemon "profile-sync-daemon";
+      in {
         psd = {
           unitConfig = {
             Description = "Profile-sync-daemon";
@@ -30,8 +32,8 @@ in {
           };
           serviceConfig = {
             RemainAfterExit = true;
-            ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon startup";
-            ExecStop = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon unsync";
+            ExecStart = "${exe} startup";
+            ExecStop = "${exe} unsync";
           };
           wantedBy = ["graphical.target"];
         };
@@ -43,7 +45,7 @@ in {
             Wants = ["psd-resync.timer"];
             BindsTo = ["psd.service"];
           };
-          serviceConfig.ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon resync";
+          serviceConfig.ExecStart = "${exe} resync";
           wantedBy = ["graphical.target"];
         };
       };
diff --git a/modules/nixos/rtorrent.nix b/modules/nixos/rtorrent.nix
index 5d2dba5..847f12d 100644
--- a/modules/nixos/rtorrent.nix
+++ b/modules/nixos/rtorrent.nix
@@ -63,7 +63,8 @@ in {
                       mv -fv "$leech_path" "$seed_path"
                     '';
                   };
-                in "${pkg}/bin/move-completed";
+                in
+                  getExe pkg;
               in
                 pkgs.writeText "rtorrent.rc" ''
                   method.insert = cfg.leech,     private|const|string, (cat, "${leechDir}")
@@ -143,7 +144,7 @@ in {
                 logDir
               ];
               ExecStart = concatStringsSep " " [
-                "${pkgs.rtorrent}/bin/rtorrent"
+                (getExe pkgs.rtorrent)
                 "-n"
                 "-o system.daemon.set=true"
                 "-o network.bind_address.set=0.0.0.0"
@@ -245,7 +246,7 @@ in {
               Group = group;
 
               ExecStart = concatStringsSep " " [
-                "${pkg}/bin/flood"
+                (getExe pkg)
                 "--allowedpath=${baseDir}"
                 "--baseuri=/"
                 "--rundir=${baseDir}/flood"
diff --git a/modules/nixos/shadowsocks.nix b/modules/nixos/shadowsocks.nix
index c04799b..97eb17f 100644
--- a/modules/nixos/shadowsocks.nix
+++ b/modules/nixos/shadowsocks.nix
@@ -79,7 +79,7 @@ in {
             });
           in
             pkgs.writeShellScript "meregeJson" ''
-              ${pkgs.jq}/bin/jq \
+              ${getExe pkgs.jq} \
                 -s '.[0] * .[1]' \
                 ${configFile} \
                 $CREDENTIALS_DIRECTORY/secret.json \
diff --git a/modules/nixos/soju.nix b/modules/nixos/soju.nix
index 3cfe015..569e218 100644
--- a/modules/nixos/soju.nix
+++ b/modules/nixos/soju.nix
@@ -96,7 +96,7 @@ in {
             '';
           in
             concatStringsSep " " [
-              "${pkgs.soju}/bin/soju"
+              (getExe' pkgs.soju "soju")
               "-config ${configFile}"
             ];
           DynamicUser = true;
diff --git a/modules/nixos/solaar.nix b/modules/nixos/solaar.nix
index ceff23d..64aafc8 100644
--- a/modules/nixos/solaar.nix
+++ b/modules/nixos/solaar.nix
@@ -38,8 +38,9 @@ in {
                 done
               '';
             };
-          in "${pkg}/bin/solaar-pre";
-          ExecStart = "${pkgs.solaar}/bin/solaar --window=hide";
+          in
+            getExe pkg;
+          ExecStart = "${getExe pkgs.solaar "solaar"} --window=hide";
         };
         Install.WantedBy = ["graphical-session.target"];
       };
diff --git a/modules/nixos/unbound.nix b/modules/nixos/unbound.nix
index dd7e757..2fab1e0 100644
--- a/modules/nixos/unbound.nix
+++ b/modules/nixos/unbound.nix
@@ -184,7 +184,8 @@ in {
                       fi
                     '';
                   };
-              in "${pkg}/bin/unbound-adblock-update";
+              in
+                getExe pkg;
             };
           };
         };
diff --git a/modules/nixos/xmonad.nix b/modules/nixos/xmonad.nix
index c5fedc2..b4eb4a0 100644
--- a/modules/nixos/xmonad.nix
+++ b/modules/nixos/xmonad.nix
@@ -18,7 +18,7 @@ in {
 
         scriptPath = ".xinitrc";
 
-        windowManager.command = "${pkgs.xmonad-ng}/bin/xmonad-ng";
+        windowManager.command = getExe' pkgs.xmonad-ng "xmonad-ng";
       };
     };
 

Consider giving Nix/NixOS a try! <3