Add agetty service and null modem test

This commit is contained in:
Sander van der Burg 2022-01-30 18:07:47 +01:00
parent 06b1f460a6
commit 2a5fc3449d
4 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,14 @@
{createManagedProcess, util-linux}:
{port, instanceName ? "agetty-${port}", baudrate ? 9600, extraOptions ? []}:
createManagedProcess {
inherit instanceName;
foregroundProcess = "${util-linux}/bin/agetty";
args = extraOptions ++ [ port baudrate ];
overrides = {
sysvinit = {
runlevels = [ 2 3 4 5 ];
};
};
}

View File

@ -207,4 +207,9 @@ in
inherit createManagedProcess forceDisableUserChange logDir libDir callingUser callingGroup;
inherit (pkgs) stdenv vsftpd writeTextFile lib;
};
agetty = import ./agetty {
inherit createManagedProcess;
inherit (pkgs) util-linux;
};
}

9
tests/agetty/note.md Normal file
View File

@ -0,0 +1,9 @@
This test is for setting up a connection with a null modem cable that works
to link up my PC with my Commodore Amiga 500.
It cannot be automated with the NixOS test driver, but you can manually deploy
it by running the following command as root user:
```bash
nixproc-supervisord-deploy-stateless processes.nix
```

View File

@ -0,0 +1,28 @@
{ pkgs ? import <nixpkgs> { inherit system; }
, system ? builtins.currentSystem
, stateDir ? "/var"
, runtimeDir ? "${stateDir}/run"
, logDir ? "${stateDir}/log"
, spoolDir ? "${stateDir}/spool"
, cacheDir ? "${stateDir}/cache"
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, processManager
, nix-processmgmt ? ../../../nix-processmgmt
}:
let
constructors = import ../../services-agnostic/constructors.nix {
inherit pkgs stateDir runtimeDir logDir tmpDir cacheDir libDir spoolDir forceDisableUserChange processManager nix-processmgmt;
};
in
{
agetty-nullmodem = {
pkg = constructors.agetty {
baudrate = 19200;
port = "ttyUSB0";
extraOptions = [ "--flow-control" ];
};
};
}