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
Allow enforcing linking etc when file exists #149
Comments
Talking to @LnL7 on #nix-darwin we identified the following requirements:
so the proposal is for nix-darwin to emit the following line when replacing an existing file in etc:
and subsequent runs:
|
I also ran into this when doing a clean install of nix and nix-darwin onto a clean computer.
I moved to a backup file and it no longer appears, but this is definitely a usability annoyance that can make someone think something is broken (I'm not sure if it is or not). |
Same issue after a first install. Manually moved /etc/nix/nix.conf to a backup file. Afterwards no spurious errors. Here's my nix-info if necessary:
|
error: not linking environment.etc."ssl/certs/ca-certificates.crt" because /etc/ssl/certs/ca-certificates.crt already exists, skipping... |
error: not linking environment.etc."shells" because /etc/shells already exists, skipping... |
I had the same error when setting up a new machine M2, I moved the file but now my nix setup is totally broken. with this error
even running I tried restoring the file, but I'm still getting the same errors If I do
Update: A restart fixed this. |
Seems like this is still not resolved. I ran into the same problem with |
Still seeing this issue as well with |
I'm seeing this with
|
Can you post the contents of |
|
I get this every time I install nix (in the same error message as /etc/nix/nix.conf) - On a new VM I use Deterministic systems nix installer then my flake.
How is the check done? |
It runs |
As I said I can't follow the bash scripts. I looked at all the hashes in doc/known-files - note that is what I see not the path docs/known-files that you quote. From my ventura machine |
I'm also experiencing the same problem. building the system configuration...
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
trace: warning: optionsDocBook is deprecated since 23.11 and will be removed in 24.05
error: Unexpected files in /etc, aborting activation
The following files have unrecognized content and would be overwritten:
/etc/shells
Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again. Renaming it works, but just wanted to report. Thanks. |
Can you upload your copy of |
Having the same problem with
|
I get this error after every recent MacOS upgrade (currently Sonoma 14.2.1, M1 MBP). To fix, I run: $ sudo mv /etc/shells{,.bak}
$ /run/current-system/sw/bin/darwin-rebuild switch --flake ~/git/nixos |
Also a problem in CI (for agenix in this case) where one uses e.g. cachix/install-nix-action with some default |
nix-darwin is detecting `/etc/nix/nix.conf` from the cachix/install-nix-action and refusing to overwrite it, failing the nix-darwin activation and therefore the rest of CI. This commit `mv`s the existing `nix.conf` to avoid the above, and then adds support for new-style nix commands and flakes to the nix-darwin configuration to allow their subsequent use in CI. It also removes the nix config from the `cachix/install-nix-action` step, which was duplicated effort since we are blowing it away with nix-darwin anyway. Relevant: - LnL7/nix-darwin#149
@n8henrie could you post your |
@Enzime unfortunately over the last 5 or so point releases I've gotten into the habit of just I presume it's the same as my wife's MBA which is on 14.1.1, though not sure. I'll probably update her to 14.2.1 tonight and if so will post that one as well (or confirm that it's the same). $ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/opt/homebrew/bin/bash
$ sha256sum /etc/shells
ecafa9a53b266e51cf985f4c69834449a207a19cee5bcb351e4115214ace1dd5 /etc/shells |
Is there a way to resolve this without having an exhaustive list of SHAs that can be replaced? I don't particularly care what the previous content was, I would just like it to be overwritten (given the number of folks who |
Depending on the file, even just a flag to enable moving it to a timestamped backup would be nice. |
@Enzime unfortunately over the last 5 or so point releases I've gotten into the habit of just I presume it's the same as my wife's MBA which is on 14.1.1, though not sure. I'll probably update her to 14.2.1 tonight and if so will post that one as well (or confirm that it's the same). $ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/opt/homebrew/bin/bash
$ sha256sum /etc/shells
ecafa9a53b266e51cf985f4c69834449a207a19cee5bcb351e4115214ace1dd5 /etc/shells ... Apparently I never clicked submit, glad Firefox kept this comment cached. After updating her computer it is indeed the same for her: $ sw_vers
ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71
$ sha256sum /etc/shells
ecafa9a53b266e51cf985f4c69834449a207a19cee5bcb351e4115214ace1dd5 /etc/shells Next time I run across this I will post my hash. |
nix-darwin is detecting `/etc/nix/nix.conf` from the cachix/install-nix-action and refusing to overwrite it, failing the nix-darwin activation and therefore the rest of CI. This commit `mv`s the existing `nix.conf` to avoid the above, and then adds support for new-style nix commands and flakes to the nix-darwin configuration to allow their subsequent use in CI. It also removes the nix config from the `cachix/install-nix-action` step, which was duplicated effort since we are blowing it away with nix-darwin anyway. Relevant: - LnL7/nix-darwin#149
Is there a temporary flag / envvar of sorts to override this behavior entirely and just force override any existing file? It's particularly painful for /etc/nix/nix.conf when I have a stale github token in it, for which I need nix to overwrite it but I can't use nix obviously (because of the stale token in nix.conf), so I edit it manually but now nix-darwin refuses to run (because it's an unknown file), but if I remove that file then Nix will act weird again, and, well, you get it. It's a catch 22. |
What about checking for the existence of a file |
In some situations it's desireable to override etc files if they exist. For example when you install Nix and then nix-darwin, it won't take over nix.conf.
The text was updated successfully, but these errors were encountered: