From 5c8654b089ad16a1d5d72ac64115d0ef20267820 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Fri, 29 Jul 2022 00:47:10 +0200 Subject: [PATCH] Add elixir env --- elixir/.envrc | 1 + elixir/flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ elixir/flake.nix | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 elixir/.envrc create mode 100644 elixir/flake.lock create mode 100644 elixir/flake.nix diff --git a/elixir/.envrc b/elixir/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/elixir/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/elixir/flake.lock b/elixir/flake.lock new file mode 100644 index 0000000..871676c --- /dev/null +++ b/elixir/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1656928814, + "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1659047633, + "narHash": "sha256-zeI+NkJOa665fRrKGpjscfy3Hs4K316q1q7394xbRbw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "496caa738a16d2bb3607243d9127df718bb50513", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/elixir/flake.nix b/elixir/flake.nix new file mode 100644 index 0000000..fad6978 --- /dev/null +++ b/elixir/flake.nix @@ -0,0 +1,35 @@ +{ + description = "A Nix-flake-based Elixir development environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + + inherit (pkgs) darwin inotify-tools mkShell nodejs-18_x terminal-notifier; + inherit (pkgs.beam.packages.erlangR25) elixir; + inherit (pkgs.lib) optionals; + inherit (pkgs.stdenv) isDarwin isLinux; + + linuxDeps = optionals isLinux + [ inotify-tools ]; + darwinDeps = optionals isDarwin + [ terminal-notifier ] ++ (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]); + in { + devShells = { + default = mkShell { + buildInputs = [ elixir nodejs-18_x ] ++ linuxDeps ++ darwinDeps; + + shellHook = '' + ${elixir}/bin/mix --version + ${elixir}/bin/iex --version + ''; + }; + }; + }); +}