From 2e37e40871a415247cf67bb42518cc77f9f1ad10 Mon Sep 17 00:00:00 2001 From: happysalada Date: Sun, 18 Oct 2020 16:59:14 +0900 Subject: [PATCH] add nix instructions for quick setup --- .envrc | 1 + .gitignore | 3 +++ README.md | 6 ++++++ shell.nix | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4a4726a --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_nix diff --git a/.gitignore b/.gitignore index 8287ffa..1ecc0b4 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,6 @@ Temporary Items *.gcode *.scad *.calva/ + +# Nix +.direnv diff --git a/README.md b/README.md index 77d14bb..41162d5 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ To tinker around this thing, follow these steps: 4. Change something in `src/dactyl_keyboard/handler.clj`. 5. Open [localhost:3030](http://localhost:3030). +### With Nix + +1. run `direnv allow` when you first cd into the project +2. nix will then install and cache dependencies +3. running `lein ring server-headless` will run the server with hot-reloading on port 3030 + ## Deployment To deploy it in a computer, follow these steps: diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..a282956 --- /dev/null +++ b/shell.nix @@ -0,0 +1,22 @@ +with import { }; +let + + # define packages to install with special handling for OSX + basePackages = [ + # Core runtime libraries + clojure + jdk + leiningen + ]; + + inputs = basePackages ++ lib.optional stdenv.isLinux inotify-tools + ++ lib.optionals stdenv.isDarwin + (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]); + + # define shell startup command + hooks = ""; + +in mkShell { + buildInputs = inputs; + shellHook = hooks; +}