Last active
March 10, 2021 16:37
-
-
Save ejpcmac/b544e7315bffcd8dee66615381c8e370 to your computer and use it in GitHub Desktop.
Example shell.nix for Nerves projects, setting both Erlang and Elixir versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
with pkgs; | |
let | |
inherit (lib) optional optionals; | |
erlangDrv = { mkDerivation }: | |
mkDerivation rec { | |
version = "21.0"; | |
# Use `nix-prefetch-github --rev OTP-<version> erlang otp` to update. | |
sha256 = "0khprgawmbdpn9b8jw2kksmvs6b45mibpjralsc0ggxym1397vm8"; | |
prePatch = '' | |
substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10' | |
''; | |
}; | |
elixirDrv = { mkDerivation }: | |
mkDerivation rec { | |
version = "1.6.6"; | |
# Use `nix-prefetch-github --rev v<version> elixir-lang elixir` to update. | |
sha256 = "1wl8rfpw0dxacq4f7xf6wjr8v2ww5691d0cfw9pzw7phd19vazgl"; | |
minimumOTPVersion = "19"; | |
}; | |
erlang = beam.lib.callErlang erlangDrv { wxGTK = wxGTK30; }; | |
rebar = pkgs.rebar.override { inherit erlang; }; | |
elixir = beam.lib.callElixir elixirDrv { | |
inherit erlang rebar; | |
debugInfo = true; | |
}; | |
in | |
mkShell { | |
buildInputs = [ elixir git fwup squashfsTools file ] | |
++ optional stdenv.isLinux libnotify # For ExUnit Notifier on Linux. | |
++ optional stdenv.isLinux x11_ssh_askpass # For `mix firmware.burn`. | |
++ optional stdenv.isDarwin terminal-notifier # For ExUnit Notifier on macOS. | |
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ | |
# For file_system on macOS. | |
CoreFoundation | |
CoreServices | |
]); | |
shellHooks = '' | |
export SUDO_ASKPASS=${x11_ssh_askpass}/libexec/x11-ssh-askpass | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment