Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devshell #1

Merged
merged 4 commits into from
Oct 22, 2024
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
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

use flake
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Context


# Definition of done


# Out of scope/Future work

4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Context


# Important Changes Introduced
17 changes: 17 additions & 0 deletions .github/workflows/validate-devshell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:

jobs:
validate-devshell:
strategy:
matrix:
system: ["x86_64-linux", "aarch64-linux", "x86_64-darwin", "aarch64-darwin"]
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
- name: 🧰 Setup Nix
uses: nixbuild/nix-quick-install-action@v28
- name: 🚀 Eval
run: nix eval .#devShells.${{matrix.system}}.default --apply toString
michalrus marked this conversation as resolved.
Show resolved Hide resolved

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.direnv
result*
/target
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# firefly-cardano


## Getting Set Up
michalrus marked this conversation as resolved.
Show resolved Hide resolved

Install Nix:
```console
# Install Nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

# Enter devshell:
nix develop
```

### (Optional) Install direnv
Should you prefer to load the devshell automatically when in a terminal

- Install Direnv:
```
# Install direnv
nix profile install nixpkgs#direnv

# Configure your shell to load direnv everytime you enter this project (If you do not use bash see: https://direnv.net/docs/hook.html)
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc

# And in case your system does not automatically .bashrc
echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile
```

- Renter the shell for direnv to take effect
- Trust direnv config (.envrc), whitelisting is required whenever this file changes
```
direnv allow
```

67 changes: 67 additions & 0 deletions flake.lock

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

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
description = "firefly-cardano";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "";

flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
};

outputs = {...} @ inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
imports = with inputs; [
devshell.flakeModule
];

perSystem = {
pkgs,
system,
self',
config,
...
}: {
devshells.default = {
name = "firefly-cardano";
imports = [
"${inputs.devshell}/extra/language/rust.nix"
];

packages = with pkgs; [
alejandra
];

commands = [
{package = pkgs.treefmt;}
{package = pkgs.just;}
];

devshell.startup.setup.text = ''
[ -e $PRJ_ROOT/.envrc.local ] && source $PRJ_ROOT/.envrc.local
'';
};
};
};
}
15 changes: 15 additions & 0 deletions treefmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[formatter]
[formatter.alejandra]
command = "alejandra"
excludes = []
includes = ["*.nix"]
options = []

[formatter.rustfmt]
command = "rustfmt"
excludes = []
includes = ["*.rs"]
options = ["--edition", "2021", "--config", "skip_children=true"]

[global]
excludes = ["*.lock", "*.patch", ".gitignore", ".gitmodules"]
Loading