chore: improved multi-host support

This commit is contained in:
alina 🌸 2024-05-01 04:53:38 +03:00
parent 65444ae475
commit 83129a7cf1
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 26 additions and 8 deletions

View file

@ -21,6 +21,16 @@ its likely due to docker containers not resolving yet. todo fix this
### teidesu-osx
`cp /var/run/current-system/Library/Fonts/* /Library/Fonts` - copy nix-managed fonts to system fonts (waiting for [this PR](https://github.com/LnL7/nix-darwin/pull/754))
### setting up
macos:
```bash
curl -L https://nixos.org/nix/install | sh
git clone https://github.com/teidesu/nixos ~/nixos
cd ~/nixos
./switch
```
## cat in a readme 🐈
![cat](https://cataas.com/cat)

24
switch
View file

@ -23,17 +23,25 @@ if [ "$1" == "boot" ]; then
shift
fi
flake="."
if [ ! -z ${NIX_HOSTNAME+x} ]; then
flake=".#$NIX_HOSTNAME"
fi
if [ "$(uname)" == "Darwin" ]; then
git add -f hosts/teidesu-osx/arc-setup.nix
function restore {
git restore --staged hosts/teidesu-osx/arc-setup.nix
}
trap restore EXIT
if [ $(hostname) == "teidesu-osx" ]; then
git add -f hosts/teidesu-osx/arc-setup.nix
function restore {
git restore --staged hosts/teidesu-osx/arc-setup.nix
}
trap restore EXIT
fi
if command -v darwin-rebuild &> /dev/null; then
darwin-rebuild switch --flake . $args $@
darwin-rebuild switch --flake $flake $args $@
else
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake . $args $@
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake $flake $args $@
fi
else
sudo nixos-rebuild $cmd --flake . $args $@
sudo nixos-rebuild $cmd --flake $flake $args $@
fi