This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
flake.nix
69 lines (62 loc) · 1.94 KB
/
flake.nix
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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
utils.url = "github:yatima-inc/nix-utils";
utils.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs =
{ self
, nixpkgs
, utils
, pre-commit-hooks
}:
let
flake-utils = utils.inputs.flake-utils;
in
flake-utils.lib.eachDefaultSystem (system:
let
pre-commit = import pre-commit-hooks { inherit system; };
lib = utils.lib.${system};
pkgs = import nixpkgs { inherit system; };
inherit (lib) getRust buildRustProject testRustProject rustDefault filterRustProject naerskDefault;
rust = getRust { date = "2021-08-24"; sha256 = "30dHH53OlZt6h2OJxeVJ8IokaQrSaV7aGfhUiv2HU0Q="; };
naersk = naerskDefault;
crateName = "yatima";
src = ./.;
yatima-nix = import ./yatima.nix;
project = yatima-nix {
inherit naersk rust src system;
nixpkgs = pkgs;
};
devTools = import ./nix/devTools.nix {
inherit rust;
pre-commit-hooks = pre-commit;
nixpkgs = pkgs;
};
web = import ./web/default.nix { nixpkgs = pkgs; inherit system; buildInputs = [ project ]; };
in
{
packages.${crateName} = project;
packages."yatima-web" = web;
defaultPackage = self.packages.${system}.${crateName};
# nix flake check
checks.${crateName} = yatima-nix {
inherit naersk rust src system;
nixpkgs = pkgs;
doCheck = true;
};
# `nix run`
apps.${crateName} = flake-utils.lib.mkApp {
name = "yatima";
drv = self.packages.${system}.${crateName};
};
defaultApp = self.apps.${system}.${crateName};
# `nix develop`
devShell = pkgs.mkShell {
inherit system;
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = [ rust ] ++ builtins.attrValues devTools;
};
});
}