-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrelease.nix
69 lines (62 loc) · 1.66 KB
/
release.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
(builtins.mapAttrs (system: _: (import ./. { inherit system; }).hydra-pay)
{ "x86_64-linux" = null;
})
//
(let
self = import ./. {};
obelisk = import ./.obelisk/impl {
system = builtins.currentSystem;
};
nixpkgs = obelisk.nixpkgs;
pkgs = import <nixpkgs> {};
configs = pkgs.stdenv.mkDerivation
{
name = "configs";
src = ./config;
installPhase = ''
mkdir -p $out
cp -r * $out
'';
};
in
{
dockerImage = args@{ version ? "latest", name ? "obsidiansys/hydra-pay" }:
pkgs.dockerTools.buildImage ({
name = name;
tag = version;
keepContentsDirlinks = true;
copyToRoot = pkgs.buildEnv {
name = "root";
paths = [ self.hydra-pay nixpkgs.bashInteractive nixpkgs.iana-etc
nixpkgs.cacert];
pathsToLink = [ "/bin" ];
};
runAsRoot = ''
#!${nixpkgs.runtimeShell}
${nixpkgs.dockerTools.shadowSetup}
mkdir -p hydra-pay/config
ln -sft /hydra-pay/config '${configs}'/*
groupadd -r hydra-pay
useradd -r -g hydra-pay hydra-pay
chown -R hydra-pay:hydra-pay /hydra-pay
'';
config = {
Env = [
("PATH=" + builtins.concatStringsSep(":")(
[
"/hydrapay"
"/bin"
]
++
map (pkg: "${pkg}/bin") nixpkgs.stdenv.initialPath # put common tools in path so docker exec is useful
))
"LANG=C.UTF-8"
"NETWORK=preprod"
];
Cmd = [ "sh" "-c" "/bin/hydra-pay instance $NETWORK" ];
WorkingDir = "/hydra-pay";
Expose = 8010;
User = "hydra-pay:hydra-pay";
};
});
})