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

22 lines
654 B
Nix
Raw Normal View History

2019-07-26 15:31:26 +00:00
nixos-rebuild:
2019-07-25 21:35:59 +00:00
let
2019-08-02 03:17:00 +00:00
inherit (import ../lib)
writeHaskellScript get-niv-path home-manager gcRetentionDays pkgs;
in rec {
2019-07-25 21:35:59 +00:00
configPath = "/etc/nixos";
update-system = writeHaskellScript {
2019-07-31 21:56:52 +00:00
name = "update-system";
bins = [ get-niv-path nixos-rebuild ];
} ''
2019-07-26 15:31:26 +00:00
getNivPath = readTrim . get_niv_path "${configPath}/nix/sources.nix"
2019-07-25 21:35:59 +00:00
2019-07-26 15:31:26 +00:00
getNivAssign name = tag <$> getNivPath name
where tag str = ["-I", [i|#{name}=#{str :: LBS.ByteString}|] ]
2019-07-25 21:35:59 +00:00
main = do
paths <- fmap concat . mapM getNivAssign $ ["nixpkgs", "unstable", "home-manager"]
2019-07-28 22:51:10 +00:00
args <- getArgs
nixos_rebuild (paths ++ ["switch"] ++ args)
2019-07-31 21:56:52 +00:00
'';
2019-08-02 03:17:00 +00:00
}