introduce lim, the liminix library

so far we have lim.parseInt, which parses an integer from a string
with optional base-selecting-prefix (e.g. 0755, 0x12ab)
This commit is contained in:
Daniel Barlow 2023-11-05 15:13:06 +00:00
parent 863045b86b
commit a135cb1217
3 changed files with 8 additions and 3 deletions

View file

@ -19,7 +19,7 @@ let
config = (pkgs.lib.evalModules { config = (pkgs.lib.evalModules {
modules = [ modules = [
{ _module.args = { inherit pkgs; lib = pkgs.lib; }; } { _module.args = { inherit pkgs; inherit (pkgs) lim; }; }
./modules/hardware.nix ./modules/hardware.nix
./modules/base.nix ./modules/base.nix
./modules/busybox.nix ./modules/busybox.nix

View file

@ -1,4 +1,4 @@
{ lib, pkgs, config, ...}: { lib, pkgs, config, lim, ...}:
{ {
config = { config = {
kernel.config = { kernel.config = {
@ -10,7 +10,7 @@
OF = "y"; OF = "y";
USE_OF = "y"; USE_OF = "y";
}; };
hardware.ram.startAddress = 0; hardware.ram.startAddress = lim.parseInt "0x0";
boot.commandLine = [ boot.commandLine = [
"console=ttyS0,115200" # true of all mips we've yet encountered "console=ttyS0,115200" # true of all mips we've yet encountered
]; ];

View file

@ -191,4 +191,9 @@ extraPkgs // {
}); });
pppBuild = prev.ppp; pppBuild = prev.ppp;
# liminix library functions
lim = {
parseInt = s : (builtins.fromTOML "r=${s}").r;
};
} }