fix shell.nix error, normalize user and host names, add more info about initial password

This commit is contained in:
Gabriel Fontes 2022-04-25 10:03:15 -03:00
parent 52a5592a5c
commit fa0748a598
No known key found for this signature in database
GPG key ID: 2E54EA7BFE630916
4 changed files with 18 additions and 12 deletions

View file

@ -113,12 +113,14 @@ the latest and greatest nix3 flake-enabled command UX.
## User password and secrets ## User password and secrets
For people fresh from installation: Unless you used `--no-root-passwd`, You have basically two ways of setting up default passwords:
`nixos-install` prompted you for a root password. Use it to log into the root - By default, you'll be prompted for a root password when installing with
account, set your own account's password imperatively with `passwd`, and `nixos-install`. After you reboot, be sure to add a password to your own
disable root login (`sudo passwd -l root`). You can also use `--no-root-passwd` account and lock root using `sudo passwd -l root`.
and instead set `initialPassword` for your user, for a temporary password upon - Alternatively, you can specify `initialPassword` for your user. This will
install. give your account a default password, be sure to change it after rebooting!
If you do, you should pass `--no-root-passwd` to `nixos-install`, to skip
setting a password on the root account.
If you don't want to set your password imperatively, you can also use If you don't want to set your password imperatively, you can also use
`passwordFile` for safely and declaratively setting a password from a file `passwordFile` for safely and declaratively setting a password from a file

View file

@ -41,7 +41,7 @@
# Accessible via 'nixos-rebuild' # Accessible via 'nixos-rebuild'
nixosConfigurations = { nixosConfigurations = {
# FIXME: Replace with your hostname # FIXME: Replace with your hostname
replace-me = nixosSystem { your-hostname = nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -61,9 +61,9 @@
# Accessible via 'home-manager' # Accessible via 'home-manager'
homeConfigurations = { homeConfigurations = {
# FIXME: Replace with your username@hostname # FIXME: Replace with your username@hostname
"replace-me@me-too-please" = homeManagerConfiguration rec { "your-name@your-hostname" = homeManagerConfiguration rec {
# FIXME: Replace with your username # FIXME: Replace with your username
username = "replace-me-daddy"; username = "your-name";
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
system = "x86_64-linux"; system = "x86_64-linux";

View file

@ -45,7 +45,7 @@
# FIXME: Add the rest of your current configuration # FIXME: Add the rest of your current configuration
# TODO: Set your hostname # TODO: Set your hostname
networking.hostName = "cool-computer"; networking.hostName = "your-hostname";
# TODO: This is just an example, be sure to use whatever bootloader you prefer # TODO: This is just an example, be sure to use whatever bootloader you prefer
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@ -53,7 +53,11 @@
# TODO: Configure your system-wide user settings (groups, etc), add more users as needed. # TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
users.users = { users.users = {
# FIXME: Replace with your username # FIXME: Replace with your username
you = { your-name = {
# TODO: You can set an initial password for your user.
# If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
# Be sure to change it (using passwd) after rebooting!
# initialPassword = "correcthorsebatterystaple";
isNormalUser = true; isNormalUser = true;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
# TODO: Add your SSH public key(s) here, if you plan on using SSH to connect # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect

View file

@ -6,7 +6,7 @@
if builtins.pathExists ./flake.lock if builtins.pathExists ./flake.lock
then then
# If we have a lock, fetch locked nixpkgs # If we have a lock, fetch locked nixpkgs
let lock = builtins.fromJSON (builtins.readFile ./flake.lock).nodes.nixpkgs.locked; let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
in in
fetchTarball { fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";