ChanServ changed the topic of #robotnix to: Robotnix: https://github.com/danielfullmer/robotnix || Channel logs: https://logs.nix.samueldr.com/robotnix
<matthewcroughan_> danielrf[m]: what is apv.buildID?
<danielrf[m]> matthewcroughan_: That's just used to select an upstream factory img/ota for android-prepare-vendor
<danielrf[m]> it's only used for pixel phones on vanilla/grapheneos
<danielrf[m]> shouldn't be used with lineageos
<matthewcroughan_> Sure. I'm looking at mako.nix now, and I love it.
<matthewcroughan_> I wasn't prepared to love nix this much. All I'm going to have to do is replace 5 strings. <3
<matthewcroughan_> Then I can make a thread on XDA which tells people how to build it with Nix, and disincentivise hosting artifacts.
<danielrf[m]> happy to hear that you like it!
<matthewcroughan_> how come your mako.nix dets deepClone = false; fetchSubmodules = false; leaveDotGit = false;
<matthewcroughan_> sets*
<danielrf[m]> that's not my mako.nix, I think you're referring to hmenke's ?
<matthewcroughan_> yeah
<danielrf[m]> Not sure why he set those, I think those are the default settings anyway for fetchgit
<danielrf[m]> although I might suggest using fetchFromGitHub instead of fetchgit if you're already going to be specifying this manually
<danielrf[m]> as I think fetchFromGitHub can more efficiently grab random (untagged) revisions than fetchgit can
<matthewcroughan_> explicit vs implicit is a good practice, especially if he hasn't pinned it to nixpkgs
<matthewcroughan_> let's imagine the behavior of fetchgit changes
<danielrf[m]> indeed
<danielrf[m]> have you been using nix before trying robotnix, btw?
<danielrf[m]> just curious
<matthewcroughan_> danielrf[m]: Yes, quite a bit actually.
<matthewcroughan_> Although I'm still quite a noob I've been contributing more https://github.com/NixOS/nixpkgs/pulls/matthewcroughan
<matthewcroughan_> How do you tell robotnix what version of LineageOS to use for a given device?
<matthewcroughan_> I want to try 18.1
<danielrf[m]> hmenke has his branch with 18.1, (which we ought to merge into robotnix master)
<danielrf[m]> There's currently no logic to select the lineageos version based on androidVersion (like there is for vanilla/grapheneos)
<matthewcroughan_> so there is no way to override it?
<matthewcroughan_> ah sweet
<danielrf[m]> So if you build with current robotnix master then you get 17.1
<danielrf[m]> but if you build with hmenke's branch then you get 18.1
<matthewcroughan_> Sweet, do you know if there's major issues with 18.1 on hmenke's branch or has it worked fine?
<danielrf[m]> I haven't tried it at all yet, but it looks like quite a small change
<matthewcroughan_> https://termbin.com/5jz88
<danielrf[m]> relatively small change
<matthewcroughan_> do you see any issues with this file?
<matthewcroughan_> or is this all that one would need to build?
<danielrf[m]> the sha256s will need to be updated
<danielrf[m]> they're all the same currently
<matthewcroughan_> yeah is there a way to do that en-masse?
<danielrf[m]> but other than that I don't notice anything obviously wrong
<matthewcroughan_> or calculate it prior to build?
<matthewcroughan_> is that what git prefetch is for?
<danielrf[m]> nix-prefetch-git
<danielrf[m]> but tbh if it's just a few repos then I just repeatedly try to build and use the error message to update the sha256s
<matthewcroughan_> fair :D
<matthewcroughan_> is there a way to change the build dir? I have a hard drive I'd rather build to lol
<matthewcroughan_> I know that's not really how nix works though.
<matthewcroughan_> /nix/store is on the root and that's all you're given
<danielrf[m]> for the build products yes, but you could probably mount /tmp on another drive
<danielrf[m]> which is where the intermediate build steps take place
<matthewcroughan_> Oh? So the more ram I have the better?
<danielrf[m]> oh yes definitely
<danielrf[m]> But you need a ton of ram to run /tmp on tmpfs
<matthewcroughan_> >The AOSP project requires at least 250GB free disk space
<danielrf[m]> That's AOSP's recommendation, and you can get away with a bit less than that
<matthewcroughan_> So, if I want to use my hard drive for this, I can't, because the /nix/store is on my 240GB ssds
<danielrf[m]> ~40GB for source code, ~100GB for intermediate build products
<danielrf[m]> yeah a 240GB drive would be tight if you have much else on it
<matthewcroughan_> But is what I'm saying about the nix store true?
<matthewcroughan_> Or could I nix --build --store /mnt/hdd1
<danielrf[m]> ah, maybe! I haven't really used that functionality before
<matthewcroughan_> yeah man it's how I used Matthew Bauer's static nix
<matthewcroughan_> danielrf[m]: error: cannot auto-call a function that has an argument without a default value ('config')
<matthewcroughan_> hmm..
<matthewcroughan_> quite stuck, any ideas? :D
<danielrf[m]> your configuration file needs a function header like:
<danielrf[m]> { pkgs, ... }:
<matthewcroughan_> Already has one
<matthewcroughan_> https://termbin.com/08nq
<danielrf[m]> I put that into `test.nix`
<matthewcroughan_> ssh ro-PcAJBDpAvrm9nFuuynpmmeMNn@lon1.tmate.io
<danielrf[m]> and ran: `nix-build --arg configuration ./test.nix -A ota`
<matthewcroughan_> here's a session you can join
<danielrf[m]> and it evaluates at least
<danielrf[m]> ok
<danielrf[m]> yeah, pynix.nix is not the entry point
<danielrf[m]> default.nix is
<matthewcroughan_> oh.. how did we make it do bacon.nix that one time?
<danielrf[m]> Try `nix-build --arg configuration ./pynix.nix -A ota`
<matthewcroughan_> is ota really the thing I wanna compile?
<matthewcroughan_> what is it that I'd flash in twrp?
<danielrf[m]> Yep, for lineageos, typically the way to flash is via the OTA
<matthewcroughan_> What do you mean "via the OTA"
<matthewcroughan_> I am going to flash the device clean
<matthewcroughan_> so I need the IMG right?
<danielrf[m]> using`adb sideload`
<matthewcroughan_> ah ok
<danielrf[m]> you could try the `img` instead, with `fastboot update` if you'd prefer
<danielrf[m]> I just thought the supported way to flash a lineageos image was via `adb sideload`
<matthewcroughan_> seems like this didn't work ha
<danielrf[m]> use `nix-build` instead of `nix build` here
<matthewcroughan_> `NIX_STORE_DIR`
<matthewcroughan_> with nix build you can do --store
<matthewcroughan_> ah..
<matthewcroughan_> yeah that won't work lol
<matthewcroughan_> I need to use `nix build` not `nix-build`
<danielrf[m]> `nix build --arg configuration ./pynix.nix -f . ota`
<danielrf[m]> plus your --store option I suppose
<matthewcroughan_> -f is channel though, isn't it?
<danielrf[m]> it's used to select which nix expression to evaluate
<danielrf[m]> using `-f .` means it will use the default.nix from the current dir
<matthewcroughan_> hmm
<danielrf[m]> `./pyxis.nix`
<danielrf[m]> needs the `./` for some reason
<matthewcroughan_> boom
<danielrf[m]> I guess so nix knows it's a path and not some other expression
<danielrf[m]> progress!
<matthewcroughan_> and now I'm compiling to /eggshells/robotnix-build
<matthewcroughan_> thank God for that
<matthewcroughan_> I mean, yeah, it's not leveraging my existing /nix/store, but hey.
<matthewcroughan_> taking too long, will risk it on my ssds for now :D
<danielrf[m]> I'm trying it as well, and I went ahead and fixed the sha256s
<danielrf[m]> Getting this error though:
<danielrf[m]> error: device/xiaomi/sdm710-common/Android.bp:1:1: module "soong_namespace": namespace hardware/xiaomi does not exist
<matthewcroughan_> oh dear D:
<matthewcroughan_> you must have a very fast machine and internet
<danielrf[m]> I actually have the lineageos sources mirrored locally
<matthewcroughan_> Unbelieveable
<danielrf[m]> plus a hackish way to get it into robotnix via the mirror
<matthewcroughan_> I'm using hmenke's repo and am checked out to lineageos-18.01
<matthewcroughan_> the sources probably do rely on that
<danielrf[m]> same
<matthewcroughan_> interesting
<matthewcroughan_> maybe it won't work yet then
<matthewcroughan_> those sources have 17.1 branches, maybe that's what I need
<danielrf[m]> I'm checking something now
<danielrf[m]> we may just not be including the right dirs from lineageos
<danielrf[m]> yep here's the issue:
<danielrf[m]> lineageos repos can contain a `lineage.dependencies` file
<danielrf[m]> this file specifies that additional source dirs need to be included in the build
<matthewcroughan_> Right, so it's missing a source dir that I've specified in pyxis.nix?
<danielrf[m]> and while robotnix handles this correctly for official devices, it doesn't know anything about the dependencies of the source dirs you manually included
<matthewcroughan_> Sure! I get that :D
<matthewcroughan_> wow
<samueldr> (it also needs to happen recursively)
<matthewcroughan_> so that -common dir I added, it's not there
<matthewcroughan_> right?
<danielrf[m]> thinking of the best way to do this for unofficial devices currently
<danielrf[m]> no, I think the -common dir is there
<danielrf[m]> but that dir needs "hardwafd/xiaomi" as well
<danielrf[m]> *hardware
<matthewcroughan_> that is hardcore :V
<matthewcroughan_> danielrf[m]: is it likely that I can override/fix this in pyxis.nix tonight? Or is this a fundamental problem?
<danielrf[m]> Fixing it correctly might take a little while
<danielrf[m]> but I have some time tonight to look into it
<danielrf[m]> there isn't an trivial workaround either
<danielrf[m]> but thanks for bringing this to my attention
<matthewcroughan_> I knew it wouldn't be this easy :P
<danielrf[m]> It's not too bad, just need to figure out how to better expose some of this dependency calculation to external sources
<matthewcroughan_> You'd be bringing LineageOS to this device.
<matthewcroughan_> Once I have it compiled, I'd be on XDA forums, perhaps even tonight with a tutorial, a video, a blog post.
<matthewcroughan_> "Unofficial" isn't bad anymore when you have Robotnix building it :D
<danielrf[m]> If you do make a blog post, just mention that the lineageos support in robotnix is still not currently up to the standard for vanilla/grapheneos on pixed phones
<matthewcroughan_> Yeah, like the updater and stuff, I get that.
<matthewcroughan_> But the fact that I can just switch between grapheneos, aosp and lineageos like it's nothing, that's magical
<matthewcroughan_> nothing short of miraculous
<danielrf[m]> I initially added lineageos support when prompted by samueldr
<danielrf[m]> I don't use it personally
<matthewcroughan_> I don't really want to, but it's the easiest to build I think.
<samueldr> (I didn't end up using it in the end)
<danielrf[m]> But I get that a lot of people use it, and it'd be nice to have better support for it
<matthewcroughan_> Or could I build AOSP right now without this issue?
<matthewcroughan_> Is this issue I have unique to LineageOS?
<danielrf[m]> Well robotnix vanilla aosp only supports pixel phones in robotnix currently
<danielrf[m]> and your device dirs target lineageos
<matthewcroughan_> Oh really? That's interesting, I didn't know this was non-generic.
<matthewcroughan_> Does this mean that Xiaomi's stock rom is based on Lineage?
<danielrf[m]> definitely not
<danielrf[m]> this might be non-generic, I shouldn't have made that assumption
<danielrf[m]> it's just that they have files like the `lineage.dependencies`
<matthewcroughan_> So what does "support" mean? If I switch my flavor to Vanilla, what would happen?
<matthewcroughan_> Are vanilla and aosp different?
<danielrf[m]> I use vanilla to mean the aosp provided by google
<danielrf[m]> If you switched to `flavor="vanilla";` with these device source dirs then it just wouldn't work
<danielrf[m]> Yeah, I'm quite certain it's not intended to work without lineageos
<danielrf[m]> They would have options for `aosp_pyxis` instead of `lineage_pyxis` otherwise
<matthewcroughan_> I see, interesting.
<matthewcroughan_> danielrf[m]: getting anywhere on this? :P
<matthewcroughan_> I can't believe I'm still fetching stuff haha
<matthewcroughan_> Man I need faster internet.
<samueldr> AFAIK each vendors basically havea fork of android for their needs
<samueldr> probably not like lineageOS, but not like AOSP either, probably somewhere in-between
<samueldr> and the fun part is that "Android" proper, it's ASL (the license), so there's no requirement for the device trees to be published, or anything like that
<samueldr> so building AOSP would probably mean as much or more work than building e.g. LineageOS or one of its derivative, to integrate the device-specific things
<samueldr> uh, s/building/porting/
<samueldr> there's a reason there's nothing else on than LineageOS derivatives in custom ROMs
<samueldr> (GrapheneOS doesn't count here, it's less of a custom ROM, more of a hardened AOSP... though I don't mean to demean the project)
<danielrf[m]> I would like to be able to build a "vanillla AOSP" for non-pixel phones as well
<danielrf[m]> lineageos disables a bunch of security features like AVB/dm-verity as well as using userdebug by default
<danielrf[m]> would be nice if there was a project to make plain android work on all these phones, and then have lineageos be a layer on top of that
<danielrf[m]> but as you said, there's no requirement for vendors to publish their sources
<danielrf[m]> matthewcroughan_: still looking in to it
<danielrf[m]> I might need to extend the existing updater scripts
<matthewcroughan_> danielrf[m]: how come? LineageOS doesn't even have updater support
<danielrf[m]> no i mean my updater scripts
<matthewcroughan_> ah ok :D
<danielrf[m]> includes how I get the information to determine the dependency relationships between source dirs
<danielrf[m]> Workaround ended up being not difficult, just manually included the `hardware/xiaomi` source dir.
<danielrf[m]> we're just lucky it only needed this one extra dir instead of a ton of them
<danielrf[m]> To make a proper fix for supporting unofficial lineageos devices would still require additional effort
<danielrf[m]> But this should suffice for you in the meantime
<danielrf[m]> I started a build and it appears to be working so far
<matthewcroughan_> danielrf[m]: Heyo, I just woke up :)
<matthewcroughan_> danielrf[m]: Totally works.. :)
<matthewcroughan_> Not flashed it yet, going to in a moment.
<danielrf[m]> nice!
<danielrf[m]> whether it boots is another hurdle :(
<danielrf[m]> *:)
<matthewcroughan_> *:(
<danielrf[m]> no luck?
<matthewcroughan_> No just replacing your smiley face with a sad face
<matthewcroughan_> it's sad before it's happy
<danielrf[m]> haha, ok
<matthewcroughan_> Things get worse before they get better ;D
<matthewcroughan_> danielrf[m]: Exciting. It's flashing, hasn't failed any checksumming, etc.
<matthewcroughan_> Super cool
<matthewcroughan_> TWRP still things the CPU is at 128712387961296C
<matthewcroughan_> danielrf[m]: IT WORKED
<matthewcroughan_> IT ABSOLUTELY WORKED, I"M IN
<danielrf[m]> yay!
<matthewcroughan_> danielrf[m]: what's the full process for upstreaming it now into robotnix?
<danielrf[m]> oh, I don't think we should upstream unofficial lineageos builds into robotnix itself
<danielrf[m]> that said, you can create another github repo containing your configuration and a known robotonix revision it builds against
<danielrf[m]> We do still need to upgrade to lineage-18.1 in robotnix itself, however.
<danielrf[m]> if you're familiar with nix flakes, making a flake that provides pyxis support could be worthwhile as well
<matthewcroughan_> danielrf[m]: how would I do that exactly? I am familiar with flakes.
<danielrf[m]> sorry I can't help with that at the moment, but I am working on some docs to describe how to easily share your builds
<danielrf[m]> if you just want to have someone easily reproduce your build, I'd just make a nix expression that imports the robotnix default.nix from hmenke's branch, and passes in your configuration
<samueldr> danielrf[m]: what's the plan for linageos major version changes? thinking about how some devices always end up being left behind, would it make sense to keep the previous versions along?
<samueldr> e.g. you'd never be using "LineageOS", you'd always be using "LineageOS XX.Y"
<danielrf[m]> IIRC, lineageos upstream supports the last two major releases?
<samueldr> I don't really know
<danielrf[m]> with some devices supporting the newer one and some only supporting the older one
<danielrf[m]> I'd like to support all these at the minimum
<samueldr> the thought literally crossed my mind moments ago
<danielrf[m]> undecided about supporting older versions, maybe I'd leave support in but YMMV
<danielrf[m]> like the android 9 support that's still kinda in robotnix but hasn't been tested for a while
<samueldr> good to know it was on your radar
<samueldr> not pressing for a resolution