diff --git a/home/home.nix b/home/home.nix index b9047d8..cda6719 100644 --- a/home/home.nix +++ b/home/home.nix @@ -36,24 +36,23 @@ in { home.packages = with pkgs; [ - # any other "normal" packages go here + # any other packages go here ] ++ ( with lib; let - # This function extracts the base file name from a path. + # this function extracts the base file name from a path. basename = path: lib.lists.last (lib.strings.splitString "/" (toString path)); - # Adjust this path to wherever your scripts are. - # If your home-manager config is in ~/dotfiles/home.nix, - # and your scripts are in ~/dotfiles/bin/bin, you could do: files = lib.filesystem.listFilesRecursive ./scripts; in - # For each script found, create a derivation installed in $PATH + # for each script found, create a derivation installed in $PATH lib.lists.forEach files ( - file: + file: let + scriptName = strings.removeSuffix ".sh" (basename file); + in pkgs.writeScriptBin - (basename file) # the new package's name - + # (basename file) # the new package's name + scriptName (builtins.readFile file) ) ); diff --git a/home/scripts/test/lol b/home/scripts/test/lol new file mode 100644 index 0000000..0898bf4 --- /dev/null +++ b/home/scripts/test/lol @@ -0,0 +1 @@ +XD