From 1f716af7f5b09675dde8841912486e60c776180b Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 5 Sep 2023 23:33:38 +0200 Subject: [PATCH] feat: smb mounts gehen wuhu --- modules/graphical/wayland.nix | 2 +- modules/smb-mounts.nix | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/modules/graphical/wayland.nix b/modules/graphical/wayland.nix index 958f58c..896d5f3 100644 --- a/modules/graphical/wayland.nix +++ b/modules/graphical/wayland.nix @@ -2,7 +2,7 @@ services.dbus.enable = true; xdg.portal = { enable = true; - wlr.enable = false; + wlr.enable = true; extraPortals = with pkgs; [xdg-desktop-portal-wlr]; }; environment.systemPackages = with pkgs; [ diff --git a/modules/smb-mounts.nix b/modules/smb-mounts.nix index 267b0f2..d2622e2 100644 --- a/modules/smb-mounts.nix +++ b/modules/smb-mounts.nix @@ -10,9 +10,9 @@ types flip attrNames - toString mkMerge concatMap + optional ; baseOptions = [ "x-systemd.idle-timeout=60" @@ -26,12 +26,12 @@ in { options.home.smb = mkOption { description = "Samba shares to be mountable under $HOME/smb"; default = []; - type = types.listOf (types.submodule { + type = types.listOf (types.submodule ({config, ...}: { options = { localPath = mkOption { description = "The path under which the share will be mounted. Defaults to the remotePath"; type = types.str; - default = null; + default = config.remotePath; }; address = mkOption { description = "The remote share address"; @@ -50,10 +50,10 @@ in { automatic = mkOption { description = "Whether this share should be automatically mounted on boot"; default = false; - type = types.boolean; + type = types.bool; }; }; - }); + })); }; } ]; @@ -69,24 +69,22 @@ in { (attrNames config.home-manager.users) ( user: let - parentPath = "${config.home-manager.users.${user}.home.homeDirectory}/smb"; + parentPath = "/home/${user}/smb"; cfg = config.home-manager.users.${user}.home.smb; + inherit (config.users.users.${user}) uid; + inherit (config.users.groups.${user}) gid; in flip map cfg ( cfg: { - "${parentPath}/${cfg.localpath or cfg.remotePath}" = let + "${parentPath}/${cfg.localPath}" = let options = baseOptions ++ [ - "uid=${toString config.users.users.${user}.uid}" - "gid=${toString config.users.groups.${user}.gid}" + "uid=${toString uid}" + "gid=${toString gid}" "credentials=${cfg.credentials}" - "${ - if cfg.automatic - then "" - else "noauto" - }" - ]; + ] + ++ (optional (!cfg.automatic) "noauto"); in { inherit options; device = "//${cfg.address}/${cfg.remotePath}";