From 516036541bebf045c6e772358dd53b0bd803819a Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 9 Aug 2025 22:58:18 -0400 Subject: [PATCH] Make home manager config work cross-platform --- flake.nix | 9 ++++++++- lib/mkHomeConfig.nix | 4 ++-- modules/hosts/home-manager-only/default.nix | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index b056cfa..629be47 100644 --- a/flake.nix +++ b/flake.nix @@ -174,9 +174,16 @@ # Home Manager (only) users homeConfigurations = { - gene = localLib.mkHomeConfig { + gene-x86_64-linux = localLib.mkHomeConfig { homeDirectory = "/home/gene"; username = "gene"; + system = "x86_64-linux"; + }; + + gene-aarch64-linux = localLib.mkHomeConfig { + homeDirectory = "/home/gene"; + username = "gene"; + system = "aarch64-linux"; }; }; # end homeConfigurations diff --git a/lib/mkHomeConfig.nix b/lib/mkHomeConfig.nix index 1abd08a..f4ef0cf 100644 --- a/lib/mkHomeConfig.nix +++ b/lib/mkHomeConfig.nix @@ -1,10 +1,10 @@ { inputs, ... }: { mkHomeConfig = { - system ? "x86_64-linux", homeDirectory, + system, username, }: inputs.home-manager.lib.homeManagerConfiguration { - extraSpecialArgs = { inherit inputs homeDirectory username; }; + extraSpecialArgs = { inherit inputs homeDirectory system username; }; pkgs = inputs.nixpkgs.legacyPackages.${system}; diff --git a/modules/hosts/home-manager-only/default.nix b/modules/hosts/home-manager-only/default.nix index b25a527..fff1b06 100644 --- a/modules/hosts/home-manager-only/default.nix +++ b/modules/hosts/home-manager-only/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ config, pkgs, system, username, ... }: { home.stateVersion = "25.05"; home.packages = with pkgs; [ age @@ -9,8 +9,8 @@ # home-manager switch --flake ~/repos/dots programs.zsh.shellAliases = { - nixdiff = "cd ~/repos/dots && home-manager build --flake . && nvd diff /run/current-system result"; - nixup = "home-manager switch --flake ~/repos/dots"; + nixdiff = "cd ~/repos/dots && home-manager build --flake .#${username}-${system} && nvd diff /run/current-system result"; + nixup = "home-manager switch --flake ~/repos/dots#${username}-${system}"; }; sops = {