Sample Header Ad - 728x90

How do I determine which commit a channel references with Nixos?

3 votes
4 answers
652 views
I'd like to figure out the commit and date that a channel references. **For example how can determine that for the nixos2009 channel below?**
sudo nix-channel --list
nixos https://nixos.org/channels/nixos-20.09 
nixos-2003 https://nixos.org/channels/nixos-20.03 
nixos2003 https://nixos.org/channels/nixos-20.03 
nixos2009 https://nixos.org/channels/nixos-20.09 
unstable https://nixos.org/channels/nixpkgs-unstable 
--- I can see ls /nix/var/nix/profiles/per-user/root/channels-*/manifest.nix shows us the channel generations.. Which the latest channel generation has the following content:
cat /nix/var/nix/profiles/per-user/root/channels-61-link/manifest.nix | nixfmt
[
  {
    meta = { };
    name = "nixos-20.09.2538.0cfd08f4881";
    out = {
      outPath =
        "/nix/store/7s917s7ipvq3zmbx5g3kssldwc029r8r-nixos-20.09.2538.0cfd08f4881";
    };
    outPath =
      "/nix/store/7s917s7ipvq3zmbx5g3kssldwc029r8r-nixos-20.09.2538.0cfd08f4881";
    outputs = [ "out" ];
    system = "x86_64-linux";
    type = "derivation";
  }
  {
    meta = { };
    name = "nixos-2003-20.03.3324.929768261a3";
    out = {
      outPath =
        "/nix/store/zajz4gpq506g68w47pnl11k8mhz06jz0-nixos-2003-20.03.3324.929768261a3";
    };
Potentially I can get it from the store path above like /nix/store/zajz4gpq506g68w47pnl11k8mhz06jz0-nixos-2003-20.03.3324.929768261a3 - but I'm not sure (and not sure what that "path" is called either). Seems like an answer for this is documented here: https://discourse.nixos.org/t/how-to-see-what-commit-is-my-channel-on/4818/6?u=chrissound though that is not a programmatic way (which is what I'm looking for).
Asked by Chris Stryczynski (6603 rep)
Mar 22, 2021, 04:28 PM
Last activity: Aug 10, 2024, 03:47 PM