1
0
Fork 0

Start upgrade to v1.1.0

This commit is contained in:
Amitai Burstein 2023-10-03 20:29:29 +03:00
parent ed89bebd5b
commit e2684680af
7 changed files with 81 additions and 55 deletions

16
.envrc Normal file
View File

@ -0,0 +1,16 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake . --impure --accept-flake-config
# Include .env file if it exists locally. Use the .env file to load env vars that you don't want to commit to git
if [ -f .env ]
then
set -o allexport
source .env
set +o allexport
fi
# Add your env vars here
#
# E.g. export AWS_ACCESS_KEY_ID="XXXXX"

4
.ghci
View File

@ -1,4 +1,4 @@
:set -XNoImplicitPrelude
:def source readFile
:source build/ihp-lib/applicationGhciConfig
:def loadFromIHP \file -> (System.Environment.getEnv "IHP_LIB") >>= (\ihpLib -> readFile (ihpLib <> "/" <> file))
:loadFromIHP applicationGhciConfig
import IHP.Prelude

6
.gitignore vendored
View File

@ -1,5 +1,4 @@
.DS_Store
.envrc
.idea
tmp
result
@ -21,3 +20,8 @@ Config/client_session_key.aes
# Ignore locally checked out IHP version
IHP
.devenv*
devenv.local.nix
.direnv
.env

10
README.md Normal file
View File

@ -0,0 +1,10 @@
Example for Multi Record Forms
Announced on https://github.com/digitallyinduced/ihp/releases/tag/v1.1.0
## Installation
```bash
direnv allow
devenv up
```

View File

@ -1,22 +1,9 @@
let
ihp = builtins.fetchGit {
url = "https://github.com/digitallyinduced/ihp.git";
rev = "c049d0e3f0f1c7fcc80f275b8307446ece00bcf0";
};
haskellEnv = import "${ihp}/NixSupport/default.nix" {
ihp = ihp;
haskellDeps = p: with p; [
cabal-install
base
wai
text
hlint
p.ihp
];
otherDeps = p: with p; [
# Native dependencies, e.g. imagemagick
];
projectPath = ./.;
};
in
haskellEnv
# For backwards compatibility using flake.nix
(import
(
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9.tar.gz";
sha256 = "sha256:1prd9b1xx8c0sfwnyzkspplh30m613j42l1k789s521f4kv4c2z2";
}
)
{ src = ./.; }).defaultNix

38
flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
inputs = {
# Here you can adjust the IHP version of your project
# You can find new releases at https://github.com/digitallyinduced/ihp/releases
ihp.url = "github:digitallyinduced/ihp/v1.1";
nixpkgs.follows = "ihp/nixpkgs";
flake-parts.follows = "ihp/flake-parts";
devenv.follows = "ihp/devenv";
systems.follows = "ihp/systems";
};
outputs = inputs@{ ihp, flake-parts, systems, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
imports = [ ihp.flakeModules.default ];
perSystem = { pkgs, ... }: {
ihp = {
enable = true;
projectPath = ./.;
packages = with pkgs; [
# Native dependencies, e.g. imagemagick
];
haskellPackages = p: with p; [
# Haskell dependencies go here
p.ihp
cabal-install
base
wai
text
hlint
];
};
};
};
}

29
start
View File

@ -1,29 +0,0 @@
#!/usr/bin/env bash
# Script to start the local dev server
set -e
# On macOS the default max count of open files is 256. IHP needs atleast 1024 to run well.
#
# The wai-static-middleware sometimes doesn't close it's file handles directly (likely because of it's use of lazy bytestrings)
# and then we usually hit the file limit of 256 at some point. With 1024 the limit is usually never hit as the GC kicks in earlier
# and will close the remaining lazy bytestring handles.
if [[ $OSTYPE == 'darwin'* ]]; then
ulimit -n 4096
fi
# Unless the RunDevServer binary is available, we rebuild the .envrc cache with nix-shell
# and config cachix for using our binary cache
command -v RunDevServer >/dev/null 2>&1 \
|| { echo "PATH_add $(nix-shell -j auto --cores 0 --run 'printf %q $PATH')" > .envrc; }
# Now we have to load the PATH variable from the .envrc cache
direnv allow
eval "$(direnv hook bash)"
eval "$(direnv export bash)"
# You can define custom env vars here:
# export CUSTOM_ENV_VAR=".."
# Finally start the dev server
RunDevServer