Hi,
I am new to NixOS. This GitHub repository really helped me out learning how to edit the host files and make it persistent across different NixOS generations. In addition, the configuration.nix
is not messed up with multiple lines because there is a pointer to another file called hosts.nix
.
Moreover, I used Steve Blank host files list in order to block everything listed by his famous repository as Unified hosts + fakenews + gambling + porn + social.
This is my configuration.nix file and my hosts.nix.
This is the key point in the config file template:
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./hosts.nix
];
...
There is a pointer to a file called hosts.nix
that should have something like:
{ config, pkgs, ... }:
{ networking.extraHosts = ''
127.0.0.1 goatse.cx # Example
....
'';
}
Thanks!