Skip to content

Commit 4567375

Browse files
authored
Adopt Project Manager (#20)
2 parents c7b077b + 2d518f7 commit 4567375

30 files changed

+1209
-2383
lines changed

.cache/git/config

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.cache/git/hooks/pre-push

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.cache/vale/Vocab/dada/accept.txt

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.config/emacs/.dir-locals.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
((nil
2+
(fill-column . 80)
3+
(indent-tabs-mode . nil)
4+
(projectile-project-configure-cmd . "nix flake update")
5+
(sentence-end-double-space . nil))
6+
("dhall"
7+
(nil
8+
;; These files generally don’t have an extension
9+
(mode . dhall))))

.config/git/config

Lines changed: 0 additions & 2 deletions
This file was deleted.

.config/git/ignoreRevs

Whitespace-only changes.

.config/mustache.yaml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
{
2-
project:
3-
{
4-
description:
5-
"Recursion schemes provide a total way to support recursion. The \
6-
decomposition they encourage also enhances composability and \
7-
reusability.",
8-
name: "dada",
9-
repo: "sellout/dada",
10-
summary: "A total recursion scheme library for Dhall",
11-
version: "0.1.0",
12-
},
13-
type: { name: "dhall" },
14-
}
1+
project:
2+
description: >-
3+
Recursion schemes allow you to separate recursion from your business logic –
4+
making your own operations simpler, more modular, and less error-prone. This
5+
library also provides tools for combining your operations in ways that
6+
reduce the number of passes over your data and is designed to encourage
7+
total (that is, successfully terminating) functions.
8+
name: "dada"
9+
repo: "sellout/dada"
10+
summary: "A total recursion scheme library for Dhall"
11+
version: "0.1.0"
12+
type: { name: "dhall" }

.config/project/default.nix

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{config, flaky, lib, pkgs, self, ...}: {
2+
project = {
3+
name = "dada";
4+
summary = "A total recursion scheme library for Dhall";
5+
6+
devPackages = [
7+
pkgs.cabal-install
8+
pkgs.dhall
9+
pkgs.dhall-docs
10+
pkgs.dhall-lsp-server
11+
pkgs.graphviz
12+
];
13+
};
14+
15+
imports = [
16+
./github-ci.nix
17+
./github-pages.nix
18+
./hlint.nix
19+
];
20+
21+
## dependency management
22+
services.renovate.enable = true;
23+
24+
## development
25+
programs = {
26+
direnv.enable = true;
27+
# This should default by whether there is a .git file/dir (and whether it’s
28+
# a file (worktree) or dir determines other things – like where hooks
29+
# are installed.
30+
git = {
31+
enable = true;
32+
ignores = [
33+
# Cabal build
34+
"dist-newstyle"
35+
];
36+
};
37+
};
38+
39+
## formatting
40+
editorconfig.enable = true;
41+
42+
programs = {
43+
treefmt = {
44+
enable = true;
45+
programs = {
46+
dhall.enable = true;
47+
## Haskell formatter
48+
ormolu.enable = true;
49+
};
50+
settings.formatter.dhall.includes = ["dhall/*"];
51+
};
52+
vale = {
53+
enable = true;
54+
excludes = [
55+
"*.cabal"
56+
"*.hs"
57+
"*.lhs"
58+
"*/.dir-locals.el"
59+
"./.shellcheckrc"
60+
"./cabal.project"
61+
"./dhall/*"
62+
];
63+
vocab.${config.project.name}.accept = [
64+
"bugfix"
65+
"comonad"
66+
"composability"
67+
"conditionalize"
68+
"Dhall"
69+
"functor"
70+
"GADT"
71+
"Kleisli"
72+
"Kmett"
73+
"reusability"
74+
];
75+
};
76+
};
77+
project.file.".dir-locals.el".source = lib.mkForce ../emacs/.dir-locals.el;
78+
79+
## CI
80+
services.garnix = {
81+
enable = true;
82+
builds.exclude = [
83+
# TODO: Remove once garnix-io/garnix#285 is fixed.
84+
"homeConfigurations.x86_64-darwin-${config.project.name}-example"
85+
];
86+
};
87+
## FIXME: Shouldn’t need `mkForce` here (or to duplicate the base contexts).
88+
## Need to improve module merging.
89+
services.github.settings.branches.main.protection.required_status_checks.contexts =
90+
lib.mkForce
91+
(map (ghc: "CI / build (${ghc}) (pull_request)") self.lib.nonNixTestedGhcVersions
92+
++ lib.concatMap flaky.lib.garnixChecks (
93+
lib.concatMap (ghc: [
94+
(sys: "devShell ghc${ghc} [${sys}]")
95+
(sys: "package ghc${sys}_all [${sys}]")
96+
])
97+
(self.lib.testedGhcVersions pkgs.system)
98+
++ [
99+
(sys: "homeConfig ${sys}-${config.project.name}-example")
100+
(sys: "package default [${sys}]")
101+
(sys: "package ${config.project.name} [${sys}]")
102+
## FIXME: These are duplicated from the base config
103+
(sys: "check formatter [${sys}]")
104+
(sys: "devShell default [${sys}]")
105+
]));
106+
107+
## publishing
108+
programs.git.attributes = ["/dhall/** linguist-language=Dhall"];
109+
services.flakehub.enable = true;
110+
services.github.enable = true;
111+
services.github.settings.repository = {
112+
homepage = "https://sellout.github.io/${config.project.name}";
113+
topics = ["library"];
114+
};
115+
}

.config/project/github-ci.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{lib, self, ...}: {
2+
services.github.workflow."build.yml".text = lib.generators.toYAML {} {
3+
name = "CI";
4+
on = {
5+
push.branches = ["main"];
6+
pull_request.types = [
7+
"opened"
8+
"synchronize"
9+
];
10+
};
11+
jobs.build = {
12+
runs-on = "ubuntu-latest";
13+
## TODO: Populate this as the difference between supported versions and
14+
## available nix package sets.
15+
strategy = {
16+
fail-fast = false;
17+
## TODO: Populate this as the difference between supported versions and
18+
## available nix package sets.
19+
matrix.ghc = self.lib.nonNixTestedGhcVersions;
20+
};
21+
env.CONFIG = "--enable-tests --enable-benchmarks";
22+
steps = [
23+
{uses = "actions/checkout@v2";}
24+
{
25+
uses = "haskell-actions/setup@v2";
26+
id = "setup-haskell-cabal";
27+
"with" = {
28+
ghc-version = "\${{ matrix.ghc }}";
29+
cabal-version = "3.10";
30+
};
31+
}
32+
{run = "cabal v2-update";}
33+
{run = "cabal v2-freeze $CONFIG";}
34+
{
35+
uses = "actions/cache@v2";
36+
"with" = {
37+
path = ''
38+
''${{ steps.setup-haskell-cabal.outputs.cabal-store }}
39+
dist-newstyle
40+
'';
41+
key = "\${{ runner.os }}-\${{ matrix.ghc }}-\${{ hashFiles('cabal.project.freeze') }}";
42+
};
43+
}
44+
{run = "cabal v2-test all $CONFIG";}
45+
];
46+
};
47+
};
48+
}

.config/project/github-pages.nix

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{lib, ...}: let
2+
defaultBranch = "main";
3+
in {
4+
services.github = {
5+
settings.pages = {
6+
build_type = "workflow";
7+
source.branch = defaultBranch;
8+
};
9+
workflow."pages.yml".text = lib.generators.toYAML {} {
10+
name = "Deploy modules & generated docs to Pages";
11+
12+
on = {
13+
# Runs on pushes targeting the default branch
14+
push.branches = [defaultBranch];
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch = null;
17+
};
18+
19+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
20+
permissions = {
21+
contents = "read";
22+
id-token = "write";
23+
pages = "write";
24+
};
25+
26+
# Allow only one concurrent deployment, skipping runs queued between the
27+
# run in-progress and latest queued. However, do NOT cancel in-progress
28+
# runs as we want to allow these production deployments to complete.
29+
concurrency = {
30+
cancel-in-progress = false;
31+
group = "pages";
32+
};
33+
34+
jobs = {
35+
build = {
36+
runs-on = "ubuntu-latest";
37+
steps = [
38+
{
39+
name = "Checkout";
40+
uses = "actions/checkout@v4";
41+
}
42+
{
43+
name = "Setup Pages";
44+
uses = "actions/configure-pages@v4";
45+
}
46+
{
47+
uses = "cachix/install-nix-action@v24";
48+
"with".extra_nix_config = ''
49+
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
50+
extra-substituters = https://cache.garnix.io
51+
'';
52+
}
53+
{
54+
uses = "lriesebos/nix-develop-command@v1";
55+
"with".command = ''
56+
dhall-docs \
57+
--input ./dhall \
58+
--base-import-url "https://sellout.github.io/dada" \
59+
--package-name "dada"
60+
## We copy here to fix the permissions from the Nix symlinks
61+
cp -r ./docs ./_site
62+
chmod --recursive +rwx ./_site
63+
cp -r ./dhall/* ./_site/
64+
'';
65+
}
66+
{
67+
name = "Upload artifact";
68+
uses = "actions/upload-pages-artifact@v2";
69+
}
70+
];
71+
};
72+
deploy = {
73+
environment = {
74+
name = "github-pages";
75+
url = "$";
76+
};
77+
runs-on = "ubuntu-latest";
78+
needs = "build";
79+
steps = [
80+
{
81+
name = "Deploy to GitHub Pages";
82+
id = "deployment";
83+
uses = "actions/deploy-pages@v3";
84+
}
85+
];
86+
};
87+
};
88+
};
89+
};
90+
}

0 commit comments

Comments
 (0)