hello-from-qemu.nix (1049B)
1 { config, pkgs, lib, ... } : 2 let 3 inherit (pkgs) serviceFns; 4 svc = config.system.service; 5 6 in rec { 7 imports = [ 8 ../modules/network 9 ../modules/dnsmasq 10 ../modules/ssh 11 ]; 12 13 hostname = "hello"; 14 15 # configure the internal network (LAN) with an address 16 services.int = svc.network.address.build { 17 interface = config.hardware.networkInterfaces.lan; 18 family = "inet"; address ="10.3.0.1"; prefixLength = 16; 19 }; 20 21 services.sshd = svc.ssh.build { }; 22 23 users.root = { 24 # the password is "secret". Use mkpasswd -m sha512crypt to 25 # create this hashed password string 26 passwd = "$6$y7WZ5hM6l5nriLmo$5AJlmzQZ6WA.7uBC7S8L4o19ESR28Dg25v64/vDvvCN01Ms9QoHeGByj8lGlJ4/b.dbwR9Hq2KXurSnLigt1W1"; 27 }; 28 29 services.dns = 30 let interface = services.int; 31 in svc.dnsmasq.build { 32 inherit interface; 33 ranges = [ 34 "10.3.0.10,10.3.0.240" 35 "::,constructor:$(output ${interface} ifname),ra-stateless" 36 ]; 37 38 domain = "example.org"; 39 }; 40 41 defaultProfile.packages = with pkgs; [ 42 figlet 43 ]; 44 }