Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ref: https://editorconfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
20 changes: 20 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# this is required for versions of direnv older than 2.29.0, since they do not
# support `use flake`, and is recommended in all cases, since it caches the
# environment and prevents dependencies from being garbage-collected by nix.
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then
source_url \
"https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" \
"sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w="
fi

# allow extending this .envrc with a user-defined .envrc.local
source_env_if_exists .envrc.local

# load the development shell defined in the flake.nix file
# note: this automatically watches the following files:
# - flake.nix
# - flake.lock
use flake

# files to watch
watch_file .envrc.local
19 changes: 19 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# git blame ignore list
#
# This file contains a list of git hashes of revisions to be ignored by
# git-blame. These revisions are considered "unimportant" in that they are
# unlikely to be what you are interested in when blaming.
#
# Instructions:
# - Only large (generally automated) reformatting or renaming commits should be
# added to this list. Do not put things here just because you feel they are
# trivial or unimportant. If in doubt, do not put it on this list.
# - Precede each revision with a comment containing the first line of its log.
# For bulk work over many commits, place all commits in a block with a single
# comment at the top describing the work done in those commits.
# - Only put full 40-character hashes on this list (not short hashes or any
# other revision reference).
# - Append to the bottom of the file (revisions should be in chronological order
# from oldest to newest).
# - Because you must use a hash, you need to append to this list in a follow-up
# commit to the actual reformatting commit that you are trying to ignore.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ dist
coverage.txt
.idea/
.git_bak*

# nix and direnv related tooling
.envrc
.envrc.local
/.direnv/
!/.envrc
33 changes: 33 additions & 0 deletions .gitmessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

################################################################################
# COMMIT MESSAGE FORMAT
#
# ```
# <type>: <subject>
# <BLANK LINE>
# [body]
# <BLANK LINE>
# [footer]
# ```
#
# General notes:
# - The `type` MUST be present.
#
# - The `body` MAY be present, and should include verbose, detailed information
# about what the old behavior was, why the change was necessary, and what the
# new behavior is
#
# - The `footer` MAY be prsent, and should include any relevant trailers and
# other metadata
#
# Valid values for <type>:
# - deprecation: a change related to deprecation of a reosurce or interface
# - design: a change related to design that does not change an interface or
# any application/business logic
# - doc: a change related to documentation
# - feat: changes that introduce new behavior or a new feature
# - fix: Changes that fix an issue
# - refactor: Changes which neither fix an issue or add a feature
# - style: Changes to formatting, blank space, alignment, etc.
# - test: Changes which add missing tests or correct existing tests
################################################################################
99 changes: 99 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Contributing

:wave: Hey there! Thanks for considering taking the time to contribute to
`git-bug`. This page contains some general guidelines, and instructions for
getting started as a contributor to this project.

## Get the source code

Clone this repository to your system in a way you're comfortable with. Below, we
show a command that [clones the repository][how-to-clone] using SSH, and places
it in `~/code/git-bug`.

```
git clone [email protected]:MichaelMure/git-bug ~/code/git-bug
```

> [!IMPORTANT]
> If you wish to clone the repository to another location on disk, change
> `~/code/git-bug` to your desired path. The rest of this documentation will
> refer to `~/code/git-bug` in all instances, so make sure you change them
> there, too.

## Software recommendations

While you can install Golang and hack on this project on your own, you're likely
to have a better experience if you install the following software.

### <a name="install-nix"></a> `nix` (_recommended_)

[`nix`][install/nix] is used in this repository to provide a common development
shell, with a complete set of the appropriate version of the tools used to work
on `git-bug`.

You can install `nix` by following [the official instructions][install/nix], but
we recommend adding some additional flags in order to enable some (technically
experimental, but largely stable) configuration options:

```
curl -L https://nixos.org/nix/install | sh -s -- --daemon --nix-extra-conf-file <( \
cat << EOF | sed -e 's/^ *//'
experimental-features = nix-command flakes
EOF
)
```

> [!TIP]
> Make sure you read the prompts from the installation script carefully. After
> installation, you'll need to start a new shell.

### <a name="install-direnv"></a> `direnv` (_recommended_)

[`direnv`][install/direnv] is used to automatically activate the development
shell (because of the `.envrc` in the root of this repository).

#### <a name="install-direnv-with-nix"></a> With `nix`

> [!IMPORTANT]
> If you are not comfortable with `nix`, we recommend [installing `direnv`
> without nix][install/install-direnv-without-nix].

```
nix --extra-experimental-options 'flakes nix-command' profile install nixpkgs\#direnv
```

There's a second step that is critical -- be sure to [configure your
shell][install/direnv/shell].

#### <a name="install-direnv-without-nix"></a> Without `nix`

You can install `direnv` by following [the official
instructions][install/direnv]. There's a second step that is critical -- be sure
to [configure your shell][install/direnv/shell].

After installation, you'll need to start a new shell.

##### <a name="direnv-config"></a> direnv configuration (_recommended_)

If you install `direnv`, it is recommended to set the following configuration
options to improve your user experience. At the time of writing, these go in
`~/.config/direnv/direnv.toml`.

This configuration, namely, the `whitelist.exact` property, will ensure that
`direnv` always automatically sources the `.envrc` in this repository.

```
hide_env_diff = true
warn_timeout = 0

[whitelist]
exact = ["~/code/git-bug/.envrc"]
```

> [!IMPORTANT]
> Make sure you change the `~/code/git-bug` portion of the string to the
> appropriate path (the path that you cloned this repository to on your system).

[install/nix]: https://nix.dev/install-nix
[install/direnv]: https://github.com/direnv/direnv/blob/master/docs/installation.md
[install/direnv/shell]: https://github.com/direnv/direnv/blob/master/docs/hook.md
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
description = "workspace configuration for git-bug";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell = pkgs.mkShell {
packages = with pkgs; [
codespell
gh
git
go
golangci-lint
nixfmt-rfc-style
nodePackages.prettier
];

shellHook = ''
# Use //:.gitmessage as the commit message template
${pkgs.git}/bin/git config --local commit.template ".gitmessage"

# Use a common, shared file as the default for running
# git-blame with the `--ignore-revs` flag
${pkgs.git}/bin/git config --local blame.ignoreRevsFile ".git-blame-ignore-revs"
'';
};
}
);
}