Compare commits
No commits in common. "main" and "CI" have entirely different histories.
9 changed files with 10 additions and 96 deletions
|
@ -38,13 +38,3 @@ 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
|
|
||||||
|
|
|
@ -4,13 +4,11 @@
|
||||||
|
|
||||||
{ lib, pkgs, config, ...}:
|
{ lib, pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr concatStringsSep mapAttrsToList;
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||||
inherit (pkgs.pseudofile) dir symlink;
|
inherit (pkgs.pseudofile) dir symlink;
|
||||||
inherit (pkgs.liminix.networking) address interface;
|
inherit (pkgs.liminix.networking) address interface;
|
||||||
inherit (pkgs.liminix.services) bundle;
|
inherit (pkgs.liminix.services) bundle;
|
||||||
|
|
||||||
# TODO: escape shell argument.
|
|
||||||
exportVar = name: value: "export ${name}=\"${value}\"";
|
|
||||||
type_service = pkgs.liminix.lib.types.service;
|
type_service = pkgs.liminix.lib.types.service;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
@ -24,24 +22,6 @@ in {
|
||||||
/run/current-system, we just add the paths in /etc/profile
|
/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 {
|
services = mkOption {
|
||||||
type = types.attrsOf type_service;
|
type = types.attrsOf type_service;
|
||||||
|
@ -131,8 +111,6 @@ in {
|
||||||
|
|
||||||
defaultProfile.packages = with pkgs;
|
defaultProfile.packages = with pkgs;
|
||||||
[ s6 s6-init-bin execline s6-linux-init s6-rc ];
|
[ 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 = [
|
boot.commandLine = [
|
||||||
"panic=10 oops=panic init=/bin/init loglevel=8"
|
"panic=10 oops=panic init=/bin/init loglevel=8"
|
||||||
|
@ -205,7 +183,6 @@ in {
|
||||||
(pkgs.writeScript ".profile" ''
|
(pkgs.writeScript ".profile" ''
|
||||||
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
|
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
|
||||||
export PATH
|
export PATH
|
||||||
${concatStringsSep "\n" (mapAttrsToList exportVar config.defaultProfile.environmentVariables)}
|
|
||||||
'');
|
'');
|
||||||
in dir {
|
in dir {
|
||||||
inherit profile;
|
inherit profile;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ lib, pkgs, config, ...}:
|
{ lib, pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
|
inherit (pkgs.liminix.services) oneshot;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
hostname = mkOption {
|
hostname = mkOption {
|
||||||
|
@ -11,21 +12,12 @@ in {
|
||||||
default = "liminix";
|
default = "liminix";
|
||||||
type = types.nonEmptyStr;
|
type = types.nonEmptyStr;
|
||||||
};
|
};
|
||||||
hostname-script = mkOption {
|
};
|
||||||
description = ''
|
config = {
|
||||||
Script that outputs the system hostname on stdin.
|
services.hostname = oneshot {
|
||||||
'';
|
name = "hostname-${builtins.substring 0 12 (builtins.hashString "sha256" config.hostname)}";
|
||||||
default = pkgs.writeScript "hostname-gen" ''
|
up = "echo ${config.hostname} > /proc/sys/kernel/hostname";
|
||||||
#!/bin/sh
|
down = "true";
|
||||||
echo ${config.hostname}
|
|
||||||
'';
|
|
||||||
defaultText = ''
|
|
||||||
pkgs.writeScript "hostname-gen" '''
|
|
||||||
#!/bin/sh
|
|
||||||
echo ''${config.hostname}
|
|
||||||
'''
|
|
||||||
'';
|
|
||||||
type = types.package;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ let
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -r $src $out/scripts
|
cp -r $src $out/scripts
|
||||||
substituteInPlace $out/scripts/rc.init \
|
|
||||||
--replace-fail 'config.hostname' "${config.hostname-script}"
|
|
||||||
chmod -R +w $out
|
chmod -R +w $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,7 +36,6 @@ fi
|
||||||
### (replace /run/service with your scandir)
|
### (replace /run/service with your scandir)
|
||||||
s6-rc-init -d -c /etc/s6-rc/compiled /run/service
|
s6-rc-init -d -c /etc/s6-rc/compiled /run/service
|
||||||
|
|
||||||
config.hostname > /proc/sys/kernel/hostname
|
|
||||||
|
|
||||||
### 2. Starting the wanted set of services
|
### 2. Starting the wanted set of services
|
||||||
### This is also called every time you change runlevels with telinit.
|
### This is also called every time you change runlevels with telinit.
|
||||||
|
|
|
@ -10,5 +10,4 @@
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
''
|
|
Loading…
Reference in a new issue