forked from armijnhemel/binaryanalysis-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use `niv` to pin nixpkgs. Use the unstable branch because pythonPackage.dockerfile-parse isn't available in a release yet.
- Loading branch information
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"nixpkgs": { | ||
"url": "https://github.com/NixOS/nixpkgs-channels/archive/362be9608c3e0dc5216e9d1d5f5c1a5643b7f7b1.tar.gz", | ||
"owner": "NixOS", | ||
"branch": "nixos-unstable", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz", | ||
"repo": "nixpkgs-channels", | ||
"type": "tarball", | ||
"sha256": "0934rhanamsnhawg15gg6cy9ird3c47hsqn5s46lq2n5kzl6v7ly", | ||
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels", | ||
"rev": "362be9608c3e0dc5216e9d1d5f5c1a5643b7f7b1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This file has been generated by Niv. | ||
|
||
# A record, from name to path, of the third-party packages | ||
with rec | ||
{ | ||
pkgs = | ||
if hasNixpkgsPath | ||
then | ||
if hasThisAsNixpkgsPath | ||
then import (builtins_fetchTarball { inherit (sources_nixpkgs) url sha256; }) {} | ||
else import <nixpkgs> {} | ||
else | ||
import (builtins_fetchTarball { inherit (sources_nixpkgs) url sha256; }) {}; | ||
|
||
sources_nixpkgs = | ||
if builtins.hasAttr "nixpkgs" sources | ||
then sources.nixpkgs | ||
else abort | ||
'' | ||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or | ||
add a package called "nixpkgs" to your sources.json. | ||
''; | ||
|
||
builtins_fetchTarball = | ||
# fetchTarball version that is compatible between all the versions of | ||
# Nix | ||
{ url, sha256 }@attrs: | ||
let | ||
inherit (builtins) lessThan nixVersion fetchTarball; | ||
in | ||
if lessThan nixVersion "1.12" then | ||
fetchTarball { inherit url; } | ||
else | ||
fetchTarball attrs; | ||
|
||
hasNixpkgsPath = (builtins.tryEval <nixpkgs>).success; | ||
hasThisAsNixpkgsPath = | ||
(builtins.tryEval <nixpkgs>).success && <nixpkgs> == ./.; | ||
|
||
sources = builtins.fromJSON (builtins.readFile ./sources.json); | ||
|
||
mapAttrs = builtins.mapAttrs or | ||
(f: set: with builtins; | ||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))); | ||
|
||
getFetcher = spec: | ||
let fetcherName = | ||
if builtins.hasAttr "type" spec | ||
then builtins.getAttr "type" spec | ||
else "tarball"; | ||
in builtins.getAttr fetcherName { | ||
"tarball" = pkgs.fetchzip; | ||
"file" = pkgs.fetchurl; | ||
}; | ||
}; | ||
# NOTE: spec must _not_ have an "outPath" attribute | ||
mapAttrs (_: spec: | ||
if builtins.hasAttr "outPath" spec | ||
then abort | ||
"The values in sources.json should not have an 'outPath' attribute" | ||
else | ||
if builtins.hasAttr "url" spec && builtins.hasAttr "sha256" spec | ||
then | ||
spec // | ||
{ outPath = getFetcher spec { inherit (spec) url sha256; } ; } | ||
else spec | ||
) sources |
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