mirror of
https://github.com/nix-community/home-manager
synced 2024-11-24 03:59:46 +01:00
home-manager: add config file attribute
(cherry picked from commit ffbc7e723d
)
This commit is contained in:
parent
85d12028ad
commit
5f2a6d90bd
2 changed files with 14 additions and 3 deletions
|
@ -9,11 +9,15 @@
|
||||||
let
|
let
|
||||||
|
|
||||||
homeManagerExpr = pkgs.writeText "home-manager.nix" ''
|
homeManagerExpr = pkgs.writeText "home-manager.nix" ''
|
||||||
{ pkgs ? import <nixpkgs> {}, confPath }:
|
{ pkgs ? import <nixpkgs> {}, confPath, confAttr }:
|
||||||
|
|
||||||
let
|
let
|
||||||
env = import <home-manager> {
|
env = import <home-manager> {
|
||||||
configuration = import confPath;
|
configuration =
|
||||||
|
let
|
||||||
|
conf = import confPath;
|
||||||
|
in
|
||||||
|
if confAttr == "" then conf else conf.''${confAttr};
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
@ -82,6 +82,7 @@ function doBuild() {
|
||||||
nix-build $extraArgs \
|
nix-build $extraArgs \
|
||||||
"@HOME_MANAGER_EXPR_PATH@" \
|
"@HOME_MANAGER_EXPR_PATH@" \
|
||||||
--argstr confPath "$HOME_MANAGER_CONFIG" \
|
--argstr confPath "$HOME_MANAGER_CONFIG" \
|
||||||
|
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE" \
|
||||||
-A activation-script \
|
-A activation-script \
|
||||||
-o "$output"
|
-o "$output"
|
||||||
}
|
}
|
||||||
|
@ -121,6 +122,8 @@ function doHelp() {
|
||||||
echo
|
echo
|
||||||
echo " -f FILE The home configuration file."
|
echo " -f FILE The home configuration file."
|
||||||
echo " Default is '~/.config/nixpkgs/home.nix'."
|
echo " Default is '~/.config/nixpkgs/home.nix'."
|
||||||
|
echo " -A ATTRIBUTE Optional attribute that selects a configuration"
|
||||||
|
echo " expression in the configuration file."
|
||||||
echo " -I PATH Add a path to the Nix expression search path."
|
echo " -I PATH Add a path to the Nix expression search path."
|
||||||
echo " -v Verbose output"
|
echo " -v Verbose output"
|
||||||
echo " -n Do a dry run, only prints what actions would be taken"
|
echo " -n Do a dry run, only prints what actions would be taken"
|
||||||
|
@ -135,8 +138,9 @@ function doHelp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
EXTRA_NIX_PATH=()
|
EXTRA_NIX_PATH=()
|
||||||
|
HOME_MANAGER_CONFIG_ATTRIBUTE=""
|
||||||
|
|
||||||
while getopts f:I:vnh opt; do
|
while getopts f:I:A:vnh opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
f)
|
f)
|
||||||
HOME_MANAGER_CONFIG="$OPTARG"
|
HOME_MANAGER_CONFIG="$OPTARG"
|
||||||
|
@ -144,6 +148,9 @@ while getopts f:I:vnh opt; do
|
||||||
I)
|
I)
|
||||||
EXTRA_NIX_PATH+=("$OPTARG")
|
EXTRA_NIX_PATH+=("$OPTARG")
|
||||||
;;
|
;;
|
||||||
|
A)
|
||||||
|
HOME_MANAGER_CONFIG_ATTRIBUTE="$OPTARG"
|
||||||
|
;;
|
||||||
v)
|
v)
|
||||||
export VERBOSE=1
|
export VERBOSE=1
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue