liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit bb280c6d97e4c776dc68dd7acb90568e49d17330
parent b7e805c97f7f530a259b8f540faf221a84a03dd9
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 15 Sep 2023 17:25:02 +0100

rename qemu example

Diffstat:
Mdoc/new.rst | 2+-
Aexamples/hello-from-qemu.nix | 44++++++++++++++++++++++++++++++++++++++++++++
Dexamples/hellonet.nix | 46----------------------------------------------
3 files changed, 45 insertions(+), 47 deletions(-)

diff --git a/doc/new.rst b/doc/new.rst @@ -48,7 +48,7 @@ Now build Liminix .. code-block:: console - nix-build -I liminix-config=./examples/hellonet.nix \ + nix-build -I liminix-config=./examples/hello-from-qemu.nix \ --arg device "import ./devices/qemu" -A outputs.default In this command ``liminix-config`` points to the desired software diff --git a/examples/hello-from-qemu.nix b/examples/hello-from-qemu.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... } : +let + inherit (pkgs) serviceFns; + svc = config.system.service; + +in rec { + imports = [ + ../modules/network + ../modules/dnsmasq + ../modules/ssh + ]; + + hostname = "hello"; + + # configure the internal network (LAN) with an address + services.int = svc.network.address.build { + interface = config.hardware.networkInterfaces.lan; + family = "inet"; address ="10.3.0.1"; prefixLength = 16; + }; + + services.sshd = svc.ssh.build { }; + + users.root = { + # the password is "secret". Use mkpasswd -m sha512crypt to + # create this hashed password string + passwd = "$6$y7WZ5hM6l5nriLmo$5AJlmzQZ6WA.7uBC7S8L4o19ESR28Dg25v64/vDvvCN01Ms9QoHeGByj8lGlJ4/b.dbwR9Hq2KXurSnLigt1W1"; + }; + + services.dns = + let interface = services.int; + in svc.dnsmasq.build { + inherit interface; + ranges = [ + "10.3.0.10,10.3.0.240" + "::,constructor:$(output ${interface} ifname),ra-stateless" + ]; + + domain = "example.org"; + }; + + defaultProfile.packages = with pkgs; [ + figlet + ]; +} diff --git a/examples/hellonet.nix b/examples/hellonet.nix @@ -1,46 +0,0 @@ -{ config, pkgs, lib, ... } : -let - inherit (pkgs) serviceFns; - svc = config.system.service; - -in rec { - imports = [ - ../modules/network - ../modules/dnsmasq - ../modules/ssh - ]; - hostname = "hellonet"; - - services.int = svc.network.address.build { - interface = config.hardware.networkInterfaces.lan; - family = "inet"; address ="10.3.0.1"; prefixLength = 16; - }; - - services.sshd = svc.ssh.build { }; - - users.root = { - # the password is "secret". Use mkpasswd -m sha512crypt to - # create this hashed password string - passwd = "$6$y7WZ5hM6l5nriLmo$5AJlmzQZ6WA.7uBC7S8L4o19ESR28Dg25v64/vDvvCN01Ms9QoHeGByj8lGlJ4/b.dbwR9Hq2KXurSnLigt1W1"; - }; - - services.dns = - let interface = services.int; - in svc.dnsmasq.build { - inherit interface; - ranges = [ - "10.3.0.10,10.3.0.240" - # ra-stateless: sends router advertisements with the O and A - # bits set, and provides a stateless DHCP service. The client - # will use a SLAAC address, and use DHCP for other - # configuration information. - "::,constructor:$(output ${interface} ifname),ra-stateless" - ]; - - domain = "example.org"; - }; - - defaultProfile.packages = with pkgs; [ - figlet - ]; -}