nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 62 lines 1.6 kB view raw
1{ buildDhallPackage, fetchFromGitHub, lib }: 2 3# This function is used by `dhall-to-nixpkgs` when given a GitHub repository 4lib.makePackageOverridable 5 ( { # Arguments passed through to `buildDhallPackage` 6 name 7 , dependencies ? [] 8 , source ? false 9 10 , # The directory containing the Dhall files, if other than the root of the 11 # repository 12 directory ? "" 13 , # The file to import, relative to the above directory 14 file ? "package.dhall" 15 # Set to `true` to generate documentation for the package 16 , document ? false 17 18 # Arguments passed through to `fetchFromGitHub` 19 , owner 20 , repo 21 , rev 22 # Extra arguments passed through to `fetchFromGitHub`, such as the hash 23 # or `fetchSubmodules` 24 , ... 25 }@args: 26 27 let 28 versionedName = "${name}-${rev}"; 29 30 src = fetchFromGitHub ({ 31 name = "${versionedName}-source"; 32 33 inherit owner repo rev; 34 } // removeAttrs args [ 35 "name" 36 "dependencies" 37 "document" 38 "source" 39 "directory" 40 "file" 41 "owner" 42 "repo" 43 "rev" 44 ]); 45 46 prefix = lib.optionalString (directory != "") "/${directory}"; 47 48 in 49 buildDhallPackage 50 ( { inherit dependencies source; 51 52 name = versionedName; 53 54 code = "${src}${prefix}/${file}"; 55 } 56 // lib.optionalAttrs document 57 { documentationRoot = "${src}/${prefix}"; 58 59 baseImportUrl = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}${prefix}"; 60 } 61 ) 62 )