Skip to content

Commit abbe117

Browse files
committed
devshell: add nix devshell for docusaurus
1 parent e92266a commit abbe117

11 files changed

+14387
-1431
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
18
*~
29
\#*
310
_cache
411
_site
512
dist-newstyle
6-
node_modules
7-
/.docusaurus/
8-
/build
13+
.docusaurus
14+
.cache-loader
15+
16+
# Misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# Nix
28+
result
29+
.direnv

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ one commit per new post.
6262

6363
## Local Development
6464

65-
One needs to install `yarn` and `nodejs`. A basic `shell.nix` is provided so
66-
it's straightforward to enter `nix-shell` and use the provided `yarn`
67-
executable.
65+
One needs to install `yarn` and `nodejs`.
6866

6967
:warning: The `yarn` package from Debian has nothing to do with the yarn we use
7068
here!
7169

70+
If using Nix package manager, one can start up a development environment by running:
71+
72+
```
73+
nix develop
74+
just setup
75+
just run
76+
```
77+
7278
### Installation
7379

7480
```

flake.lock

+101
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4+
systems.url = "github:nix-systems/default";
5+
flake-parts.url = "github:hercules-ci/flake-parts";
6+
treefmt-nix.url = "github:numtide/treefmt-nix";
7+
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
8+
};
9+
10+
outputs = inputs:
11+
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
12+
systems = import inputs.systems;
13+
imports = [
14+
inputs.treefmt-nix.flakeModule
15+
];
16+
perSystem = { self', system, lib, config, pkgs, ... }: {
17+
# Auto formatters. This also adds a flake check to ensure that the
18+
# source tree was auto formatted.
19+
treefmt.config = {
20+
projectRootFile = "docusaurus.config.js";
21+
package = pkgs.treefmt;
22+
programs.nixpkgs-fmt.enable = true;
23+
};
24+
25+
# Default shell.
26+
devShells.default = pkgs.mkShell {
27+
name = "Cardano Updates";
28+
inputsFrom = [
29+
config.treefmt.build.devShell
30+
];
31+
nativeBuildInputs = [
32+
pkgs.nodejs
33+
pkgs.just
34+
];
35+
};
36+
};
37+
};
38+
}

justfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
default:
2+
@just --list
3+
4+
# Autoformat project tree
5+
fmt:
6+
treefmt
7+
8+
# Run local server
9+
run:
10+
npm start
11+
12+
# Build static site
13+
build:
14+
npm run build
15+
16+
# setup first time
17+
setup:
18+
npm install

nix/sources.json

-26
This file was deleted.

0 commit comments

Comments
 (0)