-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nix): add some scripts and reorganise them a bit
- Loading branch information
Showing
5 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script WILL delete your data indiscriminatly without prompting you. | ||
# It's not a bug, that's the whole point. | ||
|
||
echo "🔄 Restore the original bashrc & zshrc" | ||
sudo rename -fx /etc/*.backup-before-nix | ||
|
||
echo "🧹 Remove the fstab entry for /nix" | ||
sudo sed -i.bak -e '/nix apfs/d' -e '/^$/d' /etc/fstab | ||
|
||
echo "🧹 Remove the synthetic entry for nix" | ||
sed -i.bak '/nix/d' /etc/synthetic.conf | ||
|
||
echo "🧹 Stop and remove the nix daemon service" | ||
launchctl unload /Library/LaunchDaemon/org.nixos.nix-daemon.plist | ||
rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist | ||
launchctl unload /Library/LaunchDaemons/org.nixos.activate-system.plist | ||
rm /Library/LaunchDaemons/org.nixos.activate-system.plist | ||
sudo launchctl bootout system/org.nixos.darwin-store | ||
rm /Library/LaunchDaemons/org.nixos.darwin-store.plist | ||
|
||
echo "🧹 Remove the files created by nix" | ||
rm -rf \ | ||
/etc/nix /var/root/.nix-profile \ | ||
/var/root/.nix-defexpr \ | ||
/var/root/.nix-channels \ | ||
~/.nix-profile \ | ||
~/.nix-defexpr \ | ||
~/.nix-channels | ||
|
||
echo "🛑 Remove the groups created by nix" | ||
dscl . delete /Groups/nixbld | ||
for i in $(seq 1 32); do sudo dscl . -delete /Users/_nixbld$i; done | ||
|
||
echo "🧹 Remove the nix store volume" | ||
umount /nix | ||
diskutil apfs deleteVolume /nix | ||
diskutil apfs deleteVolume "Nix Store" | ||
rm -rf /nix/ | ||
|
||
echo "🐈 Now reboot your computer KTHXBYE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd ~/ && git clone https://github.com/Mayeu/dots .dots | ||
|
||
#echo "📦 Installing nix" | ||
sh <(curl -L https://nixos.org/nix/install) | ||
|
||
echo "⤴️ Loading nix" | ||
source /etc/static/bashrc | ||
|
||
echo "🚇 Adding my channels" | ||
nix-channel --add https://channels.nixos.org/nixpkgs-22.11-darwin nixpkgs | ||
nix-channel --add https://channels.nixos.org/nixpkgs-unstable unstable | ||
nix-channel --update | ||
|
||
# cat <<EOF | sudo tee -a /etc/nix/nix.conf | ||
# substituters = https://cache.nixos.org/ ${{ secrets.S3_URL }} | ||
# trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= mdots:h40b7TWhz9PqO04aqOAiAEEdulJ2Q9oJ3MxXQCgQVvs= | ||
# post-build-hook = /etc/nix/upload-to-cache.sh | ||
# EOF | ||
|
||
echo "😈 Install nix-darwin" | ||
tmp=$(mktemp -d) | ||
|
||
cd "$tmp" | ||
|
||
export NIX_CONF="binary-caches=s3://mdots?endpoint=https://s3.fr-par.scw.cloud/" | ||
|
||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer | ||
./result/bin/darwin-installer --extra-substituters 's3://mdots?endpoint=https://s3.fr-par.scw.cloud/' | ||
|
||
echo "🔨 Building my system" | ||
# Don't think the source is needed here | ||
source /etc/static/bashrc | ||
darwin-rebuild switch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set -e | ||
sudo mv /etc/bashrc /etc/bashrc.orig | ||
sudo mv /etc/zshrc /etc/zshrc.orig | ||
sudo mv /etc/zprofile /etc/zprofile.orig | ||
sudo /nix/var/nix/profiles/system/activate | ||
exit # Start a new shell to reload the environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters