Initial commit
Some checks failed
CI / check (push) Has been cancelled
CI / ida (push) Has been cancelled
CI / cpt (push) Has been cancelled
CI / build-nixos (ena) (push) Has been cancelled
CI / build-nixos (hako) (push) Has been cancelled
CI / build-nixos (kazusa) (push) Has been cancelled
CI / build-nixos (mizuki) (push) Has been cancelled

This commit is contained in:
암냥 2026-07-03 16:53:49 +09:00
commit 70284509f3
No known key found for this signature in database
144 changed files with 7061 additions and 0 deletions

View file

@ -0,0 +1,44 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "dr";
runtimeInputs = with pkgs; [
nix-output-monitor
coreutils
nix
attic-client
];
text = ''
set -e
TARGET_NAME="''${1:-$(hostname -s)}"
FLAKE_PATH="."
UPLOAD_CACHE=true
while [[ $# -gt 0 ]]; do
case "$1" in
--no-upload) UPLOAD_CACHE=false ;;
*) TARGET_NAME="$1" ;;
esac
shift
done
echo "macOS ... ($TARGET_NAME)"
BUILD_PATH=$(nom build "$FLAKE_PATH#darwinConfigurations.$TARGET_NAME.system" --print-out-paths --no-link)
echo " ..."
sudo nix-env --profile /nix/var/nix/profiles/system --set "$BUILD_PATH"
sudo "$BUILD_PATH/activate"
if [ "$UPLOAD_CACHE" = true ]; then
echo " ..."
attic push imnyang "$BUILD_PATH" || echo " "
fi
echo "nix-darwin !"
'';
}

View file

@ -0,0 +1,50 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "nr";
runtimeInputs = with pkgs; [
nix-output-monitor
openssh
coreutils
nix
attic-client
];
text = ''
set -e
TARGET_NAME="''${1:-$(hostname)}"
FLAKE_PATH="."
UPLOAD_CACHE=true
while [[ $# -gt 0 ]]; do
case "$1" in
--no-upload) UPLOAD_CACHE=false ;;
*) TARGET_NAME="$1" ;;
esac
shift
done
EXTRA_BUILD_FLAGS=()
if [ "$TARGET_NAME" = "kazusa" ]; then
EXTRA_BUILD_FLAGS+=("--max-substituter-jobs" "2")
fi
echo " ... $TARGET_NAME"
# shellcheck disable=SC2086
BUILD_PATH=$(nom build "$FLAKE_PATH#nixosConfigurations.$TARGET_NAME.config.system.build.toplevel" \
"''${EXTRA_BUILD_FLAGS[@]}" \
--print-out-paths --no-link)
echo " ..."
sudo nix-env --profile /nix/var/nix/profiles/system --set "$BUILD_PATH"
sudo "$BUILD_PATH/bin/switch-to-configuration" switch
if [ "$UPLOAD_CACHE" = true ]; then
echo " ..."
attic push imnyang "$BUILD_PATH" || echo " "
fi
echo " !"
'';
}

View file

@ -0,0 +1,59 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "nrr";
runtimeInputs = with pkgs; [
nix-output-monitor
openssh
coreutils
];
text = ''
set -e
TARGET_NAME=""
if [ $# -gt 0 ]; then
TARGET_NAME="$1"
fi
FLAKE_PATH="."
declare -A HOST_MAP
HOST_MAP["hikari"]="10.11.8.100"
HOST_MAP["hako"]="10.11.8.102"
HOST_MAP["kazusa"]="82.21.82.30"
HOST_MAP["natsu"]="natsu.icn.mizuki.guru"
HOST_MAP["mafuyu"]="10.20.30.101"
HOST_MAP["mizuki"]="10.20.30.103"
HOST_MAP["ena"]="10.20.30.104"
if [ -z "$TARGET_NAME" ]; then
echo "nrr - NixOS "
echo ": nrr <hostname>"
exit 1
fi
if [[ -v "HOST_MAP[$TARGET_NAME]" ]]; then
TARGET_IP=''${HOST_MAP[$TARGET_NAME]}
echo " : $TARGET_NAME -> $TARGET_IP"
else
echo " ."
exit 1
fi
echo " ..."
BUILD_PATH=$(nom build "$FLAKE_PATH#nixosConfigurations.$TARGET_NAME.config.system.build.toplevel" --print-out-paths --no-link --eval-cache --accept-flake-config)
echo " ... ($BUILD_PATH -> $TARGET_IP)"
nix copy --to "ssh://imnyang@$TARGET_IP" "$BUILD_PATH"
echo " ..."
# shellcheck disable=SC2029
ssh "imnyang@$TARGET_IP" "sudo nix-env --profile /nix/var/nix/profiles/system --set \"$BUILD_PATH\" && sudo $BUILD_PATH/bin/switch-to-configuration switch"
echo " ..."
attic push imnyang "$BUILD_PATH" || echo " "
echo " !"
'';
}