nixos-conf/modules/programs/symlinked/symlinks.nix

65 lines
1.7 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
let
cfg = config.custom.symlinks;
in
{
options.custom.symlinks.enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
config = lib.mkIf cfg.enable {
system.userActivationScripts.mkDesktopSettingsSymlinks.text =
let
home = "/home/vili/";
paths = [
rec {
dir = "${home}.config/pcmanfm/default/";
file = "pcmanfm.conf";
full = "${dir}${file}";
source = "${./pcmanfm.conf}";
}
rec {
dir = "${home}.config/libfm/";
file = "libfm.conf";
full = "${dir}${file}";
source = "${./libfm.conf}";
}
rec {
dir = "${home}.config/gtk-3.0/";
file = "bookmarks";
full = "${dir}${file}";
source = "${./gtk-bookmarks}";
}
rec {
dir = "${home}";
file = ".gtkrc-2.0";
full = "${dir}${file}";
source = "${./gtkrc-2.0}";
}
rec {
dir = "${home}.config/gtk-3.0/";
file = "settings.ini";
full = "${dir}${file}";
source = "${./gtk-3-4-settings.ini}";
}
rec {
dir = "${home}.config/gtk-4.0/";
file = "settings.ini";
full = "${dir}${file}";
source = "${./gtk-3-4-settings.ini}";
}
];
in
toString (
map (path: ''
mkdir -p ${path.dir}
if test -e ${path.full} -a ! -L ${path.full}; then
mv -f ${path.full} ${path.full}.old
fi
ln -sf ${path.source} ${path.full}
'') paths
);
};
}