_0mp changed the topic of #freebsd-nix to: Adding Nix to FreeBSD ports | https://github.com/0mp/freebsd-ports-nix | https://logs.nix.samueldr.com/freebsd-nix
<qyliss> New theory: kill(-1, ...) when you have no other processes on Linux is successful, but on FreeBSD is EPERM
<qyliss> since kill(-1, ...) means "kill every process I have permission to, except this one" (roughly), EPERM shouldn't really matter to us
<qyliss> so we should just ignore it
<qyliss> yeah that gets it further!
<qyliss> managed to build GNU hello
<qyliss> there's a merge confict on the FreeBSD stdenv PR, which I think I'll just fix up myself
<qyliss> looks like the original branch has disappeared or something...
<simpson> qyliss++
<qyliss> no karma bot in here :P
<qyliss> Merged https://github.com/NixOS/nixpkgs/pull/81459 ("Fix FreeBSD support")
<abbe> Cool, thanks!
<qyliss> Next thing to do would be to get nix#4350 patched in the port
<abbe> I guess file a FreeBSD PR at https://bugs.freebsd.org/ for 0mp
<abbe> I will start testing more stuff with it
<qyliss> cmake is broken, so we can't build Nix with Nix yet
<qyliss> c++ doesn't seem to work :(
<Mic92> how does freebsd deal with libstdc++?
<Mic92> Do they also use the one that comes with gcc?
<qyliss> FreeBSD uses clang
<qyliss> it comes with clang++, so I assume the c++ stdlib is the llvm one
<abbe> There's libc++
<qyliss> that's the one
<Mic92> So nix on freebsd would not suffer from broken c++ regexes
<qyliss> hmm, so C++ worked at the time that PR was opened last year
<qyliss> but since then it appears to have been broken by https://github.com/nixos/nixpkgs/commit/704daf
<Mic92> does it not find the standard includes or does it fail to link with it?
<qyliss> both I think
<qyliss> I suspect we need to pass libcxx to cc-wrapper
<qyliss> oh, that's weird
<qyliss> the thing that specifically breaks it is that -target x86_64-unknown-freebsd started being added to cc-cflags
<Mic92> usually cc-wrapper provides libcxx wrapper itself.
<qyliss> If I comment out line 281 of pkgs/build-support/cc-wrapper/default.nix, I can build ncurses
<qyliss> otherwise, it tries and fails to link with libc++
<qyliss> cc Ericson2314 since you're the author of that commit
<qyliss> aha!
<qyliss> so the problem, for ncurses at least, is that cc-flags sets -target x86_64-unknown-freebsd
<qyliss> but FreeBSD's cc is for the target x86_64-unknown-freebsd12.2
<qyliss> if I manually set cc-flags to -target x86_64-unknown-freebsd12.2, it works
<qyliss> so it must think it's cross-compiling or something otherwise?
<abbe> FreeBSD's ABI may change between versions, so version is also encoded in the system triplet
<qyliss> hmm
<qyliss> I don't think we have any way to get the version at eval time
Lense has joined #freebsd-nix
<Lense> hi, I'm completely new to nix and getting the error "unexpected argument 'crossOverlays'" (full trace https://puu.sh/HeyOx.txt) when doing anything (such as `nix-env -qa`). Any pointers for what to look at?
<qyliss> Lense: you need to be using a very recent Nixpkgs for it to work with FreeBSD
<qyliss> as in, from today
<qyliss> because I just applied the fixes to make it work on FreeBSD a few hours ago
<Lense> so I should build from source instead of using the package in the topic?
<qyliss> there's a few steps to it, because, uh, I literally got it working today
<qyliss> (for some definition of working)
<qyliss> but I can take you through them if you want!
<qyliss> the easiest way to get a Nix that works on FreeBSD is to apply the patch in this bug report to your ports tree, then build the sysutils/nix port: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253322
<Lense> that would be great--my end goal is to build some software that uses nix as a build manager
<qyliss> unless that software is very simple it might not work yet
<qyliss> currently on FreeBSD we can only really build C programs
<qyliss> anyway, once you have a Nix that works, you need a compatible Nixpkgs
<qyliss> the fixes for FreeBSD are in Nixpkgs git master, but probably haven't made it into any channels yet, and if the software you're trying to build pins an older version of Nixpkgs, that probably also won't work.
<Lense> hmm https://github.com/urbit/urbit/tree/master/nix looks like it is mostly C but with haskell
<qyliss> I doubt Haskell will work
<qyliss> I'm also morally obligated to warn you what you're getting into with Urbit: http://distributedweb.care/posts/who-owns-the-stars/
<Lense> that's too bad. I'd volunteer to help, but I don't know any haskell or nix :)
<qyliss> we'll get there :)
<Lense> I read that post a while ago. I'm mainly interested in the tech stack of it which I think is really cool and might have some good ideas for other projects. Whether it's a good or useful communication/social structure is a whole different story
<qyliss> no need to justify yourself -- just wanted to make sure you were aware :)
<simpson> I wish I could recommend the Lojban fork of Urbit, but it seems to have died quietly. Which is fine, because one would have to know Lojban.
<simpson> I also wish I knew more BSD so that I could be more helpful. qyliss, are there obvious things that Linux-experienced folks can do for nixpkgs today which would help y'all later?
<qyliss> heh, I doubt I know any more than you
<qyliss> I'd never really used BSD until a few days ago when I started looking at this
<qyliss> I just want Nixpkgs to work on more platforms
<qyliss> simpson: do you know anything about the cross-compiling infra in Nixpkgs?
<qyliss> that's where the real problem atm is I think
<qyliss> or, just, like, how stdenv works in general I guess
<simpson> I think I grok the arch-to-arch bits somewhat, but this would be in the kernel-to-kernel parts, which I have no clue about. Maybe folks with Darwin experience would know more.
<qyliss> simpson: do you know how the platforms get populated?
<qyliss> e.g. where stdenv.hostPlatform.config comes from?
<simpson> Ah, a question of babby. Have you read lib/systems/default.nix yet?
<simpson> I might be quite behind; I bet that you've already patched that and gotten the crossPkgs attribute set up.
<qyliss> I think Ericson2314 might have done that, but I haven't really looked
<qyliss> did you read my description of the problem we're having above? with the host triple?
<simpson> Yeah. I think that we'll have to autodetect a little harder. Hopefully the pkgs/top-level/impure.nix flow doesn't need to be changed.
<simpson> I don't imagine a serious problem with "12.2" or etc. in the triple. It will frustrate having a binary cache, but whatever.
<qyliss> I wonder if I should just modify Nix to include the ABI version in builtins.currentSystem?
<qyliss> # Strip the version number from names such as `gnu0.3',
<qyliss> # `darwin10.2.0', etc.
<qyliss> I guess that rules that out unless I can present a much more knowledgeable argument than I currently can
<simpson> If the entire ABI's balanced on that number, then maybe we should leave it in. Who would have a stronger opinion on this besides niksnut?
<qyliss> I'd like to hear what Ericson2314 thinks, because every time I see a PR touching this stuff he's involved somehow
<qyliss> Will probably be good to ask Eelco too though, because idk how this will interact with flakes
<qyliss> for now I'm just going to locally hardcode it to 12.2 so I can see what other issues arise
<simpson> di'ai
<qyliss> that lojban? :p
<simpson> Oh, yeah, sorry. Teaching the basics to a Spanish speaker in #lojban and I forgot how to English. I mean to say "good luck!"
<qyliss> hehe
<qyliss> with the hack to get past the -target problem, the next failure is cmakeMinimal
<qyliss> CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
<qyliss> Please set them or make sure they are set and tested correctly in the CMake files:
<qyliss> LIBMD_LIBRARY
<qyliss> linked by target "cmTC_9ff7c" in directory /tmp/nix-build-cmake-boot-3.19.3.drv-0/cmake-3.19.3/CMakeFiles/CMakeTmp
<simpson> I gather that this is one of those "libm is not included by -lc on GNU/Linux, you need -lm as well" situations. Specifically, libmd is not included by libc on FreeBSD.
<simpson> (I also gather that libmd is Message Digests, so we probably are correct to depend on it.)
<qyliss> simpson: NIX_LDFLAGS = [ "-lmd" ] didn't help :(
georgew has left #freebsd-nix [#freebsd-nix]
<simpson> It looks like configure.ac might need to check for it, akin to the -latomic check.
<simpson> Or, hm. If it's in the CMake... Not sure.