ctucx.git: nixfiles

ctucx' nixfiles

commit 59b980bb8e8dcb6e25f5ae5d8536677634afedc8
parent 781a51e2a04014483871ea2d351a43a30d0b3df7
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 18 Mar 2025 14:25:39 +0100

move `nautilus` from gnome specific parts to own `homeManager/programs` module :)
3 files changed, 47 insertions(+), 52 deletions(-)
A
configurations/homeManager/programs/nautilus.nix
|
40
++++++++++++++++++++++++++++++++++++++++
M
configurations/nixos/wm/gnome.nix
|
21
++-------------------
M
modules/nixos/gnome.nix
|
38
+++++---------------------------------
diff --git a/configurations/homeManager/programs/nautilus.nix b/configurations/homeManager/programs/nautilus.nix
@@ -0,0 +1,40 @@
+{ inputs, pkgs, systemConfig, ... }:
+
+{
+
+  home.packages = with pkgs; [
+    nautilus
+    sushi #quick-preview for nautilus
+  ];
+
+  home.sessionVariables = {
+    NAUTILUS_4_EXTENSION_DIR = "${systemConfig.system.path}/lib/nautilus/extensions-4";
+  };
+
+  xdg.mimeApps.enable = true;
+  xdg.mimeApps.defaultApplications = {
+    "inode/directory" = [ "org.gnome.Nautilus.desktop" ];
+  };
+
+  gtk.gtk4.extraCss = ''
+    /* remove 'starred' in nautilus side-panel */
+    .nautilus-window .navigation-sidebar > .sidebar-row:nth-child(2) {
+      min-height:0;
+      font-size: 0;
+      -gtk-icon-size: 0;
+      margin-top: -2px;
+    }
+  '';
+
+  dconf.settings = with inputs.homeManager.lib.hm.gvariant; {
+    "org/gnome/nautilus/list-view" = {
+      use-tree-view      = true;
+      default-zoom-level = "small";
+    };
+    "org/gnome/nautilus/preferences" = {
+      date-time-format      = "detailed";
+      default-folder-viewer = "list-view";
+    };
+  };
+
+}
diff --git a/configurations/nixos/wm/gnome.nix b/configurations/nixos/wm/gnome.nix
@@ -41,6 +41,8 @@
     ctucxConfig.homeManager.programs.bitwarden-cli
 #      ctucxConfig.homeManager.programs.password-store
 
+    ctucxConfig.homeManager.programs.nautilus
+
     ctucxConfig.homeManager.programs.firefox
     ctucxConfig.homeManager.programs.thunderbird
 

@@ -131,16 +133,6 @@
         gtk-application-prefer-dark-theme = 1;
         gtk-theme-name                    = "adw-gtk3-dark";
       };
-
-      gtk4.extraCss = ''
-        /* remove 'starred' in nautilus side-panel */
-        .nautilus-window .navigation-sidebar > .sidebar-row:nth-child(2) {
-          min-height:0;
-          font-size: 0;
-          -gtk-icon-size: 0;
-          margin-top: -2px;
-        }
-      '';
     };
 
     # Use `dconf watch /` to track stateful changes you are doing and store them here.

@@ -240,15 +232,6 @@
         primary-color   = "#3465a4";
         secondary-color = "#000000";
       };
-
-      "org/gnome/nautilus/list-view" = {
-        use-tree-view      = true;
-        default-zoom-level = "small";
-      };
-      "org/gnome/nautilus/preferences" = {
-        date-time-format      = "detailed";
-        default-folder-viewer = "list-view";
-      };
     };
   };
 
diff --git a/modules/nixos/gnome.nix b/modules/nixos/gnome.nix
@@ -6,15 +6,6 @@ let
   settingsFormat = pkgs.formats.ini { };
   configFile     = settingsFormat.generate "custom.conf" cfg.gdm.settings;
 
-  mimeAppsList = pkgs.writeTextFile {
-    name        = "gnome-mimeapps";
-    destination = "/share/applications/mimeapps.list";
-    text = ''
-      [Default Applications]
-      inode/directory=nautilus.desktop;org.gnome.Nautilus.desktop
-    '';
-  };
-
   nixos-background-info  = pkgs.writeTextFile rec {
     name        = "nixos-background-info";
     destination = "/share/gnome-background-properties/nixos.xml";

@@ -173,8 +164,6 @@ in {
         (lib.mkIf config.services.colord.enable gnome-color-manager)
         gnome-control-center
         ghostty
-        nautilus
-        sushi #quick-preview for nautilus
         adwaita-icon-theme
         sound-theme-freedesktop
         nixos-icons

@@ -191,13 +180,6 @@ in {
         "/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
         "/share/nautilus-python/extensions"
       ];
-
-      sessionVariables = {
-        # Let nautilus find extensions
-        NAUTILUS_4_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-4";
-        # Override default mimeapps for nautilus
-        XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
-      };
     };
 
     services = {

@@ -222,24 +204,14 @@ in {
       geoclue2 = {
         enable          = lib.mkDefault true;
         enableDemoAgent = false; # GNOME has its own geoclue agent
-        appConfig = {
-          gnome-datetime-panel = {
-            isAllowed = true;
-            isSystem = true;
-          };
-          gnome-color-panel = {
-            isAllowed = true;
-            isSystem = true;
-          };
-          "org.gnome.Shell" = {
-            isAllowed = true;
-            isSystem = true;
-          };
-        };
+        appConfig = lib.genAttrs [ "gnome-datetime-panel" "gnome-color-panel" "org.gnome.Shell" ] (name: {
+          isAllowed = true;
+          isSystem = true;
+        });
       };
 
       udev.packages = [ pkgs.mutter ];
-      dbus.packages = with pkgs; [ gdm sushi ];
+      dbus.packages = [ pkgs.gdm ];
     };
 
     programs = {