build haskal

This commit is contained in:
xenia 2023-08-09 23:05:03 +02:00
parent f1a25c6d3f
commit bc45ec5fe0
4 changed files with 31 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
matabas-db/ matabas-db/
artifacts/

14
buildScripts/build.sh Executable file
View File

@ -0,0 +1,14 @@
set -e
mkdir -p artifacts
log "Kompilerar backend..."
find backend -type f -and -name '*.hs' -print0 \
| xargs -0 ghc -o artifacts/Main \
-odir artifacts \
-hidir artifacts \
-tmpdir artifacts
log "Klar" "!"
set +e

View File

@ -35,6 +35,16 @@ createdb -p "$PGPORT" matabas 2>>./matabas-db/matabas.log || log "Matabasen finn
log "Ställer in schema.sql" log "Ställer in schema.sql"
psql -p "$PGPORT" "$PBDATABASE" < schema.sql psql -p "$PGPORT" "$PBDATABASE" < schema.sql
P="$PWD"
clean() {
log "Rensar byggnad"
rm -rf artifacts
}
build() {
source "$P/buildScripts/build.sh"
}
log "Redo" "!" log "Redo" "!"
set +e set +e

View File

@ -14,8 +14,12 @@
default = pkgs.hello; default = pkgs.hello;
}; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages.default pkgs.postgresql_15_jit pkgs.cargo ]; packages = [
shellHook = builtins.readFile ./build/devShellHook.sh ; packages.default
pkgs.postgresql_15_jit
( pkgs.ghc.withPackages (ps: with ps; [ scotty postgresql-typed ]) )
];
shellHook = builtins.readFile ./buildScripts/devShellHook.sh ;
}; };
} }
) // { ) // {