sphalerite changed the topic of #nixos-dev to: NixOS Development (#nixos for questions) | NixOS 19.03 released! https://discourse.nixos.org/t/nixos-19-03-release/2652 | https://hydra.nixos.org/jobset/nixos/trunk-combined https://channels.nix.gsc.io/graph.html https://r13y.com | 19.03 RMs: samueldr,sphalerite | https://logs.nix.samueldr.com/nixos-dev
drakonis has quit [Quit: WeeChat 2.5]
drakonis has joined #nixos-dev
pie_ has quit [Ping timeout: 250 seconds]
<jtojnar> worldofpeace: testing the meson GIMP (https://github.com/jtojnar/nixpkgs/tree/gimp-meson), so far found a meson bug or something https://paste.gnome.org/pxp55snmz
drakonis has quit [Quit: WeeChat 2.5]
drakonis has joined #nixos-dev
evanjs has joined #nixos-dev
evanjs has quit [Client Quit]
evanjs has joined #nixos-dev
drakonis has quit [Quit: WeeChat 2.5]
orivej has joined #nixos-dev
orivej has quit [Ping timeout: 246 seconds]
pie_ has joined #nixos-dev
orivej has joined #nixos-dev
ixxie has joined #nixos-dev
<arianvp> I was wondering, can we do something similar for NAR file storage as here? https://github.com/systemd/casync
<arianvp> catar files and NAR files seem almost identical in goals
<arianvp> and this could save a lot of storage for binary caches
<gchristensen> can you give a little explanation of what your idea is w.r.t. how it applies to nars?
<gchristensen> is it just chunking?
<tilpner> arianvp: Have you tried it to check how much space it would saveß
<tilpner> *?
<arianvp> it chunks NARs with a rolling hash function which allows NARs with similar content to share disk space
<arianvp> there's probably some entropy-theoretical argument that you can make on how much disk space this can save
<arianvp> but dont have numbers
<arianvp> gchristensen: the catar file format and nar file format are virtually identical
<tilpner> It would depend a lot on the selection of chunks, so it would be good to first check if it would be worth the effort
<arianvp> the chunk selection happens automatically using the rsync algorithm
<gchristensen> interesting
<arianvp> yes it's an extremely cool technique
<arianvp> I think the fastest way to see if this is worthwhile is to write a little script that converts NARs into CATARs and see the size difference
<arianvp> :P
<arianvp> (after then indexing said CATARs)
<tilpner> I can see how it might be helpful for serving store paths from local disk
<tilpner> Not sure how feasible it is for cache.nixos.org
<arianvp> well the nice hting is that it will give incremental updates too. If a NAR of nginx-1.19 is similar to nginx1.18 the download would be incremental
<arianvp> however it wuld mean you need to store the NARs on the client which we currently dont do I think?
<tilpner> Oh, so Nix learns about chunks, it's not just a cache/hydra-side thing?
<tilpner> No, they're currently not stored, and that might increase space usage a lot
<arianvp> casync solves this by mounting the NAR files using FUSE
<arianvp> instead of unpacking them
<tilpner> Which would probably be a slow-down on average over having the realised files on disk
<arianvp> yeh so it would both be a space-saving but also a bandwidth-saving technique
<tilpner> The space savings might make up for that, but that needs numbers
<arianvp> yes there might be a slow-down. and yes these are all unknowns
<arianvp> just seems like a fun direction to explore; ill put some time in it
<tilpner> I'm exporting my local store to NARs and intend to chunk them afterwards
<tilpner> Just to see how/if the size changes
<tilpner> How would this play with compression though?
<tilpner> Don't most local caches store the nars in compressed form?
<arianvp> it works okay-ish with things like squashfs where random access is preserved
<arianvp> but yes compression can indeed ruin some of the benefits
<arianvp> a nix-like distro that also uses FUSE
<tilpner> Yes, I've seen it. I'm cautious against running every single library/application through FUSE, but I don't know how much actual overhead there is
<arianvp> ack
<clever> arianvp: have you seen narfuse and fusenar?
<tilpner> If it dedups really well, it might even speed up access on slow spinning disks
<clever> https://github.com/cleverca22/fusenar i originally wrote fusenar in c++, using the nar library already in nix
<clever> but to find the type of the root node (is /nix/store/foo a file or dir?) you have to parse the entire nar, even if its 2gig
<clever> and thats when the lure of haskell and lazy evaluation got me into haskell :P
<clever> with taktoa's help, i rewrote the whole thing as https://github.com/taktoa/narfuse
<clever> arianvp: narfuse lets you turn a directory full of foo.nar files, into a directory full of foo's
<clever> so /nix/foo/ can be mounted to /nix/store, and then bar.nar turns into just plain /nix/store/bar
<arianvp> cool
<clever> one limitation though, is that it operates on nar files, not nar.xz
<arianvp> clever: got it
<arianvp> have you seen the rest of the disucssion above? About the casync tool which does automatic chunking and reuse of nar files?
<clever> but it could be modified to operate on a .nar.xz instead
<arianvp> (Well; they have a file format very similar to NAR files; and trying to find out if we can do asimilar chunking thing)
<clever> the nar file format is pretty simple
<arianvp> tilpner: note that the individual chunks in casync are stored compressed. So that would make .xz'ing nar files redundant
<clever> its mostly just a series of size prefixed strings
<tilpner> Oh!
<tilpner> Neat
<arianvp> so I would expect less disk storage, and faster transfers with this kind of system
<clever> if i'm reading this code and remembering it correctly, a file is basically the following strings
<clever> "entry" "(" "name" "foo.txt" "node" "contents" ")"
<clever> each string, is prefixed by a 64bit int denoting the string's length
<clever> and a directory is then a "(", a series of "regular|symlink|directory" + <the above> pairs, and a ")"
<clever> so you could trivially break a nar up into its component strings, and then hash each one
<clever> of note, the strings: name, node, entry, regular, symlink, directory, contents, (, and ) appear often
<clever> so you might need an escape hatch to not dedup those (they are smaller then a hash) and just keep them in the resulting stream
<clever> so you would transform a nar, into a series of tokens and hashes, along with a hash=body set, that can be shared
<clever> arianvp: but if your running zfs, you get the same kind of dedup, at least at the storage level, but not at the network layer
<arianvp> there is some explanation about why this is still a benefit on COW systems
<arianvp> casync is COW-aware and will even do some reflinking magic itself too
<clever> network is the main one i can see
<arianvp> yes
<arianvp> it is meant as a image delivery mechanism
<clever> nix-store --optimize pretty much makes cow-aware stuff un-needed
das_j has quit [Remote host closed the connection]
<arianvp> not as a storage-mechanism
<clever> another issue though, at the network layer
<clever> are you going to store each chunk as a file over http?
<clever> thats a round trip per file
<tilpner> Might be fine with pipelining or parallel requests?
<clever> thats kinda half the point of things like nar and tar, so you can download 1000's of files as a single bytestream, rather then having to do 1000's of requests
<arianvp> HTTP2 solves that doesnt it?
<arianvp> (Not that the casync tool currently supports that. it's a bit of an experimental thing it seems)
<clever> http1.1 can do pipelining, 2 just adds things like the server force-feeding you stuff you didnt know you wanted yet
<clever> but if you already have parts, the server force-feeding you chunks is a waste of bandwidth
<arianvp> yeh just wanted to say. you dont want predictive push as the benefit comes from the client knowing where they are
<clever> i can see ipfs being of use here, but that complicates another one of my ideas
<clever> and makes the perf even worse
<arianvp> not sure what ipfs has got to do with this? I do remember bringing up casync on an IPFS+nix thread before though but dont remember why
<arianvp> oh yeh in this thread: https://github.com/NixOS/nix/issues/1006
<{^_^}> nix#1006 (by Ericson2314, 3 years ago, open): git tree object as alternative to NAR
<clever> ipfs is just a merkle_hash(value)=value storage system
<arianvp> just like casync :P
<clever> and if you know the hash, you can then fetch the object from the ipfs network
<arianvp> (sort of)
<clever> there is a limit to chunk size in ipfs
<clever> so it also supports special chunks, that are just a list of hashes of other chunks
<tilpner> IPFS had fairly high resource consumption, last I tried (hours ago)
<tilpner> 30-40% CPU on a small VPS, and 300-400MB memory use
<clever> the main cost i can see with ipfs, is that it has to turn each file, into a tree of chunks
<clever> and it then has to post into the DHT, at the hash of each chunk, "peer XYZ has this chunk"
<clever> so if your file breaks into 1000 chunks, you have to do 1000 DHT puts
<clever> and if somebody wants to download that file, they have to do 1000 DHT gets, from random points within the hash table
<tilpner> And it has to join the DHT in the first place, which rules out a few usecases of Nix
<clever> ipfs would be an optional thing
<clever> i'm just thinking, if you are going to be hashing each chunk anyways, if you use the ipfs hashing rules, then you are making it an option
<clever> if you use plain sha256, then your forcing the need to have a hash->hash lookup, to use ipfs fetches
<Ericson2314> clever: have they not considered a sparse DHT with just some common roots, and if you can't find it in there crawling up your graph to see if anyone has something which refers to the thing you are missing?
<Ericson2314> not a great system, but good to cope with a too large dht
<clever> Ericson2314: ive not looked in depth at what the dht is doing, mostly just filling the gaps in with how other dht's work
<Ericson2314> right i haven't looked either
<arianvp> how do I copy my entire /nix/store to nar files?
<clever> arianvp: one minute
<arianvp> nix-store --export ?
<clever> --export doesnt make a nar
<clever> it makes a different thing, that contains many nars
orivej has quit [Ping timeout: 245 seconds]
<clever> `nix-store --dump /nix/store/foo > foo.nar` will make a nar, but wont include any closure info, it wont even include the "foo" in the nar itself
<clever> [clever@amd-nixos:~]$ nix copy /nix/store/n9z80xrc7bidx5hcap2wvb5l9r2vk6y0-hello-2.10 --to file:///home/clever/cache-test/
<clever> arianvp: this will recursively copy (and xz compress) a given path, to a given dir, and generate narinfo files that perserve the closure data
<clever> if that directory is served over http, it can then be used as a binary cache
pie_ has quit [Ping timeout: 250 seconds]
<arianvp> so to have one for my system I have to pass the nixos derivaiton there?
<clever> yeah
<clever> you can also pass it /run/current-system/ to just cache whatever your currently running
<arianvp> how does the cache do non-directory entries in nix store?
<arianvp> are they also NAR'd?
<clever> yep
<clever> the root element in the nar is a file in that case
<clever> or a symlink
<arianvp> as in
<arianvp> . is a file?
<clever> yeah
<arianvp> darnit casync doesnt support that. so ill have to skip all the file stuff and only d odirectories
<clever> with nar files, every element only has a type, and a body
<clever> names are not attached to the elements themselves
<clever> rather, a directory is just a series of name+element pairs
orivej has joined #nixos-dev
<clever> and the root element can be any type of element, so its valid for the root to just be a file, in which case, no name exists
<clever> arianvp: also, for any fixed-output derivation with outputHashMode = "recursive";, the sha256 of it, is just the sha256 of the nar
<clever> arianvp: so when your doing fetchFromGithub, your giving it the hash of the nar for the $out it generates
<clever> outputHashMode = "flat"; is for the special case where you expect $out to be a file, in which case, your giving it the plain hash of that file without wrapping it in a nar
<clever> arianvp: you may need to special-case files, and just have them bypass catar? and just be stored as a single chunk?
orivej has quit [Ping timeout: 245 seconds]
pie_ has joined #nixos-dev
<arianvp> okay casyncing my entire store
<arianvp> :)
<clever> arianvp: nix copy also has a --all flag
<arianvp> Nix doesnt really have a hard dependency on NARs does it? as in I could just extract these catar files and then register the paths right?
<arianvp> make a prototype that bypasses nix's own caching stuff
<clever> arianvp: /nix/store is read-only by default, so you must go thru nix-daemon to extract anything
<arianvp> oh yeh darnit
<tilpner> zfs does not like this .castr structure
<tilpner> 9.1G vs 7.3G (--apparent-size)
<clever> tilpner: try to find the worst offending file, then ls -lhs it
<arianvp> yeh so there is special case code for btrfs filesystems in casync
<arianvp> wonder if it does the same on zfs probably not
<tilpner> zfs doesn't support reflink AFAIK
<arianvp> ah
<tilpner> clever: It's a giant directory forest, and lots of small files
<clever> tilpner: ah, there is a min size for things
<arianvp> tilpner: allign your --chunk-size with the zfs min-size
<arianvp> will probably be more friendly :)
<clever> ls -lhs will reveal the min size
<clever> [clever@amd-nixos:~/apps/nixpkgs-master]$ ls -lUsh /nix/store/.links/ | head
<clever> 4.5K -r--r--r-- 5 root root 538 Dec 31 1969 07a8cfj62fij9nb23zb12d7nhzq2czfngjn4m2dnbir5cr9f8p5a
<clever> 512 lrwxrwxrwx 2 root root 83 Dec 31 1969 1w19ljky3g9dnnis4x6zj443lmsxiyz7jws6hzyc3qqzifk0hj9y -> /nix/store/l95nkqp7bdimqnz9ixay1aahljzsz7vc-python-2.7.15/lib/python2.7/decimal.pyc
<clever> at 538 bytes and up, it eats a whole 4.5kb
<arianvp> oh I forgot to enable --with=symlinks oops
<clever> 83 bytes and down, it fits inside the pointers that would normally say where the data exists, so it doesnt even need a data block
<arianvp> wonder what will happen now, whether it will follow the symlinks or just ignore the
<clever> between 83 and 538 bytes, youll need to investigate more :P
<tilpner> clever: They're not small enough to fit under 83 bytes
<tilpner> And I'm not sure what I expected anyway
<tilpner> Presumably, the ecosystem would have to agree on one chunking configuration
<tilpner> Which might be problematic with everyone running different FS' with different settings
* tilpner ends casync after creating 390841 .cacnks
<arianvp> 274812 and going
<arianvp> =)
das_j has joined #nixos-dev
<das_j> how is that assert at the top of pkgs/os-specific/linux/phc-intel/default.nix supposed to work? Wouldn't meta.broken be more appropriate?
<clever> das_j: broken might also work, would want to test it though of course
<das_j> clever: Alright. Because it prevents one of my systems from evaluating because it has a 4.9 kernel
<clever> das_j: i would expect broken to cause the same problem, if you attempt to reference that package
<das_j> clever: That's the weird thing. I do not reference it
<clever> what does --show-trace say?
<das_j> Now that I think about it, it's probably another issue. The system builds fine on 19.03, but fails on unstable
<das_j> cc ajs124
ixxie has quit [Ping timeout: 258 seconds]
pie_ has quit [Ping timeout: 250 seconds]
pie_ has joined #nixos-dev
ixxie has joined #nixos-dev
ixxie has quit [Ping timeout: 248 seconds]
ixxie has joined #nixos-dev
drakonis has joined #nixos-dev
pie_ has quit [Ping timeout: 250 seconds]
pie_ has joined #nixos-dev
lopsided98 has quit [Remote host closed the connection]
lopsided98 has joined #nixos-dev
ixxie has quit [Ping timeout: 245 seconds]
ixxie has joined #nixos-dev
justanotheruser has quit [Ping timeout: 245 seconds]
pie_ has quit [Ping timeout: 250 seconds]
orivej has joined #nixos-dev
justanotheruser has joined #nixos-dev
pie_ has joined #nixos-dev
pie_ has quit [Ping timeout: 250 seconds]
<marek> how do we forward changes from staging to master? just opening a PR againts master with cherry picked commit once it is verified in staging?
<samueldr> staging eventually graduates into staging-next when it's deemed good to go to master, and staging-next is where a last check for breakage, and fixing those is done
<ivan> staging is for things that rebuild too many packages and so shouldn't go into master until a staging-next merge
<samueldr> staging-next is eventually merged into master once deemed good
<globin> marek: see also https://github.com/NixOS/rfcs/pull/26
<{^_^}> rfcs#26 (by vcunat, 1 year ago, merged): staging workflow
<marek> ok, just wondering if I'm responsible for forwarding my change once it is in staging or it will get to master eventually on its own
<marek> globin: I see, thank you
das_j has quit [Remote host closed the connection]
pie_ has joined #nixos-dev
drakonis has quit [Ping timeout: 246 seconds]
pie_ has quit [Ping timeout: 250 seconds]
drakonis has joined #nixos-dev
<worldofpeace> jtojnar: Noticed the bug also, I could reproduce it with latest meson.
<jtojnar> worldofpeace: 10⁹$💩️
<{^_^}> mesonbuild/meson#5844 (by jtojnar, 3 hours ago, open): AttributeError: 'NoneType' object has no attribute 'startswith'
<worldofpeace> jtojnar: 🤣 It's rather funny really. Wonder why it's an issue we only trigger
<jtojnar> worldofpeace: because Meson normally means Python 3 is available
<jtojnar> whereas we have purity
<worldofpeace> 🔷 in rough. Oh these assumptions.
<worldofpeace> jtojnar: so what do you think of splitting the module into what they think is core already https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/master/elements/core.bst. We've done a kind of interesting thing in deepin https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/desktops/deepin/deepin.nix. The actual desktopManager enables those services, so perhaps we can do similar?
<jtojnar> worldofpeace: yeah, that looks good
<jtojnar> except I want core to be even more barebones
<jtojnar> core without core-utilities
edwtjo has quit [Ping timeout: 272 seconds]
<worldofpeace> With three separate options would that be needed? Then the gnome3 module default enables all three of them.
ixxie has quit [Ping timeout: 248 seconds]
edwtjo has joined #nixos-dev
<jtojnar> worldofpeace: do you mean one option each for core-os-services, core-shell and core-utilities?
<worldofpeace> jtojnar: yes
<jtojnar> worldofpeace: yeah that sounds good to me
<worldofpeace> jtojnar: thanks, putting it together now
<worldofpeace> jtojnar: huh it seems they don't use telepathy default https://gitlab.gnome.org/GNOME/gnome-build-meta/commit/69e9ccc898ae1482fbc79a42491f364fd4fb6160
<jtojnar> worldofpeace: yeah, they have been trying to get rid of it for a long time
<jtojnar> there is almost no upstream core development (only some backends, mostly in Qt land)
<jtojnar> empathy has been dead for ages
<jtojnar> one of the main authors even renounced it
<jtojnar> which is too bad, if Purism adopted it instead of libpurple, everything would be much nicer
<worldofpeace> Though I do understand purism's choice of doing that jtojnar with all that reviving things can look unpleasant
<jtojnar> worldofpeace: it's not like libpurple is particularly alive, but I can understand that they wanted to limit necromancy to minimum
pie_ has joined #nixos-dev
paradigm has joined #nixos-dev
ryantm has quit [Quit: Lost terminal]
ryantm has joined #nixos-dev
drakonis has quit [Quit: WeeChat 2.5]
orivej has quit [Ping timeout: 244 seconds]
<worldofpeace> jtojnar: more than useful, I think we want that 😃
justanotheruser has quit [Ping timeout: 244 seconds]
justanotheruser has joined #nixos-dev
<jtojnar> worldofpeace: I am going to add a lot of notes not related to the split, since I am already paying attention to every line
<worldofpeace> jtojnar: comments on github, or do you mean pushing comments to the branch?
<jtojnar> worldofpeace: on GH
<worldofpeace> 👍️ jtojnar
<jtojnar> will add an emoji to the relevant stuff so it is easier to address