1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 21:49:48 +01:00

home-manager: move Nix code to own file

(cherry picked from commit e9ca4305a6)
This commit is contained in:
Robert Helgesson 2017-08-28 11:37:34 +02:00
parent edb46f4aa2
commit a3395bc3a4
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
2 changed files with 16 additions and 19 deletions

View file

@ -8,24 +8,6 @@
let
homeManagerExpr = pkgs.writeText "home-manager.nix" ''
{ pkgs ? import <nixpkgs> {}, confPath, confAttr }:
let
env = import <home-manager> {
configuration =
let
conf = import confPath;
in
if confAttr == "" then conf else conf.''${confAttr};
pkgs = pkgs;
};
in
{
inherit (env) activationPackage;
}
'';
modulesPathStr = if modulesPath == null then "" else modulesPath;
in
@ -42,7 +24,7 @@ pkgs.stdenv.mkDerivation {
--subst-var-by bash "${pkgs.bash}" \
--subst-var-by coreutils "${pkgs.coreutils}" \
--subst-var-by MODULES_PATH '${modulesPathStr}' \
--subst-var-by HOME_MANAGER_EXPR_PATH "${homeManagerExpr}"
--subst-var-by HOME_MANAGER_EXPR_PATH "${./home-manager.nix}"
'';
meta = with pkgs.stdenv.lib; {

View file

@ -0,0 +1,15 @@
{ pkgs ? import <nixpkgs> {}, confPath, confAttr }:
let
env = import <home-manager> {
configuration =
let
conf = import confPath;
in
if confAttr == "" then conf else conf.''${confAttr};
pkgs = pkgs;
};
in
{
inherit (env) activationPackage;
}