feat: smb mounts gehen wuhu
This commit is contained in:
parent
d21693d584
commit
1f716af7f5
|
@ -2,7 +2,7 @@
|
||||||
services.dbus.enable = true;
|
services.dbus.enable = true;
|
||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wlr.enable = false;
|
wlr.enable = true;
|
||||||
extraPortals = with pkgs; [xdg-desktop-portal-wlr];
|
extraPortals = with pkgs; [xdg-desktop-portal-wlr];
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
types
|
types
|
||||||
flip
|
flip
|
||||||
attrNames
|
attrNames
|
||||||
toString
|
|
||||||
mkMerge
|
mkMerge
|
||||||
concatMap
|
concatMap
|
||||||
|
optional
|
||||||
;
|
;
|
||||||
baseOptions = [
|
baseOptions = [
|
||||||
"x-systemd.idle-timeout=60"
|
"x-systemd.idle-timeout=60"
|
||||||
|
@ -26,12 +26,12 @@ in {
|
||||||
options.home.smb = mkOption {
|
options.home.smb = mkOption {
|
||||||
description = "Samba shares to be mountable under $HOME/smb";
|
description = "Samba shares to be mountable under $HOME/smb";
|
||||||
default = [];
|
default = [];
|
||||||
type = types.listOf (types.submodule {
|
type = types.listOf (types.submodule ({config, ...}: {
|
||||||
options = {
|
options = {
|
||||||
localPath = mkOption {
|
localPath = mkOption {
|
||||||
description = "The path under which the share will be mounted. Defaults to the remotePath";
|
description = "The path under which the share will be mounted. Defaults to the remotePath";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = null;
|
default = config.remotePath;
|
||||||
};
|
};
|
||||||
address = mkOption {
|
address = mkOption {
|
||||||
description = "The remote share address";
|
description = "The remote share address";
|
||||||
|
@ -50,10 +50,10 @@ in {
|
||||||
automatic = mkOption {
|
automatic = mkOption {
|
||||||
description = "Whether this share should be automatically mounted on boot";
|
description = "Whether this share should be automatically mounted on boot";
|
||||||
default = false;
|
default = false;
|
||||||
type = types.boolean;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
}));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -69,24 +69,22 @@ in {
|
||||||
(attrNames config.home-manager.users)
|
(attrNames config.home-manager.users)
|
||||||
(
|
(
|
||||||
user: let
|
user: let
|
||||||
parentPath = "${config.home-manager.users.${user}.home.homeDirectory}/smb";
|
parentPath = "/home/${user}/smb";
|
||||||
cfg = config.home-manager.users.${user}.home.smb;
|
cfg = config.home-manager.users.${user}.home.smb;
|
||||||
|
inherit (config.users.users.${user}) uid;
|
||||||
|
inherit (config.users.groups.${user}) gid;
|
||||||
in
|
in
|
||||||
flip map cfg (
|
flip map cfg (
|
||||||
cfg: {
|
cfg: {
|
||||||
"${parentPath}/${cfg.localpath or cfg.remotePath}" = let
|
"${parentPath}/${cfg.localPath}" = let
|
||||||
options =
|
options =
|
||||||
baseOptions
|
baseOptions
|
||||||
++ [
|
++ [
|
||||||
"uid=${toString config.users.users.${user}.uid}"
|
"uid=${toString uid}"
|
||||||
"gid=${toString config.users.groups.${user}.gid}"
|
"gid=${toString gid}"
|
||||||
"credentials=${cfg.credentials}"
|
"credentials=${cfg.credentials}"
|
||||||
"${
|
]
|
||||||
if cfg.automatic
|
++ (optional (!cfg.automatic) "noauto");
|
||||||
then ""
|
|
||||||
else "noauto"
|
|
||||||
}"
|
|
||||||
];
|
|
||||||
in {
|
in {
|
||||||
inherit options;
|
inherit options;
|
||||||
device = "//${cfg.address}/${cfg.remotePath}";
|
device = "//${cfg.address}/${cfg.remotePath}";
|
||||||
|
|
Loading…
Reference in a new issue