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 = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager.url = "github:nix-community/home-manager";
# home-manager = {
# url = "github:nix-community/home-manager";
# inputs.nixpkgs.follows = "nixpkgs";
# };
};
outputs = { nixpkgs, home-manager, ... }:
@@ -18,18 +19,10 @@
in
{
homeManagerModules.default = { config, pkgs, ... }: {
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.";
};
imports = [ ./home.nix ] ++ lib.optionals (config.profile == "personal") [ ./git-personal.nix ];
imports = [
./options.nix
./home.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
@@ -28,6 +28,9 @@
nix flake update --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
# # 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.";
};
}