Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@
manager. If enabled, it sets the mount option ~x-gvfs-hide~
on all the bind mounts.

- ~allowTrash~ allows you to specify whether to allow apps that use
certain GTK-based technologies such as GIO to put items in the
trash. If enabled, it sets the mount option ~x-gvfs-trash~ on all
the bind mounts.

****** ~directories~

All directories you want to bind mount to persistent storage. A
Expand Down
8 changes: 6 additions & 2 deletions nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ in

boot.initrd.systemd.mounts =
let
mkBindMount = { dirPath, persistentStoragePath, hideMount, ... }: {
mkBindMount = { dirPath, persistentStoragePath, hideMount, allowTrash, ... }: {
wantedBy = [ "initrd.target" ];
before = [ "initrd-nixos-activation.service" ];
where = concatPaths [ "/sysroot" dirPath ];
Expand All @@ -278,6 +278,8 @@ in
"bind"
] ++ optionals hideMount [
"x-gvfs-hide"
] ++ optionals allowTrash [
"x-gvfs-trash"
]);
};
dirs = filter (d: elem d.dirPath pathsNeededForBoot) directories;
Expand All @@ -286,7 +288,7 @@ in

systemd.mounts =
let
mkBindMount = { dirPath, persistentStoragePath, hideMount, ... }: {
mkBindMount = { dirPath, persistentStoragePath, hideMount, allowTrash, ... }: {
wantedBy = [ "local-fs.target" ];
before = [ "local-fs.target" ];
where = concatPaths [ "/" dirPath ];
Expand All @@ -297,6 +299,8 @@ in
"bind"
] ++ optionals hideMount [
"x-gvfs-hide"
] ++ optionals allowTrash [
"x-gvfs-trash"
]);
};
in
Expand Down
18 changes: 18 additions & 0 deletions submodule-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ let
mounted drives.
'';
};
allowTrash = mkOption {
type = bool;
default = config.allowTrash;
defaultText = "environment.persistence.‹name›.allowTrash";
example = true;
description = ''
Whether to allow newer GIO-based applications to trash files.
'';
};
# Save the default permissions at the level the
# directory resides. This used when creating its
# parent directories, giving them reasonable
Expand Down Expand Up @@ -295,6 +304,15 @@ in
'';
};

allowTrash = mkOption {
type = bool;
default = false;
example = true;
description = ''
Whether to allow newer GIO-based applications to trash files.
'';
};

enableDebugging = mkOption {
type = bool;
default = false;
Expand Down