Add custom impermanence module

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-08-08 22:03:15 +03:00
parent 5e57d63a54
commit 22e0150a65
69 changed files with 777 additions and 494 deletions

View File

@@ -1,5 +1,6 @@
{
username ? throw "username argument is required",
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
@@ -7,15 +8,10 @@
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/cliphist"
];
environment.persistence."/cache"."${home}/.cache/cliphist" = { };
home-manager.users.${username} = {
home-manager.users.${user} = {
home.packages = with pkgs; [
wl-clipboard
cliphist
@@ -26,7 +22,10 @@ in
Unit = {
Description = "Clipboard manager";
BindsTo = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
After = [
"graphical-session.target"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
Service.ExecStart = lib.meta.getExe (
@@ -47,7 +46,10 @@ in
Unit = {
Description = "Clipboard manager (images)";
BindsTo = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
After = [
"graphical-session.target"
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
];
};
Service.ExecStart = lib.meta.getExe (
@@ -72,8 +74,8 @@ in
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
in
[
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} delete"
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} delete"
"$mod_Ctrl_Shift, v, exec, ${cliphist} wipe"
];
};