zaphyra's git: nixfiles

zaphyra's nixfiles

commit 7483b71c13a6d0c81ef99ef390f276a7ccece414
parent 55d0f32da33f8c5123954f210d3b639c28bd057d
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Sat, 26 Jul 2025 20:01:43 +0200

config/nixos/modules/services: add `gvfs`
2 files changed, 64 insertions(+), 0 deletions(-)
M
config/nixos/modules/presets/graphical/typeNiri.nix
|
2
++
A
config/nixos/modules/services/gvfs.nix
|
62
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/config/nixos/modules/presets/graphical/typeNiri.nix b/config/nixos/modules/presets/graphical/typeNiri.nix
@@ -21,6 +21,8 @@ in
       networking.NetworkManager.enable = true;
 
       services = {
+        gvfs.enable = true;
+
         upower.enable = true;
         power-profiles-daemon.enable = true;
         swaylock.enable = true;
diff --git a/config/nixos/modules/services/gvfs.nix b/config/nixos/modules/services/gvfs.nix
@@ -0,0 +1,62 @@
+{
+  povSelf,
+  config,
+  pkgs,
+  lib,
+  ...
+}:
+let
+  inherit (lib) types;
+  cfg = lib.getAttrFromPath povSelf config;
+
+in
+{
+
+  options = {
+    enable = {
+      type = types.bool;
+      default = false;
+    };
+    backends = {
+      afc = {
+        type = types.bool;
+        default = false;
+      };
+      afp = {
+        type = types.bool;
+        default = false;
+      };
+      mtp = {
+        type = types.bool;
+        default = false;
+      };
+      gphoto2 = {
+        type = types.bool;
+        default = false;
+      };
+      smb = {
+        type = types.bool;
+        default = false;
+      };
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.gvfs = {
+      enable = true;
+      package =
+        (pkgs.gvfs.overrideAttrs (old: {
+          mesonFlags = (old.mesonFlags or [ ]) ++ [
+            "-Dafp=${lib.boolToString cfg.backends.afp}"
+            "-Dafc=${lib.boolToString cfg.backends.afc}"
+            "-Dmtp=${lib.boolToString cfg.backends.mtp}"
+            "-Dgphoto2=${lib.boolToString cfg.backends.gphoto2}"
+          ];
+        })).override
+          {
+            samba = null;
+          };
+    };
+  };
+
+}