Use vscode editor configuration.nix cant save

code /etc/nixos/configuration.nix

use root user try save

not save “configuration.nix”: Unable to find pkexec or kdesudo.

how to deal with? need to config with some things?

Use sudoedit or sudo -e to edit the /etc/nixos/configuration.nix or edit in a user owned location and build from there using an appropriate nix path entry for nixos-config.

use sudo -e or sudo vim can edit, but use code for edit cant write the file.

You can use vscode with sudo -e by setting EDITOR="code --wait".

Remember to close it that changes are actually applied to the file.

1 Like

thk you, its working.