forked from DGNum/liminix
shell-customization #4
5 changed files with 52 additions and 0 deletions
|
@ -38,3 +38,13 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# Enter the shell
|
# Enter the shell
|
||||||
nix-build ci.nix -A wlan
|
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
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
tftpboot = import ./tftpboot/test.nix;
|
tftpboot = import ./tftpboot/test.nix;
|
||||||
updown = import ./updown/test.nix;
|
updown = import ./updown/test.nix;
|
||||||
inout = import ./inout/test.nix;
|
inout = import ./inout/test.nix;
|
||||||
|
custom-shell = import ./custom-shell/test.nix;
|
||||||
}
|
}
|
||||||
|
|
7
tests/custom-shell/check-prompt.expect
Normal file
7
tests/custom-shell/check-prompt.expect
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
set timeout 60
|
||||||
|
|
||||||
|
spawn socat unix-connect:vm/console -
|
||||||
|
expect {
|
||||||
|
"root@liminix blah blah > " { exit 0 }
|
||||||
|
timeout { exit 1 }
|
||||||
|
}
|
13
tests/custom-shell/configuration.nix
Normal file
13
tests/custom-shell/configuration.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ 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; [ ];
|
||||||
|
}
|
21
tests/custom-shell/test.nix
Normal file
21
tests/custom-shell/test.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
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
|
||||||
|
''
|
Loading…
Reference in a new issue