Make the paths relative to the user's home directory.

This commit is contained in:
Tom Alexander 2025-08-09 20:43:01 -04:00
parent eb5815048f
commit 6b42a09468
No known key found for this signature in database
GPG Key ID: D3A179C9A53C0EDE

View File

@ -21,28 +21,30 @@ let
};
in
stage: target: (constructors."${target.method}"."${stage}" target);
old_install_user_file =
let
constructors = {
"overwrite" = install_user_file_overwrite;
"symlink" = install_user_file_symlink;
};
in
(target: (constructors."${target.method}" target));
install_user_file_overwrite = {
"check" = (target: "");
"install" = (
target:
let
source = lib.strings.escapeShellArg "${target.source}";
destination = lib.strings.escapeShellArg "${target.target}";
homedir = config.users.users."${target.username}".home;
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
mode = lib.strings.escapeShellArg "${target.mode}";
in
''
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare -m ${mode} ${source} ${destination}
''
);
"uninstall" = (target: "");
"uninstall" = (
target:
let
homedir = config.users.users."${target.username}".home;
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
in
''
$DRY_RUN_CMD echo rm -f ${destination}
''
);
};
install_user_file_symlink = {
"check" = (target: "");
@ -50,13 +52,23 @@ let
target:
let
source = lib.strings.escapeShellArg "${target.source}";
destination = lib.strings.escapeShellArg "${target.target}";
homedir = config.users.users."${target.username}".home;
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
in
''
$DRY_RUN_CMD ln $VERBOSE_ARG -s ${source} ${destination}
''
);
"uninstall" = (target: "");
"uninstall" = (
target:
let
homedir = config.users.users."${target.username}".home;
destination = lib.strings.escapeShellArg "${homedir}/${target.target}";
in
''
$DRY_RUN_CMD echo rm -f ${destination}
''
);
};
in
{