nixfmt-rfc-style

There is nothing in this commit except for the changes made by
nix-shell -p nixfmt-rfc-style --run "nixfmt ."

If this has mucked up your open branches then sorry about that. You
can probably nixfmt them to match before merging
This commit is contained in:
Daniel Barlow
2025-02-10 21:55:08 +00:00
parent 13cc5a8992
commit 7e2b0068e6
211 changed files with 6049 additions and 4355 deletions

View File

@@ -1,7 +1,8 @@
{ config, pkgs, ... } :
{ config, pkgs, ... }:
let
inherit (pkgs.pseudofile) dir;
in {
in
{
imports = [
../../modules/outputs/ext4fs.nix
];

View File

@@ -1,15 +1,20 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
}).outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect
socat
] ;
} ''
mkdir vm
${img}/run.sh --background ./vm
expect ${./script.expect} >$out
''
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
];
}
''
mkdir vm
${img}/run.sh --background ./vm
expect ${./script.expect} >$out
''

View File

@@ -1,17 +1,25 @@
let
overlay = import <liminix/overlay.nix>;
pkgs = import <nixpkgs> { overlays = [overlay]; };
script = pkgs.writeFennel "foo" {} ./hello.fnl;
pkgs = import <nixpkgs> { overlays = [ overlay ]; };
script = pkgs.writeFennel "foo" { } ./hello.fnl;
inherit (pkgs.lua.pkgs) fifo;
netlink = pkgs.netlink-lua;
script2 = pkgs.writeFennel "foo2" { packages = [fifo netlink];} ./hello.fnl;
in pkgs.runCommand "check" {
} ''
set -e
# test that it works
test $(${script}) = "hello"
# test that lua path, cpath are set
grep -q ${fifo}/share/lua/5.3 ${script2}
grep -q ${netlink}/lib/lua/5.3 ${script2}
date > $out
''
script2 = pkgs.writeFennel "foo2" {
packages = [
fifo
netlink
];
} ./hello.fnl;
in
pkgs.runCommand "check"
{
}
''
set -e
# test that it works
test $(${script}) = "hello"
# test that lua path, cpath are set
grep -q ${fifo}/share/lua/5.3 ${script2}
grep -q ${netlink}/lib/lua/5.3 ${script2}
date > $out
''

View File

@@ -1,10 +1,16 @@
{ config, pkgs, modulesPath, ... } :
{
config,
pkgs,
modulesPath,
...
}:
let
inherit (pkgs.pseudofile) dir;
svc = config.system.service;
in rec {
in
rec {
imports = [
"${modulesPath}/dhcp6c"
"${modulesPath}/dnsmasq"
@@ -16,7 +22,7 @@ in rec {
"${modulesPath}/mdevd.nix"
];
filesystem = dir { srv = dir {}; };
filesystem = dir { srv = dir { }; };
kernel = {
config = {

View File

@@ -1,37 +1,42 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
}).outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect
socat
e2fsprogs
util-linux # for sfdisk, fallocate
parted
] ;
} ''
mkdir vm
dd if=/dev/zero of=./vm/stick.e2fs bs=1M count=32
mkfs.ext2 -L backup-disk ./vm/stick.e2fs
dd if=/dev/zero of=./vm/stick.img bs=1M count=38
dd if=./vm/stick.e2fs of=./vm/stick.img bs=512 seek=34 conv=notrunc
parted -s ./vm/stick.img -- mklabel gpt mkpart backup-disk ext2 34s -0M
sync
cp ./vm/stick.img ./vm/stick.img.orig
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
e2fsprogs
util-linux # for sfdisk, fallocate
parted
];
}
''
mkdir vm
dd if=/dev/zero of=./vm/stick.e2fs bs=1M count=32
mkfs.ext2 -L backup-disk ./vm/stick.e2fs
dd if=/dev/zero of=./vm/stick.img bs=1M count=38
dd if=./vm/stick.e2fs of=./vm/stick.img bs=512 seek=34 conv=notrunc
parted -s ./vm/stick.img -- mklabel gpt mkpart backup-disk ext2 34s -0M
sync
cp ./vm/stick.img ./vm/stick.img.orig
{
{
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
expect ${./script.expect} late
kill $(cat ./vm/pid)
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
expect ${./script.expect} late
kill $(cat ./vm/pid)
cp ./vm/stick.img.orig ./vm/stick.img
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
expect ${./script.expect} early
cp ./vm/stick.img.orig ./vm/stick.img
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
expect ${./script.expect} early
} | tee $out
} | tee $out
''
''

View File

@@ -1,7 +1,8 @@
{ config, pkgs, ... } :
{ config, pkgs, ... }:
let
inherit (pkgs.pseudofile) dir;
in {
in
{
imports = [
../../vanilla-configuration.nix
../../modules/outputs/squashfs.nix

View File

@@ -1,15 +1,20 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
}).outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect
socat
] ;
} ''
mkdir vm
${img}/run.sh --background ./vm
expect ${./script.expect} >$out
''
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
];
}
''
mkdir vm
${img}/run.sh --background ./vm
expect ${./script.expect} >$out
''

View File

@@ -1,6 +1,6 @@
{ lib, ... } :
{ lib, ... }:
{
imports= [
imports = [
./configuration.nix
../../modules/outputs/ext4fs.nix
];

View File

@@ -1,19 +1,25 @@
{ config, pkgs, lib, ... } :
{
config,
pkgs,
lib,
...
}:
let
inherit (pkgs) dropbear;
inherit (pkgs.liminix.services) longrun;
in {
in
{
imports = [
../../vanilla-configuration.nix
../../modules/outputs/jffs2.nix
];
config = {
config = {
services.sshd = longrun {
name = "sshd";
run = ''
mkdir -p /run/dropbear
${dropbear}/bin/dropbear -E -P /run/dropbear.pid -R -F
'';
mkdir -p /run/dropbear
${dropbear}/bin/dropbear -E -P /run/dropbear.pid -R -F
'';
};
users.root = {

View File

@@ -1,29 +1,35 @@
let lmx = (import <liminix> {
let
lmx = (
import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
});
rogue = lmx.pkgs.rogue;
img = lmx.outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect
socat
min-copy-closure
rogue
] ;
} ''
. ${../test-helpers.sh}
}
);
rogue = lmx.pkgs.rogue;
img = lmx.outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
min-copy-closure
rogue
];
}
''
. ${../test-helpers.sh}
(
mkdir vm
${img}/run.sh --lan user,hostfwd=tcp::2022-:22 --background ./vm
expect ${./wait-until-ready.expect}
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
$SSH_COMMAND root@localhost echo ready
IN_NIX_BUILD=true min-copy-closure --quiet root@localhost ${rogue}
$SSH_COMMAND root@localhost ls -ld ${rogue}
IN_NIX_BUILD=true min-copy-closure --root /run root@localhost ${rogue}
$SSH_COMMAND root@localhost ls -ld /run/${rogue}
) 2>&1 | tee $out
''
(
mkdir vm
${img}/run.sh --lan user,hostfwd=tcp::2022-:22 --background ./vm
expect ${./wait-until-ready.expect}
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
$SSH_COMMAND root@localhost echo ready
IN_NIX_BUILD=true min-copy-closure --quiet root@localhost ${rogue}
$SSH_COMMAND root@localhost ls -ld ${rogue}
IN_NIX_BUILD=true min-copy-closure --root /run root@localhost ${rogue}
$SSH_COMMAND root@localhost ls -ld /run/${rogue}
) 2>&1 | tee $out
''

View File

@@ -1,6 +1,6 @@
{ pkgs, ... } :
{ pkgs, ... }:
{
imports= [./config-ext4.nix];
imports = [ ./config-ext4.nix ];
defaultProfile.packages = with pkgs; [
figlet
];

View File

@@ -1,11 +1,14 @@
{ config, pkgs, ... } :
{ config, pkgs, ... }:
let
inherit (pkgs.liminix.services) target;
svc = config.system.service;
in rec {
in
rec {
services.lan4 = svc.network.address.build {
interface = config.hardware.networkInterfaces.lan;
family = "inet"; address ="192.168.19.1"; prefixLength = 24;
family = "inet";
address = "192.168.19.1";
prefixLength = 24;
};
imports = [
@@ -14,12 +17,11 @@ in rec {
../../modules/network
];
services.pppoe =
svc.pppoe.build {
interface = config.hardware.networkInterfaces.wan;
username = "db123@a.1";
password= "NotReallyTheSecret";
};
services.pppoe = svc.pppoe.build {
interface = config.hardware.networkInterfaces.wan;
username = "db123@a.1";
password = "NotReallyTheSecret";
};
services.defaultroute4 = svc.network.route.build {
via = "$(output ${services.pppoe} address)";
@@ -28,15 +30,14 @@ in rec {
};
services.packet_forwarding = svc.network.forward.build {
dependencies = [services.pppoe];
dependencies = [ services.pppoe ];
};
services.dns =
svc.dnsmasq.build {
interface = services.lan4;
ranges = ["192.168.19.10,192.168.19.253"];
domain = "fake.liminix.org";
};
services.dns = svc.dnsmasq.build {
interface = services.lan4;
ranges = [ "192.168.19.10,192.168.19.253" ];
domain = "fake.liminix.org";
};
defaultProfile.packages = [ pkgs.hello ] ;
defaultProfile.packages = [ pkgs.hello ];
}

View File

@@ -1,34 +1,39 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
}).outputs.default;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
inherit (pkgs.pkgsBuildBuild) routeros;
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
python3Packages.scapy
expect
jq
socat
routeros.routeros
] ;
} ''
serverstatedir=$(mktemp -d -t routeros-XXXXXX)
# python scapy drags in matplotlib which doesn't enjoy running in
# a sandbox with no $HOME, hence this environment variable
export MPLCONFIGDIR=$(mktemp -d -t routeros-XXXXXX)
export XDG_CONFIG_HOME=/tmp
export XDG_CACHE_HOME=/tmp
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
inherit (pkgs.pkgsBuildBuild) routeros;
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
python3Packages.scapy
expect
jq
socat
routeros.routeros
];
}
''
serverstatedir=$(mktemp -d -t routeros-XXXXXX)
# python scapy drags in matplotlib which doesn't enjoy running in
# a sandbox with no $HOME, hence this environment variable
export MPLCONFIGDIR=$(mktemp -d -t routeros-XXXXXX)
export XDG_CONFIG_HOME=/tmp
export XDG_CACHE_HOME=/tmp
. ${../test-helpers.sh}
. ${../test-helpers.sh}
routeros $serverstatedir
mkdir vm
${img}/run.sh --background ./vm
expect ${./getaddress.expect}
routeros $serverstatedir
mkdir vm
${img}/run.sh --background ./vm
expect ${./getaddress.expect}
set -o pipefail
response=$(python ${./test-dhcp-service.py})
echo "$response" | jq -e 'select((.router == "192.168.19.1") and (.server_id=="192.168.19.1"))'
echo $response > $out
''
set -o pipefail
response=$(python ${./test-dhcp-service.py})
echo "$response" | jq -e 'select((.router == "192.168.19.1") and (.server_id=="192.168.19.1"))'
echo $response > $out
''

View File

@@ -1,15 +1,18 @@
{
pseudofile
}: let
pseudofile,
}:
let
inherit (pseudofile) dir;
structure = {
service = dir {
s6-linux-init-runleveld = dir {
notification-fd = { file = "3"; };
notification-fd = {
file = "3";
};
run = {
file = ''
hello
world
hello
world
'';
mode = "0755";
};
@@ -21,8 +24,8 @@
};
run = {
file = ''
s6-linux-init/bin/s6-linux-init-shutdownd -c "/etc/s6-linux-init/current" -g 3000
'';
s6-linux-init/bin/s6-linux-init-shutdownd -c "/etc/s6-linux-init/current" -g 3000
'';
mode = "0755";
};
@@ -32,14 +35,19 @@
type = "i";
mode = "0600";
};
notification-fd = { file = "3"; };
notification-fd = {
file = "3";
};
run = {
file = ''
gdsgdfgsdgf
gdsgdfgsdgf
'';
};
};
};
uncaught-logs = (dir {}) // {mode = "2750";};
uncaught-logs = (dir { }) // {
mode = "2750";
};
};
in pseudofile.write "pseudo.s6-init" structure
in
pseudofile.write "pseudo.s6-init" structure

View File

@@ -1,15 +1,21 @@
let
overlay = import <liminix/overlay.nix>;
pkgs = import <nixpkgs> { overlays = [overlay]; };
fixture = pkgs.callPackage ./fixture.nix {};
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [ squashfsTools qprint ] ;
} ''
set -e
diff ${fixture} ${./result.expected}
test -f /tmp/out.squashfs && rm /tmp/out.squashfs
mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf ${fixture} -quiet -no-progress
foo="$(unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run)"
test "$foo" = "$(printf "hello\nworld")"
date > $out
''
pkgs = import <nixpkgs> { overlays = [ overlay ]; };
fixture = pkgs.callPackage ./fixture.nix { };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
squashfsTools
qprint
];
}
''
set -e
diff ${fixture} ${./result.expected}
test -f /tmp/out.squashfs && rm /tmp/out.squashfs
mksquashfs - /tmp/out.squashfs -p '/ d 755 0 0' -pf ${fixture} -quiet -no-progress
foo="$(unsquashfs -cat /tmp/out.squashfs service/s6-linux-init-runleveld/run)"
test "$foo" = "$(printf "hello\nworld")"
date > $out
''

View File

@@ -1,24 +1,32 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = <liminix/vanilla-configuration.nix>;
}).outputs.rootfs;
pkgs = import <nixpkgs> {};
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [ squashfsTools s6-rc ] ;
} ''
destpath=$(mktemp -d)/smoke.img
echo $destpath
cleanup(){ test -n $destpath && test -d $destpath && chmod -R +w $destpath && rm -rf $destpath; }
trap cleanup EXIT
trap 'echo "command $(eval echo $BASH_COMMAND) failed with exit code $?"; exit $?' ERR
unsquashfs -q -d $destpath -excludes ${img} /dev
cd $destpath;
db=nix/store/*-s6-rc-database/compiled/
test -d $db
chmod -R +w $db
# check we have closure of config.services (lo.link service exists only
# as a dependency)
test "$(s6-rc-db -c $db type lo.link)" = "oneshot"
test "$(s6-rc-db -c $db type ntp)" = "longrun"
echo OK > $out
''
pkgs = import <nixpkgs> { };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
squashfsTools
s6-rc
];
}
''
destpath=$(mktemp -d)/smoke.img
echo $destpath
cleanup(){ test -n $destpath && test -d $destpath && chmod -R +w $destpath && rm -rf $destpath; }
trap cleanup EXIT
trap 'echo "command $(eval echo $BASH_COMMAND) failed with exit code $?"; exit $?' ERR
unsquashfs -q -d $destpath -excludes ${img} /dev
cd $destpath;
db=nix/store/*-s6-rc-database/compiled/
test -d $db
chmod -R +w $db
# check we have closure of config.services (lo.link service exists only
# as a dependency)
test "$(s6-rc-db -c $db type lo.link)" = "oneshot"
test "$(s6-rc-db -c $db type ntp)" = "longrun"
echo OK > $out
''

View File

@@ -1,18 +1,31 @@
{ config, pkgs, lib, lim, ... } :
{
config,
pkgs,
lib,
lim,
...
}:
let
inherit (pkgs.pseudofile) dir;
dts = pkgs.runCommand "qemu.dts" {
nativeBuildInputs = with pkgs.pkgsBuildBuild; [ dtc qemu ];
} ''
qemu-system-${pkgs.stdenv.hostPlatform.qemuArch} \
-machine virt -machine dumpdtb=tmp.dtb
dtc -I dtb -O dts -o $out tmp.dtb
# https://stackoverflow.com/a/69890137,
# XXX try fdtput $out -p -t s /pl061@9030000 status disabled
# instead of using sed
sed -i $out -e 's/compatible = "arm,pl061.*/status = "disabled";/g'
'';
in {
dts =
pkgs.runCommand "qemu.dts"
{
nativeBuildInputs = with pkgs.pkgsBuildBuild; [
dtc
qemu
];
}
''
qemu-system-${pkgs.stdenv.hostPlatform.qemuArch} \
-machine virt -machine dumpdtb=tmp.dtb
dtc -I dtb -O dts -o $out tmp.dtb
# https://stackoverflow.com/a/69890137,
# XXX try fdtput $out -p -t s /pl061@9030000 status disabled
# instead of using sed
sed -i $out -e 's/compatible = "arm,pl061.*/status = "disabled";/g'
'';
in
{
imports = [
../../modules/outputs/ext4fs.nix
../../modules/outputs/tftpboot.nix
@@ -25,12 +38,14 @@ in {
hardware.dts.src = lib.mkOverride 500 dts;
boot.tftp = {
loadAddress =
let offsets = {
mips = "0x88000000";
arm = "0x44000000";
aarch64 = "0x44000000";
};
in lim.parseInt offsets.${pkgs.stdenv.hostPlatform.qemuArch} ;
let
offsets = {
mips = "0x88000000";
arm = "0x44000000";
aarch64 = "0x44000000";
};
in
lim.parseInt offsets.${pkgs.stdenv.hostPlatform.qemuArch};
serverip = "10.0.2.2";
ipaddr = "10.0.2.15";
};

View File

@@ -1,44 +1,55 @@
let check = deviceName : config :
let derivation = (import <liminix> {
device = import (<liminix/devices> + "/${deviceName}");
liminix-config = { ... } : {
imports = [./configuration.nix];
inherit config;
};
});
img = derivation.outputs.tftpboot;
uboot = derivation.outputs.u-boot;
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
in pkgsBuild.runCommand "check-${deviceName}" {
nativeBuildInputs = with pkgsBuild; [
expect
socat
run-liminix-vm
] ;
} ''
mkdir vm
ln -s ${img} result
let
check =
deviceName: config:
let
derivation = (
import <liminix> {
device = import (<liminix/devices> + "/${deviceName}");
liminix-config =
{ ... }:
{
imports = [ ./configuration.nix ];
inherit config;
};
}
);
img = derivation.outputs.tftpboot;
uboot = derivation.outputs.u-boot;
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
in
pkgsBuild.runCommand "check-${deviceName}"
{
nativeBuildInputs = with pkgsBuild; [
expect
socat
run-liminix-vm
];
}
''
mkdir vm
ln -s ${img} result
touch empty empty2
touch empty empty2
run-liminix-vm \
--background ./vm \
--u-boot ${uboot}/u-boot.bin \
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
--wan "user,tftp=`pwd`" \
--disk-image empty2 \
empty empty2
run-liminix-vm \
--background ./vm \
--u-boot ${uboot}/u-boot.bin \
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
--wan "user,tftp=`pwd`" \
--disk-image empty2 \
empty empty2
expect ${./script.expect} 2>&1 |tee $out
'';
in {
aarch64 = check "qemu-aarch64" {};
arm = check "qemu-armv7l" {};
armZimage = check "qemu-armv7l" {
expect ${./script.expect} 2>&1 |tee $out
'';
in
{
aarch64 = check "qemu-aarch64" { };
arm = check "qemu-armv7l" { };
armZimage = check "qemu-armv7l" {
boot.tftp.kernelFormat = "zimage";
};
mips = check "qemu" {};
mipsLz = check "qemu" {
mips = check "qemu" { };
mipsLz = check "qemu" {
boot.tftp.compressRoot = true;
};
# this works on real hardware but I haven't figured out how

View File

@@ -1,11 +1,12 @@
{ config, pkgs, ... } :
{ config, pkgs, ... }:
let
# EDIT: you can pick your preferred RFC1918 address space
# for NATted connections, if you don't like this one.
ipv4LocalNet = "10.8.0";
svc = config.system.service;
in rec {
in
rec {
imports = [
../../modules/bridge
../../modules/dhcp6c
@@ -22,13 +23,14 @@ in rec {
services.int = svc.network.address.build {
interface = svc.bridge.primary.build { ifname = "int"; };
family = "inet"; address = "${ipv4LocalNet}.1"; prefixLength = 16;
family = "inet";
address = "${ipv4LocalNet}.1";
prefixLength = 16;
};
services.bridge = svc.bridge.members.build {
services.bridge = svc.bridge.members.build {
primary = services.int;
members = with config.hardware.networkInterfaces;
[ lan ];
members = with config.hardware.networkInterfaces; [ lan ];
};
services.sshd = svc.ssh.build { };
@@ -46,7 +48,7 @@ in rec {
defaultProfile.packages = with pkgs; [
min-collect-garbage
# strace
# strace
# ethtool
tcpdump
];

View File

@@ -1,15 +1,20 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu>;
liminix-config = ./configuration.nix;
}).outputs.vmroot;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect
socat
] ;
} ''
mkdir vm
${img}/run.sh --flag -S --background ./vm
expect ${./script.expect} | tee $out
''
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
];
}
''
mkdir vm
${img}/run.sh --flag -S --background ./vm
expect ${./script.expect} | tee $out
''

View File

@@ -1,7 +1,8 @@
{ config, pkgs, ... } :
{ config, pkgs, ... }:
let
inherit (pkgs.liminix.networking) interface hostapd;
in rec {
in
rec {
imports = [
../../modules/wlan.nix
../../modules/hostapd
@@ -13,18 +14,18 @@ in rec {
params = {
ssid = "liminix";
country_code = "GB";
hw_mode="g";
hw_mode = "g";
channel = "2";
wmm_enabled = 1;
ieee80211n = 1;
wpa_passphrase = "colourless green ideas";
auth_algs = 1; # 1=wpa2, 2=wep, 3=both
wpa = 2; # 1=wpa, 2=wpa2, 3=both
wpa = 2; # 1=wpa, 2=wpa2, 3=both
wpa_key_mgmt = "WPA-PSK";
wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?)
rsn_pairwise = "CCMP"; # auth for wpa2
wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?)
rsn_pairwise = "CCMP"; # auth for wpa2
};
};
defaultProfile.packages = with pkgs; [ tcpdump ] ;
defaultProfile.packages = with pkgs; [ tcpdump ];
}

View File

@@ -1,16 +1,22 @@
let img = (import <liminix> {
let
img =
(import <liminix> {
device = import <liminix/devices/qemu-armv7l>;
liminix-config = ./configuration.nix;
}).outputs.default;
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
in pkgs.runCommand "check" {
nativeBuildInputs = with pkgs; [
expect socat
] ;
} ''
. ${../test-helpers.sh}
pkgs = import <nixpkgs> { overlays = [ (import ../../overlay.nix) ]; };
in
pkgs.runCommand "check"
{
nativeBuildInputs = with pkgs; [
expect
socat
];
}
''
. ${../test-helpers.sh}
mkdir vm
${img}/run.sh --background ./vm
expect ${./wait-for-wlan.expect} |tee output && mv output $out
''
mkdir vm
${img}/run.sh --background ./vm
expect ${./wait-for-wlan.expect} |tee output && mv output $out
''