Skip to content

Commit 7f8d26d

Browse files
authored
v1.0.0.0 (#5)
1 parent 8da8988 commit 7f8d26d

25 files changed

+633
-701
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build & cache
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: cachix/install-nix-action@v31
9+
with:
10+
extra_nix_config: |
11+
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
12+
substituters = https://cache.iog.io/ https://cache.nixos.org/
13+
allow-import-from-derivation = true
14+
accept-flake-config = true
15+
download-buffer-size = 524288000
16+
nix_path: nixpkgs=channel:nixos-unstable
17+
- uses: cachix/cachix-action@v15
18+
with:
19+
name: inguncache
20+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
21+
- run: |
22+
# nix run "github:input-output-hk/haskell.nix#hix" -- init
23+
# echo "------ Content of flake.nix ------"
24+
# cat flake.nix
25+
# echo "----- Content of nix/hix.nix -----"
26+
# cat nix/hix.nix
27+
nix build .#answers-script:exe:answers-script

.gitignore

Lines changed: 3 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,3 @@
1-
.cabal-sandbox/
2-
cabal.sandbox.config
3-
cabal.project.local
4-
.ghc.environment.*
5-
cabal-dev/
6-
.hpc/
7-
*.hi
8-
*.o
9-
*.p_hi
10-
*.prof
11-
*.tix
12-
dist
13-
dist-*
14-
register.sh
15-
./cabal.config
16-
cabal-tests.log
17-
bootstrap/*.plan.json
18-
19-
/Cabal/dist/
20-
/Cabal/tests/Setup
21-
/Cabal/Setup
22-
/Cabal/source-file-list
23-
24-
/cabal-install/dist/
25-
/cabal-install/Setup
26-
/cabal-install/source-file-list
27-
28-
.stylish-haskell.yaml
29-
.stylish-haskell.yml
30-
.ghci
31-
.ghcid
32-
33-
# Output of release and bootstrap
34-
_build
35-
36-
# editor temp files
37-
38-
*#
39-
.#*
40-
*~
41-
.*.swp
42-
*.bak
43-
44-
# GHC build
45-
46-
Cabal/GNUmakefile
47-
Cabal/dist-boot/
48-
Cabal/dist-install/
49-
Cabal/ghc.mk
50-
51-
52-
# TAGS files
53-
TAGS
54-
tags
55-
ctags
56-
57-
# stack artifacts
58-
/.stack-work/
59-
stack.yaml.lock
60-
61-
# Shake artifacts
62-
.shake*
63-
progress.txt
64-
65-
# test files
66-
register.sh
67-
68-
# windows test artifacts
69-
cabal-testsuite/**/*.exe
70-
cabal-testsuite/**/*.bat
71-
72-
# python artifacts from documentation builds
73-
*.pyc
74-
.python-sphinx-virtualenv/
75-
/doc/.skjold_cache/
76-
77-
# macOS folder metadata
78-
.DS_Store
79-
80-
# benchmarks
81-
bench.html
82-
83-
# Emacs
84-
.projectile
85-
/test/dst/
1+
/dist-newstyle
2+
/test/dst
3+
/cabal.project.freeze

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "test/answers-db"]
2+
path = test/answers-db
3+
url = https://github.com/ingun37/answers-db.git
4+
branch = test-data
File renamed without changes.

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Copyright (c) 2025, Ingun Jon
2+
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above
11+
copyright notice, this list of conditions and the following
12+
disclaimer in the documentation and/or other materials provided
13+
with the distribution.
14+
15+
* Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived
17+
from this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,72 @@
1-
# Answers Script
1+
# Build MacOS
22

3-
## Generate default.nix
3+
```sh
4+
# for building gitlib packages
5+
brew install pkgconf
6+
brew install icu4c
7+
brew install openssl@3
48

5-
```shell
6-
nix-shell -p cabal2nix
7-
cabal2nix --no-check ./. > default.nix
8-
```
9-
10-
## Generate shell.nix
9+
# /usr/local/opt/openssl is hard coded in the gitlib build setting.
10+
ln -s $(brew --prefix openssl@3)/3.5.2 /usr/local/opt/openssl
1111

12-
```shell
13-
nix-shell -p cabal2nix
14-
cabal2nix --shell --no-check ./. > shell.nix
12+
echo "export PKG_CONFIG_PATH=\"$(brew --prefix)/opt/icu4c/lib/pkgconfig\"" >> ~/.zprofile
1513
```
1614

17-
## Build
15+
```sh
16+
cabal build
17+
```
1818

19-
**Don't just build using Cabal!!** it will take forever because of Pandoc.
19+
# Data flow
2020

21-
Build in Nix environment
21+
```mermaid
22+
flowchart LR
23+
n1["src"] --> n2(("directory-tree<br>readDirectoryWithL"))
24+
n3["myReader"] --> n2
25+
n2 --> n4["AnchoredDirTree FileType"]
26+
n4 --> n5(("directory-tree<br>filterDir"))
27+
n5 --> n8(("unfoldTree"))
28+
n9["myUnfolder"] --> n8
29+
n8 --> n10["Tree Item"]
30+
n11["myFilter"] --> n5
31+
n10 --> n12(("recurse"))
32+
n13["myWriter"] --> n12
33+
n12 --> n14["[Effect]"]
2234
23-
```shell
24-
# Enter Nix environment defined in shell.nix
25-
nix-shell
26-
# Use executable
27-
answers-script ...
35+
n1@{ shape: rect}
36+
n9@{ shape: rect}
2837
```
2938

30-
## Test
39+
# CI/CD
3140

32-
```shell
33-
nix-shell
34-
cabal --enable-nix test
41+
Check the sha1 of gitlib like this
42+
43+
```sh
44+
nix-shell -p nix-prefetch-git
45+
nix-prefetch-git https://github.com/jwiegley/gitlib.git bf256617179d853bdbc12e9283b3f570ebb9d9d7 --fetch-submodules
3546
```
3647

37-
## Install from other machines
48+
Output is like
3849

39-
```shell
40-
TAR="https://github.com/ingun37/answers-script/archive/refs/tags/1.0.1.tar.gz"
41-
# sandboxing
42-
nix-shell -p "with import <nixpkgs> {}; let f = import (fetchTarball $TAR); in haskellPackages.callPackage f {}"
43-
# no sandboxing
44-
nix-env --install -E "with import <nixpkgs> {}; let f = import (fetchTarball $TAR); in _: (haskellPackages.callPackage f {})"
4550
```
51+
git revision is bf256617179d853bdbc12e9283b3f570ebb9d9d7
52+
path is /nix/store/63bx4k5nwjqwk7gv0a0k8adq796bjbpr-gitlib-bf25661
53+
git human-readable version is -- none --
54+
Commit date is 2025-09-04 11:17:27 -0700
55+
hash is 13k3aymqwzpcijnjjka820nv6rkgakzbvh13glw98p1c4yhqwcbf
56+
{
57+
"url": "https://github.com/jwiegley/gitlib.git",
58+
"rev": "bf256617179d853bdbc12e9283b3f570ebb9d9d7",
59+
"date": "2025-09-04T11:17:27-07:00",
60+
"path": "/nix/store/63bx4k5nwjqwk7gv0a0k8adq796bjbpr-gitlib-bf25661",
61+
"sha256": "13k3aymqwzpcijnjjka820nv6rkgakzbvh13glw98p1c4yhqwcbf",
62+
"hash": "sha256-bjGOoScsXJQ4fSPAvf5Ub2azLRBITSmtjOx+jqtXY44=",
63+
"fetchLFS": false,
64+
"fetchSubmodules": true,
65+
"deepClone": false,
66+
"fetchTags": false,
67+
"leaveDotGit": false,
68+
"rootDir": ""
69+
}
70+
```
71+
72+
Use the "sha256" for the `--sha256` field in the `cabal.project`.

0 commit comments

Comments
 (0)