Seems my hosts file (/etc/hosts) points to /nix/store/gds7bha3bx0a22pnzw93pgf0666anpyr-etc-hosts and is read only.
How am I meant to modify this file?
Seems my hosts file (/etc/hosts) points to /nix/store/gds7bha3bx0a22pnzw93pgf0666anpyr-etc-hosts and is read only.
How am I meant to modify this file?
Modify the nixos config (usually in /etc/nixos/configuration.nix) with:
networking.extraHosts =
''
127.0.0.2 other-localhost
10.0.0.1 server
'';
This is documented at NixOS Wiki and defined here.
From Readme of nixos-addblock-hosts
A nixos configuration file that you can import from configuration.nix to block common ad/tracker hosts
Download hosts.nix to /etc/nixos/hosts.nix and add it as import to your /etc/nixos/configuration.nix like this (example):
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./hosts.nix
];
...
Also note this comment from the top of the original hosts file:
# This hosts file is brought to you by Dan Pollock and can be found at # http://someonewhocares.org/hosts/ # You are free to copy and distribute this file for non-commercial uses, # as long the original URL and attribution is included.
PLease also see some github high level code I have no idea about, a chat on discourse.nixos