Skip to content

Commit c96b253

Browse files
committed
Merge branch 'master' of github.com:jeff-hykin/better-cpp-syntax; branch 'textmate' of github.com:jeff-hykin/fornix
2 parents d9a7f15 + dad25f1 commit c96b253

File tree

3 files changed

+129
-10
lines changed

3 files changed

+129
-10
lines changed

settings/during_start/094_000_jeffs_git_shortcuts.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ git_checkout () {
2828
return
2929
}
3030

31+
git_checkout_pr () {
32+
pr_number="$1"
33+
git_delete_branch '@__temp__/pull_request'
34+
git fetch origin "pull/$pr_number/head:@__temp__/pull_request"
35+
git checkout '@__temp__/pull_request'
36+
}
37+
3138
git_commit_hashes () {
3239
git log --reflog --oneline | sed -e 's/ .*//'
3340
}

settings/extensions/nix/uninstaller_helper

Lines changed: 121 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
1+
#!/usr/bin/env bash
2+
3+
echo ""
4+
echo "If you've still got a problem after this"
5+
if [ "$(uname)" = "Darwin" ]
6+
then
7+
echo "take a look here: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos"
8+
else
9+
echo "take a look here: https://nixos.org/manual/nix/stable/installation/installing-binary.html#linux"
10+
fi
11+
echo "Okay?"
12+
read
13+
14+
if [ -z "$NIX_ROOT" ]
15+
then
16+
export NIX_ROOT="/nix"
17+
fi
18+
19+
20+
21+
if [ "$(uname)" = "Darwin" ]
22+
then
23+
# TODO: make sure this fully removes LaunchDaemon: org.nixos.darwin-store
24+
sudo launchctl bootout system/org.nixos.darwin-store
25+
26+
# check if file exists
27+
if [ -f "/Library/LaunchDaemon/org.nixos.nix-daemon.plist" ]
28+
then
29+
echo "removing LaunchDaemon1"
30+
sudo launchctl unload /Library/LaunchDaemon/org.nixos.nix-daemon.plist
31+
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
32+
fi
33+
34+
35+
# check if file exists
36+
if [ -f "/Library/LaunchDaemons/org.nixos.activate-system.plist" ]
37+
then
38+
echo "removing LaunchDaemon2"
39+
sudo launchctl unload /Library/LaunchDaemons/org.nixos.activate-system.plist
40+
sudo rm /Library/LaunchDaemons/org.nixos.activate-system.plist
41+
fi
42+
43+
# if it was mounted
44+
if sudo diskutil list | grep 'Nix Store' &>/dev/null
45+
then
46+
echo "removing nix volume"
47+
# it was removed successfully
48+
if sudo diskutil apfs deleteVolume /nix
49+
then
50+
sudo diskutil apfs deleteVolume /nix && sudo rm -rf /nix/
51+
fi
52+
echo "may need to reboot for full effect"
53+
fi
54+
55+
# check if file exists
56+
mount_filepath="/etc/synthetic.conf"
57+
if [ -f "$mount_filepath" ]
58+
then
59+
echo "removing $mount_filepath"
60+
# if file contains "nix"
61+
if cat "$mount_filepath" | grep 'nix' &>/dev/null
62+
then
63+
# remove nix from the file
64+
sudo mount_filepath="$mount_filepath" -- bash -c '
65+
sudo cat "$mount_filepath" | sed -E '"'"'s/nix\n?$//g'"'"' > "$mount_filepath"
66+
'
67+
fi
68+
fi
69+
70+
# check if file exists
71+
if [ -f "/etc/fstab" ]; then
72+
write_to_fstab() {
73+
new_fstab_lines="$0"
74+
# vifs must be used to edit fstab
75+
# to make that work we create a patch using "diff"
76+
# then tell vifs to use "patch" as an editor and apply the patch
77+
/usr/bin/diff /etc/fstab <(/usr/bin/printf "%s" "$new_fstab_lines") | EDITOR="/usr/bin/patch" sudo vifs
78+
}
79+
# if name_of_command doesnt exist
80+
if /usr/bin/grep "$NIX_ROOT apfs rw" /etc/fstab; then
81+
echo "Patching fstab"
82+
fstab_without_nix="$(/usr/bin/grep -v "$NIX_ROOT apfs rw" /etc/fstab)"
83+
write_to_fstab "$fstab_without_nix"
84+
fi
85+
fi
86+
fi
87+
88+
189
delete_user () {
290
user="$1"
391
# logs them out by locking the account
@@ -18,21 +106,27 @@ delete_user () {
18106

19107
remove_service () {
20108
service="$1"
21-
sudo systemctl stop "$service"
22-
sudo systemctl disable "$service"
23-
sudo rm -f /etc/systemd/system/"$service"
24-
sudo rm -f /etc/systemd/system/"$service" # and symlinks that might be related
25-
sudo rm -f /usr/lib/systemd/system/"$service"
26-
sudo rm -f /usr/lib/systemd/system/"$service" # and symlinks that might be related
27-
sudo systemctl daemon-reload
28-
sudo systemctl reset-failed
109+
# if systemctl exists
110+
if [ -n "$(command -v "systemctl")" ]
111+
then
112+
sudo systemctl stop "$service"
113+
sudo systemctl disable "$service"
114+
sudo rm -f /etc/systemd/system/"$service"
115+
sudo rm -f /etc/systemd/system/"$service" # and symlinks that might be related
116+
sudo rm -f /usr/lib/systemd/system/"$service"
117+
sudo rm -f /usr/lib/systemd/system/"$service" # and symlinks that might be related
118+
sudo systemctl daemon-reload
119+
sudo systemctl reset-failed
120+
fi
29121
}
30122

31123
# stop the daemon
124+
echo "removing service"
32125
remove_service nix-daemon.service
33126
remove_service nix-daemon.socket
34127

35128
# remove the users
129+
echo "removing users"
36130
delete_user nixbld1
37131
delete_user nixbld2
38132
delete_user nixbld3
@@ -67,12 +161,15 @@ delete_user nixbld31
67161
delete_user nixbld32
68162

69163
# remove the group
164+
echo "removing group"
70165
sudo groupdel nixbld 2>/dev/null
71166

72167
# remove all the files
73-
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels "$HOME"/.nix-profile "$HOME"/.nix-defexpr "$HOME"/.nix-channels
168+
echo "removing all nixpkgs files"
169+
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels "$HOME"/.nix-profile "$HOME"/.nix-defexpr "$HOME"/.nix-channels 2>/dev/null
74170

75171
# restore the shell files
172+
echo "restoring any shell files"
76173
if [ -f "/etc/bashrc.backup-before-nix" ]
77174
then
78175
sudo mv /etc/bashrc.backup-before-nix /etc/bashrc
@@ -88,4 +185,19 @@ fi
88185
if [ -f "/etc/bash.bashrc.backup-before-nix" ]
89186
then
90187
sudo mv /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
188+
fi
189+
190+
echo "final check"
191+
if [ -e "$NIX_ROOT" ]
192+
then
193+
sudo rm -rf "$NIX_ROOT" &>/dev/null
194+
sudo rm -f "$NIX_ROOT" &>/dev/null
195+
if [ -e "$NIX_ROOT" ]
196+
then
197+
echo
198+
echo
199+
echo
200+
echo "Because your system mounted /nix during boot"
201+
echo "I believe you'll need to restart for changes to take affect"
202+
fi
91203
fi

settings/extensions/ruby/during_start_prep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ mkdir "$GEM_HOME" &>/dev/null
44
if [ -n "$(command -v "nix-shell")" ]
55
then
66
# create the bundix file
7-
HOME="$FORNIX_HOME" nix-shell --run "bundix -l" -p bundix -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/046f8835dcb9082beb75bb471c28c832e1b067b6.tar.gz"
7+
HOME="$FORNIX_HOME" nix-shell --run "bundix -l" -p bundix -I "nixpkgs=https://github.com/NixOS/nixpkgs/archive/ce6aa13369b667ac2542593170993504932eb836.tar.gz"
88
fi

0 commit comments

Comments
 (0)