From 99130d0f148988b9c8f5d54adb1701e341510aea Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 10 Apr 2021 14:06:49 +0200 Subject: [PATCH] lib.generators.toDhall: match API with nixpkgs --- flake.nix | 9 +++++---- nixos-modules/hardware/default.nix | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 0ccc1c7..a7fdbb3 100644 --- a/flake.nix +++ b/flake.nix @@ -95,23 +95,24 @@ (prev.attrsets.mapAttrsToList (path: { cap, closure }: { path = "${pkg'}${ - substring (stringLength pkg') (stringLength path') path' + substring (stringLength pkg') (stringLength path) path }"; # hack to build a string with context inherit cap closure; }) erisInfo); in assert length caps == 1; head caps; generators = prev.generators // rec { - toDhall = x: + toDhall = { }: + x: with builtins; let concatItems = final.strings.concatStringsSep ", "; in if isAttrs x then "{ ${ concatItems (prev.attrsets.mapAttrsToList - (key: value: "${key} = ${toDhall value}") x) + (key: value: "${key} = ${toDhall { } value}") x) } }" else if isList x then - "[ ${concatItems (map toDhall x)} ]" + "[ ${concatItems (map (toDhall { }) x)} ]" else if isString x || isPath x then ''"${x}"'' else if isInt x then diff --git a/nixos-modules/hardware/default.nix b/nixos-modules/hardware/default.nix index 069c5dc..ce99eb3 100644 --- a/nixos-modules/hardware/default.nix +++ b/nixos-modules/hardware/default.nix @@ -1,8 +1,8 @@ { config, pkgs, lib, ... }: with lib; - -{ +let toDhall = lib.generators.toDhall { }; +in { imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ]; options.hardware.genode.platform.policies = lib.mkOption { @@ -25,7 +25,7 @@ with lib; ahciConfig = with config.hardware.genode.ahci; lib.optionalString enable '' , ahci_driver = Some ${ - lib.generators.toDhall { + toDhall { binary = ahciEris.cap; atapi = atapiSupport; } @@ -36,7 +36,7 @@ with lib; lib.optionalString enable '' , usb_block = Some { binary = "${usbEris.usb_block_drv.cap}" } , usb_driver = Some ${ - lib.generators.toDhall { + toDhall { binary = usbEris.usb_drv.cap; bios_handoff = biosHandoff; ehci = ehciSupport;