1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-04-18 02:18:13 +00:00

etc: use .before-nix-darwin instead of .orig

This commit is contained in:
Michael Hoang 2023-07-11 18:58:29 +10:00
parent ac9a366aed
commit 63af129cb5
4 changed files with 7 additions and 8 deletions
README.md
modules
programs/ssh
services
system

View file

@ -24,9 +24,8 @@ nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
> updated by default. If you didn't use the installer or skipped some of the options you'll have to take care of this yourself.
> Either modify the existing file to source/import the one from `/etc/static` or remove it. Some examples:
- `mv /etc/bashrc /etc/bashrc.orig`
- `mv /etc/bashrc /etc/bashrc.before-nix-darwin`
- `echo 'if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi' | sudo tee -a /etc/bashrc`
- `echo 'if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi' | tee -a ~/.bashrc`
## Updating

View file

@ -164,9 +164,9 @@ in
};
};
# Clean up .orig file left over from using knownSha256Hashes
# Clean up .before-nix-darwin file left over from using knownSha256Hashes
system.activationScripts.etc.text = ''
auth_keys_orig=/etc/ssh/sshd_config.d/101-authorized-keys.conf.orig
auth_keys_orig=/etc/ssh/sshd_config.d/101-authorized-keys.conf.before-nix-darwin
if [ -e "$auth_keys_orig" ] && [ "$(shasum -a 256 $auth_keys_orig | cut -d ' ' -f 1)" = "${oldAuthorizedKeysHash}" ]; then
rm "$auth_keys_orig"

View file

@ -74,10 +74,10 @@ in
"2c28f4fe3b4a958cd86b120e7eb799eee6976daa35b228c885f0630c55ef626c"
];
# Cleaning up the .orig file is necessary as any files in /etc/resolver will be used.
# Cleaning up the .before-nix-darwin file is necessary as any files in /etc/resolver will be used.
system.activationScripts.etc.text = mkAfter ''
if [ -e /etc/resolver/ts.net.orig ]; then
rm /etc/resolver/ts.net.orig
if [ -e /etc/resolver/ts.net.before-nix-darwin ]; then
rm /etc/resolver/ts.net.before-nix-darwin
fi
'';
};

View file

@ -69,7 +69,7 @@ in
o=''${o%% *}
for h in ''${etcSha256Hashes["$l"]}; do
if [ "$o" = "$h" ]; then
mv "$l" "$l.orig"
mv "$l" "$l.before-nix-darwin"
ln -s "$f" "$l"
break
else