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