Skip to content
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

files: add helper function mkOutOfStoreSymlink #1211

Merged
merged 1 commit into from May 2, 2020

Conversation

rycee
Copy link
Member

@rycee rycee commented May 1, 2020

Using this function it is possible to make home.file create a symlink to a path outside the Nix store. For example, a Home Manager configuration containing

home.file."foo".source = config.lib.file.mkOutOfStoreSymlink ./bar;

would upon activation create a symlink ~/foo that points to the absolute path of the bar file relative the configuration file.

Inspired by https://github.com/adisbladis/nixconfig/blob/53457d0f20a67571b3847cb32a49a143d9c99c2d/home-adisbladis-nixpkgs/home.nix#L6-L8

@rycee rycee force-pushed the add-mkoutofstoresymlink branch from b02f048 to b87c0d7 Compare May 1, 2020 23:21
Using this function it is possible to make `home.file` create a
symlink to a path outside the Nix store. For example, a Home Manager
configuration containing

    home.file."foo".source = config.lib.file.mkOutOfStoreSymlink ./bar;

would upon activation create a symlink `~/foo` that points to the
absolute path of the `bar` file relative the configuration file.

PR #1211
@rycee rycee force-pushed the add-mkoutofstoresymlink branch from b87c0d7 to 91551c0 Compare May 1, 2020 23:22
Copy link
Collaborator

@kalbasit kalbasit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool module! Thanks for adding this @rycee

@rycee rycee merged commit 91551c0 into master May 2, 2020
@rycee rycee deleted the add-mkoutofstoresymlink branch May 2, 2020 14:10
NickHu pushed a commit to NickHu/home-manager that referenced this pull request May 19, 2020
Using this function it is possible to make `home.file` create a
symlink to a path outside the Nix store. For example, a Home Manager
configuration containing

    home.file."foo".source = config.lib.file.mkOutOfStoreSymlink ./bar;

would upon activation create a symlink `~/foo` that points to the
absolute path of the `bar` file relative the configuration file.

PR nix-community#1211
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants