diff options
-rw-r--r-- | lib/generators.nix | 86 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/platform.nix | 10 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/sdk.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/toolchain.nix | 2 |
4 files changed, 51 insertions, 51 deletions
diff --git a/lib/generators.nix b/lib/generators.nix index aab4498f9c64..143329815837 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -176,51 +176,51 @@ rec { else abort "toPretty: should never happen (v = ${v})"; # PLIST handling - - toPLIST = x: '' + toPLIST = {}: v: let + pprExpr = ind: x: with builtins; + if isNull x then "" else + if isBool x then pprBool ind x else + if isInt x then pprInt ind x else + if isString x then pprStr ind x else + if isList x then pprList ind x else + if isAttrs x then pprAttrs ind x else + abort "pprExpr: should never happen (v = ${v})"; + + pprLiteral = ind: x: ind + x; + + pprBool = ind: x: pprLiteral ind (if x then "<true/>" else "<false/>"); + pprInt = ind: x: pprLiteral ind "<integer>${toString x}</integer>"; + pprStr = ind: x: pprLiteral ind "<string>${x}</string>"; + pprKey = ind: x: pprLiteral ind "<key>${x}</key>"; + + pprIndent = ind: pprExpr "\t${ind}"; + + pprItem = ind: libStr.concatMapStringsSep "\n" (pprIndent ind); + + pprList = ind: x: libStr.concatStringsSep "\n" [ + (pprLiteral ind "<array>") + (pprItem ind x) + (pprLiteral ind "</array>") + ]; + + pprAttrs = ind: x: libStr.concatStringsSep "\n" [ + (pprLiteral ind "<dict>") + (pprAttr ind x) + (pprLiteral ind "</dict>") + ]; + + pprAttr = let attrFilter = name: value: name != "_module" && value != null; + in ind: x: libStr.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList + (name: value: lib.optional (attrFilter name value) [ + (pprKey "\t${ind}" name) + (pprExpr "\t${ind}" value) + ]) x)); + + in '' <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> - '' + pprExpr "" x - + "\n</plist>"; - - pprExpr = ind: x: with builtins; - if isNull x then "" else - if isBool x then pprBool ind x else - if isInt x then pprInt ind x else - if isString x then pprStr ind x else - if isList x then pprList ind x else - if isAttrs x then pprAttrs ind x else - throw "invalid plist type"; - - pprLiteral = ind: x: ind + x; - - pprBool = ind: x: pprLiteral ind (if x then "<true/>" else "<false/>"); - pprInt = ind: x: pprLiteral ind "<integer>${toString x}</integer>"; - pprStr = ind: x: pprLiteral ind "<string>${x}</string>"; - pprKey = ind: x: pprLiteral ind "<key>${x}</key>"; - - pprIndent = ind: pprExpr "\t${ind}"; - - pprItem = ind: libStr.concatMapStringsSep "\n" (pprIndent ind); - - pprList = ind: x: libStr.concatStringsSep "\n" [ - (pprLiteral ind "<array>") - (pprItem ind x) - (pprLiteral ind "</array>") - ]; - - pprAttrs = ind: x: libStr.concatStringsSep "\n" [ - (pprLiteral ind "<dict>") - (pprAttr ind x) - (pprLiteral ind "</dict>") - ]; - - attrFilter = name: value: name != "_module" && value != null; - - pprAttr = ind: x: libStr.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList (name: value: lib.optional (attrFilter name value) [ - (pprKey "\t${ind}" name) - (pprExpr "\t${ind}" value) - ]) x)); + ${pprExpr "" v} + </plist>''; } diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix index e3fb83edc674..502c3bcdbc87 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -286,11 +286,11 @@ let in runCommand "MacOSX.platform" {} '' - install -D ${writeText "Info.plist" (toPLIST Info)} $out/Info.plist - install -D ${writeText "version.plist" (toPLIST Version)} $out/version.plist - install -D ${writeText "Architectures.xcspec" (toPLIST Architectures)} $out/Developer/Library/Xcode/Specifications/Architectures.xcspec - install -D ${writeText "PackageTypes.xcspec" (toPLIST PackageTypes)} $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec - install -D ${writeText "ProductTypes.xcspec" (toPLIST ProductTypes)} $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec + install -D ${writeText "Info.plist" (toPLIST {} Info)} $out/Info.plist + install -D ${writeText "version.plist" (toPLIST {} Version)} $out/version.plist + install -D ${writeText "Architectures.xcspec" (toPLIST {} Architectures)} $out/Developer/Library/Xcode/Specifications/Architectures.xcspec + install -D ${writeText "PackageTypes.xcspec" (toPLIST {} PackageTypes)} $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec + install -D ${writeText "ProductTypes.xcspec" (toPLIST {} ProductTypes)} $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec mkdir -p $out/Developer/SDKs/ cd $out/Developer/SDKs/ diff --git a/pkgs/development/tools/xcbuild/sdk.nix b/pkgs/development/tools/xcbuild/sdk.nix index 2d43347da03d..5fdfe5877228 100644 --- a/pkgs/development/tools/xcbuild/sdk.nix +++ b/pkgs/development/tools/xcbuild/sdk.nix @@ -24,6 +24,6 @@ in runCommand "MacOSX${version}.sdk" { inherit version; } '' - install -D ${writeText "SDKSettings.plist" (toPLIST SDKSettings)} $out/SDKSettings.plist - install -D ${writeText "SystemVersion.plist" (toPLIST SystemVersion)} $out/System/Library/CoreServices/SystemVersion.plist + install -D ${writeText "SDKSettings.plist" (toPLIST {} SDKSettings)} $out/SDKSettings.plist + install -D ${writeText "SystemVersion.plist" (toPLIST {} SystemVersion)} $out/System/Library/CoreServices/SystemVersion.plist '' diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix index d8c80b53831c..ed5730abddf6 100644 --- a/pkgs/development/tools/xcbuild/toolchain.nix +++ b/pkgs/development/tools/xcbuild/toolchain.nix @@ -24,7 +24,7 @@ runCommand "nixpkgs.xctoolchain" { nativeBuildInputs = [ makeWrapper ]; } ('' mkdir -p $out - install -D ${writeText "ToolchainInfo.plist" (toPLIST ToolchainInfo)} $out/ToolchainInfo.plist + install -D ${writeText "ToolchainInfo.plist" (toPLIST {} ToolchainInfo)} $out/ToolchainInfo.plist mkdir -p $out/usr/include mkdir -p $out/usr/lib |