working without option, but still referenced
This commit is contained in:
25
flake.nix
25
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
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
5
home.nix
5
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
|
||||
|
||||
14
options.nix
Normal file
14
options.nix
Normal 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.";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user