home-manager: move Nix code to own file

This commit is contained in:
Robert Helgesson 2017-08-28 11:37:34 +02:00
parent 125deafc84
commit e9ca4305a6
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;
}