2020-05-27 13:20:08 +00:00
|
|
|
{ pkgs, nixos-rebuild }:
|
|
|
|
let configPath = "/etc/nixos";
|
|
|
|
in {
|
|
|
|
update-system = pkgs.writeHaskellScript {
|
2019-07-31 21:56:52 +00:00
|
|
|
name = "update-system";
|
2020-10-12 00:33:25 +00:00
|
|
|
bins = [ nixos-rebuild pkgs.nix-output-monitor ];
|
2019-07-31 21:56:52 +00:00
|
|
|
} ''
|
2020-10-01 01:02:10 +00:00
|
|
|
privatePath = "${configPath}/private"
|
|
|
|
canaryPath = privatePath <> "/submodule-is-checked-out"
|
|
|
|
|
2019-07-25 21:35:59 +00:00
|
|
|
main = do
|
2020-05-16 14:47:52 +00:00
|
|
|
paths <- myNixPath "${configPath}"
|
2019-07-28 22:51:10 +00:00
|
|
|
args <- getArgs
|
2020-10-01 06:05:00 +00:00
|
|
|
bracket (rm canaryPath) (\() -> exe "/run/wrappers/bin/sudo" "-u" "maralorn" "git" "-C" privatePath "restore" canaryPath) $ \() -> do
|
2020-10-12 00:33:25 +00:00
|
|
|
nix_build (paths ++ buildSystemParams ++ ["--no-out-link"] ++ remoteBuildParams ++ fmap toString args) &!> StdOut |> nom
|
|
|
|
nixos_rebuild (paths ++ ["switch"] ++ fmap toString args) &!> StdOut |> nom
|
2019-07-31 21:56:52 +00:00
|
|
|
'';
|
2019-08-02 03:17:00 +00:00
|
|
|
}
|