Skip to content

Instantly share code, notes, and snippets.

@elerch
Created November 14, 2023 19:45
Show Gist options
  • Save elerch/a0951dbd32e308dc187de0a69b8c1844 to your computer and use it in GitHub Desktop.
Save elerch/a0951dbd32e308dc187de0a69b8c1844 to your computer and use it in GitHub Desktop.
Cross platform version of Julia Evan's flake from "Some notes on nix flakes"
{
inputs.nixpkgs.url = "nixpkgs/nixos-23.05";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
defaultPackage = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
nixpkgs.legacyPackages.${system}.buildEnv {
name = "homepkgs";
paths = with pkgs; [
cowsay
ruby
];
pathsToLink = [ "/share/man" "/share/doc" "/bin" "/lib" ];
extraOutputsToInstall = [ "man" "doc" ];
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment