I want to write a config file to `$HOME/Dev/.my-config` using nix ... how would I do that? 

I only find how to write files to the home directory, but I want to place files everywhere around the system I need them to be 😬

#nix #nixos #nixdarwin

@kevin if you use home-manager, you can use `home.file.<name>`. Specifically the `target` attribute.

Reference: https://home-manager-options.extranix.com/?query=file&release=release-25.11

Home Manager - Option Search

@Crocmagnon thank you! I'm already using home manager, but I think my "problem" is that I want to place files outside of home - would I need to use `../../../` etc in `target`?

@kevin @Crocmagnon Unfortunately you cannot place files outside your home directory using `home.file`. But you can easily create your own activation script block that does it.

Unfortunately this limitation is due to a historic decision that will be fixed eventually, but will take a while.

@kevin @Crocmagnon See the `home.activation` option. Hopefully the option description and example is sufficient for your purposes.

@rycee @kevin I was specifically referring to

> I want to write a config file to `$HOME/Dev/.my-config` using nix

Which is possible with home manager.

What’s your actual need? I believe this may be a case of the XY problem 🙂

https://xyproblem.info

Home - The XY Problem

@Crocmagnon @rycee my actual problem is:

I have a bunch of config files on my system, e.g. a special gitconfig for work stuff in `/Users/kevin/Dev`. I want to easily convert these existing files to nix expressions so I can include them in my nix configuration.

Some of these files are on my home directory, which is where home-manager comes in handy, but others are outside of my home and I want a „nix way“ of writing / managing these files
@rycee thank you! I’ll check that out