New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkOutOfStoreSymlink doesn't work as expected with a flake setup #2085
Comments
|
@cole-h that's exactly how I solved it :) Closing this issue. |
@folke when providing a string argument, the link would then point to the source file within your home directory? I've tried using a string but it's making no difference (NixOS) xdg.configFile."Code/User/settings.json".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/dotfiles/nix/config/settings.json"; ls -l /home/andy/.config/Code/User/settings.json
lrwxrwxrwx 1 andy users 94 Jun 15 12:39 /home/andy/.config/Code/User/settings.json -> /nix/store/9qqncknpzrfhw21kwa9k634ady5lm0bk-home-manager-files/.config/Code/User/settings.json Edit: Looks like, when using a string, the link eventually points to the file in the home directory (with correct read/write permissions)
|
You need to use a full path with home.file. That works in my case |
I scratched my head for awhile about how to get the absolute path of the flake. It ended up being quite dirty. I run my builds through a script. This scripts writes the path to a file within the flake repo, this file is ignored with At this point I guess I could just make the script make the symlinks too, but it's pretty nice to have them activated and deactivated through Nix. Does anyone have a better solution 2023? 😄 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-manage-dotfiles-with-home-manager/30576/5 |
This is what i use currently:
options = {
dotfiles = lib.mkOption {
type = lib.types.path;
apply = toString;
default = "${config.home.homeDirectory}/.dotfiles";
example = "${config.home.homeDirectory}/.dotfiles";
description = "Location of the dotfiles working copy";
};
}; Then, I use this option whenever i want to create a symlink to a file, for eg. xdg.configFile."wezterm".source = config.lib.file.mkOutOfStoreSymlink "${config.dotfiles}/config/wezterm";
home.file.".p10k.zsh".source = config.lib.file.mkOutOfStoreSymlink "${config.dotfiles}/config/zsh/p10k.zsh"; |
Issue description
I'm currently migrating my dotfiles to Nix using nix-darwin and the home-manager module.
One problem I'm having is that
mkOutOfStoreSymlink
doesn't seem to work when using flakes.In the example below, the
.config/alacritty
directory will link to the flake sources (/nix/store/54vrjl9afxg7ckb5waxy3w521f3mpi3j-hm_alacritty
) instead of the original directory in my~/projects/dot/config/alacritty
.Is there any way to do what I want with the
flake.nix
setup?The text was updated successfully, but these errors were encountered: