From b1f4db00a07cce0cdd7d7d62eb52328a1dbef98a Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 17 May 2023 15:03:45 +0100 Subject: [PATCH] add liminix-rebuild command --- pkgs/min-copy-closure/default.nix | 1 + pkgs/min-copy-closure/liminix-rebuild.sh | 14 ++++++++++++++ pkgs/systemconfig/default.nix | 2 ++ 3 files changed, 17 insertions(+) create mode 100755 pkgs/min-copy-closure/liminix-rebuild.sh diff --git a/pkgs/min-copy-closure/default.nix b/pkgs/min-copy-closure/default.nix index ec77177..f0dcf6b 100644 --- a/pkgs/min-copy-closure/default.nix +++ b/pkgs/min-copy-closure/default.nix @@ -11,5 +11,6 @@ installPhase = '' mkdir -p $out/bin cp min-copy-closure.sh $out/bin/min-copy-closure + cp liminix-rebuild.sh $out/bin/liminix-rebuild ''; } diff --git a/pkgs/min-copy-closure/liminix-rebuild.sh b/pkgs/min-copy-closure/liminix-rebuild.sh new file mode 100755 index 0000000..e1544fd --- /dev/null +++ b/pkgs/min-copy-closure/liminix-rebuild.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +target_host=$1 +shift + +if [ -z "$target_host" ] ; then + echo Usage: liminix-rebuild target-host params + exit 1 +fi + +toplevel=$(nix-build "$@" -A outputs.systemConfiguration --no-out-link) +min-copy-closure $target_host $toplevel +ssh $target_host cp -P $toplevel/bin/\* / +ssh $target_host reboot diff --git a/pkgs/systemconfig/default.nix b/pkgs/systemconfig/default.nix index 8b40af0..a162e5f 100644 --- a/pkgs/systemconfig/default.nix +++ b/pkgs/systemconfig/default.nix @@ -7,6 +7,7 @@ { writeText , lib +, s6-init-bin , stdenv }: let @@ -74,5 +75,6 @@ in attrset: installPhase = '' mkdir -p $out/bin $STRIP --remove-section=.note --remove-section=.comment --strip-all makedevs -o $out/bin/activate + ln -s ${s6-init-bin}/bin/init $out/bin/init ''; }