1
0
Fork 0
nixos-config/home-manager/lib.nix

22 lines
621 B
Nix
Raw Normal View History

2019-07-25 21:35:59 +00:00
let
2019-07-31 21:56:52 +00:00
inherit (import ../common/lib.nix)
home-manager writeHaskellScript get-niv-path;
in {
update-home = configPath:
writeHaskellScript {
2019-07-26 13:54:30 +00:00
name = "update-home";
2019-07-31 21:56:52 +00:00
bins = [ get-niv-path home-manager ];
} ''
2019-07-25 21:35:59 +00:00
2019-07-31 21:56:52 +00:00
getNivPath = get_niv_path "${configPath}/nix/sources.nix"
2019-07-26 13:54:30 +00:00
2019-07-31 21:56:52 +00:00
getNivAssign name = (tag <$>) . readTrim . getNivPath $ name
where tag str = ["-I", [i|#{name}=#{str :: LBS.ByteString}|]]
2019-07-25 21:35:59 +00:00
2019-07-31 21:56:52 +00:00
main = do
args <- getArgs
paths <- concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"]
home_manager $ paths ++ ["switch"] ++ args
2019-07-25 21:35:59 +00:00
'';
}