installPhase cp dir missing .sh file in $out

I have a derivation that is copying a directory with subdirectories with .sh scripts, however when I run nix build some of the new subdirectory .sh files don’t show up in $out/ directory

            installPhase = ''
              mkdir -p $out/share
              cp -r share/. $out/share/

              find $out/share -iname "*.sh" -exec chmod a+x {} \;
            
              mkdir -p $out/bin
              cp start_server.sh $out/bin/start_server
  
              wrapProgram $out/bin/start_server \
                --prefix PATH : ${pkgs.lib.makeBinPath propagatedDeps} \
                --prefix SHARE : "$out/share"
            '';

For instance my directory structure looks something like the following, where all .sh files are available in $out/share except for a newly added share/utils/apply.sh. To note this file has same permissions as all the others

β”œβ”€β”€ share
β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”œβ”€β”€ README.md
β”‚   β”‚   └── setup_auth_creds.sh
β”‚   β”œβ”€β”€ cluster1
β”‚   β”‚   β”œβ”€β”€ node_01
β”‚   β”‚   β”‚   β”œβ”€β”€ server.sh
β”‚   β”‚   β”‚   └── server.conf
β”‚   β”œβ”€β”€ cluster2
β”‚   β”‚   β”œβ”€β”€ node_01
β”‚   β”‚   β”‚   β”œβ”€β”€ server.sh
β”‚   β”‚   β”‚   └── server.conf
β”‚   └── utils
β”‚       β”œβ”€β”€ apply.sh
β”‚       └── push.sh
β”œβ”€β”€ start_server.sh

Not sure why this file isn’t copying over or available for run

Are you using flakes? When the flake is evaluated, new files don’t exist unless they’ve been tracked by git. They don’t have to be committed, and the latest changes don’t even have to be staged. The files just have to be tracked at all.

1 Like

Yes, using flakes and that looks to have been the issue. Once I tracked the file nix build picked it up. Cheers!