Skip to content

Commit 4a8c4cf

Browse files
authored
nix: setup an installation and teardown script for mac machines (#32)
1 parent ccf9bcb commit 4a8c4cf

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ versioning is done in a continuous fashion without worries of breaking changes.
77
## patches
88

99
- `ci`: checkout changes of branches to test with updates in motion 2025-03-04
10+
- `nix`: rebuild the darwin machine with an installed switch script 2025-03-03
11+
- `nix`: setup an installation and teardown script for mac machines 2025-03-02
1012
- `nix`: move pulse audio from hardware to services in toms configs 2025-03-02
1113
- `nix`: avoid global packages while overlayed other packages exist 2025-03-02
1214
- `nix`: skip specific darwin configurations of the package manager 2025-03-02

machines/puma/setup.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ set -eo pipefail
77
function help {
88
echo " help display this informative message"
99
echo " host configure the machine this runs"
10+
echo " install download tooling for dependencies"
1011
echo " switch change to the latest declarations"
12+
echo "uninstall remove the packages configured"
1113
}
1214

1315
# Configure the machine this runs
@@ -22,9 +24,21 @@ function host {
2224
printf "Changed hostname: \x1b[32m%s\x1b[0m\n" "$(scutil --get HostName)"
2325
}
2426

27+
# Download tooling for dependencies
28+
function install {
29+
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate
30+
nix run nix-darwin/master#darwin-rebuild -- switch --flake .#"$(hostname)"
31+
}
32+
2533
# Change to the latest declarations
2634
function switch {
27-
nix run --extra-experimental-features "nix-command flakes" nix-darwin -- switch --flake .#"$(hostname)"
35+
darwin-rebuild switch --flake .#"$(hostname)"
36+
}
37+
38+
# Remove the packages configured
39+
function uninstall {
40+
nix --extra-experimental-features "nix-command flakes" run nix-darwin#darwin-uninstaller
41+
/nix/nix-installer uninstall
2842
}
2943

3044
# Hint if no command is provided

machines/work/setup.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33
# Display this informative message
44
function help {
55
echo " help display this informative message"
6+
echo " install download tooling for dependencies"
67
echo " switch change to the latest declarations"
8+
echo "uninstall remove the packages configured"
9+
}
10+
11+
# Download tooling for dependencies
12+
function install {
13+
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate
14+
nix run nix-darwin/master#darwin-rebuild -- switch --flake .#"$(hostname)"
715
}
816

917
# Change to the latest declarations
1018
function switch {
11-
nix run --extra-experimental-features "nix-command flakes" nix-darwin -- switch --flake .#"$(hostname)"
19+
darwin-rebuild switch --flake .#"$(hostname)"
20+
}
21+
22+
# Remove the packages configured
23+
function uninstall {
24+
nix --extra-experimental-features "nix-command flakes" run nix-darwin#darwin-uninstaller
25+
/nix/nix-installer uninstall
1226
}
1327

1428
# Hint if no command is provided

0 commit comments

Comments
 (0)