feat: show detailed error messages

This commit is contained in:
Ryan Yin
2024-01-23 09:48:55 +08:00
parent 4a71d5934a
commit b2e9c6a2a7
8 changed files with 43 additions and 1 deletions

View File

@@ -62,6 +62,8 @@ In this configuration, we declare our intention to enable the openssh service, a
To deploy the modified configuration, run `sudo nixos-rebuild switch`. This command will apply the changes, generate a new system environment, and set it as the default. You can now log in to the system using SSH with the configured SSH keys.
> You can always try to add `--show-trace -L` to the `nixos-rebuild` command to get the detailed error message if you encounter any errors during the deployment.
Remember that any reproducible changes to the system can be made by modifying the `/etc/nixos/configuration.nix` file and deploying the changes with `sudo nixos-rebuild switch`.
To find configuration options and documentation:

View File

@@ -248,6 +248,8 @@ After that, you can start the Helix editor by running the `hx` command.
> If your system's hostname is not `nixos-test`, you need to modify the name of `nixosConfigurations` in `flake.nix`, or use `--flake /etc/nixos#nixos-test` to specify the configuration name.
> You can always try to add `--show-trace -L` to the `nixos-rebuild` command to get the detailed error message if you encounter any errors during the deployment.
Furthermore, if you merely want to experiment with the latest version of Helix before deciding whether to install it system-wide, there's a simpler way just a single command:
> Similarly, if you wish to use the latest version, compiling from source is usually unavoidable and may take some time.

View File

@@ -1,5 +1,14 @@
# Other Useful Tips
## Show detailed error messages
You can always try to add `--show-trace -L` to the `nixos-rebuild` command to get the detailed error message if you encounter any errors during the deployment. e.g.
```bash
cd /etc/nixos
sudo nixos-rebuild switch --flake .#myhost --show-trace -L
```
## Managing the Configuration with Git
NixOS configuration, being a set of text files, is well-suited for version control with Git. This allows easy rollback to a previous version in case of issues.
@@ -87,7 +96,7 @@ The following configuration can be added to your NixOS configuration to help red
automatic = true;
dates = "weekly";
options = "--delete-older-than 1w";
};
};
# Optimize storage
# You can also manually optimize the store via: