diff --git a/darwin/baseline.nix b/darwin/baseline.nix index 8e7f046..aa38a0f 100644 --- a/darwin/baseline.nix +++ b/darwin/baseline.nix @@ -31,7 +31,7 @@ in 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 = { enable = true; diff --git a/darwin/default.nix b/darwin/default.nix index b927091..bfc1b09 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -37,8 +37,11 @@ let ++ lib.optionals (builtins.pathExists ./hosts/${name}) [ ./hosts/${name} ]; }; in -{ - "MacBook-Pro" = mac { name = "ivr"; }; - "MacBook-Prolocal" = mac { name = "ivr"; }; - "li" = mac { name = "li"; }; -} +( + lib.genAttrs + (builtins.attrNames (builtins.readDir ./hosts)) + ( + name: + mac { inherit name; } + ) +) diff --git a/darwin/hosts/gregory.hellings-mbp b/darwin/hosts/gregory.hellings-mbp new file mode 120000 index 0000000..c12c63e --- /dev/null +++ b/darwin/hosts/gregory.hellings-mbp @@ -0,0 +1 @@ +gregory \ No newline at end of file diff --git a/darwin/hosts/ivr/default.nix b/darwin/hosts/gregory/default.nix similarity index 100% rename from darwin/hosts/ivr/default.nix rename to darwin/hosts/gregory/default.nix diff --git a/darwin/hosts/ivr b/darwin/hosts/ivr new file mode 120000 index 0000000..ed27f59 --- /dev/null +++ b/darwin/hosts/ivr @@ -0,0 +1 @@ +gregory/ \ No newline at end of file diff --git a/darwin/hosts/li b/darwin/hosts/li new file mode 120000 index 0000000..b99c84f --- /dev/null +++ b/darwin/hosts/li @@ -0,0 +1 @@ +gregs-MacBook-Pro-16-inch-Nov-2024/ \ No newline at end of file diff --git a/darwin/hosts/li/default.nix b/darwin/hosts/lithic/default.nix similarity index 93% rename from darwin/hosts/li/default.nix rename to darwin/hosts/lithic/default.nix index a2740c3..2b74931 100644 --- a/darwin/hosts/li/default.nix +++ b/darwin/hosts/lithic/default.nix @@ -1,6 +1,6 @@ { ... }: let - username = "gregory.hellings"; + username = "greg"; in { greg = { @@ -33,7 +33,6 @@ in "podman-desktop" "tabby" "zed" - "zoom" ]; user = username; }; diff --git a/home/default.nix b/home/default.nix index 8c7688b..17b79d8 100644 --- a/home/default.nix +++ b/home/default.nix @@ -4,11 +4,13 @@ top, }: let + inherit (top.nixunstable) lib; user = - host: username: + host: let inherit (metadata.hosts.${host}) system; pkgs = nixpkgs.${system}; + username = if builtins.hasAttr "user" metadata.hosts.${host} then metadata.hosts.${host}.user else "greg"; in top.hmunstable.lib.homeManagerConfiguration { inherit pkgs; @@ -28,20 +30,9 @@ let gnome = false; }; }; - greg = host: (user host "greg"); in -{ - "MacBook-Pro.local" = user "ivr" "gregory.hellings"; - "MacBook-Prolocal.local" = user "ivr" "gregory.hellings"; - "MacBook-Pro.thehellings.lan" = user "ivr" "gregory.hellings"; - "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"; -} +( + lib.genAttrs + (builtins.attrNames (builtins.readDir ./hosts)) + user +) diff --git a/home/hosts/ivr/default.nix b/home/hosts/gregory.hellings-mbp/default.nix similarity index 97% rename from home/hosts/ivr/default.nix rename to home/hosts/gregory.hellings-mbp/default.nix index 71a4395..fa923c4 100644 --- a/home/hosts/ivr/default.nix +++ b/home/hosts/gregory.hellings-mbp/default.nix @@ -1,11 +1,9 @@ { pkgs, lib, + username, ... }: -let - username = "gregory.hellings"; -in { # Disables hitting local cache _module.args.cache = lib.mkForce false; diff --git a/home/hosts/ivr b/home/hosts/ivr new file mode 120000 index 0000000..b078250 --- /dev/null +++ b/home/hosts/ivr @@ -0,0 +1 @@ +gregory.hellings-mbp/ \ No newline at end of file diff --git a/home/hosts/li/default.nix b/home/hosts/lithic/default.nix similarity index 94% rename from home/hosts/li/default.nix rename to home/hosts/lithic/default.nix index 8fb2d6e..e8a75c3 100644 --- a/home/hosts/li/default.nix +++ b/home/hosts/lithic/default.nix @@ -4,7 +4,7 @@ ... }: let - username = "gregory.hellings"; + username = "greg"; in { # Disables hitting local cache @@ -13,7 +13,7 @@ in development = true; gui = true; nix.cache = false; - vscodium = false; + zed = true; }; home = { diff --git a/main.tar.gz b/main.tar.gz new file mode 100644 index 0000000..50951f6 Binary files /dev/null and b/main.tar.gz differ diff --git a/network.json b/network.json index bb9e901..a81985a 100644 --- a/network.json +++ b/network.json @@ -53,9 +53,10 @@ "external": true, "system": "x86_64-linux" }, - "ivr": { + "gregory.hellings-mbp": { "external": true, - "system": "aarch64-darwin" + "system": "aarch64-darwin", + "user": "gregory.hellings" }, "jeremiah": { "builder": true, @@ -72,7 +73,7 @@ "ip": "10.42.0.4", "ts": null }, - "li": { + "lithic": { "external": true, "system": "aarch64-darwin" }, diff --git a/pkgs/inject-darwin.nix b/pkgs/inject-darwin.nix index 5e8f21b..83d6d6e 100644 --- a/pkgs/inject-darwin.nix +++ b/pkgs/inject-darwin.nix @@ -4,6 +4,7 @@ curl, gnutar, nix, + nix-output-monitor, ... }: writeShellApplication { @@ -13,26 +14,16 @@ writeShellApplication { curl gnutar nix + nix-output-monitor ]; 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 - mkdir -p ~/.config/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 + cd /etc/nix-darwin # Build NixOS for this system - pushd "''${dir}" - nix build "''${HOME}/.config/darwin#darwinConfigurations.$(hostname -s).system" - ./result/sw/bin/darwin-rebuild switch --flake ~/.config/darwin - popd - rm -r "''${dir}" + nom build --extra-experimental-features "nix-command flakes" ".#darwinConfigurations.$(hostname -s).system" + sudo mv /etc/bashrc /etc/bashrc.before-nix-darwin + sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin + sudo ./result/sw/bin/darwin-rebuild switch --flake . ''; } diff --git a/setup_mac.sh b/setup_mac.sh new file mode 100644 index 0000000..94ee635 --- /dev/null +++ b/setup_mac.sh @@ -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