Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
b11e752c02 | |||
876909959c |
29 changed files with 47 additions and 199 deletions
|
@ -17,34 +17,4 @@ jobs:
|
|||
- name: Build VM QEMU MIPS
|
||||
run: |
|
||||
# Enter the shell
|
||||
nix-build ci.nix -A qemu
|
||||
|
||||
build_zyxel-nwa50ax_mips:
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build VM QEMU MIPS
|
||||
run: |
|
||||
# Enter the shell
|
||||
nix-build ci.nix -A qemu
|
||||
|
||||
test_hostapd:
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build VM QEMU MIPS
|
||||
run: |
|
||||
# Enter the shell
|
||||
nix-build ci.nix -A wlan
|
||||
|
||||
test_shell_customization:
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build VM QEMU MIPS
|
||||
run: |
|
||||
# Enter the shell
|
||||
nix-build ci.nix -A custom-shell
|
||||
nix-build -I liminix-config=./examples/hello-from-qemu.nix --arg device "import ./devices/qemu" -A outputs.default
|
||||
|
|
4
ci.nix
4
ci.nix
|
@ -7,7 +7,7 @@
|
|||
let
|
||||
pkgs = (import nixpkgs { });
|
||||
borderVmConf = ./bordervm.conf-example.nix;
|
||||
inherit (pkgs.lib.attrsets) genAttrs mapAttrs;
|
||||
inherit (pkgs.lib.attrsets) genAttrs;
|
||||
devices = [
|
||||
"qemu"
|
||||
"zyxel-nwa50ax"
|
||||
|
@ -19,7 +19,7 @@ let
|
|||
device = import (liminix + "/devices/${name}");
|
||||
liminix-config = vanilla;
|
||||
}).outputs.default;
|
||||
tests = mapAttrs (_: v: v { inherit liminix nixpkgs; }) (import ./tests/ci.nix);
|
||||
tests = import ./tests/ci.nix;
|
||||
jobs =
|
||||
(genAttrs devices for-device) //
|
||||
tests //
|
||||
|
|
|
@ -26,13 +26,9 @@ let
|
|||
eval = evalModules {
|
||||
modules = [
|
||||
{
|
||||
nixpkgs = {
|
||||
source = nixpkgs;
|
||||
overlays = [ overlay ];
|
||||
config.permittedInsecurePackages = [
|
||||
"python-2.7.18.8"
|
||||
nixpkgs.overlays = [
|
||||
overlay
|
||||
];
|
||||
};
|
||||
}
|
||||
device.module
|
||||
liminix-config
|
||||
|
|
|
@ -4,13 +4,11 @@
|
|||
|
||||
{ lib, pkgs, config, ...}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr concatStringsSep mapAttrsToList;
|
||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||
inherit (pkgs.pseudofile) dir symlink;
|
||||
inherit (pkgs.liminix.networking) address interface;
|
||||
inherit (pkgs.liminix.services) bundle;
|
||||
|
||||
# TODO: escape shell argument.
|
||||
exportVar = name: value: "export ${name}=\"${value}\"";
|
||||
type_service = pkgs.liminix.lib.types.service;
|
||||
|
||||
in {
|
||||
|
@ -24,24 +22,6 @@ in {
|
|||
/run/current-system, we just add the paths in /etc/profile
|
||||
'';
|
||||
};
|
||||
|
||||
environmentVariables = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = ''
|
||||
Attribute set of environment variables to make available
|
||||
in a login shell.
|
||||
|
||||
The value is assumed to be escaped and the name to be valid.
|
||||
'';
|
||||
};
|
||||
|
||||
prompt = mkOption {
|
||||
type = types.str;
|
||||
default = "$(whoami)@$(hostname) # ";
|
||||
description = ''
|
||||
Prompt string (PS1) for the shell.
|
||||
'';
|
||||
};
|
||||
};
|
||||
services = mkOption {
|
||||
type = types.attrsOf type_service;
|
||||
|
@ -125,14 +105,15 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [ ./nixpkgs.nix ];
|
||||
|
||||
config = {
|
||||
# By default, we enable cross-compilation support.
|
||||
nixpkgs.buildPlatform = lib.mkDefault builtins.currentSystem;
|
||||
|
||||
defaultProfile.packages = with pkgs;
|
||||
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
|
||||
# Set the useful PS1 prompt by default.
|
||||
defaultProfile.environmentVariables.PS1 = lib.mkDefault config.defaultProfile.prompt;
|
||||
|
||||
boot.commandLine = [
|
||||
"panic=10 oops=panic init=/bin/init loglevel=8"
|
||||
|
@ -205,7 +186,6 @@ in {
|
|||
(pkgs.writeScript ".profile" ''
|
||||
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
|
||||
export PATH
|
||||
${concatStringsSep "\n" (mapAttrsToList exportVar config.defaultProfile.environmentVariables)}
|
||||
'');
|
||||
in dir {
|
||||
inherit profile;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ lib, pkgs, config, ...}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (pkgs.liminix.services) oneshot;
|
||||
in {
|
||||
options = {
|
||||
hostname = mkOption {
|
||||
|
@ -11,21 +12,12 @@ in {
|
|||
default = "liminix";
|
||||
type = types.nonEmptyStr;
|
||||
};
|
||||
hostname-script = mkOption {
|
||||
description = ''
|
||||
Script that outputs the system hostname on stdin.
|
||||
'';
|
||||
default = pkgs.writeScript "hostname-gen" ''
|
||||
#!/bin/sh
|
||||
echo ${config.hostname}
|
||||
'';
|
||||
defaultText = ''
|
||||
pkgs.writeScript "hostname-gen" '''
|
||||
#!/bin/sh
|
||||
echo ''${config.hostname}
|
||||
'''
|
||||
'';
|
||||
type = types.package;
|
||||
};
|
||||
config = {
|
||||
services.hostname = oneshot {
|
||||
name = "hostname-${builtins.substring 0 12 (builtins.hashString "sha256" config.hostname)}";
|
||||
up = "echo ${config.hostname} > /proc/sys/kernel/hostname";
|
||||
down = "true";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -331,6 +331,8 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
imports = [ ./misc/assertions.nix ];
|
||||
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs =
|
||||
|
|
|
@ -13,6 +13,14 @@ in
|
|||
boot.initramfs = {
|
||||
enable = mkEnableOption "initramfs";
|
||||
};
|
||||
system.build.toplevel = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
pkgs.systemconfig for the configured filesystem,
|
||||
contains 'activate' and 'init' commands
|
||||
'';
|
||||
internal = true;
|
||||
};
|
||||
system.outputs = {
|
||||
initramfs = mkOption {
|
||||
type = types.package;
|
||||
|
@ -39,6 +47,8 @@ in
|
|||
INITRAMFS_COMPRESSION_ZSTD = "y";
|
||||
};
|
||||
|
||||
system.build.toplevel = config.system.outputs.systemConfiguration;
|
||||
|
||||
system.outputs = {
|
||||
initramfs =
|
||||
let
|
||||
|
|
|
@ -30,8 +30,6 @@ let
|
|||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r $src $out/scripts
|
||||
substituteInPlace $out/scripts/rc.init \
|
||||
--replace-fail 'config.hostname' "${config.hostname-script}"
|
||||
chmod -R +w $out
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -36,7 +36,6 @@ fi
|
|||
### (replace /run/service with your scandir)
|
||||
s6-rc-init -d -c /etc/s6-rc/compiled /run/service
|
||||
|
||||
config.hostname > /proc/sys/kernel/hostname
|
||||
|
||||
### 2. Starting the wanted set of services
|
||||
### This is also called every time you change runlevels with telinit.
|
||||
|
|
|
@ -194,11 +194,7 @@ extraPkgs // {
|
|||
});
|
||||
in h.override { openssl = null; sqlite = null; };
|
||||
|
||||
wpa_supplicant = prev.wpa_supplicant.override {
|
||||
dbusSupport = false;
|
||||
withPcsclite = false;
|
||||
wpa_supplicant_gui = null;
|
||||
};
|
||||
|
||||
|
||||
kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
|
||||
# For kexecboot we copy kexec into a ramdisk on the system being
|
||||
|
|
|
@ -10,5 +10,4 @@
|
|||
tftpboot = import ./tftpboot/test.nix;
|
||||
updown = import ./updown/test.nix;
|
||||
inout = import ./inout/test.nix;
|
||||
custom-shell = import ./custom-shell/test.nix;
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
set timeout 60
|
||||
|
||||
spawn socat unix-connect:vm/console -
|
||||
expect {
|
||||
"root@liminix blah blah > " { exit 0 }
|
||||
timeout { exit 1 }
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{ config, pkgs, lib, ... } :
|
||||
let
|
||||
inherit (pkgs.liminix.networking) interface address hostapd route dnsmasq;
|
||||
inherit (pkgs.liminix.services) oneshot longrun bundle target;
|
||||
in rec {
|
||||
imports = [
|
||||
../../modules/network
|
||||
];
|
||||
|
||||
defaultProfile.prompt = "$(whoami)@$(hostname) blah blah > ";
|
||||
|
||||
defaultProfile.packages = with pkgs; [ ];
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
liminix
|
||||
, nixpkgs
|
||||
}:
|
||||
let img = (import liminix {
|
||||
inherit nixpkgs;
|
||||
device = import "${liminix}/devices/qemu/";
|
||||
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}
|
||||
|
||||
mkdir vm
|
||||
${img}/run.sh --background ./vm
|
||||
expect ${./check-prompt.expect} |tee output && mv output $out
|
||||
''
|
|
@ -6,7 +6,7 @@ let img = (import liminix {
|
|||
device = import "${liminix}/devices/qemu/";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.vmroot;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
}:
|
||||
let
|
||||
overlay = import "${liminix}/overlay.nix";
|
||||
pkgs = import nixpkgs { overlays = [overlay]; };
|
||||
pkgs = import <nixpkgs> { overlays = [overlay]; };
|
||||
script = pkgs.writeFennelScript "foo" [] ./hello.fnl;
|
||||
inherit (pkgs.lua.pkgs) fifo;
|
||||
netlink = pkgs.netlink-lua;
|
||||
|
|
|
@ -6,7 +6,7 @@ let img = (import liminix {
|
|||
device = import "${liminix}/devices/qemu/";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.vmroot;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
|
|
|
@ -5,6 +5,7 @@ in {
|
|||
imports = [
|
||||
../../vanilla-configuration.nix
|
||||
../../modules/squashfs.nix
|
||||
../../modules/outputs/jffs2.nix
|
||||
];
|
||||
config.rootfsType = "jffs2";
|
||||
config.filesystem = dir {
|
||||
|
|
|
@ -6,7 +6,7 @@ let img = (import liminix {
|
|||
device = import "${liminix}/devices/qemu/";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.vmroot;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
|
|
|
@ -13,6 +13,7 @@ let
|
|||
in {
|
||||
imports = [
|
||||
../../vanilla-configuration.nix
|
||||
../../modules/outputs/jffs2.nix
|
||||
];
|
||||
config = {
|
||||
services.sshd = longrun {
|
||||
|
|
|
@ -8,7 +8,7 @@ let lmx = (import liminix {
|
|||
});
|
||||
rogue = lmx.pkgs.rogue;
|
||||
img = lmx.outputs.vmroot;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
|
|
|
@ -6,7 +6,7 @@ let img = (import liminix {
|
|||
device = import "${liminix}/devices/qemu";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.default;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
inherit (pkgs.pkgsBuildBuild) routeros;
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
liminix,
|
||||
...
|
||||
liminix
|
||||
}:
|
||||
let check = deviceName : config :
|
||||
let derivation = (import liminix {
|
||||
|
|
|
@ -6,7 +6,7 @@ let img = (import liminix {
|
|||
device = import "${liminix}/devices/qemu/";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.vmroot;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect
|
||||
|
|
|
@ -7,7 +7,6 @@ in rec {
|
|||
../../modules/wlan.nix
|
||||
../../modules/hostapd
|
||||
../../modules/network
|
||||
./wpa_supplicant.nix
|
||||
];
|
||||
|
||||
services.hostap = config.system.service.hostapd.build {
|
||||
|
@ -28,21 +27,5 @@ in rec {
|
|||
};
|
||||
};
|
||||
|
||||
services.wpa_supplicant = config.system.service.wpa_supplicant.build {
|
||||
interface = "wlan1";
|
||||
driver = "nl80211";
|
||||
config-file = pkgs.writeText "wpa_supplicant.conf" ''
|
||||
country=us
|
||||
update_config=1
|
||||
ctrl_interface=/run/wpa_supplicant
|
||||
|
||||
network={
|
||||
scan_ssid=1
|
||||
ssid="liminix"
|
||||
psk="colourless green ideas"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
defaultProfile.packages = with pkgs; [ tcpdump wpa_supplicant ];
|
||||
defaultProfile.packages = with pkgs; [ tcpdump ] ;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
, nixpkgs
|
||||
}:
|
||||
let img = (import liminix {
|
||||
inherit nixpkgs;
|
||||
device = import "${liminix}/devices/qemu/";
|
||||
device = import "${liminix}/devices/qemu-armv7l/";
|
||||
liminix-config = ./configuration.nix;
|
||||
}).outputs.default;
|
||||
pkgs = import nixpkgs { overlays = [(import ../../overlay.nix)]; };
|
||||
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||
in pkgs.runCommand "check" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
expect socat
|
||||
|
|
|
@ -14,10 +14,10 @@ expect {
|
|||
}
|
||||
expect "#"
|
||||
while { $FINISHED < 10 } {
|
||||
send "date && grep CTRL-EVENT-CONNECTED /run/uncaught-logs/* || echo \$NOT\r\n"
|
||||
send "date && grep AP-ENABLED /run/uncaught-logs/* || echo \$NOT\r\n"
|
||||
|
||||
expect {
|
||||
"wlan1: CTRL-EVENT-CONNECTED" { set FINISHED 999; set EXIT 0; }
|
||||
"wlan0: AP-ENABLED" { set FINISHED 999; set EXIT 0; }
|
||||
"not_present" { send_user "waiting ...\n" ; sleep 5 }
|
||||
}
|
||||
set FINISHED [ expr $FINISHED + 1 ]
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
liminix,
|
||||
wpa_supplicant,
|
||||
lib,
|
||||
}:
|
||||
{
|
||||
interface,
|
||||
driver,
|
||||
config-file,
|
||||
}:
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
inherit (lib.strings) escapeShellArg;
|
||||
in
|
||||
longrun {
|
||||
name = "wpa_supplicant";
|
||||
run =
|
||||
''
|
||||
${wpa_supplicant}/bin/wpa_supplicant -D${driver} -i${interface} -c ${config-file}
|
||||
'';
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib; {
|
||||
options.system.service.wpa_supplicant = mkOption { type = pkgs.liminix.lib.types.serviceDefn; };
|
||||
config.system.service.wpa_supplicant = config.system.callService ./wpa_service.nix {
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
driver = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
config-file = mkOption {
|
||||
type = types.package;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue