Skip to content

Commit 8c6df51

Browse files
committed
init
0 parents  commit 8c6df51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3586
-0
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{json,yaml,yml,toml}]
12+
indent_size = 2
13+
14+
[*.md]
15+
indent_size = 2
16+
17+
[*.nix]
18+
indent_size = 2

.envrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# If you have `direnv` installed, this file
4+
# will source the Nix devShell `default` directlty when entering this
5+
# directory.
6+
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
7+
echo "Loading nix-direnv, because its faster..."
8+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
9+
fi
10+
11+
watch_dir ./tools/nix/shells
12+
13+
use flake ./tools/nix#default --no-pure-eval

.gitattributes

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Attribute file for assigning key=value pairs to paths.
2+
# Any author editing this file should know about Git LFS.
3+
4+
# These attributes define among other things
5+
# which files are transferred into Git LFS when
6+
# staging/commiting.
7+
#
8+
# Please read the docs first: https://git-scm.com/docs/gitattributes
9+
#
10+
# Restrictions:
11+
# - No backslashes for paths! (also on Windows)
12+
# - For spaces in paths use `[[:space:]]`.
13+
14+
# Overall LF lineendings for the
15+
# following files.
16+
# ===============================
17+
* text=auto eol=lf
18+
19+
# Default attribute patterns for common binary files
20+
# which should be stored in Git LFS.
21+
# ==================================================
22+
# Images
23+
*.[Ii][Cc][Oo] filter=lfs diff=lfs merge=lfs -text
24+
*.[Jj][Pp][Gg] filter=lfs diff=lfs merge=lfs -text
25+
*.[Jj][Pp][Ee][Gg] filter=lfs diff=lfs merge=lfs -text
26+
*.[Pp][Nn][Gg] filter=lfs diff=lfs merge=lfs -text
27+
*.[Gg][Ii][Ff] filter=lfs diff=lfs merge=lfs -text
28+
*.[Tt][Ii][Ff] filter=lfs diff=lfs merge=lfs -text
29+
*.[Tt][Ii][Ff][Ff] filter=lfs diff=lfs merge=lfs -text
30+
*.[Pp][Ss][Dd] filter=lfs diff=lfs merge=lfs -text
31+
*.[Aa][Ii] filter=lfs diff=lfs merge=lfs -text
32+
33+
# Media
34+
*.[Pp][Dd][Ff] filter=lfs diff=lfs merge=lfs -text
35+
36+
# Video/Audio
37+
*.[Mm][Oo][Vv] filter=lfs diff=lfs merge=lfs -text
38+
*.[Mm][Pp]4 filter=lfs diff=lfs merge=lfs -text
39+
*.[Mm][Pp]2 filter=lfs diff=lfs merge=lfs -text
40+
*.[Mm]4[Vv] filter=lfs diff=lfs merge=lfs -text
41+
*.[Ww][Mm][Vv] filter=lfs diff=lfs merge=lfs -text
42+
*.[Ww][Mm][Vv] filter=lfs diff=lfs merge=lfs -text
43+
*.[Mm][Pp][Ee] filter=lfs diff=lfs merge=lfs -text
44+
*.[Mm][Pp][Gg] filter=lfs diff=lfs merge=lfs -text
45+
*.[Mm][Pp][Ee][Gg] filter=lfs diff=lfs merge=lfs -text
46+
*.[Aa][Vv][Ii] filter=lfs diff=lfs merge=lfs -text
47+
*.[Ww][Ee][Bb][Mm] filter=lfs diff=lfs merge=lfs -text
48+
*.[Oo][Gg][Gg] filter=lfs diff=lfs merge=lfs -text
49+
*.[Mm][Pp]3 filter=lfs diff=lfs merge=lfs -text
50+
*.[Ww][Aa][Vv] filter=lfs diff=lfs merge=lfs -text
51+
52+
# MS Office
53+
*.[Dd][Oo][Cc] filter=lfs diff=lfs merge=lfs -text
54+
*.[Dd][Oo][Cc][Xx] filter=lfs diff=lfs merge=lfs -text
55+
*.[Pp][Pp][Tt] filter=lfs diff=lfs merge=lfs -text
56+
*.[Pp][Pp][Tt][Xx] filter=lfs diff=lfs merge=lfs -text
57+
*.[Xx][Ll][Ss] filter=lfs diff=lfs merge=lfs -text
58+
*.[Xx][Ll][Ss][Xx] filter=lfs diff=lfs merge=lfs -text
59+
*.[Dd][Oo][Tt][Xx] filter=lfs diff=lfs merge=lfs -text
60+
61+
# Fonts
62+
*.[Tt][Tt][Ff] filter=lfs diff=lfs merge=lfs -text
63+
*.[Oo][Tt][Ff] filter=lfs diff=lfs merge=lfs -text
64+
*.[Ww][Oo][Ff][Ff] filter=lfs diff=lfs merge=lfs -text
65+
*.[Ww][Oo][Ff][Ff]2 filter=lfs diff=lfs merge=lfs -text
66+
67+
# Data Zips
68+
*.[Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text
69+
*.[Zz] filter=lfs diff=lfs merge=lfs -text
70+
*.[Gg][Zz] filter=lfs diff=lfs merge=lfs -text
71+
*.[Tt][Aa][Rr] filter=lfs diff=lfs merge=lfs -text
72+
*.[Tt][Gg][Zz] filter=lfs diff=lfs merge=lfs -text
73+
*.[Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text
74+
*.[Bb][Zz]2 filter=lfs diff=lfs merge=lfs -text
75+
*.[Ll][Zz][Mm][Aa] filter=lfs diff=lfs merge=lfs -text
76+
*.[Ll][Zz] filter=lfs diff=lfs merge=lfs -text
77+
*.[Ll][Zz]4 filter=lfs diff=lfs merge=lfs -text
78+
*.7[Zz] filter=lfs diff=lfs merge=lfs -text
79+
*.[Ss]7[Zz] filter=lfs diff=lfs merge=lfs -text
80+
*.[Rr][Aa][Rr] filter=lfs diff=lfs merge=lfs -text
81+
*.[Bb][Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text
82+
83+
# Packages
84+
*.[Xx][Pp][Ii] filter=lfs diff=lfs merge=lfs -text
85+
*.[Dd][Mm][Gg] filter=lfs diff=lfs merge=lfs -text
86+
*.[Ii][Mm][Gg] filter=lfs diff=lfs merge=lfs -text
87+
*.[Ii][Ss][Oo] filter=lfs diff=lfs merge=lfs -text
88+
*.[Ww][Ii][Mm] filter=lfs diff=lfs merge=lfs -text
89+
*.[Ss][Ww][Mm] filter=lfs diff=lfs merge=lfs -text
90+
*.[Ee][Ss][Dd] filter=lfs diff=lfs merge=lfs -text
91+
*.[Mm][Ss][Ii] filter=lfs diff=lfs merge=lfs -text
92+
*.[Pp][Kk][Gg] filter=lfs diff=lfs merge=lfs -text
93+
*.[Mm][Pp][Kk][Gg] filter=lfs diff=lfs merge=lfs -text
94+
*.[Dd][Ee][Bb] filter=lfs diff=lfs merge=lfs -text
95+
*.[Rr][Pp][Mm] filter=lfs diff=lfs merge=lfs -text
96+
*.[Jj][Aa][Rr] filter=lfs diff=lfs merge=lfs -text
97+
98+
# Libraries
99+
*.[Pp][Dd][Bb] filter=lfs diff=lfs merge=lfs -text
100+
*.[Dd][Ll][Ll] filter=lfs diff=lfs merge=lfs -text
101+
*.[Ll][Ii][Bb] filter=lfs diff=lfs merge=lfs -text
102+
103+
# General binary
104+
*.[Bb][Ii][Nn] filter=lfs diff=lfs merge=lfs -text
105+
*.[Ee][Xx][Ee] filter=lfs diff=lfs merge=lfs -text

.githooks/.ignore.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
patterns:
2+
- "**/*.md"
3+
- "**/*export-staged"

.githooks/README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Githooks
2+
3+
This project uses [Githooks](https://github.com/gabyx/githooks), that allows
4+
running [Git hooks](https://git-scm.com/docs/cli/githooks) checked into this
5+
repository. This folder contains hooks that should be executed by everyone who
6+
interacts with this source repository. For a documentation on how this works and
7+
how to get it [installed](https://github.com/gabyx/githooks#installation), check
8+
the project [README](https://github.com/gabyx/githooks/blob/main/README.md) in
9+
the [gabyx/githooks](https://github.com/gabyx/githooks) GitHub repository.
10+
11+
## Brief summary
12+
13+
The [directories or files](https://github.com/gabyx/githooks#layout-and-options)
14+
in this folder tell Git to execute certain scripts on various
15+
[trigger events](https://github.com/gabyx/githooks#supported-hooks), before or
16+
after a commit, on every checkout, before a push for example - assuming
17+
[Githooks](https://github.com/gabyx/githooks) is already
18+
[installed](https://github.com/gabyx/githooks#installation) and
19+
[run-wrappers are installed](https://github.com/gabyx/githooks#installing-or-removing-run-wrappers)
20+
for the repository. The directory or file names refer to these events, like
21+
`pre-commit`, `post-commit`, `post-checkout`, `pre-push`, etc. If they are
22+
folders, each file inside them is treated as a hook script and will be executed
23+
when Git runs the hooks as part of the command issued by the user.
24+
[Githooks](https://github.com/gabyx/githooks) comes with a
25+
[command line tool](https://github.com/gabyx/githooks/blob/main/docs/cli/git_hooks.md)
26+
tool, that allows you to manage its configuration and state with a
27+
`git hooks <cmd>` command. See the
28+
[documentation](https://github.com/gabyx/githooks/blob/main/docs/cli/git_hooks.md)
29+
or run `git hooks --help` for more information and available options.
30+
31+
### Is this safe?
32+
33+
[Githooks](https://github.com/gabyx/githooks) uses an
34+
[opt-in model](https://github.com/gabyx/githooks#trusting-hooks), where it will
35+
ask for confirmation whether new or changed hooks should be run or not (or
36+
disabled).
37+
38+
### How do I add a new hook script?
39+
40+
Either create a file with the
41+
[Git hook](https://github.com/gabyx/githooks#supported-hooks) name, or a
42+
directory (recommended) inside the `.githooks` folder, and place files with the
43+
individual steps that should be executed for that event inside. If the file is
44+
executable, it will be invoked directly, otherwise it is assumed to be a Shell
45+
script - unless this file matches one of the
46+
[ignore patterns](https://github.com/gabyx/githooks#ignoring-hooks-and-files) in
47+
the `.githooks` area.
48+
49+
### How can I see what hooks are active?
50+
51+
You can look at the `.githooks` folder to see the local hooks in the repository,
52+
though if you have shared hook repositories defined, those will live under the
53+
`~/.githooks/shared` folder. The
54+
[command line tool](https://github.com/gabyx/githooks/blob/main/docs/cli/git_hooks.md)
55+
can list out all of them for you with `git hooks list`, and you can use it to
56+
trust or ignoring hooks.
57+
58+
## More information
59+
60+
You can find more information about how this all works in the
61+
[README](https://github.com/gabyx/githooks/blob/main/README.md) of the
62+
[Githooks](https://github.com/gabyx/githooks) project repository.
63+
64+
If you find it useful, please show your support by starring the project in
65+
GitHub!

.githooks/pre-commit/.all-parallel

Whitespace-only changes.

.githooks/pre-commit/.common.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
# Some common functions for Githooks.
3+
4+
function _print() {
5+
local flags="$1"
6+
local header="$2"
7+
shift 2
8+
9+
local msg
10+
msg=$(printf '%b\n' "$@")
11+
msg="${msg//$'\n'/$'\n' }"
12+
13+
# shellcheck disable=SC2086
14+
echo $flags -e "⚙️ $header$msg"
15+
}
16+
17+
function print_info() {
18+
_print "" "" "$@"
19+
}
20+
21+
function print_warn() {
22+
_print "" "WARN: " "$@" >&2
23+
}
24+
25+
function print_prompt() {
26+
_print "-n" "" "$@" >&2
27+
}
28+
29+
function print_error() {
30+
_print "" "ERROR: " "$@" >&2
31+
}
32+
33+
function die() {
34+
print_error "$@"
35+
exit 1
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# List all staged files.
3+
#
4+
set -e
5+
set -u
6+
set -o pipefail
7+
8+
. "tools/ci/general.sh"
9+
10+
if [ -n "${STAGED_FILES:-}" ]; then
11+
ci::print_info "Staged files:" >&2
12+
13+
for file in $STAGED_FILES; do
14+
echo " - $file" >&2
15+
done
16+
elif [ -n "${STAGED_FILES_FILE:-}" ]; then
17+
ci::print_info "Staged files:" >&2
18+
19+
while read -rd $'\\0' file; do
20+
echo " - $file" >&2
21+
done <"$STAGED_FILES_FILE"
22+
fi
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1091
3+
#
4+
# Format all files.
5+
6+
set -e
7+
set -u
8+
set -o pipefail
9+
10+
./tools/ci/check-git-lfs.sh

.githooks/pre-commit/2-format.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC1091
3+
#
4+
# Format all files.
5+
6+
set -e
7+
set -u
8+
set -o pipefail
9+
10+
. "tools/ci/general.sh"
11+
12+
if ! command -v "nix" &>/dev/null; then
13+
print_warn "! Tool 'nix' is not on your path." >&2
14+
exit 0
15+
fi
16+
17+
FILES=()
18+
readarray -t FILES < <(echo "$STAGED_FILES")
19+
20+
# shellcheck disable=SC2128
21+
if [ "${#FILES[@]}" = "0" ]; then
22+
ci::print_info "No files to format."
23+
exit 0
24+
fi
25+
26+
ci::print_info "Running 'treefmt'..."
27+
nix run "./tools/nix#treefmt" -- "${FILES[@]}"

.githooks/trust-all

Whitespace-only changes.

.github/actions/setup-nix/action.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Setup Nix Environment"
2+
description: "Sets up Nix and Cachix"
3+
4+
inputs:
5+
cachix_cache_name:
6+
description: "Cachix cache name"
7+
required: true
8+
cachix_auth_token:
9+
description: "Cachix authentication token"
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- uses: cachix/install-nix-action@v30
16+
with:
17+
nix_path: nixpkgs=channel:nixos-unstable
18+
- uses: cachix/cachix-action@v15
19+
with:
20+
name: "${{ inputs.cachix_cache_name }}"
21+
authToken: "${{ inputs.cachix_auth_token }}"
22+
- name: bootstrap
23+
run: nix profile install "./tools/nix#bootstrap"
24+
shell: bash

.github/pull_request_template.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Proposed Changes
2+
3+
<!--
4+
Describe the big picture of your changes here to communicate to the maintainers
5+
why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
6+
-->
7+
8+
## Types of Changes
9+
10+
What types of changes does your contribution introduce? _Put an `x` in the boxes
11+
that apply_
12+
13+
- [ ] A **bug fix** (non-breaking change which fixes an issue). Use MR tag
14+
`bugfix`.
15+
- [ ] A new **feature** (non-breaking change which adds functionality). Use MR
16+
tag `feature`.
17+
- [ ] A **breaking change** (fix or feature that would cause existing
18+
functionality to not work as expected). Use MR tag `feature`.
19+
- [ ] A **non-productive** update (documentation, tooling, etc. if none of the
20+
other choices apply). Use MR tag `chore`.
21+
22+
## Checklist
23+
24+
_Put an `x` in the boxes that apply. You can also fill these out after creating
25+
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
26+
help! This is simply a reminder of what we are going to look for before merging
27+
your code._
28+
29+
- [ ] I have read the
30+
[CONTRIBUTING](https://github.com/swissdatasciencecenter/my-project/tree/main/CONTRIBUTING.md)
31+
guidelines.
32+
33+
## Further Comments
34+
35+
<!-- If this is a relatively large or complex change, kick off the discussion by -->
36+
<!-- explaining why you chose the solution you did and what alternatives you -->
37+
<!-- considered, etc... -->

0 commit comments

Comments
 (0)