From 8900ac44f03d9b54feb79a700805085a20457430 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 30 Jun 2025 19:34:45 -0500 Subject: [PATCH] working without option, but still referenced --- flake.nix | 25 +++++++++---------------- home.nix | 5 ++++- options.nix | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 options.nix diff --git a/flake.nix b/flake.nix index 1214290..f746645 100644 --- a/flake.nix +++ b/flake.nix @@ -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 + ]; }; }; } diff --git a/home.nix b/home.nix index 05eacf5..6c1fb8b 100644 --- a/home.nix +++ b/home.nix @@ -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 diff --git a/options.nix b/options.nix new file mode 100644 index 0000000..7a90622 --- /dev/null +++ b/options.nix @@ -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."; + }; +}