add project template

This commit is contained in:
Jörg Thalheim 2021-05-29 09:19:31 +02:00
parent 1134713112
commit 5655ef0fbd
No known key found for this signature in database
GPG key ID: B3F5D81B0C6967C4
7 changed files with 85 additions and 20 deletions

View file

@ -160,31 +160,16 @@ guarantee stability after an nix upgrade.
Likewise `use_nix` the `use_flake` implementation will prevent garbage
collection of downloaded packages and also for flake inputs.
Save this file as `flake.nix`:
You can run `nix flake new -t github:nix-community/nix-direnv` to get [this](https://github.com/nix-community/nix-direnv/tree/master/template) project template.
or just add:
``` nix
{
description = "A very basic flake";
# Provides abstraction to boiler-code when specifying multi-platform outputs.
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [ pkgs.hello ];
};
});
}
```
Then add `use flake` to your `.envrc`:
```console
$ echo "use flake" >> .envrc
$ direnv allow
```
in case the project already comes with a `flake.nix`
## Storing .direnv outside the project directory
A `.direnv` directory will be created in each `use_nix` project, which might