From 0c018a898a0c8c6f78f45f2c5248c62e8fbc87a4 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Fri, 15 Oct 2021 10:37:00 +0200 Subject: [PATCH] Add support for development with Nix This patch adds support for development with the Nix package manager. In order to support the traditional nix-shell tool as well as the (still experimental) Nix Flakes feature of the upcoming version of Nix, this patch adds shell.nix *and* flake.nix/flake.lock. Usage instructions have been added to the README. --- README.md | 18 +++++++++++++++++- flake.lock | 41 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 8 ++++++++ shell.nix | 17 +++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/README.md b/README.md index a21d7f8..01f5b9a 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,28 @@ Hopefully a more comprehensive guide will be written at some point, but for now ## Contributing -1. [Install required dependencies](https://luckyframework.org/guides/getting-started/installing#install-required-dependencies) +1. Install required dependencies (see sub-sections below) 1. Run `script/setup` 1. Run `lucky dev` to start the app 1. [Send a patch](https://man.sr.ht/git.sr.ht/#sending-patches-upstream) to `~edwardloveall/Scribe@lists.sr.ht` (yes that's an email address). * To be honest, I'm not sure how I feel about the send patch git workflow as opposed to the GitHub style pull request workflow. I'm trying it out for now. If you can't figure it out, get in contact and we can figure out a way to get your contributions in. +### Installing dependencies + +General instructions for installing Lucky and its dependencies can be found at . + +### Installing dependencies with Nix + +If you are using the [Nix](https://nixos.org/) package manager, you can get a shell with all dependencies with the following command(s): + +``` shell +nix-shell + +# Or if you are using the (still experimental) Nix Flakes feature +nix flake update # Update dependencies (optional) +nix develop +``` + ### Learning Lucky Lucky uses the [Crystal](https://crystal-lang.org) programming language. You can learn about Lucky from the [Lucky Guides](https://luckyframework.org/guides/getting-started/why-lucky). diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c6658b2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1634282420, + "narHash": "sha256-YOI78SSF4Q/ZFoEgfO8Xy3EnjCW/F9VgB2Qz9YljzhI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0a68ef410b40f49de76aecb5c8b5cc5111bac91d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..390bccc --- /dev/null +++ b/flake.nix @@ -0,0 +1,8 @@ +{ + inputs = { flake-utils.url = "github:numtide/flake-utils"; }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { devShell = import ./shell.nix { inherit pkgs; }; }); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..06da585 --- /dev/null +++ b/shell.nix @@ -0,0 +1,17 @@ +{ pkgs ? import { } }: + +pkgs.mkShell { + shellHook = '' + export PKG_CONFIG_PATH=${pkgs.openssl.dev}/lib/pkgconfig + ''; + buildInputs = with pkgs; [ + crystal + lucky-cli + overmind + nodejs + openssl.dev + postgresql + shards + yarn + ]; +}