New getEris functions
This commit is contained in:
parent
d6e8db17f9
commit
ea0cb3a364
61
flake.nix
61
flake.nix
|
@ -62,49 +62,32 @@
|
||||||
nixpkgs.lib.extend (final: prev: {
|
nixpkgs.lib.extend (final: prev: {
|
||||||
inherit forAllSystems forAllLocalSystems forAllCrossSystems;
|
inherit forAllSystems forAllLocalSystems forAllCrossSystems;
|
||||||
|
|
||||||
getEris =
|
getMainProgram = pkg:
|
||||||
# For a the name of a derivation output and a derivation,
|
|
||||||
# generate a set of { cap, closure, and path } for a singular
|
|
||||||
# file found within the subdirectory of the output with the
|
|
||||||
# same name as that output. In the case that the derivation
|
|
||||||
# does not have this named output, the subdirectory will be
|
|
||||||
# taken from the default output. This subdirectory must
|
|
||||||
# contain a single file, and the output must contain an
|
|
||||||
# ERIS manifest file.
|
|
||||||
output: pkg:
|
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
if hasAttr "mainProgram" pkg.meta then
|
||||||
pkg' = prev.getOutput output pkg;
|
pkg.meta.mainProgram
|
||||||
erisInfo = fromJSON (builtins.unsafeDiscardStringContext
|
else
|
||||||
(readFile "${pkg'}/nix-support/eris-manifest.json"));
|
trace "${pkg.name} is missing meta.mainProgram" pkg.pname;
|
||||||
caps = filter
|
|
||||||
({ path, ... }: prev.strings.hasPrefix "${pkg'}/${output}" path)
|
|
||||||
(prev.attrsets.mapAttrsToList (path:
|
|
||||||
{ cap, closure }: {
|
|
||||||
path = "${pkg'}${
|
|
||||||
substring (stringLength pkg') (stringLength path) path
|
|
||||||
}"; # hack to build a string with context
|
|
||||||
inherit cap closure;
|
|
||||||
}) erisInfo);
|
|
||||||
in assert length caps == 1; head caps;
|
|
||||||
|
|
||||||
getEris' = output: pkg: file:
|
getEris = filename: pkg:
|
||||||
# A variant of the getEris function with file selection.
|
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
pkg' = prev.getOutput output pkg;
|
manifest = fromJSON (unsafeDiscardStringContext
|
||||||
path' = "${pkg'}/${output}/${file}";
|
(readFile "${pkg}/nix-support/eris-manifest.json"));
|
||||||
erisInfo = fromJSON (builtins.unsafeDiscardStringContext
|
entry = manifest.${filename};
|
||||||
(readFile "${pkg'}/nix-support/eris-manifest.json"));
|
in entry // {
|
||||||
caps = filter ({ path, ... }: path == path')
|
cap = "(${pkg}/nix-support/eris-manifest.dhall).${filename}.cap";
|
||||||
(prev.attrsets.mapAttrsToList (path:
|
path = "${pkg}${
|
||||||
{ cap, closure }: {
|
substring (stringLength pkg) (stringLength entry.path)
|
||||||
path = "${pkg'}${
|
entry.path
|
||||||
substring (stringLength pkg') (stringLength path) path
|
}"; # hack to build a string with context
|
||||||
}"; # hack to build a string with context
|
};
|
||||||
inherit cap closure;
|
|
||||||
}) erisInfo);
|
getErisMainProgram = pkg:
|
||||||
in assert length caps == 1; head caps;
|
final.getEris (final.getMainProgram pkg) (prev.getOutput "bin" pkg);
|
||||||
|
|
||||||
|
getErisLib = filename: pkg:
|
||||||
|
final.getEris filename (prev.getOutput "lib" pkg);
|
||||||
|
|
||||||
uuidFrom = seed:
|
uuidFrom = seed:
|
||||||
let digest = builtins.hashString "sha256" seed;
|
let digest = builtins.hashString "sha256" seed;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
genode.core.children.eris_vfs = {
|
genode.core.children.eris_vfs = {
|
||||||
fs = let
|
fs = let
|
||||||
vfsRump = lib.getEris' "lib" pkgs.genodePackages.rump "vfs_rump.lib.so";
|
vfsRump = lib.getErisLib "vfs_rump.lib.so" pkgs.genodePackages.rump;
|
||||||
in {
|
in {
|
||||||
package = pkgs.genodePackages.vfs;
|
package = pkgs.genodePackages.vfs;
|
||||||
extraErisInputs = [ vfsRump ];
|
extraErisInputs = [ vfsRump ];
|
||||||
|
|
|
@ -13,7 +13,7 @@ let
|
||||||
let pkg = pkgs.genodePackages.${name};
|
let pkg = pkgs.genodePackages.${name};
|
||||||
in {
|
in {
|
||||||
inherit name;
|
inherit name;
|
||||||
value = lib.getEris "bin" pkg;
|
value = lib.getErisMainProgram pkg;
|
||||||
}) pkgNames);
|
}) pkgNames);
|
||||||
|
|
||||||
tarball =
|
tarball =
|
||||||
|
|
|
@ -73,9 +73,9 @@ in {
|
||||||
|
|
||||||
genode.core.children.gui = lib.mkIf cfg.enable (let
|
genode.core.children.gui = lib.mkIf cfg.enable (let
|
||||||
eris = with pkgs.genodePackages;
|
eris = with pkgs.genodePackages;
|
||||||
lib.attrsets.mapAttrs (_: lib.getEris "bin") {
|
lib.attrsets.mapAttrs (_: lib.getErisMainProgram) {
|
||||||
inherit decorator window_layouter wm;
|
inherit decorator window_layouter wm;
|
||||||
} // (let nitpick = lib.getEris' "bin" nitpicker;
|
} // (let nitpick = lib.getErisMainProgram nitpicker;
|
||||||
in {
|
in {
|
||||||
nitpicker = nitpick "nitpicker";
|
nitpicker = nitpick "nitpicker";
|
||||||
pointer = nitpick "pointer";
|
pointer = nitpick "pointer";
|
||||||
|
@ -97,11 +97,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
genode.core.children.consoleLog = lib.mkIf cfg.consoleLog.enable (let
|
genode.core.children.consoleLog = lib.mkIf cfg.consoleLog.enable (let
|
||||||
erisInputs = (lib.attrsets.mapAttrs (_: lib.getEris "bin") {
|
erisInputs = (lib.attrsets.mapAttrs (_: lib.getErisMainProgram) {
|
||||||
inherit (pkgs.genodePackages) log_core terminal terminal_log;
|
inherit (pkgs.genodePackages) log_core terminal terminal_log;
|
||||||
}) // (lib.attrsets.mapAttrs (_: lib.getEris "lib") {
|
}) // {
|
||||||
inherit (pkgs.genodePackages) vfs_ttf;
|
vfs_ttf = lib.getErisLib "vfs_ttf.lib.so" pkgs.genodePackages.vfs_ttf;
|
||||||
});
|
};
|
||||||
in {
|
in {
|
||||||
package = pkgs.genodePackages.init;
|
package = pkgs.genodePackages.init;
|
||||||
coreROMs = [ "core_log" "kernel_log" ];
|
coreROMs = [ "core_log" "kernel_log" ];
|
||||||
|
|
|
@ -22,10 +22,10 @@ in {
|
||||||
config = let
|
config = let
|
||||||
deviceManagerEnable = cfg.ahci.enable || cfg.usb.enable;
|
deviceManagerEnable = cfg.ahci.enable || cfg.usb.enable;
|
||||||
|
|
||||||
ahciEris = lib.getEris "bin" pkgs.genodePackages.ahci_drv;
|
ahciEris = lib.getErisMainProgram pkgs.genodePackages.ahci_drv;
|
||||||
partBlockEris = lib.getEris "bin" pkgs.genodePackages.part_block;
|
partBlockEris = lib.getErisMainProgram pkgs.genodePackages.part_block;
|
||||||
|
|
||||||
usbEris = lib.attrsets.mapAttrs (_: lib.getEris "bin") {
|
usbEris = lib.attrsets.mapAttrs (_: lib.getErisMainProgram) {
|
||||||
usb_block_drv = cfg.usb.storage.package;
|
usb_block_drv = cfg.usb.storage.package;
|
||||||
usb_host_drv = cfg.usb.host.package;
|
usb_host_drv = cfg.usb.host.package;
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
config = ''${configFile} "${binary}"'';
|
config = ''${configFile} "${binary}"'';
|
||||||
roms = extraRoms;
|
roms = extraRoms;
|
||||||
} else
|
} else
|
||||||
let bin = lib.getEris "bin" package;
|
let bin = lib.getErisMainProgram package;
|
||||||
in {
|
in {
|
||||||
config = ''${configFile} "${bin.cap}"'';
|
config = ''${configFile} "${bin.cap}"'';
|
||||||
roms = toRoms bin ++ extraRoms;
|
roms = toRoms bin ++ extraRoms;
|
||||||
|
|
|
@ -7,9 +7,9 @@ in {
|
||||||
genode.init.children.tor = let
|
genode.init.children.tor = let
|
||||||
args = lib.strings.splitString " "
|
args = lib.strings.splitString " "
|
||||||
config.systemd.services.tor.serviceConfig.ExecStart;
|
config.systemd.services.tor.serviceConfig.ExecStart;
|
||||||
tor' = lib.getEris' "bin" pkgs.tor "tor";
|
tor' = lib.getErisMainProgram pkgs.tor;
|
||||||
lwip' = lib.getEris "lib" pkgs.genodePackages.vfs_lwip;
|
lwip' = lib.getErisLib "vfs_lwip.lib.so" pkgs.genodePackages.vfs_lwip;
|
||||||
pipe' = lib.getEris "lib" pkgs.genodePackages.vfs_pipe;
|
pipe' = lib.getErisLib "vfs_pipe.lib.so" pkgs.genodePackages.vfs_pipe;
|
||||||
in {
|
in {
|
||||||
binary = builtins.head args;
|
binary = builtins.head args;
|
||||||
package = pkgs.tor;
|
package = pkgs.tor;
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
in {
|
in {
|
||||||
genode.init.children.bash = let
|
genode.init.children.bash = let
|
||||||
extraErisInputs' = with pkgs.genodePackages; {
|
extraErisInputs' = with pkgs.genodePackages; {
|
||||||
bash = lib.getEris "bin" pkgs.bash;
|
bash =
|
||||||
cached_fs_rom = lib.getEris "bin" cached_fs_rom;
|
lib.getErisMainProgram "bash" (pkgs.bash // { pname = "bash"; });
|
||||||
vfs = lib.getEris "bin" vfs;
|
cached_fs_rom = lib.getErisMainProgram cached_fs_rom;
|
||||||
vfs_pipe = lib.getEris "lib" vfs_pipe;
|
vfs = lib.getErisMainProgram vfs;
|
||||||
|
vfs_pipe = lib.getErisLib "vfs_pipe.lib.so" vfs_pipe;
|
||||||
};
|
};
|
||||||
params = {
|
params = {
|
||||||
bash = "${pkgs.bash}";
|
bash = "${pkgs.bash}";
|
||||||
|
|
Loading…
Reference in New Issue