Skip to content

Commit

Permalink
Enable Travis CI (awakesecurity#49)
Browse files Browse the repository at this point in the history
* enable travis ci

* pin nixpkgs without NIXPATH

* remove nixpkgs.json

* fix type error

* fix nixpkgs hash
  • Loading branch information
themattchan authored Jan 20, 2018
1 parent d6865cb commit 853b4ac
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: nix
script: nix-build --attr proto3-suite-linux release.nix
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `proto3-suite`

[![Build Status](https://travis-ci.org/awakesecurity/proto3-suite.svg?branch=master)](https://travis-ci.org/awakesecurity/proto3-suite)

This package defines tools for working with protocol buffers version 3 in Haskell.

This library provides a higher-level API to
Expand Down
51 changes: 51 additions & 0 deletions fetch-nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{ rev # The Git revision of nixpkgs to fetch
, sha256 # The SHA256 of the downloaded data
, system ? builtins.currentSystem # This is overridable if necessary
}:

with {
ifThenElse = { bool, thenValue, elseValue }: (
if bool then thenValue else elseValue);
};

ifThenElse {
bool = (0 <= builtins.compareVersions builtins.nixVersion "1.12");

# In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`.
thenValue = (
builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256;
});

# This hack should at least work for Nix 1.11
elseValue = (
(rec {
tarball = import <nix/fetchurl.nix> {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256;
};

builtin-paths = import <nix/config.nix>;

script = builtins.toFile "nixpkgs-unpacker" ''
"$coreutils/mkdir" "$out"
cd "$out"
"$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1
'';

nixpkgs = builtins.derivation {
name = "nixpkgs-${builtins.substring 0 6 rev}";

builder = builtins.storePath builtin-paths.shell;

args = [ script ];

inherit tarball system;

tar = builtins.storePath builtin-paths.tar;
gzip = builtins.storePath builtin-paths.gzip;
coreutils = builtins.storePath builtin-paths.coreutils;
};
}).nixpkgs);
}
6 changes: 0 additions & 6 deletions nixpkgs.json

This file was deleted.

17 changes: 4 additions & 13 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,10 @@ let
allowUnfree = true;
};

bootstrap = import <nixpkgs> { };

nixpkgs =
let
json = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
in
bootstrap.fetchFromGitHub {
owner = "NixOS";

repo = "nixpkgs";

inherit (json) rev sha256;
};
nixpkgs = import ./fetch-nixpkgs.nix {
rev = "7ae9da426924537755ce9164fd5b5f81ce16a1c3";
sha256 = "1zg1j2fsfj6qhh724nc8fnn3ig3rm6nd29zzhjrbjkszkjspc9pl";
};

linuxPkgs = import nixpkgs { inherit config; system = "x86_64-linux" ; };
darwinPkgs = import nixpkgs { inherit config; system = "x86_64-darwin"; };
Expand Down

0 comments on commit 853b4ac

Please sign in to comment.