Skip to content

Instantly share code, notes, and snippets.

@punnie
Created August 25, 2023 17:55
Show Gist options
  • Save punnie/272b352f0393bb1735e04c2171de130c to your computer and use it in GitHub Desktop.
Save punnie/272b352f0393bb1735e04c2171de130c to your computer and use it in GitHub Desktop.
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
outputs = inputs@{ self, nixpkgs, ... }:
let
lib = nixpkgs.lib;
darwin = [ "x86_64-darwin" "aarch64-darwin" ];
linux = [ "x86_64-linux" "aarch64-linux" ];
allSystems = darwin ++ linux;
forEachSystem = systems: f: lib.genAttrs systems (system: f system);
forAllSystems = forEachSystem allSystems;
in
{
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
inherit (pkgs) hello;
cross = forEachSystem (lib.filter (sys: sys != system) allSystems) (targetSystem:
let
crossPkgs = import nixpkgs { localSystem = system; crossSystem = targetSystem; };
in
{
inherit (crossPkgs) hello;
}
);
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment