Is it appropriate to discuss posts linked from NixOS Weekly here?
Regarding Mixing channels in nixos, is there a reason to take the tarball approach instead of just adding nixos-18.09
as a separate channel?
I myself am doing something similar to get access to nixos-unstable
because 19.03 still doesn’t include one of the packages I want to use (lsd
), I have nixos-unstable
set up as a channel (pointing at nixos-unstable-small
) and my configuration.nix
preamble looks like
let
nixos-unstable = import <nixos-unstable> {
config = removeAttrs config.nixpkgs.config [ "packageOverrides" ];
};
in
It looks like that because I want to make sure if I override a package with an unstable one, that the override doesn’t affect the unstable packageset. Though in my case I don’t have to use packageOverrides
at all, because lsd
isn’t a dependency for anything, so I just stick nixos-unstable.lsd
in my environment.systemPackages
, but on 18.09 I did have to use a package override for fish
as I was using the module for that.
Yes, here is the right place.
IMHO, the reason for the tarball approach is so the .nix file is portable and can just be evaluated on other system without the nixos-unstable channel existing.
I personally don’t use nix-channels because they are to “stateful” for my taste.
The downside to the tarball is if it’s been longer than an hour (based on the commentary from that post), it’ll have to redownload the tarball on next build.
that’s right, but you can use a fixed-output-derivation. then it will not refetch it.
...
oldTarball = pkgs.fetchzip { url = https://nixos.org/channels/nixos-18.09/nixexprs.tar.xz; sha256 = "1kipnh7fifi1v2ggckb10yrq9b1q0hh7xhkd8wyx341xkm2f59yv"; }
...
The IPFS one was interesting, but do I remember correctly, nixos cache used to be hosted at IPFS, but it was too unreliable? Or do I mix this up with some other memory?
The fixed-output version looks neat, though if the tarball does change and you collect garbage, surely it will fail to build on the next attempt.
It shouldn’t be garbage collected if your current system depends on it.
also I’m not sure how stable github links are, but I would guess you could just refetch it
Here you can gain the insight to nix ipfs issues: Nix and IPFS · Issue #859 · NixOS/nix · GitHub
Would the current system actually depend on the tarball though? The tarball contains nix expressions, but any expressions used by the current system would be evaluated into derivations and placed into the nix store. Collecting garbage wouldn’t affect the current system, but it should still clean up the tarball, thus requiring a redownload later, unless I misunderstand something about how this works.