Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
fail-fast: false
matrix:
machine:
- m1
- m2-large
- intense-heron # m1
- kind-lumiere # m2
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
Expand Down
21 changes: 16 additions & 5 deletions macs/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
{
flake.darwinConfigurations =
let
mac =
system: entrypoint:
mkNixDarwin =
localHostName: entrypoint:
inputs.darwin.lib.darwinSystem {
inherit system;
system = "aarch64-darwin";

modules = [
{
networking = { inherit localHostName; };
}
./common.nix
entrypoint
];
};
in
{
m1 = mac "aarch64-darwin" ./profiles/m1.nix;
m2-large = mac "aarch64-darwin" ./profiles/m2.large.nix;
# M1 8C, 16G, 256G (Hetzner)
enormous-catfish = mkNixDarwin "enormous-catfish" ./profiles/m1.nix;
growing-jennet = mkNixDarwin "growing-jennet" ./profiles/m1.nix;
intense-heron = mkNixDarwin "intense-heron" ./profiles/m1.nix;
maximum-snail = mkNixDarwin "maximum-snail" ./profiles/m1.nix;
sweeping-filly = mkNixDarwin "sweeping-filly" ./profiles/m1.nix;

# M2 8C, 24G, 1TB (Oakhost)
eager-heisenberg = mkNixDarwin "eager-heisenberg" ./profiles/m2.large.nix;
kind-lumiere = mkNixDarwin "kind-lumiere" ./profiles/m2.large.nix;
};
}
16 changes: 8 additions & 8 deletions macs/mac-update
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ PIDS=()
update() {
local HOST=${1}
local PROFILE=${2}
(ssh "$HOST" -- sudo darwin-rebuild switch --flake "github:nixos/infra#$PROFILE" 2>&1| sed -e "s/^/${HOST} | /") &
(ssh "$HOST" -- sudo darwin-rebuild switch --flake "github:nixos/infra" 2>&1| sed -e "s/^/${HOST} | /") &
Copy link
Member Author

@mweinelt mweinelt Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assumption here is that, same as on NixOS, they'll fall back to a darwin configuration based on their hostname. Is that correct?

Copy link
Member Author

@mweinelt mweinelt Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hetzner@intense-heron:~/ > sudo darwin-rebuild switch --flake github:nixos/infra               
building the system configuration...
[...]
error: flake 'github:nixos/infra' does not provide attribute 'packages.aarch64-darwin.darwinConfigurations.hetzners-Mac-mini.system', 'legacyPackages.aarch64-darwin.darwinConfigurations.hetzners-Mac-mini.system' or 'darwinConfigurations.hetzners-Mac-mini.system'

So maybe after we redeploy them with this PR, because we now set a hostname.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hetzner@intense-heron:~/ > scutil --get HostName
HostName: not set
hetzner@intense-heron:~/ > scutil --get LocalHostName
hetzners-Mac-mini
hetzner@intense-heron:~/ > scutil --get ComputerName             
hetzner’s Mac mini

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From darwin-rebuild:

if [[ -n "$flake" ]]; then
    if [[ $flake =~ ^(.*)\#([^\#\"]*)$ ]]; then
       flake="${BASH_REMATCH[1]}"
       flakeAttr="${BASH_REMATCH[2]}"
    fi
    if [[ -z "$flakeAttr" ]]; then
      flakeAttr=$(scutil --get LocalHostName)
    fi
    flakeAttr=darwinConfigurations.${flakeAttr}
fi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hetzner@intense-heron:~/ > scutil --get HostName    
HostName: not set
hetzner@intense-heron:~/ > scutil --get LocalHostName
intense-heron
hetzner@intense-heron:~/ > scutil --get ComputerName 
hetzner’s Mac mini

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we're good. Updated all machines, so this is good to go.

PIDS+=($!)
}

update [email protected] m1
update [email protected] m1
update [email protected] m1
update [email protected] m1
update [email protected] m1
update [email protected] m2-large
update [email protected] m2-large
update [email protected]
update [email protected]
update [email protected]
update [email protected]
update [email protected]
update [email protected]
update [email protected]

wait "${PIDS[@]}"