You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-46Lines changed: 12 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,22 @@ Opinionated flake for development of various things I work on using multiple lan
6
6
7
7
## Workflow
8
8
9
-
This flake is intended to fit with my workflow, which is with [Visual Studio Code](https://code.visualstudio.com), NixOS and direnv. This project is not intended to be a replacement or alternative to excellent projects such as direnv, devenv, devshell, lorri etc. The flake setups up a reproducible development environment for different programming contexts, and aims to be as declarative as possible whilst allowing some flexibility.
9
+
This flake is intended to fit with my workflow, which is with [Visual Studio Code](https://code.visualstudio.com), NixOS and direnv. This project is not intended to be a replacement or alternative to excellent projects such as direnv, devenv, devshell, lorri etc. The flake creates reproducible development environments for various programming contexts, and aims to balance configurability and opinion.
10
10
11
11
12
12
## Features
13
13
14
14
- Based off `direnv`, nix flakes and `devshell` for portable, easy, reproducible development environments.
15
-
-Editor integration, with first-class support for Visual Studio Code/VSCodium (extensions permitting).
15
+
-Direct editor integration, with first-class support for Visual Studio Code/VSCodium (extensions permitting).
16
16
- Formatting support either with `treefmt-nix` or standard config files
17
17
- Configurable and extensible language support via the module system:
18
18
- Languages which allow any number of includes/extra packages are (semi)-automatically added with the creation of a file!
19
-
-`C/C++` GCC or Clang/LLVM C/C++ development environment with options for build systems, libraries and includes.
20
-
-`Python` with the option to use [uv](https://docs.astral.sh/uv/).
21
-
-`Node/JS/TS` with options for [corepack](https://github.com/nodejs/corepack), [asdf](https://asdf-vm.com/) and package manager configuration for [pnpm](https://pnpm.io/) and [yarn](https://yarnpkg.com).
22
-
-`Fortran` support with `gfortran`, enabling debugger and the `fortls` language server with [Modern Fortran](https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran).
23
-
-Reproducible LaTeX environment with support for [LTeX+](https://ltex-plus.github.io/ltex-plus/index.html).
24
-
-`Typst` with [tinymist](https://myriad-dreamin.github.io/tinymist/introduction.html)
19
+
-`C/C++` GCC or Clang/LLVM C/C++ development environment with options for build systems, libraries and includes
20
+
-`Python` with the option to use [uv](https://docs.astral.sh/uv/)
21
+
-`Node/JS/TS` with options for [corepack](https://github.com/nodejs/corepack), [asdf](https://asdf-vm.com/) and package manager configuration for [pnpm](https://pnpm.io/) and [yarn](https://yarnpkg.com)
22
+
-`Fortran` support with `gfortran`, enabling debugger and the `fortls` language server with [Modern Fortran](https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran)
23
+
- $\LaTeX$ environment with support for [LTeX+](https://ltex-plus.github.io/ltex-plus/index.html)
24
+
-`Typst` with [tinymist](https://myriad-dreamin.github.io/tinymist/introduction.html) and `typstyle`
25
25
26
26
<!-- - Setting up local `settings.json` for VSCode (WIP). -->
27
27
## Usage
@@ -30,10 +30,10 @@ To minimise clutter in projects, the majority of configuration is done inside a
30
30
31
31
0. Have `direnv` installed and that it is hooked into your shell. Have flakes enabled via some mechanism with the flag `experimental-features = nix-command flakes` e.g. in `nix.conf`.
32
32
1. Either click `Use this template` on GitHub and follow the instructions, or in a new repository, run `nix flake init -t github:chpxu/development-flake#default`.
33
-
2. In `config.nzix`, define your available programming contexts, e.g.
33
+
2. In `config.nix`, define your available programming contexts, e.g.
34
34
```nix
35
35
# config.nix
36
-
{pkgs, ...}: {
36
+
_: {
37
37
languages = {
38
38
# For each language inside nix/languages, a corresponding language.enable will exist!
39
39
python = {
@@ -79,7 +79,7 @@ The following commands are now available!
79
79
80
80
## Extending devflake
81
81
82
-
Currently, devflake supports C, C++, Fortran, JS/TS, LaTeX, Pythonand Nix. You may use other languages than these, use packages that aren't available in nixpkgs or otherwise. This flake imports `nixos-unstable` and `nixpkgs-25.05` (mainly for some older LLVM/GCC packages). Extension can be done via traditional overlays or adding files into`/nix`.
82
+
Currently, devflake supports C, C++, Fortran, JS/TS, LaTeX, Python, Typst and Nix. You may use other languages than these and/or use packages that aren't available in nixpkgs or otherwise. This flake imports `nixos-unstable` and `nixpkgs-25.05` (mainly for some older LLVM/GCC packages). Extension can be done via traditional overlays or configuring files in`/nix`.
83
83
84
84
### Overlays
85
85
Overlays are applied on top of the **unstable** nixpkgs input only. This can be done by editing the file `overlays/default.nix`, for example to modify `ripgrep`, the file could look like this:
@@ -92,7 +92,7 @@ final: prev: {
92
92
# Your other overlays ...
93
93
}
94
94
```
95
-
Note that overlays will most certainly trigger a package rebuild. If you attempting to modify a really big package, consider whether you really need to.
95
+
Note that overlays will most certainly trigger a package rebuild. If you attempting to modify a really big package, consider whether you really need to.[`flake-parts` does not recommend overlays](https://flake.parts/options/flake-parts-easyoverlay) but I have provided the basic support for those who need it.
96
96
97
97
### Including other languages
98
98
@@ -167,36 +167,6 @@ This is to stop the flake from breaking (it automatically assumes these files ex
167
167
### Non nixpkgs software
168
168
169
169
You should follow the instructions to construct a package for your software, e.g. use `pkgs.python3.pkgs.buildPythonPackage`, or `stdenv.mkDerivation`. You should then add your package into the respective language's `packages` attribute (or inside the `python3.withPackages` call for Python).
170
-
<!-- The `nix` folder structure looks something like this:
171
-
```
172
-
.
173
-
└── nix/
174
-
├── default.nix
175
-
├── languages/
176
-
│ ├── c/
177
-
│ │ ├── c.nix
178
-
│ │ └── # other c/c++ configuration files
179
-
│ ├── python/
180
-
│ │ ├── python.nix
181
-
│ │ └── # other python configuration files
182
-
│ ├── js/
183
-
│ │ ├── js.nix
184
-
│ │ └── # other js configuration files
185
-
│ └── # other languages
186
-
├── overlays/
187
-
│ └── default.nix
188
-
└── misc/
189
-
├── write_vscode_settings.nix
190
-
├── helper.nix
191
-
└── # other files
192
-
```
193
-
194
-
- `default.nix` is the file which imports and includes everything from all the other files and sets up package configuration, shellHook, vscode configuration etc. This file is then included inside `flake.nix` to be consumed by `devShells`.
195
-
- `packages/<language>` folders contain nix files that detail the relevant packages to be installed.
196
-
- `overlays` folder contains, well, any overlays you might want to use.
197
-
- For example, configuring python311 to `enableOptimisations` and disable `reproducibleBuild` for potential speedups
198
-
- `misc` folder contains any general functions written to be used across the project (`helper.nix`), and any configuration that does not directly impact the shell itself (e.g. editor settings). -->
199
-
200
170
## Editor/IDE Integration
201
171
202
172
Currently this is WIP, and my main goal is making sure this flake works well with VSCode.
@@ -231,16 +201,12 @@ STATUS: parity with stable.
231
201
232
202
Launching emacs from the directory of the project, after direnv has loaded, should hopefully make it pick up the right environment variables.
233
203
234
-
235
-
STATUS: parity with stable.
236
-
237
204
## Contributing
238
205
239
206
Thanks for viewing this repo!
240
207
241
208
I don't really use anything other than NixOS and VSCode. I do not develop on Windows or Mac (even though I've enabled support for `x86_64-darwin`, this is because I expect it to function pretty much the same). Extending the flake to cope with some other editors or platforms would be greatly appreciated and would help a bunch of others if they ever happen to come across this flake and find it useful :pray:.
242
209
243
-
244
210
To contribute, please look at [extending-devflake](#extending-devflake).
0 commit comments