9 derivationWithMeta = attrs:
11 passthru = attrs.passthru or {};
12 validity = checkMeta.assertValidity { inherit meta attrs; };
13 meta = checkMeta.commonMeta { inherit validity attrs; };
14 baseDrv = derivation ({
15 inherit (buildPlatform) system;
17 } // (builtins.removeAttrs attrs [ "meta" "passthru" ]));
18 passthru' = passthru // lib.optionalAttrs (passthru ? tests) {
19 tests = lib.mapAttrs (_: f: f baseDrv) passthru.tests;
24 ({ inherit meta; passthru = passthru'; } // passthru')
28 { name # the name of the derivation
30 , executable ? false # run chmod +x ?
31 , destination ? "" # relative path appended to $out eg "/bin/foo"
35 passAsFile = [ "text" ];
37 builder = "${kaem}/bin/kaem";
42 (builtins.toFile "write-text-file.kaem" (''
43 target=''${out}''${destination}
44 '' + lib.optionalString (builtins.dirOf destination == ".") ''
45 mkdir -p ''${out}''${destinationDir}
47 cp ''${textPath} ''${target}
48 '' + lib.optionalString executable ''
53 PATH = lib.makeBinPath [ mescc-tools-extra ];
54 destinationDir = builtins.dirOf destination;
58 writeText = name: text: writeTextFile {inherit name text;};