diff --git a/flake.nix b/flake.nix index 41b3cab..39a88d2 100644 --- a/flake.nix +++ b/flake.nix @@ -141,14 +141,15 @@ modules = [ ./hosts/macbook/configuration.nix home-manager.darwinModules.home-manager - { + ({ config, ... }: { home-manager.extraSpecialArgs = { pkgs-unstable = pkgs-unstable_aarch64-darwin; + inherit (config) user; }; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.uagm.imports = [ ./hosts/macbook/home.nix ]; - } + }) ]; }; "msft-mac" = nix-darwin.lib.darwinSystem { diff --git a/home-modules/homebrew.nix b/home-modules/homebrew.nix new file mode 100644 index 0000000..261c756 --- /dev/null +++ b/home-modules/homebrew.nix @@ -0,0 +1,5 @@ +{ ... } : { + programgs.zsh.profileExtra = '' + eval "$(/opt/homebrew/bin/brew shellenv)" + ''; +} diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix index 683d49e..559068a 100644 --- a/hosts/macbook/configuration.nix +++ b/hosts/macbook/configuration.nix @@ -1,12 +1,13 @@ -{ self, pkgs, ... }: { +{ self, pkgs, config, ... }: { imports = [ ./hotkeys.nix + ../../modules/common ]; # To reflect hotkeys without a login cycle. system.activationScripts.postActivation.text = '' - sudo -u uagm /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + sudo -u ${config.user.name} /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u ''; # List packages installed in system profile. To search by name, run: @@ -15,7 +16,9 @@ neofetch ]; - system.primaryUser = "uagm"; + user.name = "jmug"; + + system.primaryUser = config.user.name; homebrew = { enable = true; @@ -37,7 +40,7 @@ "ghostty" "kicad" "secretive" - "gcc-arm-embedded" + "gcc-arm-embedded" # Maybe defer this to individual porject flakes. "karabiner-elements" "raycast" "logi-options+" @@ -49,7 +52,7 @@ nerd-fonts.bigblue-terminal ]; - users.users.uagm.home = "/Users/uagm"; + users.users.${config.user.name}.home = config.user.homeDirectory; nixpkgs.config.allowUnfree = true; @@ -63,7 +66,7 @@ # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog - system.stateVersion = 5; + system.stateVersion = 6; # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index 1318789..9e1da8a 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -2,12 +2,19 @@ config, pkgs, pkgs-unstable, + user, ... -} : { +} : +let + username = user.name; + homeDirectory = user.homeDirectory; +in { imports = [ + ../../home-modules/default.nix ../../home-modules/direnv.nix ../../home-modules/ghostty-config.nix + ../../home-modules/homebrew.nix ../../home-modules/karabiner.nix ../../home-modules/lazygit.nix ../../home-modules/nvim.nix @@ -27,16 +34,14 @@ }; home = { - username = "uagm"; - homeDirectory = "/Users/uagm"; + username = username; + homeDirectory = homeDirectory; packages = with pkgs; [ - fzf - ripgrep + nerd-fonts.bigblue-terminal + nerd-fonts.fira-code exercism - typescript-language-server - lua-language-server - starship + typescript-language-server # TODO: Defer to individual projects. audacity pkgs-unstable.claude-code (pkgs-unstable.litellm.overrideAttrs (oldAttrs: rec { @@ -57,12 +62,11 @@ programs.zsh = { shellAliases = { # TODO BEGIN Interpolate the name of the host here. - flakeconf = "nvim /Users/uagm/nixos/flake.nix"; - sysconf = "nvim /Users/uagm/nixos/hosts/macbook/configuration.nix"; - homeconf = "nvim /Users/uagm/nixos/hosts/macbook/home.nix"; - nvconf = "nvim /Users/uagm/nixos/home-modules/explicit-configs/nvim/init.lua"; - # TODO: Interpolate the name of the host here. - nrsw = "sudo darwin-rebuild switch --flake /Users/uagm/nixos#macbook"; + flakeconf = "nvim ${homeDirectory}/nixos/flake.nix"; + sysconf = "nvim ${homeDirectory}/nixos/hosts/macbook/configuration.nix"; + homeconf = "nvim ${homeDirectory}/nixos/hosts/macbook/home.nix"; + nvconf = "nvim ${homeDirectory}/nixos/home-modules/explicit-configs/nvim/init.lua"; + nrsw = "sudo darwin-rebuild switch --flake ${homeDirectory}/nixos#macbook"; }; }; } diff --git a/hosts/msft-mac/home.nix b/hosts/msft-mac/home.nix index 7c30986..e674811 100644 --- a/hosts/msft-mac/home.nix +++ b/hosts/msft-mac/home.nix @@ -14,6 +14,7 @@ in { ../../home-modules/default.nix ../../home-modules/direnv.nix ../../home-modules/ghostty-config.nix + ../../home-modules/homebrew.nix ../../home-modules/karabiner.nix ../../home-modules/lazygit.nix ../../home-modules/nvim.nix