dustinlyons / nixos-config

General purpose Nix configuration for macOS / NixOS with starter templates + step-by-step guides ✨
BSD 3-Clause "New" or "Revised" License
1.79k stars 113 forks source link

aarch64-darwin/create-keys: cannot execute: No such file or directory (MacBook Pro M3 Max chip) #36

Closed oscarvarto closed 11 months ago

oscarvarto commented 11 months ago

Hi!

I'm trying to follow the instructions for the full starter template with secrets management. However, I'm getting the following error:

$ nix run .#create-keys
Running create-keys for aarch64-darwin
/nix/store/n8qlll9v78ml2lwlp3f4yb0zq24mczsv-create-keys/bin/create-keys: line 4: /nix/store/s54dazbbdqhdc34i6cgd83d19rjjiq1f-source/apps/aarch64-darwin/create-keys: No such file or directory
/nix/store/n8qlll9v78ml2lwlp3f4yb0zq24mczsv-create-keys/bin/create-keys: line 4: exec: /nix/store/s54dazbbdqhdc34i6cgd83d19rjjiq1f-source/apps/aarch64-darwin/create-keys: cannot execute: No such file or directory

I'm following the guide using a new MacBook Pro with an M3 Max chip. Really new to nix on Darwin.

At first, I thought it might be because I installed nix (2.19.2) with the official installation method from https://nixos.org/download.html#nix-install-macos. I deleted my previous nix installation, and used the instructions provided in this repo, that install an older version of nix. I'm getting the same error though...

Any hints?

dustinlyons commented 11 months ago

Oops, this was my fault. Can you try again with the latest?

dustinlyons commented 11 months ago

Hey, if you get this running okay, can you let me know? I'd love to add 'M3 Apple Silicon' to my list of confirmed working platforms. Thanks!

dustinlyons commented 11 months ago

Also both methods for installing Nix should work. I prefer the Determinate Systems installer as it details an easier uninstall path for users.

oscarvarto commented 11 months ago

@dustinlyons I am getting a "permission denied" error when trying to execute nix run .#create-keys:

nix run .#create-keys
Running create-keys for aarch64-darwin
/nix/store/njzb67j6a7wjhjvv1gapi2ng6rvj74h3-create-keys/bin/create-keys: line 4: /nix/store/dk7cnim2pcw3mxrirz5y6k6jyjxby86a-source/apps/aarch64-darwin/create-keys: Permission denied
/nix/store/njzb67j6a7wjhjvv1gapi2ng6rvj74h3-create-keys/bin/create-keys: line 4: exec: /nix/store/dk7cnim2pcw3mxrirz5y6k6jyjxby86a-source/apps/aarch64-darwin/create-keys: cannot execute: Undefined error: 0

Is it necessary to use sudo?

Edit: I tried with sudo, and it didn't work neither (I guess this was expected, and sudo shouldn't be used). I've been trying to start with nix and flakes on my machine without success, since yesterday. This is not the first template I've tried.

Should I try uninstalling everything and restart? Maybe I have garbage after the first try...

dustinlyons commented 11 months ago

I think we need to chmod +x the create-keys app. I missed that in the documentation.

So,

chmod +x apps/aarch64-darwin/apply && chmod +x apps/aarch64-darwin/build && chmod +x apps/aarch64-darwin/build-switch && chmod +x apps/aarch64-darwin/create-keys && chmod +x apps/aarch64-darwin/copy-keys && chmod +x apps/aarch64-darwin/check-keys
oscarvarto commented 11 months ago

That did the trick.

However, I decided to not overwrite my already existing id_ed25519 key pair. Is it possible to keep that but generate the id_ed25519_agenix. Sorry if I am asking too much, or something that is not possible. It's just that I already have keys that identify me, I just don't have the last one ending in _agenix.

dustinlyons commented 11 months ago

I love all of these questions! I don't get to talk to users of this project enough, so this is really helpful for me.

I (er.. ChatGPT 😂) updated the app to first check for keys and give the user an interactive prompt; try now.

dustinlyons commented 11 months ago

Actually, one second, I think it's all keys or no keys. Let me make it work for either key.

dustinlyons commented 11 months ago

Okay, try now.

oscarvarto commented 11 months ago

@dustinlyons Sorry for the noob question. I've already modified the template, how do I pull the most recent changes to the template (quickly) without throwing away my work?

Edit: Also, is there a discord, irc channel, or somewhere else we could have a more convenient interchange of words?

dustinlyons commented 11 months ago

Oh okay, in that case it may be tricky. If you want, just go inside of your template's apps/aarch64-darwin directory and change create-keys to this:

https://github.com/dustinlyons/nixos-config/blob/main/templates/starter-with-secrets/apps/aarch64-darwin/create-keys

dustinlyons commented 11 months ago

I'm on freenode IRC if you want to jump in and chat. Channel is #nixos-config.

oscarvarto commented 11 months ago

@dustinlyons nix run .#build completed successfully on M3 Max chip. I'd like to spend some time reviewing the changes it will do when I finally (other day) execute nix run .#build-switch.

Thank you very much for your help today.

oscarvarto commented 11 months ago

@dustinlyons Are you on freenode or liberachat? Just making sure.

dustinlyons commented 11 months ago

@oscarvarto I'm on freenode in #nixos-config.