Skip to content

Instantly share code, notes, and snippets.

@brianmcgee
Created August 9, 2023 15:05
Show Gist options
  • Save brianmcgee/7bf282579f00f52750c0edde93d2fe95 to your computer and use it in GitHub Desktop.
Save brianmcgee/7bf282579f00f52750c0edde93d2fe95 to your computer and use it in GitHub Desktop.
Passing hostname into home-manager
{ config, inputs, hostName, ... }: {
// hostName should now be available as an arg to all of your home-manager modules
}
nixosConfigurations = {
floyd = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{ system.stateVersion = "22.11"; }
nixos-hardware.nixosModules.lenovo-thinkpad-x260
./hosts/floyd
./configuration.nix
home-manager.nixosModules.home-manager
({ config, ...}: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs;
inherit (config.networking) hostName;
};
home-manager.users.vk = {...}: {
imports = [
./packages/cli-tools.nix
[...more files...]
};
}) # end home-manager
]; # end modules
}; # end floyd
[... rest of flake.nix ...]
@neoSnakex34
Copy link

thank you so much

@OriCat101
Copy link

noice... thx for posting this <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment