Created
November 14, 2023 19:45
-
-
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"
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
{ | |
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