Skip to content

Commit

Permalink
[IDX-2040] Remove common dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Jude Taylor committed Feb 14, 2022
1 parent 72a2989 commit ecdd306
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gitlab-ci/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let
);
python3-with-packages = pkgs.python3.withPackages python3-packages;
in
pkgs.mkCiShell {
pkgs.mkShell {
buildInputs = [
pkgs.buf
pkgs.binutils # Provides objcopy, used to strip symbols from binaries.
Expand Down
8 changes: 3 additions & 5 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ let
sha256 = "0a2rhxli7ss4wixppfwks0hy3zpazwm9l3y2v9krrnyiska3qfrw";
};

pkgs = import (sources.common + "/pkgs") {
inherit system crossSystem config isMaster labels;
repoRoot = ../.;
extraSources = sources;
overlays = import ./overlays ++ overlays;
pkgs = import sources.nixpkgs {
inherit system crossSystem;
overlays = import ./overlays sources ++ overlays;
};
in
pkgs
29 changes: 26 additions & 3 deletions nix/overlays/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
sources:

[
(_: _: { inherit sources; })
(
self: super:
{
nc = self.netcat;

# Override niv with our own pinned version. This version actually calls
# pkgs.haskell.lib.justStaticExecutables which significantly reduces closure
# size.
inherit (import self.sources.niv { pkgs = self; }) niv;

# Don't run git's test suite on darwin because it takes longer than 5h.
gitMinimal = super.gitMinimal.overrideAttrs (
_oldAttrs: self.lib.optionalAttrs self.stdenv.isDarwin { doInstallCheck = false; }
);
git = super.git.overrideAttrs (
_oldAttrs: self.lib.optionalAttrs self.stdenv.isDarwin { doInstallCheck = false; }
);
buildPackages = super.buildPackages // {
gitMinimal = super.buildPackages.gitMinimal.overrideAttrs (
_oldAttrs: self.lib.optionalAttrs self.stdenv.isDarwin { doInstallCheck = false; }
);
};

naersk = self.callPackage self.sources.naersk {};

# The 'pre-commit' tool that we use for a lot of checks (formatting, etc)
# https://pre-commit.com
Expand Down Expand Up @@ -67,13 +91,12 @@

# The rust code-coverage tool. As per the doc, only runs on Linux
# (doesn't even build on Darwin).
cargo-tarpaulin = self.lib.linuxOnly (
cargo-tarpaulin =
self.naersk.buildPackage {
src = self.sources.tarpaulin;
doCheck = false;
buildInputs = [ self.openssl self.pkg-config self.libiconv ];
}
);
};
cargo-graph = self.naersk.buildPackage self.sources.cargo-graph;

rocksdb = super.callPackage ./rocksdb {};
Expand Down
45 changes: 39 additions & 6 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "0.1.2"
},
"common": {
"branch": "master",
"repo": "ssh://[email protected]/dfinity-lab/common",
"rev": "d865c0cfd64d765a8daf6a31c76dca21a5d4d203",
"type": "git"
},
"dfx-x86_64-darwin": {
"builtin": false,
"name": "dfx",
Expand Down Expand Up @@ -188,6 +182,45 @@
"tag": "0.5.10",
"type": "git"
},
"naersk": {
"branch": "master",
"builtin": false,
"description": "Fast, flexible and eco-friendly Nix shipping of cargo crates since 2019",
"homepage": null,
"owner": "nmattia",
"repo": "naersk",
"rev": "df71f5e4babda41cd919a8684b72218e2e809fa9",
"sha256": "0k1pk2ixnxl6njjrgy750gm6m1nkkdsah383n3wp4ybrzacnav5h",
"type": "tarball",
"url": "https://github.com/nmattia/naersk/archive/df71f5e4babda41cd919a8684b72218e2e809fa9.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"builtin": false,
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "ba57d5a29b4e0f2085917010380ef3ddc3cf380f",
"sha256": "1kpsvc53x821cmjg1khvp1nz7906gczq8mp83664cr15h94sh8i4",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/ba57d5a29b4e0f2085917010380ef3ddc3cf380f.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "big-sur-backport",
"builtin": true,
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",
"homepage": null,
"owner": "dfinity-lab",
"repo": "nixpkgs",
"rev": "fff5699f89ee1bc7523855a55c8ea125885932f4",
"sha256": "0dj0yvl3az6j5z0ikwj9rqc5riwch4bfja4im0vz8inyjjb5a7y1",
"type": "tarball",
"url": "https://github.com/dfinity-lab/nixpkgs/archive/fff5699f89ee1bc7523855a55c8ea125885932f4.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rosetta-cli-x86_64-darwin": {
"builtin": false,
"sha256": "0478rqi4iydbf4ad5v740vhnfmyhc5xd7rdp306qn3ync5rj4m2m",
Expand Down
3 changes: 1 addition & 2 deletions outsource/shell.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ pkgs ? import ../nix { inherit system; }
, system ? builtins.currentSystem
}:
pkgs.mkCiShell {

pkgs.mkShell {
buildInputs = [
pkgs.python3
pkgs.rsync
Expand Down
2 changes: 1 addition & 1 deletion testnet/shell.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ pkgs ? import ../nix { inherit system; }, system ? builtins.currentSystem }:
pkgs.mkCiShell {
pkgs.mkShell {
buildInputs = [
(pkgs.python3.withPackages (ps: with ps; [ cbor GitPython paramiko requests pyyaml ansible ]))
pkgs.ansible
Expand Down
2 changes: 1 addition & 1 deletion tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ic-ref-test = import ./ic-ref-test { inherit pkgs rs; };
ic-workloadgen-test = import ./ic-workloadgen-test { inherit pkgs verbose; };

shell = pkgs.mkCompositeShell {
shell = pkgs.mkShell {
nativeBuildInputs = [
pkgs.ic-ref

Expand Down

0 comments on commit ecdd306

Please sign in to comment.