working without option, but still referenced

This commit is contained in:
John Lancaster
2025-06-30 19:34:45 -05:00
parent bb145deb8e
commit 8900ac44f0
3 changed files with 27 additions and 17 deletions

View File

@@ -4,10 +4,11 @@
inputs = { inputs = {
# Specify the source of Home Manager and Nixpkgs. # Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = { home-manager.url = "github:nix-community/home-manager";
url = "github:nix-community/home-manager"; # home-manager = {
inputs.nixpkgs.follows = "nixpkgs"; # url = "github:nix-community/home-manager";
}; # inputs.nixpkgs.follows = "nixpkgs";
# };
}; };
outputs = { nixpkgs, home-manager, ... }: outputs = { nixpkgs, home-manager, ... }:
@@ -18,18 +19,10 @@
in in
{ {
homeManagerModules.default = { config, pkgs, ... }: { homeManagerModules.default = { config, pkgs, ... }: {
options.user = lib.mkOption { imports = [
type = lib.types.str; ./options.nix
description = "The username for the Home Manager configuration."; ./home.nix
}; ];
options.profile = lib.mkOption {
type = lib.types.enum [ "personal" "work" ];
default = "personal";
description = "Profile type for the Home Manager configuration.";
};
imports = [ ./home.nix ] ++ lib.optionals (config.profile == "personal") [ ./git-personal.nix ];
}; };
}; };
} }

View File

@@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
@@ -28,6 +28,9 @@
nix flake update --flake ~/.config/home-manager nix flake update --flake ~/.config/home-manager
nix run home-manager -- switch --flake ~/.config/home-manager nix run home-manager -- switch --flake ~/.config/home-manager
'') '')
(writeShellScriptBin "test-hm" ''
echo "${config.profile}"
'')
# # It is sometimes useful to fine-tune packages, for example, by applying # # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the # # overrides. You can do that directly here, just don't forget the

14
options.nix Normal file
View File

@@ -0,0 +1,14 @@
{ lib, ... }:
{
options.user = lib.mkOption {
type = lib.types.str;
description = "The username for the Home Manager configuration.";
};
options.profile = lib.mkOption {
type = lib.types.enum [ "personal" "work" ];
default = "personal";
description = "Profile type for the Home Manager configuration.";
};
}