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

20 lines
644 B
Nix
Raw Normal View History

2019-08-02 03:17:00 +00:00
let inherit (import ./.) home-manager writeHaskellScript get-niv-path;
2019-07-31 21:56:52 +00:00
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-08-13 22:24:38 +00:00
getNivPath name = get_niv_path "${configPath}/nix/sources.nix" name |> captureTrim
2019-07-26 13:54:30 +00:00
2019-08-13 22:24:38 +00:00
getNivAssign name = tag <$> getNivPath name
2020-01-19 16:40:02 +00:00
where tag str = ["-I", [i|#{name :: String}=#{str :: LByteString}|]] :: [String]
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"]
2020-01-19 16:40:02 +00:00
home_manager $ paths ++ ["switch"] ++ fmap toString args
2019-07-25 21:35:59 +00:00
'';
}