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.
This commit is contained in:
Martin Puppe 2021-10-15 10:37:00 +02:00 committed by Edward Loveall
parent 56b6d546db
commit 0c018a898a
No known key found for this signature in database
GPG Key ID: A7606DFEC2BA731F
4 changed files with 83 additions and 1 deletions

View File

@ -12,12 +12,28 @@ Hopefully a more comprehensive guide will be written at some point, but for now
## Contributing ## 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 `script/setup`
1. Run `lucky dev` to start the app 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). 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. * 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 <https://luckyframework.org/guides/getting-started/installing#install-required-dependencies>.
### 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 ### 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). 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).

41
flake.lock Normal file
View File

@ -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
}

8
flake.nix Normal file
View File

@ -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; }; });
}

17
shell.nix Normal file
View File

@ -0,0 +1,17 @@
{ pkgs ? import <nixpkgs> { } }:
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
];
}