forked from Xe/pronouns
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
83 lines (71 loc) · 2.09 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
Xess = {
url = "github:Xe/Xess";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "utils";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, utils, naersk, nixpkgs, Xess }:
utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) { inherit system; };
naersk' = pkgs.callPackage naersk { };
xess = Xess.packages.${system}.default;
in rec {
# For `nix build` & `nix run`:
packages = rec {
bin = naersk'.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [ pkg-config openssl ];
XESS_PATH = "${xess}/static/css";
};
data = pkgs.stdenv.mkDerivation {
pname = "pronouns-data";
inherit (bin) version;
src = ./dhall;
nativeBuildInputs = with pkgs; [ dhall ];
phases = "installPhase";
installPhase = ''
mkdir -p $out/dhall
dhall resolve --file $src/package.dhall >> $out/dhall/package.dhall
'';
};
default = pkgs.symlinkJoin {
name = "pronouns-${bin.version}";
paths = [ bin data ];
};
docker = pkgs.dockerTools.buildLayeredImage {
name = "registry.fly.io/xe-pronouns";
tag = "latest";
contents = [ default ];
config = {
Cmd = [ "${bin}/bin/pronouns" ];
WorkingDir = default;
};
};
};
# For `nix develop`:
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
rust-analyzer
rustfmt
python3
pkg-config
openssl
dhall
flyctl
terraform
];
XESS_PATH = "${xess}/static/css";
};
});
}