aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile52
-rw-r--r--README.md26
-rw-r--r--default.nix6
-rw-r--r--package.json23
-rw-r--r--shell.nix11
6 files changed, 82 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
index 67f8ad9..d03e751 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,7 @@ database-shm
database-wal
elm-stuff/
public/javascripts/*.js
-./public/javascripts/*.js
sessionKey
node_modules
-shell.nix
local.conf
+sharedCost.nix
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0f393fd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+all: install build
+
+clean:
+ @echo "Cleaning…"
+ @cabal clean > /dev/null
+ @rm -r elm-stuff >/dev/null 2>&1 || true
+ @rm -r node_modules >/dev/null 2>&1 || true
+
+install:
+ cabal2nix --shell . > sharedCost.nix
+ nix-shell sharedCost.nix -I ~ --command 'cabal configure'
+ elm package install
+ npm install
+
+# Watch
+# -----
+
+watch: watch-server watch-elm watch-js
+
+watch-server:
+ ./node_modules/nodemon/bin/nodemon.js -e hs,conf --exec 'make build-and-launch-server --silent'
+
+watch-elm:
+ ./node_modules/nodemon/bin/nodemon.js -e elm --exec 'make build-elm --silent'
+
+watch-js:
+ ./node_modules/nodemon/bin/nodemon.js --watch src/client/js --exec 'make build-js --silent'
+
+# Build and launch
+# ----------------
+
+build-and-launch-server: build-server kill-server launch-server
+
+launch-server:
+ ./dist/build/sharedCost/sharedCost &
+
+kill-server:
+ pkill sharedCost || true
+
+# Build
+# -----
+
+build: build-server build-elm build-js
+
+build-server:
+ cabal build
+
+build-elm:
+ elm make src/client/elm/Main.elm --output public/javascripts/client.js
+
+build-js:
+ cp src/client/js/main.js public/javascripts/main.js
diff --git a/README.md b/README.md
index 3b3335d..055c1f4 100644
--- a/README.md
+++ b/README.md
@@ -2,22 +2,25 @@
Share costs with a group of people.
-## Required dependencies
+## Install nix
-- `cabal2nix`
-- `nix`
-- `cabal-install`
-- `npm`
-- `elm`
+```
+curl https://nixos.org/nix/install | sh
+```
## Usage
+Open a nix shell:
+
+```
+nix-shell
+```
+
+Then:
+
```
-cabal2nix --shell . > shell.nix
-nix-shell -I ~ --command 'cabal configure'
-npm install
-elm package install
-npm start
+make install
+make start
```
## TODO
@@ -25,4 +28,3 @@ npm start
- Income CRUD
- Server error message
- Dates after today most be forbidden
-- Get rid of npm
diff --git a/default.nix b/default.nix
deleted file mode 100644
index cd8b6fc..0000000
--- a/default.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-with import <nixpkgs> {}; {
- env = stdenv.mkDerivation {
- name = "env";
- buildInputs = [ emacs ];
- };
-}
diff --git a/package.json b/package.json
index 9cc8f10..6d7467e 100644
--- a/package.json
+++ b/package.json
@@ -1,22 +1,7 @@
{
- "devDependencies": {
- "nodemon": "1.9.1"
+ "dependencies": {
+ "nodemon": "1.9.2"
},
- "scripts": {
- "start": "npm run watch",
-
- "watch": "npm run watch-server & npm run watch-elm & npm run watch-js",
- "watch-server": "nodemon -e hs,conf --exec 'npm run build-and-launch-server --silent'",
- "watch-elm": "nodemon -e elm --exec 'npm run build-elm --silent'",
- "watch-js": "nodemon --watch src/client/js --exec 'npm run build-js --silent'",
-
- "build": "npm run build-server && npm run build-elm && npm run build-js",
- "build-server": "cabal build",
- "build-elm": "elm make src/client/elm/Main.elm --output public/javascripts/client.js",
- "build-js": "cp src/client/js/main.js public/javascripts/main.js && echo 'javascript pasted.'",
-
- "build-and-launch-server": "npm run build-server && npm run kill-server && npm run launch-server",
- "launch-server": "./dist/build/sharedCost/sharedCost &",
- "kill-server": "pkill sharedCost || true"
- }
+ "repository": "guyonvarch/sharedCost",
+ "license": "GPL-3.0"
}
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..4a2046a
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,11 @@
+with import <nixpkgs> {}; {
+ env = stdenv.mkDerivation {
+ name = "env";
+ buildInputs = [
+ elmPackages.elm
+ cabal-install
+ cabal2nix
+ nodejs
+ ];
+ };
+}