Users
This commit is contained in:
@ -84,9 +84,44 @@ For more hardware-specific settings, see https://github.com/NixOS/nixos-hardware
|
||||
...
|
||||
```
|
||||
|
||||
Now you can reboot and progress to the post install.
|
||||
|
||||
# Post install
|
||||
|
||||
TODO: adding a user and git.
|
||||
Now, you can log into the root user.
|
||||
|
||||
First of, time to add a user.
|
||||
This can be done in `/etc/nixos/configuration.nix` by adding the following (The editor **nano** is installed by default):
|
||||
```nix
|
||||
users.users.<name> = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ]; #Enables sudo for the user;
|
||||
packages = with pkgs; [
|
||||
];
|
||||
}
|
||||
```
|
||||
Please change `<name>` to the username you want, and then run `nixos-rebuild switch --flake .#nixos -L` to rebuild the system with the user added.
|
||||
Then run `passwd <name>` to change their password.
|
||||
|
||||
Logout and login to your new user.
|
||||
|
||||
It is now time to make this version controlled.
|
||||
Run `cp -r /etc/nixos dots` to copy the configuration to the local folder dots.
|
||||
Then run `cd dots` and edit `configuration.nix` by adding:
|
||||
```nix
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
neovim # or another editor if you want
|
||||
];
|
||||
```
|
||||
Then run `nixos-rebuild switch --flake .#nixos -L`.
|
||||
Now you have git and another editor installed globally.
|
||||
Time to run `git init && git add .` to save your current config.
|
||||
Now, if you add files that are used by your configuration but not added to git, the rebuild will fail.
|
||||
This is done to ensure a rebuildable system.
|
||||
But remember, do not include secrets within your configuration, unless you have a good system.
|
||||
|
||||
After fixing a good setup, please setup a remote for git, so that you are able to rebuild when needed, or just share your magnificent setup.
|
||||
|
||||
# Further reading
|
||||
With this you have an installed system, with a user, but not much more.
|
||||
|
Reference in New Issue
Block a user