feat: pull dynamic names for Darwin/Home

This commit is contained in:
Greg Hellings
2026-04-06 16:21:02 -05:00
parent 0d70a9e018
commit 6b7f54d0a2
15 changed files with 64 additions and 49 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ in
nerd-fonts.hack nerd-fonts.hack
]; ];
launchd.daemons = lib.genAttrs' [ "x86" "aarch" ] (arch: lib.nameValuePair "builder-${arch}-machine" (builder arch)); #launchd.daemons = lib.genAttrs' [ "x86" "aarch" ] (arch: lib.nameValuePair "builder-${arch}-machine" (builder arch));
nix = { nix = {
enable = true; enable = true;
+8 -5
View File
@@ -37,8 +37,11 @@ let
++ lib.optionals (builtins.pathExists ./hosts/${name}) [ ./hosts/${name} ]; ++ lib.optionals (builtins.pathExists ./hosts/${name}) [ ./hosts/${name} ];
}; };
in in
{ (
"MacBook-Pro" = mac { name = "ivr"; }; lib.genAttrs
"MacBook-Prolocal" = mac { name = "ivr"; }; (builtins.attrNames (builtins.readDir ./hosts))
"li" = mac { name = "li"; }; (
} name:
mac { inherit name; }
)
)
+1
View File
@@ -0,0 +1 @@
gregory
+1
View File
@@ -0,0 +1 @@
gregory/
+1
View File
@@ -0,0 +1 @@
gregs-MacBook-Pro-16-inch-Nov-2024/
@@ -1,6 +1,6 @@
{ ... }: { ... }:
let let
username = "gregory.hellings"; username = "greg";
in in
{ {
greg = { greg = {
@@ -33,7 +33,6 @@ in
"podman-desktop" "podman-desktop"
"tabby" "tabby"
"zed" "zed"
"zoom"
]; ];
user = username; user = username;
}; };
+8 -17
View File
@@ -4,11 +4,13 @@
top, top,
}: }:
let let
inherit (top.nixunstable) lib;
user = user =
host: username: host:
let let
inherit (metadata.hosts.${host}) system; inherit (metadata.hosts.${host}) system;
pkgs = nixpkgs.${system}; pkgs = nixpkgs.${system};
username = if builtins.hasAttr "user" metadata.hosts.${host} then metadata.hosts.${host}.user else "greg";
in in
top.hmunstable.lib.homeManagerConfiguration { top.hmunstable.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
@@ -28,20 +30,9 @@ let
gnome = false; gnome = false;
}; };
}; };
greg = host: (user host "greg");
in in
{ (
"MacBook-Pro.local" = user "ivr" "gregory.hellings"; lib.genAttrs
"MacBook-Prolocal.local" = user "ivr" "gregory.hellings"; (builtins.attrNames (builtins.readDir ./hosts))
"MacBook-Pro.thehellings.lan" = user "ivr" "gregory.hellings"; user
"gregory.hellings-mbp" = user "ivr" "gregory.hellings"; )
genesis = greg "genesis";
exodus = greg "exodus";
zeke = greg "zeke";
isaiah = greg "isaiah";
jeremiah = greg "jeremiah";
li = user "li" "gregory.hellings";
linode = greg "linode";
hosea = greg "hosea";
gitlab = greg "gitlab";
}
@@ -1,11 +1,9 @@
{ {
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
let
username = "gregory.hellings";
in
{ {
# Disables hitting local cache # Disables hitting local cache
_module.args.cache = lib.mkForce false; _module.args.cache = lib.mkForce false;
+1
View File
@@ -0,0 +1 @@
gregory.hellings-mbp/
@@ -4,7 +4,7 @@
... ...
}: }:
let let
username = "gregory.hellings"; username = "greg";
in in
{ {
# Disables hitting local cache # Disables hitting local cache
@@ -13,7 +13,7 @@ in
development = true; development = true;
gui = true; gui = true;
nix.cache = false; nix.cache = false;
vscodium = false; zed = true;
}; };
home = { home = {
BIN
View File
Binary file not shown.
+4 -3
View File
@@ -53,9 +53,10 @@
"external": true, "external": true,
"system": "x86_64-linux" "system": "x86_64-linux"
}, },
"ivr": { "gregory.hellings-mbp": {
"external": true, "external": true,
"system": "aarch64-darwin" "system": "aarch64-darwin",
"user": "gregory.hellings"
}, },
"jeremiah": { "jeremiah": {
"builder": true, "builder": true,
@@ -72,7 +73,7 @@
"ip": "10.42.0.4", "ip": "10.42.0.4",
"ts": null "ts": null
}, },
"li": { "lithic": {
"external": true, "external": true,
"system": "aarch64-darwin" "system": "aarch64-darwin"
}, },
+7 -16
View File
@@ -4,6 +4,7 @@
curl, curl,
gnutar, gnutar,
nix, nix,
nix-output-monitor,
... ...
}: }:
writeShellApplication { writeShellApplication {
@@ -13,26 +14,16 @@ writeShellApplication {
curl curl
gnutar gnutar
nix nix
nix-output-monitor
]; ];
text = '' text = ''
dir="$(mktemp -d)"
cd "''${dir}"
# Install nix-darwin
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
# Get my configuration # Get my configuration
mkdir -p ~/.config/darwin cd /etc/nix-darwin
cd ~/.config/darwin
curl -O -L https://github.com/greg-hellings/nixos-config/archive/refs/heads/main.tar.gz
tar xvzf main.tar.gz --strip-components 1
# Build NixOS for this system # Build NixOS for this system
pushd "''${dir}" nom build --extra-experimental-features "nix-command flakes" ".#darwinConfigurations.$(hostname -s).system"
nix build "''${HOME}/.config/darwin#darwinConfigurations.$(hostname -s).system" sudo mv /etc/bashrc /etc/bashrc.before-nix-darwin
./result/sw/bin/darwin-rebuild switch --flake ~/.config/darwin sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin
popd sudo ./result/sw/bin/darwin-rebuild switch --flake .
rm -r "''${dir}"
''; '';
} }
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
host="$(hostname -s)"
# Install XCode tools
echo "Installing XCode Tools"
xcode-select --install
# Install Homebrew
echo "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo >> ~/.zprofile
echo >> 'eval "$(/opt/homebrew/bin/brew shellenv zsh)"' >> ~/.zprofile
# Install Nix
echo "Installing Nix"
sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon
sudo mkdir /etc/nix-darwin
sudo chown -R $USER /etc/nix-darwin
# Install my configurations
cd /etc/nix-darwin
curl -O -L https://github.com/greg-hellings/nixos-config/archive/refs/heads/main.tar.gz
tar xvzf main.tar.gz --strip-components 1
mkdir -p "/etc/nix-darwin/darwin/hosts/${host}"
mkdir -p "/etc/nix-darwin/home/hosts/${host}"
/nix/var/nix/profiles/system/sw/bin/nix --extra-experimental-features "nix-command flakes" run greg-hellings/nixos-config#inject-darwin