jrolfs has quit [Ping timeout: 246 seconds]
yastero has joined #nix-darwin
philr has joined #nix-darwin
<copumpkin> rebuilding the stdenv for the first time in a while, for this LTO change
<copumpkin> looks like our bootstrap tools are still on LLVM 5
<copumpkin> 4
<copumpkin> I mean
<copumpkin> we should bump everything up to 6 at some point then refresh the bootstrap tools
<copumpkin> has there been any noise about adding 7 to nixpkgs?
nikivi has quit [Ping timeout: 252 seconds]
nikivi has joined #nix-darwin
hamishmack has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
philr has quit [Ping timeout: 240 seconds]
<johnw> copumpkin: someone else just asked that a day or two ago here
<johnw> I didn't hear an answer
<copumpkin> about 7?
<johnw> yeah
<copumpkin> LnL: the swift-corelibs-foundation CF looks a lot better now actually, I might be able to get a working build
<copumpkin> been hacking at it this evening and it doesn't look as hopeless as it did in the past
<copumpkin> like I think I might almost have it working :)
<copumpkin> but must sleep now, will hack at it tomorrow after work
<copumpkin> if so that would get us unblocked and let us upgrade SDK, etc.
<copumpkin> as well as being more full-featured compared to our current CFLite
<copumpkin> will fix it up more tomorrow if someone doesn't get to it first
<copumpkin> the LTO-enabled stdenv is also building right now, but I'm not sure I want to roll it out without releasing a new version of the bootstrap tools (that include libLTO.dylib)
<copumpkin> or I suppose I could turn off LTO during bootstrap
<copumpkin> okay, I should sleep
<LnL> copumpkin: yeah, I think our current bootstrap-tools also won't work on 10.14
<johnw> if I want a clang that knows where libc++ is, what should I pull in?
<LnL> copumpkin: but I didn't update it yet because I was wondering if we could clean it up a bit
<johnw> llvmPackages_6.libcxxStdenv.cc.cc doesn't have the libc++ includes in its -print-search-path
<johnw> which strikes me as very odd
<LnL> what context?
<johnw> trying to use Nix to build Google's V8 engine
<johnw> steps:
<johnw> nix-store -r $(nix-instantiate --expr '(import <darwin> {}).pkgs.llvmPackages_6.libcxxStdenv.cc.cc')
<johnw> <path_to_clang>/bin/clang++ -print-search-dirs
<johnw> I see:
<johnw> programs: =/nix/store/74qn633mb6xj23f84kmwjn7wa2bzzggr-clang-6.0.1/bin
<johnw> libraries: =/nix/store/74qn633mb6xj23f84kmwjn7wa2bzzggr-clang-6.0.1/lib/clang/6.0.1
<johnw> however, in that libraries directory, you won't find include/ctime, for example
<LnL> that's the unwrapped clang
<LnL> libcxx is in a separate package so it doesn't know about it unless it's configured
<johnw> so how do I get a reference to the directory whose bin/clang++ knows the path to libcxx?
<{^_^}> #41589 (by uri-canva, 13 weeks ago, open): stdenv.cc: use libc++ as default c++ standard library on darwin
<LnL> libcxxStdenv.cc is a wrapped clang that will find nix dependencies
<LnL> and the stdenv itself configures libcxx
<johnw> but as you can see from my reproduction steps above, this is not the case
<johnw> this should succeed: ls -l $($(nix-store -r $(nix-instantiate --expr 'let pkgs = (import <darwin> {}).pkgs; in (pkgs.wrapCC pkgs.llvmPackages_6.clang).cc.cc') | head -1)/bin/clang++ -print-search-dirs | tail -1 | sed 's/libraries: =//')/include/ctime
<johnw> well, change that to libcxxStdenv.cc
<johnw> it fails identically
<LnL> well no, the stdenv determines what libc++ to use this is just a plain clang
<johnw> not sure I understand your previous comment then
<johnw> what attribute do I use to get what I want?
<johnw> I also tried my command with: pkgs.llvmPackages_6.libcxxStdenv.cc.cc
<LnL> nix-build -E 'with import <nixpkgs> {}; llvmPackages.stdenv.mkDerivation { name = "foo"; buildCommand = "NIX_DEBUG=1 clang++ -print-search-dirs"; }'
<johnw> how do I reliably discover the path to this clang++ binary?
<LnL> the extra output is from the cc-wrapper, but it needs environment variables from the stdenv to find stuff
<LnL> llvmPackages.stdenv.cc is the same binary, but without the extra context provided by the stdenv
<LnL> does that make sense?
<johnw> yeah
<johnw> this clang wrapper directory isn't good enough though
<LnL> I just woke up so I'm probably explaining this poorly
<johnw> the tree is missing lib/libFindBadConstructs.dylib
<LnL> where does that come from?
<johnw> an error after running clang++ during the v8 build
<LnL> can't find it with nix-locate, but the llvm6 set probably doesn't get recursed
<LnL> gtg
<johnw> thanks for your help!
<nikivi> does anyone know if it would be hard to make this nixder work on mac?
<LnL> does it not work?
<LnL> buildInputs = [ ... ] ++ stdenv.lib.optional stdenv.isDarwin CoreServices
<LnL> and https://search.nix.gsc.io/?q=inherit%20%5C(darwin.apple_sdk.frameworks%5C)&i=nope&files=&repos=
<LnL> to get it into callPackage scope
<LnL> if you run into missing frameworks there's a good change it will just work when you add them
<nikivi> thanks
<nikivi> and to get it to build without calling nixpkgs
<nikivi> I just create default.nix file somewhere in FS
<nikivi> whats your usual workflow for it is?
<LnL> I have a nixpkgs clone and edit that
<nikivi> fork you mean?
<nikivi> or just a local clone
<LnL> well, both :)
<LnL> but a clone is enough to build locally
<nikivi> I have a clone of nixpkgs in ~/src/clones/nixpkgs
<nikivi> say I changed default.nix of that command in it
<nikivi> how can I build it from it
<LnL> cd to it and nix-build -A hello or whatever :)
<nikivi> LnL this is what you meant right?
<LnL> ah there where no buildInputs, drop the [ ... ]
<LnL> that was just a placeholder
<nikivi> should I add darwin to platforms too?
<nikivi> or its fine
<nikivi> if it works I will PR to nixpkgs
<nikivi> I can run `nix-build -A watchexec` at root of nixpkgs clone
<nikivi> or I have to go to dir with default.nix of watchexec
hamishmack has joined #nix-darwin
<nikivi> here is with trace https://paste.ee/p/vPwMy
<nikivi> my default.nix
<LnL> yeah, add an entry like I linked to all-packages.nix for watchexec
<LnL> darwin frameworks are not part of the default set
<nikivi> a bit confused
<nikivi> I should add `inherit \(darwin.apple_sdk.frameworks\)` to the 22k line `all-packages.nix` file?
<nikivi> https://search.nix.gsc.io/?q=inherit%20%5C(darwin.apple_sdk.frameworks%5C)&i=nope&files=&repos=
<nikivi> I am not sure I understand this
<nikivi> currently it has watchexec = callPackage ../tools/misc/watchexec { };
<nikivi> watchexec = callPackage ../tools/misc/watchexec {
<nikivi> inherit \(darwin.apple_sdk.frameworks\);
<nikivi> };
<nikivi> so this?
<nikivi> or okay nvm its this I think
<nikivi> watchexec = callPackage ../tools/misc/watchexec {
<nikivi> inherit (darwin.apple_sdk.frameworks) Foundation ApplicationServices AppKit;
<nikivi> };
<nikivi> I get this error now
<nikivi> ❯ nix-build -A watchexec
<nikivi> error: anonymous function at /Users/nikivi/src/clones/nixpkgs/pkgs/tools/misc/watchexec/default.nix:1:1 called with unexpected argument 'Foundation', at /Users/nikivi/src/clones/nixpkgs/lib/customisation.nix:74:12
<nikivi> line 74 is line 3 in pastee https://paste.ee/p/IiOXX
philr has joined #nix-darwin
<LnL> nikivi: like the second one, but only inherit the frameworks you need (eg. CoreServices)
<nikivi> ❯ nix-build -A watchexec
<nikivi> error: anonymous function at /Users/nikivi/src/clones/nixpkgs/pkgs/tools/misc/watchexec/default.nix:1:1 called with unexpected argument 'CoreServices', at /Users/nikivi/src/clones/nixpkgs/lib/customisation.nix:74:12
<nikivi> :(
<nikivi> what I added
<LnL> oh, add it to the first line of the expression https://paste.ee/p/iufWo#s=0&l=1
<LnL> like stdenv and rustPlatofrm
<nikivi> add what
<nikivi> { stdenv, lib, rustPlatform, fetchFromGitHub darwin.apple_sdk.frameworks }:
<nikivi> ?
<nikivi> or { stdenv, lib, rustPlatform, fetchFromGitHub CoreServices; }:
<nikivi> with a comma there*
<nikivi> okay I think I got it, it was CoreServices, as it references it
<nikivi> LnL it failed https://paste.ee/p/KKvOr
<nikivi> my default.nix https://paste.ee/p/oDdi5
<LnL> hmm :/
<nikivi> was offline for a bit
<nikivi> LnL do you know what causes the build fail?
<LnL> probably because our CF is a bit old
<nikivi> Ill just use brew then :(
<nikivi> I wish there was a brew -> nix converter
<nikivi> like there is node -> nix or go -> nix
<LnL> this is mostly because apple has not released the sources for CoreFoundation is ages
<LnL> nikivi: //gist.github.com/LnL7/7614fae68cd4fd4ff0f331a8212f499f
<LnL> that magic trick should work around the issue
<nikivi> I get error
<nikivi> ❯ nix-build -A watchexec
<nikivi> error: undefined variable 'CoreFoundation' at /Users/nikivi/src/clones/nixpkgs/pkgs/tools/misc/watchexec/default.nix:11:29
<nikivi> (use '--show-trace' to show detailed location information)
<nikivi> or nvm Ill try import it
<nikivi> can I do this?
<nikivi> watchexec = callPackage ../tools/misc/watchexec {
<nikivi> inherit (darwin.apple_sdk.frameworks) CoreServices, CoreFoundation;
<nikivi> };
<nikivi> in all-packages.nix?
hamishmack has quit [Read error: Connection reset by peer]
<LnL> without the comma there
<nikivi> LnL thanks. It seemed to have built https://paste.ee/p/C56Kf
<nikivi> but `which watchexec` returns nothing
philr has quit [Quit: WeeChat 2.2]
<nikivi> I wonder where it installed
<LnL> nix-build doesn't install anything
<LnL> it only builds stuff, you should have a ./result that points to the build output
<nikivi> yep I got ./result
<nikivi> but how can I build locally a package as if I got it from nixpkgs
<nikivi> or its bad practice?
<nikivi> so its in my .nix-profile/bin/tree
<nikivi> or I should manually put it there
<LnL> you can make nix-env use the local nixpkgs with nix-env -f . -iA watchexec or even install the resulting path you built before directly using nix-env -i ./result
jtojnar has quit [Quit: jtojnar]
jtojnar has joined #nix-darwin
<LnL> btw you should contribute that and ask for a backport :)
<nikivi> magic
<nikivi> that worked
<nikivi> will send PR in a bit
<nikivi> can you expand on what you mean by a backport here?
<LnL> for every stable nixos release there's also a corresponding channel for darwin now
<LnL> these only get security updates and bugfixes and are pretty useful if you just want a working version of something
<LnL> but 18.09 was only branched recently so this will also be broken there
<nikivi> why does nixpkgs not have CONTRIBUTING.md
<LnL> there's a pull request template
<LnL> but I guess that's a bit late for a bunch of information :p
<nikivi> yeah I was just curious about git branching
<nikivi> should it be in a branch and with what name
<LnL> but basically branch master and use `<packagename>: <message>` as commit message
<nikivi> trying to find what's the name of platform for macOS
<nikivi> platforms = [ "x86_64-linux" ];
<nikivi> so I can extend above
<nikivi> also I am curious should I add some if statements
<nikivi> because linux users don't want to load CoreFoundation
<LnL> you can use platforms.unix
<LnL> oh right!
<LnL> stdenv.lib.optionalString stdenv.isDarwin '' ... ''
<{^_^}> #46311 (by nikitavoloboev, 7 seconds ago, open): watchexec: darwin support
<nikivi> it was hidden in .github
<nikivi> strangely
<nikivi> its better to put it in root because GitHub knows about it and suggests issuers and PRs to read it
<LnL> oh, what's it doing on there
<nikivi> I dont know why my PR has other commits in it
<nikivi> not just my 1 commit :|
<LnL> assuming NixOS/nixpkgs your origin remote
<LnL> git fetch origin master; git rebase -i origin/master
<LnL> and remove the lines except for the darwin fix
<nikivi> LnL after running it I had vim open this file https://paste.ee/p/TSG0Q
<nikivi> my remote is my fork https://github.com/nikitavoloboev/nixpkgs
<LnL> you have to use the name of the nixos remote
<LnL> (check git remote -v)
<nikivi> ❯ git remote -v
<nikivi> upstreamhttps://github.com/NixOS/nixpkgs (fetch)
<nikivi> upstreamhttps://github.com/NixOS/nixpkgs (push)
<nikivi> I thought git workflow was to push changes to fork, then make PR
<LnL> yeah so upstream instead of origin in your case
<nikivi> git fetch upstream master; git rebase -i upstream/master
<nikivi> just so I dont mess up
<LnL> yeah, that should get rid of the extra commits on your fork
<nikivi> I get this in file opened
<nikivi> pick a999c36b18a watchexec: darwin support
<nikivi> should I just save that?
<LnL> that's good
<LnL> it figured out the commits automatically
<nikivi> I fixed conflicts
<nikivi> and made a commit
<nikivi> but not sure what I should push it to
<nikivi> its certainly not git push upstream HEAD:master
<nikivi> I tried: git push upstream HEAD:nikitavoloboev:master
<nikivi> basically I was thinking of pushing what I have to the PR
<nikivi> ill just run through advice in PR :)
<LnL> you'll need to force push
<LnL> ah somebody already posted similar instructions there :)
<{^_^}> #46313 (by nikitavoloboev, 14 seconds ago, open): watchexec: darwin support
<nikivi> I hope this is okay
<copumpkin> LnL: you see that CF I put together?
<copumpkin> I'm quite excited
<LnL> not properly yet
<copumpkin> oh okay no rush
<copumpkin> after work I'll get it actually working
<copumpkin> and then compare against the current CF and system CF
<copumpkin> symbols, headers, etc.
<copumpkin> the LTO stdenv built fine :D
<LnL> yeah, running a wip eval once everything looks good should also give us a bit of confidence that it's good
<nikivi> any way to improve thisiz
<nikivi> ?
<nikivi> thanks for the help btw LnL
<LnL> no problem
<LnL> FYI. it's a big hidden if you don't know where to look, but you can change branches in the github ui
<LnL> bit*
ryanartecona has joined #nix-darwin
philr has joined #nix-darwin
philr has quit [Ping timeout: 272 seconds]
ryanartecona has quit [Quit: ryanartecona]
goodwill has joined #nix-darwin
ryanartecona has joined #nix-darwin
<copumpkin> LnL: sounds like llvm6 might be too big of a chunk to bite off just yet if there are still unresolved issues, so I might regenerate bootstrap tools on 5
<copumpkin> which is already version bump since they're currently on 4 :)
<LnL> yeah that's fine and might fix the stdenv build for 10.14 (and 10.13?)
<LnL> I did have some questions about it while looking at it a while back
<{^_^}> #43140 (by LnL7, 8 weeks ago, merged): darwin: fix Libsystem compatibility for macOS 10.14
<LnL> like why isn't libSystem in there?/
<LnL> it's essentially gets rebuilt while unpacking the tarball
<johnw> copumpkin: also pretty busy, as you can see :)
<copumpkin> LnL: will need to refresh my memory a bit, it might just be for silly historical reasons at this point
<copumpkin> I think that might be it
<LnL> yeah, it's mentioned explicitly but doesn't say why
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #nix-darwin