Modified home-manager flake.nix

This commit is contained in:
lulusilly 2025-08-31 22:59:47 -04:00
parent d5268d2ade
commit 394b36306d

View file

@ -1,5 +1,5 @@
{ {
description = "Home Manager multi-machine flake"; description = "Multi-machine Home Manager (Linux/macOS/NixOS)";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -8,12 +8,13 @@
}; };
outputs = { self, nixpkgs, home-manager, ... }: let outputs = { self, nixpkgs, home-manager, ... }: let
# Get system type (Linux or MacOS, x86_64 or ARM)
system = builtins.currentSystem; system = builtins.currentSystem;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
# Get current machine hostname
# Grab hostname from environment
hostname = builtins.getEnv "HOSTNAME"; hostname = builtins.getEnv "HOSTNAME";
in { in {
# -------- Standalone Home Manager (macOS / non-NixOS Linux) --------
homeConfigurations = { homeConfigurations = {
"${hostname}" = home-manager.lib.homeManagerConfiguration { "${hostname}" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
@ -21,7 +22,32 @@
./common.nix ./common.nix
./${hostname}/home.nix ./${hostname}/home.nix
]; ];
};
};
# -------- NixOS Integration --------
nixosConfigurations = {
"${hostname}" = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
# Enable Home Manager as NixOS module
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.elisha = {
imports = [
./common.nix
./${hostname}/home.nix
];
};
} }
];
};
}; };
}; };
} }