Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions nix/rust-workspace.nix → dfx.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{ motoko
, buildDfinityRustPackage
, cargo-graph
, darwin
, dfinity
, graphviz
, lib
, libressl
, runCommandNoCC
, stdenv
, dfinity-sdk
# This file defines all flavors of the dfx build:
# * lint and documentation
# * debug build
# * release build
#
# If you only intend to perform a release build, run:
# nix-build ./dfx.nix -A build

{ pkgs ? import ./nix { inherit system; }
, system ? builtins.currentSystem
}:
let
workspace = buildDfinityRustPackage {
repoRoot = ../.;
lib = pkgs.lib;
workspace = pkgs.buildDfinityRustPackage {
repoRoot = ./.;
name = "dfinity-sdk-rust";
srcDir = ../.;
srcDir = ./.;
regexes = [
".*/assets/.*$"
".*\.rs$"
Expand All @@ -27,8 +27,8 @@ let
workspace' = (workspace //
{ lint = workspace.lint.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
cargo-graph
graphviz
pkgs.cargo-graph
pkgs.graphviz
];

postDoc = oldAttrs.postDoc + ''
Expand All @@ -49,16 +49,16 @@ in
(lib.mapAttrs (k: drv:
if !lib.isDerivation drv then drv else
drv.overrideAttrs (_: {
DFX_ASSETS = runCommandNoCC "dfx-assets" {} ''
DFX_ASSETS = pkgs.runCommandNoCC "dfx-assets" {} ''
mkdir -p $out
cp ${dfinity.nodemanager}/bin/nodemanager $out
cp ${dfinity.ic-client}/bin/client $out
cp ${motoko.moc-bin}/bin/moc $out
cp ${motoko.mo-ide}/bin/mo-ide $out
cp ${motoko.didc}/bin/didc $out
cp ${motoko.rts}/rts/mo-rts.wasm $out
mkdir $out/stdlib && cp -R ${motoko.stdlib}/. $out/stdlib
mkdir $out/js-user-library && cp -R ${dfinity-sdk.packages.userlib.js}/. $out/js-user-library
cp ${pkgs.dfinity.nodemanager}/bin/nodemanager $out
cp ${pkgs.dfinity.ic-client}/bin/client $out
cp ${pkgs.motoko.moc-bin}/bin/moc $out
cp ${pkgs.motoko.mo-ide}/bin/mo-ide $out
cp ${pkgs.motoko.didc}/bin/didc $out
cp ${pkgs.motoko.rts}/rts/mo-rts.wasm $out
mkdir $out/stdlib && cp -R ${pkgs.motoko.stdlib}/. $out/stdlib
mkdir $out/js-user-library && cp -R ${pkgs.dfinity-sdk.packages.userlib.js}/. $out/js-user-library
'';
})
) workspace')
Expand Down
2 changes: 1 addition & 1 deletion nix/overlays/dfinity-sdk.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
self: super:
let
mkRelease = super.callPackage ./mk-release.nix {};
rust-package' = super.callPackage ../rust-workspace.nix {};
rust-package' = import ../../dfx.nix { pkgs = self; };
# remove some stuff leftover by callPackage
rust-package = removeAttrs rust-package'
[ "override" "overrideDerivation" ];
Expand Down