-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
69 lines (58 loc) · 1.92 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
{
description = "Bepitone";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.deploy-rs.url = "github:serokell/deploy-rs";
outputs = { self, nixpkgs, deploy-rs }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
bepitone_api = with pkgs; rustPlatform.buildRustPackage {
pname = "bepitone_api";
version = "1.0.0";
src = ./.;
cargoBuildFlags = [ "--workspace" ];
cargoHash = "sha256-9t4VKMPbq0l7vk2Ku4JNb9GoVSYR6K2XgimGgCCoh+E=";
};
in {
nixosConfigurations.bepitone = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({modulesPath, ...}: {
imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
networking.firewall.allowedTCPPorts = [ 80 ];
systemd.services.bepitone = {
description = "bep";
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
serviceConfig = {
ExecStart = "${bepitone_api}/bin/bepitone_api";
Restart = "on-failure";
};
};
systemd.services.bepitone_discord = {
description = "bep discord bot";
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
serviceConfig = {
ExecStart = "${bepitone_api}/bin/bepitone_discord";
Restart = "on-failure";
};
};
environment.systemPackages = with pkgs; [
sqlite-interactive
cloud-utils
];
})
];
inherit pkgs;
};
deploy.nodes.bepitone-ec2 = {
hostname = "bep";
profiles.main = {
sshUser = "root";
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.bepitone;
};
};
packages.x86_64-linux.bepitone_api = bepitone_api;
};
}