Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readme: fix sed expression #1336

Closed
wants to merge 1 commit into from

Conversation

DamienCassou
Copy link

No description provided.

@Samasaur1
Copy link
Contributor

My guess is that you're using GNU sed as opposed to the BSD sed that comes with macOS. This command works fine with the macOS sed

@Samasaur1
Copy link
Contributor

We could also update the command to be

sed -i'' -e "s/simple/$(scutil --get LocalHostName)/" flake.nix

which works with both BSD and GNU sed

@DamienCassou
Copy link
Author

@Samasaur1: I didn't install any version of sed specifically. I'm just switching from linux to os x today and I'm still in the process of installing stuff. Anyway, I changed my commit to follow your suggestion.

Copy link
Contributor

@Samasaur1 Samasaur1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're still missing the -e option

@@ -53,7 +53,7 @@ nix flake init -t nix-darwin/master
# To use Nixpkgs 24.11:
nix flake init -t nix-darwin/nix-darwin-24.11

sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix
sed -i'' "s/simple/$(scutil --get LocalHostName)/" flake.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sed -i'' "s/simple/$(scutil --get LocalHostName)/" flake.nix
sed -i'' -e "s/simple/$(scutil --get LocalHostName)/" flake.nix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DamienCassou I think it's still missing the -e

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-i'' is incorrect for macOS’s default BSD sed. It needs to be -i '' or you get a flake.nix-e file.

@DamienCassou
Copy link
Author

I don't see any way to make a command that works in all cases. I am therefore closing the PR. Feel free to reopen if you see a way forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants