-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
82 lines (71 loc) · 2.44 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
{
description = "Hackage search";
inputs = {
serokell-nix.url = "github:serokell/serokell.nix";
nixpkgs.follows = "serokell-nix/nixpkgs";
serokell-website.url = "git+ssh://[email protected]/serokell/serokell-website";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
servant-prometheus = {
url = "github:serokell/servant-prometheus";
flake = false;
};
};
outputs = { self, nixpkgs, serokell-nix, flake-utils, deploy-rs, servant-prometheus, ... }@inputs:
let
inherit (nixpkgs.lib) recursiveUpdate makeLibraryPath;
inherit (builtins) mapAttrs;
in
recursiveUpdate (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend serokell-nix.overlay;
p = import ./package.nix { inherit pkgs; servant-prometheus = import servant-prometheus { nixpkgs = pkgs; }; };
in {
defaultPackage = self.packages.${system}.hackage-search;
packages.hackage-search = pkgs.buildEnv {
name = "hackage-search-release";
paths = [
p.frontend
p.download
p.search
inputs.serokell-website.packages.x86_64-linux.fonts
];
};
devShell = pkgs.mkShell rec {
buildInputs = [
pkgs.nixUnstable
] ++ p.shellExtraInputs;
shellHook = ''
export LD_LIBRARY_PATH=${makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
export LANG=en_US.UTF-8
'';
LOCALE_ARCHIVE =
if pkgs.stdenv.isLinux
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
};
}))
{
module = import ./service.nix;
# Deployment expressions
deploy.magicRollback = false;
deploy.nodes.sadalbari = let
system = "x86_64-linux";
in {
hostname = "sadalbari.pegasus.serokell.team";
sshOpts = [ "-p" "17788" ];
profiles.hackage-search = {
sshUser = "deploy";
path = deploy-rs.lib.${system}.activate.custom
self.packages.${system}.hackage-search
"sudo systemctl restart hackage-search";
};
};
checks = mapAttrs (_: lib: lib.deployChecks self.deploy) deploy-rs.lib;
};
}