Improve update-system a teeny bit
This commit is contained in:
parent
dd3b8ed10c
commit
5b06f60c93
|
@ -3,7 +3,7 @@ let configPath = "/etc/nixos";
|
|||
in {
|
||||
update-system = pkgs.writeHaskellScript {
|
||||
name = "update-system";
|
||||
bins = [ nixos-rebuild ];
|
||||
bins = [ nixos-rebuild pkgs.nix-output-monitor ];
|
||||
} ''
|
||||
privatePath = "${configPath}/private"
|
||||
canaryPath = privatePath <> "/submodule-is-checked-out"
|
||||
|
@ -12,8 +12,7 @@ in {
|
|||
paths <- myNixPath "${configPath}"
|
||||
args <- getArgs
|
||||
bracket (rm canaryPath) (\() -> exe "/run/wrappers/bin/sudo" "-u" "maralorn" "git" "-C" privatePath "restore" canaryPath) $ \() -> do
|
||||
nixos_rebuild (paths ++ ["build"] ++ remoteBuildParams ++ fmap toString args)
|
||||
rm "result"
|
||||
nixos_rebuild (paths ++ ["switch"] ++ fmap toString args)
|
||||
nix_build (paths ++ buildSystemParams ++ ["--no-out-link"] ++ remoteBuildParams ++ fmap toString args) &!> StdOut |> nom
|
||||
nixos_rebuild (paths ++ ["switch"] ++ fmap toString args) &!> StdOut |> nom
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
# You need pw-files for every configured user in ./secret/pw-useralias for login to work.
|
||||
# dropbearkey -t rsa -f /etc/nixos/nixos/machines/<hostname>/secret/boot_rsa
|
||||
|
||||
let
|
||||
inherit (config.m-0.private) me;
|
||||
inherit (import ../../../common/common.nix { inherit pkgs; }) syncthing;
|
||||
|
|
|
@ -25,7 +25,7 @@ in {
|
|||
name = "test-system-config";
|
||||
inherit bins;
|
||||
inherit imports;
|
||||
} (haskellBody "system" ''nix_build $ ["<nixpkgs/nixos>", "-A", "system"] ++ paths ++ ["-I", [i|nixos-config=#{configDir}/nixos/machines/#{hostname}/configuration.nix|], "-o", [i|result-system-#{hostname}|]] ++ fmap toString args'');
|
||||
} (haskellBody "system" ''nix_build $ buildSystemParams ++ paths ++ ["-I", [i|nixos-config=#{configDir}/nixos/machines/#{hostname}/configuration.nix|], "-o", [i|result-system-#{hostname}|]] ++ fmap toString args'');
|
||||
|
||||
test-home-config = self.writeHaskellScript {
|
||||
name = "test-home-config";
|
||||
|
|
|
@ -55,6 +55,9 @@ self: super: {
|
|||
tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String]
|
||||
getNivAssign name = tag name <$> getNivPath path name
|
||||
|
||||
buildSystemParams :: [String]
|
||||
buildSystemParams = ["<nixpkgs/nixos>", "-A", "system"]
|
||||
|
||||
remoteBuildParams :: [String]
|
||||
remoteBuildParams = ["--builders", "@/etc/nix/machines", "--max-jobs", "1"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue