Skip to content

Commit

Permalink
treewide: document and setup scripts for darwin systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerschtli committed Jan 9, 2024
1 parent 8005b5b commit e803a00
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ nix run \

### Manual instructions for some systems

#### Darwin

```sh
# Install nix via Determinate Nix Installer https://determinate.systems/posts/determinate-nix-installer
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

sudo echo "trusted-users = $USER" >> /etc/nix/nix.conf
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon

nix run github:Gerschtli/nix-config#setup
```

#### NixOS

1. Set up like written in the [NixOS manual][nixos-manual] with image from `nix build ".#installer-image"`
Expand Down
8 changes: 8 additions & 0 deletions files/apps/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ if _is_nixos; then
_log "Don't forget to set passwd for tobias and root!"
_log "It may be required to set up an age key for root:"
_log " age-keygen -o ~/.age/key.txt"
elif _is_darwin; then
hostname=$(_read_enum "Enter hostname" R2026 work01)

_log "Run darwin-rebuild switch..."
nix \
--option extra-substituters "https://gerschtli.cachix.org" \
--option extra-trusted-public-keys "gerschtli.cachix.org-1:dWJ/WiIA3W2tTornS/2agax+OI0yQF8ZA2SFjU56vZ0=" \
run nix-darwin -- switch --flake "${nix_config}#${hostname}"
elif [[ "${USER}" == "nix-on-droid" ]]; then
_log "Run nix-on-droid switch..."
nix-on-droid switch \
Expand Down
2 changes: 1 addition & 1 deletion home/misc/util-bins/system-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ keychain "${HOME}/.ssh/keys/id_rsa.vcs"


# update ubuntu
if _available apt && [[ "${OSTYPE}" != "darwin"* ]]; then
if _available apt && ! _is_darwin; then
_log "apt" "update"
sudo apt update
_log "apt" "upgrade"
Expand Down
4 changes: 4 additions & 0 deletions lib/script/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ _available() {
hash "${1}" > /dev/null 2>&1
}

_is_darwin() {
[[ "${OSTYPE}" == "darwin"* ]]
}

_is_nixos() {
[[ -f "/etc/NIXOS" ]]
}
Expand Down

0 comments on commit e803a00

Please sign in to comment.