aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: e4ba8dd0b8d03f7bf9953f2e8f1341861128f8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# flaky-utils

Additional Nix Flake utility functions for personal convenience (mainly
reducing boilerplate).

No promise on API stability.


## Usage

Functions documentation provided as comments below.

```nix
{
  description = "Example of a Flake using flaky-utils.";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
    flake-utils.url = "github:numtide/flake-utils";
    flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils";
  };

  outputs = { self, nixpkgs, flake-utils, flaky-utils }:
  flake-utils.lib.eachDefaultSystem (system: let
    pkgs = import nixpkgs { inherit system; };
  in {

    # Convenience development shell providing some tools.
    #
    # The binaries made available and the environment variable set are printed
    # when entering the shell.
    #
    # The user's default shell is used instead of Bash (sacrifying a bit of
    # reproducibility for convenience).
    #
    devShell = flaky-utils.lib.mkDevShell {
      inherit pkgs;

      tools = with pkgs; [
        postgresql_14
        pgcli
      ];

      envVars = rec {
        PGDATA = "$PWD/development_database/pgdata";
        PGHOST = "$PWD/development_database";
        PGPORT = "5432";
        PGDATABASE = "app";
        DATABASE_URL = "postgresql:///${PGDATABASE}?host=${PGHOST}";
      };

      shell = null;
    };

  });
}
```


## Contributing

Issues and patches: email the author.


## Licence and copyright

Copyright (C) 2022 Pacien TRAN-GIRARD.

This project is distributed under the terms of European Union Public Licence
version 1.2, a copy of which is provided in `./licence.txt`.