hall / kubenix

Kubernetes management with Nix
https://kubenix.org/
MIT License
316 stars 29 forks source link

kubenix script has no shebang, leading to "Exec format error" #59

Closed adrian-gierakowski closed 6 months ago

adrian-gierakowski commented 7 months ago

see for yourelf by running:

> nix run 'github:adrian-gierakowski/kubenix-hall-test?rev=1c28b59527c9645a83973bf9df4c34252353444d#kubenix'
error: unable to execute '/nix/store/grfgha6r1r02j4cgqj3fmqx5x0cklvbm-kubenix/bin/kubenix': Exec format error

or building and cating the file:

> cat $(nix build 'github:adrian-gierakowski/kubenix-hall-test?rev=1c28b59527c9645a83973bf9df4c34252353444d#kubenix' --no-link --print-out-paths)/bin/kubenix
  set -uo pipefail

  export KUBECONFIG=$HOME/.kube/config
  export KUBECTL_EXTERNAL_DIFF=/nix/store/dzbp20ma86l2xycay3h7prpgwpf173kp-kubenix-diff
...
adrian-gierakowski commented 7 months ago

hmm, looks like it only gives this error when running with nix 2.21.0, with 2.18.2 it works, even without the shebang

pizzapim commented 6 months ago

Just hit this problem myself. Running the script on my laptop works fine, but in my CI run it fails. A bit puzzled why it fails though, because according to this Stack Exchange post, Bash uses the currently running shell to run the script. This is apparently bash-interactive-5.2-p15 on my CI but this is the same as my laptop. Anyways, adding a shebang should fix this!