Skip to content

Commit

Permalink
nixos: Update s-t-c and apply help text
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Oct 29, 2024
1 parent 2cf4e11 commit 514ea18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
17 changes: 17 additions & 0 deletions nixos/modules/system/activation/apply/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ die() {
exit 1
}

usage() {
log "NixOS apply invocation error: $*"
cat >&2 <<EOF
Usage: apply [switch|boot|test|dry-activate] [OPTIONS]
Subcommands:
switch make the configuration the boot default and activate it
boot make the configuration the boot default
test activate the configuration, but don\'t make it the boot default
dry-activate show what would be done if this configuration were activated
Options:
--install-bootloader install the bootloader
--profile PROFILE use PROFILE as the target profile (if applicable)
--specialisation NAME use the specialisation NAME
EOF
}


parse_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
Expand Down
7 changes: 2 additions & 5 deletions nixos/modules/system/activation/switch-to-configuration.pl
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,9 @@

if (!defined($action) || ($action ne "switch" && $action ne "boot" && $action ne "test" && $action ne "dry-activate")) {
print STDERR <<"EOF";
error: Unknown action $action
Usage: $0 [switch|boot|test|dry-activate]
switch: make the configuration the boot default and activate now
boot: make the configuration the boot default
test: activate the configuration, but don\'t make it the boot default
dry-activate: show what would be done if this configuration were activated
Consider calling `apply` instead of `switch-to-configuration`.
EOF
exit(1);
}
Expand Down
5 changes: 1 addition & 4 deletions pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,7 @@ fn do_user_switch(parent_exe: String) -> anyhow::Result<()> {
fn usage(argv0: &str) -> ! {
eprintln!(
r#"Usage: {} [switch|boot|test|dry-activate]
switch: make the configuration the boot default and activate now
boot: make the configuration the boot default
test: activate the configuration, but don't make it the boot default
dry-activate: show what would be done if this configuration were activated
Consider calling `apply` instead of `switch-to-configuration`.
"#,
argv0
);
Expand Down

0 comments on commit 514ea18

Please sign in to comment.