lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #42669 from obsidiansystems/upstream-plist

Upstream PLIST handling

authored by

Matthew Bauer and committed by
GitHub
a44d33aa 6eb81b80

+149 -166
+48 -1
lib/generators.nix
··· 173 173 fna); 174 174 in if fna == {} then "<λ>" 175 175 else "<λ:{${showFnas}}>" 176 - else abort "toPretty: should never happen (v = ${v})"; 176 + else abort "generators.toPretty: should never happen (v = ${v})"; 177 + 178 + # PLIST handling 179 + toPlist = {}: v: let 180 + expr = ind: x: with builtins; 181 + if isNull x then "" else 182 + if isBool x then bool ind x else 183 + if isInt x then int ind x else 184 + if isString x then str ind x else 185 + if isList x then list ind x else 186 + if isAttrs x then attrs ind x else 187 + abort "generators.toPlist: should never happen (v = ${v})"; 188 + 189 + literal = ind: x: ind + x; 190 + 191 + bool = ind: x: literal ind (if x then "<true/>" else "<false/>"); 192 + int = ind: x: literal ind "<integer>${toString x}</integer>"; 193 + str = ind: x: literal ind "<string>${x}</string>"; 194 + key = ind: x: literal ind "<key>${x}</key>"; 195 + 196 + indent = ind: expr "\t${ind}"; 197 + 198 + item = ind: libStr.concatMapStringsSep "\n" (indent ind); 199 + 200 + list = ind: x: libStr.concatStringsSep "\n" [ 201 + (literal ind "<array>") 202 + (item ind x) 203 + (literal ind "</array>") 204 + ]; 205 + 206 + attrs = ind: x: libStr.concatStringsSep "\n" [ 207 + (literal ind "<dict>") 208 + (attr ind x) 209 + (literal ind "</dict>") 210 + ]; 211 + 212 + attr = let attrFilter = name: value: name != "_module" && value != null; 213 + in ind: x: libStr.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList 214 + (name: value: lib.optional (attrFilter name value) [ 215 + (key "\t${ind}" name) 216 + (expr "\t${ind}" value) 217 + ]) x)); 218 + 219 + in ''<?xml version="1.0" encoding="UTF-8"?> 220 + <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 221 + <plist version="1.0"> 222 + ${expr "" v} 223 + </plist>''; 177 224 178 225 }
+5 -2
pkgs/applications/networking/syncthing-gtk/default.nix
··· 1 - { stdenv, fetchFromGitHub, fetchpatch, libnotify, librsvg, darwin, psmisc, gtk3, libappindicator-gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, buildPythonApplication, dateutil, pyinotify, pygobject3, bcrypt, gobjectIntrospection }: 1 + { stdenv, fetchFromGitHub, fetchpatch, libnotify, librsvg, killall 2 + , gtk3, libappindicator-gtk3, substituteAll, syncthing, wrapGAppsHook 3 + , gnome3, buildPythonApplication, dateutil, pyinotify, pygobject3 4 + , bcrypt, gobjectIntrospection }: 2 5 3 6 buildPythonApplication rec { 4 7 version = "0.9.4"; ··· 35 38 }) 36 39 (substituteAll { 37 40 src = ./paths.patch; 38 - killall = "${if stdenv.isDarwin then darwin.shell_cmds else psmisc}/bin/killall"; 41 + killall = "${killall}/bin/killall"; 39 42 syncthing = "${syncthing}/bin/syncthing"; 40 43 }) 41 44 ];
+4 -2
pkgs/development/tools/xcbuild/default.nix
··· 1 - { stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng, CoreServices, CoreGraphics, ImageIO, ninja }: 1 + { stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng 2 + , CoreServices, CoreGraphics, ImageIO, ninja }: 2 3 3 4 let 4 5 googletest = fetchFromGitHub { ··· 17 18 in stdenv.mkDerivation rec { 18 19 name = "xcbuild-${version}"; 19 20 20 - # Once a version is released that includes https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, 21 + # Once a version is released that includes 22 + # https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, 21 23 # we can stop doing this -pre thing. 22 24 version = "0.1.2-pre"; 23 25
+13 -21
pkgs/development/tools/xcbuild/platform.nix
··· 1 - { stdenv, sdk, writeText, platformName, xcbuild }: 1 + { runCommand, lib, sdk, platformName, writeText }: 2 2 3 3 let 4 + 5 + inherit (lib.generators) toPlist; 4 6 5 7 Info = { 6 8 CFBundleIdentifier = platformName; ··· 283 285 284 286 in 285 287 286 - stdenv.mkDerivation { 287 - name = "MacOSX.platform"; 288 - buildInputs = [ xcbuild ]; 289 - buildCommand = '' 290 - mkdir -p $out/ 291 - cd $out/ 292 - 293 - plutil -convert xml1 -o Info.plist ${writeText "Info.plist" (builtins.toJSON Info)} 294 - plutil -convert xml1 -o version.plist ${writeText "version.plist" (builtins.toJSON Version)} 295 - 296 - mkdir -p $out/Developer/Library/Xcode/Specifications/ 297 - cd $out/Developer/Library/Xcode/Specifications/ 298 - plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)} 299 - plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)} 300 - plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)} 288 + runCommand "MacOSX.platform" {} '' 289 + install -D ${writeText "Info.plist" (toPlist {} Info)} $out/Info.plist 290 + install -D ${writeText "version.plist" (toPlist {} Version)} $out/version.plist 291 + install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $out/Developer/Library/Xcode/Specifications/Architectures.xcspec 292 + install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec 293 + install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec 301 294 302 - mkdir -p $out/Developer/SDKs/ 303 - cd $out/Developer/SDKs/ 304 - cp -r ${sdk} ${sdk.name} 305 - ''; 306 - } 295 + mkdir -p $out/Developer/SDKs/ 296 + cd $out/Developer/SDKs/ 297 + cp -r ${sdk} ${sdk.name} 298 + ''
+8 -14
pkgs/development/tools/xcbuild/sdk.nix
··· 1 - { stdenv, writeText, toolchainName, sdkName, xcbuild }: 1 + { runCommand, lib, toolchainName, sdkName, writeText }: 2 2 3 3 let 4 + inherit (lib.generators) toPlist; 5 + 4 6 # TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here. 5 7 version = "10.10"; 6 8 ··· 19 21 }; 20 22 in 21 23 22 - stdenv.mkDerivation { 23 - name = "MacOSX${version}.sdk"; 24 + runCommand "MacOSX${version}.sdk" { 24 25 inherit version; 25 - 26 - buildInputs = [ xcbuild ]; 27 - 28 - buildCommand = '' 29 - mkdir -p $out/ 30 - plutil -convert xml1 -o $out/SDKSettings.plist ${writeText "SDKSettings.json" (builtins.toJSON SDKSettings)} 31 - 32 - mkdir -p $out/System/Library/CoreServices/ 33 - plutil -convert xml1 -o $out/System/Library/CoreServices/SystemVersion.plist ${writeText "SystemVersion.plist" (builtins.toJSON SystemVersion)} 34 - ''; 35 - } 26 + } '' 27 + install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $out/SDKSettings.plist 28 + install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $out/System/Library/CoreServices/SystemVersion.plist 29 + ''
+42 -102
pkgs/development/tools/xcbuild/toolchain.nix
··· 1 - {stdenv, writeText, toolchainName, xcbuild, fetchurl 2 - , llvm, cctools, gcc, bootstrap_cmds, binutils 3 - , yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper 4 - , xib2nib}: 1 + { runCommand, toolchainName, fetchurl, makeWrapper, stdenv 2 + , buildPackages, lib, writeText }: 5 3 6 4 let 5 + 6 + inherit (lib) getBin optionalString; 7 + inherit (lib.generators) toPlist; 7 8 8 9 ToolchainInfo = { 9 10 Identifier = toolchainName; 10 11 }; 11 12 12 - # We could pull this out of developer_cmds but it adds an annoying loop if we want to bootstrap and 13 - # this is just a tiny script so I'm not going to bother 13 + # We could pull this out of developer_cmds but it adds an annoying 14 + # loop if we want to bootstrap and this is just a tiny script so I'm 15 + # not going to bother. 14 16 mkdep-darwin-src = fetchurl { 15 17 url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh"; 16 18 sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541"; ··· 18 20 }; 19 21 in 20 22 21 - stdenv.mkDerivation { 22 - name = "nixpkgs.xctoolchain"; 23 - buildInputs = [ xcbuild makeWrapper ]; 24 - 25 - ## cctools should build on Linux but it doesn't currently 26 - 27 - buildCommand = '' 28 - mkdir -p $out 29 - plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)} 30 - 31 - mkdir -p $out/usr/include 32 - mkdir -p $out/usr/lib 33 - mkdir -p $out/usr/libexec 34 - mkdir -p $out/usr/share 35 - 36 - mkdir -p $out/usr/bin 37 - cd $out/usr/bin 38 - ln -s ${stdenv.cc}/bin/cpp 39 - ln -s ${stdenv.cc}/bin/c++ 40 - ln -s ${stdenv.cc}/bin/cc 41 - ln -s c++ clang++ 42 - ln -s cc clang 43 - 44 - ln -s ${llvm}/bin/llvm-cov 45 - ln -s ${llvm}/bin/llvm-dsymutil 46 - ln -s ${llvm}/bin/llvm-dwarfdump 47 - ln -s ${llvm}/bin/llvm-nm 48 - ln -s ${llvm}/bin/llvm-objdump 49 - ln -s ${llvm}/bin/llvm-otool 50 - ln -s ${llvm}/bin/llvm-profdata 51 - ln -s ${llvm}/bin/llvm-size 52 - 53 - ln -s ${yacc}/bin/yacc 54 - ln -s ${yacc}/bin/bison 55 - ln -s ${flex}/bin/flex 56 - ln -s ${flex}/bin/flex++ 57 - 58 - ln -s flex lex 59 - 60 - ln -s ${m4}/bin/m4 61 - ln -s m4 gm4 23 + runCommand "nixpkgs.xctoolchain" { 24 + nativeBuildInputs = [ makeWrapper ]; 25 + } ('' 26 + mkdir -p $out 27 + install -D ${writeText "ToolchainInfo.plist" (toPlist {} ToolchainInfo)} $out/ToolchainInfo.plist 62 28 63 - ln -s ${unifdef}/bin/unifdef 64 - ln -s ${unifdef}/bin/unifdefall 29 + mkdir -p $out/usr/include 30 + mkdir -p $out/usr/lib 31 + mkdir -p $out/usr/libexec 32 + mkdir -p $out/usr/share 33 + mkdir -p $out/usr/bin 65 34 66 - ln -s ${gperf}/bin/gperf 67 - ln -s ${indent}/bin/indent 68 - ln -s ${ctags}/bin/ctags 69 - '' + stdenv.lib.optionalString stdenv.isDarwin '' 70 - ln -s ${bootstrap_cmds}/bin/mig 71 - ln -s ${binutils}/bin/lipo 35 + for bin in ${getBin stdenv.cc}/bin/*; do 36 + ln -s $bin $out/usr/bin 37 + done 72 38 73 - ln -s ${cctools}/bin/ar 74 - ln -s ${cctools}/bin/as 75 - ln -s ${cctools}/bin/nm 76 - ln -s ${cctools}/bin/nmedit 77 - ln -s ${cctools}/bin/ld 78 - ln -s ${cctools}/bin/libtool 79 - ln -s ${cctools}/bin/strings 80 - ln -s ${cctools}/bin/strip 81 - ln -s ${cctools}/bin/install_name_tool 82 - ln -s ${cctools}/bin/bitcode_strip 83 - ln -s ${cctools}/bin/codesign_allocate 84 - ln -s ${cctools}/bin/dsymutil 85 - ln -s ${cctools}/bin/dyldinfo 86 - ln -s ${cctools}/bin/otool 87 - ln -s ${cctools}/bin/unwinddump 88 - ln -s ${cctools}/bin/size 89 - ln -s ${cctools}/bin/segedit 90 - ln -s ${cctools}/bin/pagestuff 91 - ln -s ${cctools}/bin/ranlib 92 - ln -s ${cctools}/bin/redo_prebinding 39 + for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do 40 + if ! [ -e "$out/usr/bin/$(basename $bin)" ]; then 41 + ln -s $bin $out/usr/bin 42 + fi 43 + done 93 44 94 - ln -s ${xib2nib}/bin/ibtool 95 - '' + 96 - # No point including the entire gcc closure if we don't already have it 97 - (if stdenv.cc.isClang then '' 98 - ln -s ${stdenv.cc.cc.llvm}/bin/llvm-cov gcov 99 - ln -s ${mkdep-darwin-src} mkdep 100 - '' else '' 101 - ln -s ${gcc}/bin/gcov 102 - ln -s ${gcc}/bin/mkdep 103 - ''); 104 - } 45 + ln -s ${buildPackages.yacc}/bin/yacc $out/usr/bin/yacc 46 + ln -s ${buildPackages.yacc}/bin/bison $out/usr/bin/bison 47 + ln -s ${buildPackages.flex}/bin/flex $out/usr/bin/flex 48 + ln -s ${buildPackages.flex}/bin/flex++ $out/usr/bin/flex++ 49 + ln -s $out/bin/flex $out/usr/bin/lex 105 50 106 - # other commands in /bin/ 107 - # asa 108 - # cmpdylib (in cctools) 109 - # ctf_insert (in cctools) 110 - # dwarfdump 111 - # lorder 112 - # rebase 113 - # rpcgen (in developer_cmds) 114 - # what 51 + ln -s ${buildPackages.m4}/bin/m4 $out/usr/bin/m4 52 + ln -s $out/usr/bin/m4 $out/usr/bin/gm4 115 53 54 + ln -s ${buildPackages.unifdef}/bin/unifdef $out/usr/bin/unifdef 55 + ln -s ${buildPackages.unifdef}/bin/unifdefall $out/usr/bin/unifdefall 116 56 117 - # swift: see #11463 118 - # swift 119 - # swift-compress 120 - # swift-demangle 121 - # swift-stdlib-tool 122 - # swift-update 123 - # swiftc 57 + ln -s ${buildPackages.gperf}/bin/gperf $out/usr/bin/gperf 58 + ln -s ${buildPackages.indent}/bin/indent $out/usr/bin/indent 59 + ln -s ${buildPackages.ctags}/bin/ctags $out/usr/bin/ctags 60 + '' + optionalString stdenv.isDarwin '' 61 + ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $out/usr/bin 62 + ln -s ${mkdep-darwin-src} $out/usr/bin/mkdep 63 + '')
+15 -16
pkgs/development/tools/xcbuild/wrapper.nix
··· 1 - { stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics 2 - , cctools, bootstrap_cmds, binutils}: 1 + { stdenv, buildPackages, makeWrapper, writeText, runCommand 2 + , CoreServices, ImageIO, CoreGraphics }: 3 3 4 4 let 5 5 ··· 7 7 platformName = "com.apple.platform.macosx"; 8 8 sdkName = "macosx10.10"; 9 9 10 - xcbuild = callPackage ./default.nix { 10 + xcbuild = buildPackages.callPackage ./default.nix { 11 11 inherit CoreServices ImageIO CoreGraphics; 12 12 }; 13 13 14 - toolchain = callPackage ./toolchain.nix { 15 - inherit cctools bootstrap_cmds toolchainName xcbuild binutils stdenv; 14 + toolchain = buildPackages.callPackage ./toolchain.nix { 15 + inherit toolchainName; 16 16 }; 17 17 18 - sdk = callPackage ./sdk.nix { 19 - inherit toolchainName sdkName xcbuild; 18 + sdk = buildPackages.callPackage ./sdk.nix { 19 + inherit toolchainName sdkName; 20 20 }; 21 21 22 - platform = callPackage ./platform.nix { 23 - inherit sdk platformName xcbuild; 22 + platform = buildPackages.callPackage ./platform.nix { 23 + inherit sdk platformName; 24 24 }; 25 25 26 26 xcconfig = writeText "nix.xcconfig" '' ··· 32 32 stdenv.mkDerivation { 33 33 name = "xcbuild-wrapper-${xcbuild.version}"; 34 34 35 - buildInputs = [ xcbuild makeWrapper ]; 35 + nativeBuildInputs = [ makeWrapper ]; 36 36 37 37 setupHook = ./setup-hook.sh; 38 38 ··· 40 40 41 41 installPhase = '' 42 42 mkdir -p $out/bin 43 - cd $out/bin/ 44 43 45 44 for file in ${xcbuild}/bin/*; do 46 - ln -s $file 45 + ln -s $file $out/bin 47 46 done 48 47 49 - mkdir $out/usr 48 + mkdir -p $out/usr 50 49 ln -s $out/bin $out/usr/bin 51 50 52 - mkdir -p $out/Library/Xcode/ 51 + mkdir -p $out/Library/Xcode 53 52 ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications 54 53 55 - mkdir -p $out/Platforms/ 54 + mkdir -p $out/Platforms 56 55 ln -s ${platform} $out/Platforms/nixpkgs.platform 57 56 58 - mkdir -p $out/Toolchains/ 57 + mkdir -p $out/Toolchains 59 58 ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolchain 60 59 61 60 wrapProgram $out/bin/xcodebuild \
+2 -2
pkgs/servers/http/myserver/default.nix
··· 1 1 { lib, fetchurl, stdenv, libgcrypt, libevent, libidn, gnutls 2 - , libxml2, zlib, guile, texinfo, cppunit, psmisc }: 2 + , libxml2, zlib, guile, texinfo, cppunit, killall }: 3 3 4 4 let version = "0.11"; in 5 5 ··· 26 26 27 27 # On GNU/Linux the `test_suite' process sometimes stays around, so 28 28 # forcefully terminate it. 29 - postCheck = lib.optionalString stdenv.isLinux "${psmisc}/bin/killall test_suite || true"; 29 + postCheck = "${killall}/bin/killall test_suite || true"; 30 30 31 31 meta = { 32 32 description = "GNU MyServer, a powerful and easy to configure web server";
+6 -3
pkgs/tools/misc/xfstests/default.nix
··· 1 - { stdenv, acl, attr, autoconf, automake, bash, bc, coreutils, e2fsprogs, fetchgit, fio, gawk, keyutils 2 - , lib, libaio, libcap, libtool, libuuid, libxfs, lvm2, openssl, perl, procps, psmisc, quota, su 1 + { stdenv, acl, attr, autoconf, automake, bash, bc, coreutils, e2fsprogs 2 + , fetchgit, fio, gawk, keyutils, killall, lib, libaio, libcap, libtool 3 + , libuuid, libxfs, lvm2, openssl, perl, procps, quota, su 3 4 , time, utillinux, which, writeScript, xfsprogs }: 4 5 5 6 stdenv.mkDerivation { ··· 90 91 ln -s @out@/lib/xfstests/$f $f 91 92 done 92 93 93 - export PATH=${lib.makeBinPath [acl attr bc e2fsprogs fio gawk keyutils libcap lvm2 perl procps psmisc quota utillinux which xfsprogs]}:$PATH 94 + export PATH=${lib.makeBinPath [acl attr bc e2fsprogs fio gawk keyutils 95 + libcap lvm2 perl procps killall quota 96 + utillinux which xfsprogs]}:$PATH 94 97 exec ./check "$@" 95 98 ''; 96 99
+2 -3
pkgs/top-level/all-packages.nix
··· 8576 8576 8577 8577 xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix { 8578 8578 inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; 8579 - inherit (darwin) cctools bootstrap_cmds binutils; 8580 - stdenv = clangStdenv; 8579 + stdenv = buildPackages.clangStdenv; 8581 8580 }; 8582 8581 8583 8582 xmlindent = callPackage ../development/web/xmlindent {}; ··· 21742 21741 unixtools = recurseIntoAttrs (callPackages ./unix-tools.nix { }); 21743 21742 inherit (unixtools) hexdump ps logger eject umount 21744 21743 mount wall hostname more sysctl getconf 21745 - getent locale; 21744 + getent locale killall; 21746 21745 21747 21746 fts = if hostPlatform.isMusl then netbsd.fts else null; 21748 21747
+4
pkgs/top-level/unix-tools.nix
··· 81 81 linux = pkgs.nettools; 82 82 darwin = pkgs.darwin.network_cmds; 83 83 }; 84 + killall = { 85 + linux = pkgs.psmisc; 86 + darwin = pkgs.darwin.shell_cmds; 87 + }; 84 88 locale = { 85 89 linux = pkgs.glibc; 86 90 darwin = pkgs.netbsd.locale;