-
-
Save mausch/c3aec376c953bc26d3b32f2711dc96f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: $ nix eval "(builtins.attrNames (import (builtins.fetchurl "https://matthewbauer.us/generate-versions.nix") {}).emacs)" | |
# $ nix run "(import (builtins.fetchurl "https://matthewbauer.us/generate-versions.nix") {}).emacs.\"24.3\"" -u LANG -c emacs | |
{}: | |
let | |
channels = [ "nixos-20.09" "nixos-20.03" "nixos-19.09" "nixpkgs-unstable" ]; | |
getSet = channel: (import (builtins.fetchTarball "channel:${channel}") {inherit (builtins.currentSystem);}).pkgs; | |
getPkg = name: channel: let | |
pkgs = getSet channel; | |
pkg = pkgs.${name}; | |
version = (builtins.parseDrvName pkg.name).version; | |
in if builtins.hasAttr name pkgs && pkg ? name then { | |
name = version; | |
value = pkg; | |
} else null; | |
attrs = builtins.attrNames (import <nixpkgs> {}); | |
in builtins.listToAttrs (map (name: { | |
inherit name; | |
value = builtins.listToAttrs | |
(builtins.filter (x: x != null) | |
(map (getPkg name) channels)); | |
}) attrs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment