Uživatelské nástroje

Nástroje pro tento web


navody:distribuce:nixos

NixOS

NixOS allows declarative configuration management of the whole system and deployed services.

To start using NixOS on vpsFree.cz, make sure you're on a node with vpsAdminOS, you can recognize it e.g. by the kernel version:

# uname -rv
5.9.2 #1-vpsAdminOS SMP Fri Oct 30 12:31:53 UTC 2020

If you have set your public SSH keys in vpsAdmin the key will be automatically deployed and you can login as root right away. To be able to login with a password you need to set the password manually after your container is created.

Initial setup & informations

After installing NixOS (mainly talking about stable release) you have to know, that there is activated firewall by default blocking everything except ssh (port no. 22) so if you want to run some webserver (for example nginx) you have to tell firewall to not block your ports with this in your /etc/nixos/configuration.nix:nixos

networking.firewall.allowedTCPPorts = [ 80 443 ];

Then don'rt forget to do

 nixos-rebuild switch

so your changes will take effect (without rebooting)

Configuration

Configuration is available at

/etc/nixos/configuration.nix

This can be altered to change container configuration on the fly or for next reboot. Try changing container hostname and running

nixos-rebuild switch

to build new configuration and directly switch to it. To switch to new configuration after reboot (set as a default boot profile) use

nixos-rebuild boot

If you are using channels you can update your system by running

nixos-rebuild switch --upgrade

Package installation

Packages can be installed system wide via configuration.nix or for local profile via

nix-env

To install vim use

nix-env -iA nixos.vim

To search for a package use

nix-env -qaP postgre

Manual

Consult NixOS manual for more https://nixos.org/nixos/manual/

navody/distribuce/nixos.txt · Poslední úprava: 2020/11/30 21:12 autor: Aither