1
0
Fork 0

Improve update-system a teeny bit

This commit is contained in:
Malte Brandy 2020-10-12 02:33:25 +02:00
parent dd3b8ed10c
commit 5b06f60c93
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
4 changed files with 7 additions and 9 deletions

View file

@ -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
'';
}

View file

@ -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;

View file

@ -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";

View file

@ -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"]