Skip to content

Commit

Permalink
Switch over entirely to nix-thunk
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Dec 9, 2020
1 parent 97c0ba8 commit e99f796
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 220 deletions.
3 changes: 1 addition & 2 deletions ci.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ system ? builtins.currentSystem }:
let
sources = import ./nix/sources.nix {};
pkgs = import sources.nixpkgs { inherit system; };
pkgs = import ./dep/nixpkgs { inherit system; };
in
pkgs.recurseIntoAttrs {
# Build both default.nix and shell.nix such that both derivations are
Expand Down
3 changes: 1 addition & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
args@{...}:
let
sources = import nix/sources.nix {};
pkgs = import sources.nixpkgs args;
pkgs = import ./dep/nixpkgs {} ;
in (import ./project.nix { pkgs = pkgs; } ).neuron
2 changes: 2 additions & 0 deletions dep/nixpkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)
7 changes: 7 additions & 0 deletions dep/nixpkgs/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"private": false,
"rev": "3537ea7a8358abe11d07223812305faebf3d5074",
"sha256": "1im926giknm1si40j596gm3837ipbgn880g0psydk5ql8m79872g"
}
9 changes: 9 additions & 0 deletions dep/nixpkgs/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import <nixpkgs> {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
3 changes: 1 addition & 2 deletions docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
# --argstr tag <image-tag>
# )
let
sources = import nix/sources.nix {};
pkgs = import sources.nixpkgs {};
pkgs = import ./dep/nixpkgs {};
neuron = import ./. {};
in {
name ? "sridca/neuron"
Expand Down
38 changes: 0 additions & 38 deletions nix/sources.json

This file was deleted.

171 changes: 0 additions & 171 deletions nix/sources.nix

This file was deleted.

3 changes: 1 addition & 2 deletions project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ let
url = "https://github.com/hercules-ci/gitignore/archive/c4662e6.tar.gz";
sha256 = "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx";
};
sources = import nix/sources.nix {};
nixpkgs = import sources.nixpkgs {};
nixpkgs = import ./dep/nixpkgs {};
in {
pkgs ? nixpkgs,
pkgsForBins ? null,
Expand Down
6 changes: 3 additions & 3 deletions static.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
args@{...}:
let
sources = import nix/sources.nix {};
nixpkgs = import sources.nixpkgs-static args;
# FIXME: Use a nixpkgs that works with static builds
nixpkgs = import ./dep/nixpkgs args;
pkgs = nixpkgs.pkgsMusl;
in
(import ./project.nix {
inherit pkgs;
# We have to use original nixpkgs for fzf, etc. otherwise this will give
# error: missing bootstrap url for platform x86_64-unknown-linux-musl
pkgsForBins = import sources.nixpkgs {};
pkgsForBins = nixpkgs;
disableHsLuaTests = true;
neuronFlags = [
"--ghc-option=-optl=-static"
Expand Down

0 comments on commit e99f796

Please sign in to comment.