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

mix mac install assumed gnu diff and other /etc/synthetic.conf issues #7286

Open
diekhans opened this issue Nov 11, 2022 · 10 comments
Open

mix mac install assumed gnu diff and other /etc/synthetic.conf issues #7286

diekhans opened this issue Nov 11, 2022 · 10 comments
Labels

Comments

@diekhans
Copy link

MacOS Ventura, M1
I want to have nix installed under

Steps To Reproduce

Create an /etc/synthetic.conf with /nix

nix       System/Volumes/Data/nix

and reboot then

sh <(curl -L https://nixos.org/nix/install) --daemon

Install then tries to edit out the nix line from synthetic.conf.
I don't want it to do this. I don't want a new disk volume,
I just want nix in System/Volumes/Data/nix

As part of insisting on edit the file, it calls diff with invalid arguments
for MacOs

~~> Fixing any leftover Nix volume state                                                                                                
Before I try to install, I'll check for any existing Nix volume config
and ask for your permission to remove it (so that the installer can
start fresh). I'll also ask for permission to fix any issues I spot.

During install, I add 'nix' to /etc/synthetic.conf, which instructs
macOS to create an empty root directory for mounting the Nix volume.

---- warning! ------------------------------------------------------------------                                                        

/etc/synthetic.conf already contains a line instructing your system
to make '/nix' as a symlink:
    3:nix       System/Volumes/Data/nix

This may mean your system has/had a non-standard Nix install.

The volume-creation process in this installer is *not* compatible
with a symlinked store, so I'll have to remove this instruction to
continue.

If you want/need to keep this instruction, answer 'n' to abort.



Nix isn't the only thing in /var/folders/3k/fvyxn7p97976wmlmtkd7ltfr0000z8/T/tmp.XagVkQCxZv/synthetic.conf.edit,
but I think I know how to edit it out.
Here's the diff:
diff: unrecognized option `--unchanged-group-format=\033[2m%=\033[0m'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-I pattern] [-F pattern] [-L label] file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
            [-F pattern] -C number file1 file2
       diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
            [--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
       diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
            [-F pattern] -U number file1 file2
       diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
            [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
            [-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
       diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
            [--ignore-blank-lines] [--ignore-case] [--minimal]
            [--no-ignore-file-name-case] [--strip-trailing-cr]
            [--suppress-common-lines] [--tabsize] [--text] [--width]
            -y | --side-by-side file1 file2
       diff [--help] [--version]
Does the change above look right?                                                                                                       
[y/n] n

@abathur
Copy link
Member

abathur commented Nov 11, 2022

As the installer explained, it isn't compatible with a symlinked store. If you want to force it to work for some reason, you'll need to download the install scripts and modify them.

What diff do you have? GNU is what ships with macOS AFAIK. No strong reason not to pin that path down, so I've opened #7288 to do so.

@diekhans
Copy link
Author

% /usr/bin/diff --version
Apple diff (based on FreeBSD diff)

It doesn't have --unchanged-group-format

It would be most useful if it was explicitly mentioned that the normal way one does synthetic.conf doesn't
work in https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos-installation.

It would be nice if apple support firmlinks by users.

I am sure it has been said before, but it is sad that nix installs in / instead of following the UNIX convention of /opt/.
At least you don't splatter all over /usr/local ;-)

thanks!

@abathur
Copy link
Member

abathur commented Nov 11, 2022

What macos is this? Ventura? It's possible they swapped it out there and you are just the first report because of the symlink/synthetic.conf

@diekhans
Copy link
Author

diekhans commented Nov 11, 2022 via email

@abathur
Copy link
Member

abathur commented Nov 11, 2022

Hmm. I guess we'll actually need a different fix, though I'm not quite sure what. I don't have a Ventura to poke at myself yet.

@diekhans
Copy link
Author

If you give me something to test, I will try it out for you. The scribbling on / was enough to get me to hold off on investing time in Nix right now, so it is easy for me to reproduce without disrupting anything.

diff.man.txt

@abathur
Copy link
Member

abathur commented Nov 11, 2022

Thanks. I don't expect I'll have time to pick at how to adapt the formats for a few days myself. I asked on Matrix in case someone there will be up for taking a look.

@pmarreck
Copy link

pmarreck commented Dec 7, 2022

Running into the exact same issue after upgrading to Ventura. Same diff issue as well. The diff issue can probably be fixed with brew install diffutils; just checked and the diff installed that way does understand that option.

@bestlem
Copy link

bestlem commented Jan 12, 2023

Any progress on this.

I am having enough issues with nix - that I don't want to have macports or HomeBrew to get a working version.

Although I note that if I just accept the diff output the script seemed to have worked.

@abathur
Copy link
Member

abathur commented Jan 12, 2023

Not that I'm aware of

mkenigs added a commit to mkenigs/nix that referenced this issue Mar 3, 2023
macOS Ventura ships with it's own version of diff. Try to output a
similar diff with Apple diff as with GNU diff, instead of failing

Helps NixOS#7286
mkenigs added a commit to mkenigs/nix that referenced this issue Mar 3, 2023
macOS Ventura ships with it's own version of diff. Try to output a
similar diff with Apple diff as with GNU diff, instead of failing

Helps NixOS#7286
mkenigs added a commit to mkenigs/nix that referenced this issue May 25, 2023
macOS Ventura ships with it's own version of diff. Try to output a
similar diff with Apple diff as with GNU diff, instead of failing

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

No branches or pull requests

4 participants