Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Last active May 29, 2023 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pitometsu/c247945f8ef2db0aefc7b393596b4de3 to your computer and use it in GitHub Desktop.
Save Pitometsu/c247945f8ef2db0aefc7b393596b4de3 to your computer and use it in GitHub Desktop.
Internet Computer development environment with dfx and mops
with import <nixpkgs> {}; with builtins; let
dfx-env = import (fetchTarball https://github.com/ninegua/ic-nix/releases/latest/download/dfx-env.tar.gz) {};
mops-nix = https://raw.githubusercontent.com/nomeata/ic-certification/3f51849073d19d2ab46aaff3c4985bf8c60196a1;
nodeEnv = import (fetchurl "${mops-nix}/mops.nix/node-env.nix") {
nodejs = nodejs-14_x;
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
mops = (import (fetchurl "${mops-nix}/mops.nix/node-packages.nix") {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}).ic-mops;
in dfx-env.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
mops wasmtime gnumake
coreutils cacert gnupg openssh
less which tree ripgrep gitMinimal
];
})
@Pitometsu
Copy link
Author

Pitometsu commented May 24, 2023

Just a mix of https://github.com/ninegua/ic-nix and https://github.com/nomeata/ic-certification/blob/main/mops.nix/default.nix for convenient:

nix-shell --pure https://codeload.github.com/gist/c247945f8ef2db0aefc7b393596b4de3/zip/9924660b704f0b42bc6eb192fb1f41b464dd44e8

@Pitometsu
Copy link
Author

Pitometsu commented May 25, 2023

For direnv integration with the code editor of your choice:

nix profile install nixpkgs#direnv
nix profile install nixpkgs#nix-direnv
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > ~/.config/direnv/direnvrc
cat >> ~/.config/nix/nix.conf <<EOF
keep-derivations = true
keep-outputs = true
EOF
echo 'use nix --pure --keep DIRENV_DUMP_FILE_PATH https://codeload.github.com/gist/c247945f8ef2db0aefc7b393596b4de3/zip/2b7a7c36d0321373afa93b7ce21b4687e4754791
' > ./.envrc
direnv allow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment