-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerimage.nix
58 lines (50 loc) · 1.44 KB
/
dockerimage.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
let
config = {
packageOverrides = pkgs: rec {
haskellPackages = pkgs.haskellPackages.override {
overrides = haskellPackagesNew: haskellPackagesOld: rec {
matrix-gitlab-bot = haskellPackagesNew.callCabal2nix "matrix-gitlab" ./. {};
};
};
};
};
bootstrap = import <nixpkgs> { };
nixpkgs = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
src = bootstrap.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs-channels";
inherit (nixpkgs) rev sha256;
};
pkgs = import src { inherit config; };
# We need this "mess" in order to get a minimal base image containing /etc/services, /etc/protocols
# and maybe even certificates. http(s) is hard.
# See https://github.com/NixOS/nixpkgs/issues/18038
minimalDocker = {
imports = [ "${src}/nixos/modules/profiles/minimal.nix" ];
boot.isContainer = true;
};
eval = import "${src}/nixos/lib/eval-config.nix" {
modules = [
minimalDocker
];
};
system = eval.config.system;
in
pkgs.dockerTools.buildImage {
name = "matrix-gitlab-bot";
tag = "latest";
contents = pkgs.symlinkJoin {
name = "matrix-gitlab-bot-contents";
paths = [
(pkgs.haskell.lib.justStaticExecutables pkgs.haskellPackages.matrix-gitlab-bot)
system.build.etc
system.path
];
};
config = {
Cmd = [ "matrix-gitlab-exe" ];
Volumes = {
"/etc/matrix-bot" = {};
};
};
}