What I want is when I run nixos-rebuild
for it to check if certain folders don’t exist and if they do create them. Specifically I want to do this to achieve two things:
- When I deploy a new system based on my config I want my home directory structured the way I like.
- I want a place to mount drives from which I can them sym link them into the home folder. The way I currently have my drives setup means that I cannot simply mount them into the home directory.
I have tried both pkgs.runCommand
and with a shell script home manager’s home.file
. The home manager solution did nothing and run command kept giving my a syntax error despite to the best of my knowledge exactly copying the syntax from the documentation.
I should note that I am completely new to nix and I am finding the documentation very confusing. Any explanation would be greatly appreciated.
The home manager solution I tried looked as follows:
home.file.git.enable = true; #I am not sure if this is strictly necessary
home.file.git.recursive = true; #If I understand the documentation correct this turns the file into a folder
home.file.git.source = "/etc/nixos/empty-folder"; #This is the template of what to craete
home.file.git.target = "git"; #This is where to put that I have created
The runCommand solution I tried looks as follows:
pkgs.runCommand "create-folders" {} '' /etc/nixos/create-folders.sh '';