From a135cb121782b5e7fc7e857e100353d17e24b3e6 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 5 Nov 2023 15:13:06 +0000 Subject: [PATCH] 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) --- default.nix | 2 +- modules/arch/mips.nix | 4 ++-- overlay.nix | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 41f2387..74d8636 100644 --- a/default.nix +++ b/default.nix @@ -19,7 +19,7 @@ let config = (pkgs.lib.evalModules { modules = [ - { _module.args = { inherit pkgs; lib = pkgs.lib; }; } + { _module.args = { inherit pkgs; inherit (pkgs) lim; }; } ./modules/hardware.nix ./modules/base.nix ./modules/busybox.nix diff --git a/modules/arch/mips.nix b/modules/arch/mips.nix index 956abf4..fb637d6 100644 --- a/modules/arch/mips.nix +++ b/modules/arch/mips.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, ...}: +{ lib, pkgs, config, lim, ...}: { config = { kernel.config = { @@ -10,7 +10,7 @@ OF = "y"; USE_OF = "y"; }; - hardware.ram.startAddress = 0; + hardware.ram.startAddress = lim.parseInt "0x0"; boot.commandLine = [ "console=ttyS0,115200" # true of all mips we've yet encountered ]; diff --git a/overlay.nix b/overlay.nix index dbc9671..c02d8f3 100644 --- a/overlay.nix +++ b/overlay.nix @@ -191,4 +191,9 @@ extraPkgs // { }); pppBuild = prev.ppp; + + # liminix library functions + lim = { + parseInt = s : (builtins.fromTOML "r=${s}").r; + }; }