Skip to content

Commit 5c4a1fb

Browse files
authored
Merge branch 'main' into main
2 parents e453e31 + 97b45ac commit 5c4a1fb

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

scripts/create-release.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu -o pipefail
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
6+
cd "$SCRIPT_DIR/.."
7+
8+
version=${1:-}
9+
if [[ -z $version ]]; then
10+
echo "USAGE: $0 version" >&2
11+
exit 1
12+
fi
13+
14+
if [[ "$(git symbolic-ref --short HEAD)" != "main" ]]; then
15+
echo "must be on main branch" >&2
16+
exit 1
17+
fi
18+
19+
# ensure we are up-to-date
20+
uncommitted_changes=$(git diff --compact-summary)
21+
if [[ -n $uncommitted_changes ]]; then
22+
echo -e "There are uncommitted changes, exiting:\n${uncommitted_changes}" >&2
23+
exit 1
24+
fi
25+
git pull [email protected]:nix-community/nixos-anywhere main
26+
unpushed_commits=$(git log --format=oneline origin/main..main)
27+
if [[ $unpushed_commits != "" ]]; then
28+
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
29+
exit 1
30+
fi
31+
sed -i -e "s!version = \".*\";!version = \"${version}\";!" src/default.nix
32+
git add src/default.nix
33+
nix-shell -p nix-fast-build --command "nix-fast-build --eval-workers 2"
34+
git commit -m "bump version ${version}"
35+
git tag "${version}"
36+
37+
echo "now run 'git push --tags origin main'"

src/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let
3333
in
3434
stdenv.mkDerivation {
3535
pname = "nixos-anywhere";
36-
version = "1.3.0";
36+
version = "1.6.0";
3737
src = ./..;
3838
nativeBuildInputs = [ makeWrapper ];
3939
installPhase = ''

src/nixos-anywhere.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Options:
7474
Also supports variants:
7575
nixos-anywhere --flake .#nixosConfigurations.mymachine.config.virtualisation.vmVariant
7676
* --target-host <ssh-host>
77-
specified the SSH target host to deploy onto.
77+
set the SSH target host to deploy onto.
7878
* -i <identity_file>
7979
selects which SSH private key file to use.
8080
* -p, --ssh-port <ssh_port>
@@ -342,6 +342,9 @@ parseArgs() {
342342
}
343343

344344
# ssh wrapper
345+
runSshNoTty() {
346+
ssh -i "$sshKeyDir"/nixos-anywhere -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${sshArgs[@]}" "$sshConnection" "$@"
347+
}
345348
runSshTimeout() {
346349
timeout 10 ssh -i "$sshKeyDir"/nixos-anywhere -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${sshArgs[@]}" "$sshConnection" "$@"
347350
}
@@ -458,19 +461,18 @@ generateHardwareConfig() {
458461
nixos-facter)
459462
if [[ ${isInstaller} == "y" ]]; then
460463
if [[ ${hasNixOSFacter} == "n" ]]; then
461-
abort "nixos-facter is not available in booted installer. You may want to boot an installer image from here instead: https://github.com/nix-community/nixos-images"
464+
abort "nixos-facter is not available in booted installer, use nixos-generate-config. For nixos-facter, you may want to boot an installer image from here instead: https://github.com/nix-community/nixos-images"
462465
fi
463466
else
464467
maybeSudo=""
465468
fi
466469

467470
step "Generating hardware-configuration.nix using nixos-facter"
468-
# FIXME: if we take the output directly it adds some weird characters at the beginning
469-
runSsh -o ConnectTimeout=10 ${maybeSudo} "nixos-facter" >"$hardwareConfigPath"
471+
runSshNoTty -o ConnectTimeout=10 ${maybeSudo} "nixos-facter" >"$hardwareConfigPath"
470472
;;
471473
nixos-generate-config)
472474
step "Generating hardware-configuration.nix using nixos-generate-config"
473-
runSsh -o ConnectTimeout=10 nixos-generate-config --show-hardware-config --no-filesystems >"$hardwareConfigPath"
475+
runSshNoTty -o ConnectTimeout=10 nixos-generate-config --show-hardware-config --no-filesystems >"$hardwareConfigPath"
474476
;;
475477
*)
476478
abort "Unknown hardware config backend: $hardwareConfigBackend"

0 commit comments

Comments
 (0)