2021-04-17 16:12:20 +00:00
|
|
|
{
|
2022-03-08 01:42:46 +00:00
|
|
|
pkgs,
|
|
|
|
nixos-rebuild,
|
|
|
|
}: let
|
|
|
|
configPath = "/etc/nixos";
|
|
|
|
in {
|
2022-08-11 09:50:05 +00:00
|
|
|
update-system =
|
|
|
|
pkgs.writeHaskellScript
|
|
|
|
{
|
|
|
|
name = "update-system";
|
|
|
|
bins = [nixos-rebuild pkgs.nix-output-monitor pkgs.nvd];
|
|
|
|
} ''
|
|
|
|
main = do
|
|
|
|
paths <- myNixPath "${configPath}"
|
|
|
|
args <- getArgs
|
|
|
|
setEnv "WITH_SECRETS" "false"
|
|
|
|
nom_build (paths ++ buildSystemParams ++ ["--no-out-link"] ++ remoteBuildParams ++ fmap toString args)
|
|
|
|
setEnv "WITH_SECRETS" "true"
|
|
|
|
oldSystem <- readlink "-f" "/run/current-system" |> captureTrim
|
|
|
|
nixos_rebuild (paths ++ ["switch"] ++ fmap toString args) &!> StdOut |> nom
|
|
|
|
newSystem <- readlink "-f" "/run/current-system" |> captureTrim
|
|
|
|
nvd "diff" oldSystem newSystem
|
|
|
|
'';
|
2019-08-02 03:17:00 +00:00
|
|
|
}
|