How to make scripts imported via Home Manager executable?

Using Home Manager, I import some scripts in the following way:

    home.file = {
        ".local/bin" = {
            source = ../sources/scripts;
            recursive = true;
        };
    };

For example, I have made the following test script (shebang info):

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash

echo "Hello, World!"

After rebuilding I can list the content in ~/.local/bin/, I see that helloWorld.sh is a symlink to the Nix store, with the permissions lrwxrwxrwx. Trying to run this script I get “Permission denied”.

Obviously, I am missing something here. Any ideas on what can be done to make the script executable?

The solution was to make the source file executable!

1 Like

Looks like you can also set home.file.<name>.executable = true. Although, I’m ensure how that would work with a directory input.
https://home-manager-options.extranix.com/?query=home.file.<name>.executable

2 Likes