-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
137 lines (124 loc) · 3.98 KB
/
Copy pathflake.nix
File metadata and controls
137 lines (124 loc) · 3.98 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
{
nixConfig = {
flake-registry = "https://github.com/serokell/flake-registry/raw/master/flake-registry.json";
};
inputs = {
flake-compat.flake = false;
naersk.url = "github:nix-community/naersk";
nix.url = "github:nixos/nix?ref=2.32.4";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, serokell-nix, naersk, rust-overlay, ... }@inputs:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
serokell-nix.overlay
rust-overlay.overlays.default
];
};
rustChannel = (pkgs.rust-bin.fromRustupToolchain { channel = "1.77.1"; }).override({
extensions = [
"clippy"
"rust-analysis"
"rust-analyzer"
"rust-docs"
"rust-src"
"rustfmt"
];
});
naersk' = pkgs.callPackage naersk {
rustc = rustChannel;
cargo = rustChannel;
};
nix = inputs.nix.packages.${system}.nix;
update-daemon = naersk'.buildPackage {
src = builtins.path {
path = ./.;
name = "update-daemon-src";
};
nativeBuildInputs = [
pkgs.pkg-config
pkgs.makeWrapper
];
buildInputs = [
pkgs.openssl
pkgs.libgit2
pkgs.libgpg-error
pkgs.gpgme
];
postInstall =
"wrapProgram $out/bin/update-daemon --prefix PATH : ${
pkgs.lib.makeBinPath [ nix pkgs.gitMinimal ]
}";
cargoTestCommands = x: x ++ [
# pedantic clippy
''cargo clippy --all --all-features --tests -- \
-D clippy::pedantic \
-D warnings \
-A clippy::module-name-repetitions \
-A clippy::too-many-lines \
-A clippy::cast-possible-wrap \
-A clippy::cast-possible-truncation \
-A clippy::nonminimal_bool''
];
};
in {
packages = {
inherit update-daemon;
default = update-daemon;
};
checks = {
trailing-whitespace = pkgs.build.checkTrailingWhitespace ./.;
reuse-lint = pkgs.build.reuseLint ./.;
inherit update-daemon;
};
devShells.default = pkgs.mkShell {
#RUST_LOG = "trace";
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; [
rustChannel
nix
openssl
pkg-config
reuse
libgit2
];
};
}) // {
nixosModules.update-daemon = import ./module.nix self;
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.update-daemon
({ config, pkgs, lib, ... }: {
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
boot.isContainer = true;
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [ 80 ];
networking.hostName = "update-daemon";
services.update-daemon = {
enable = true;
secretFile = "/run/secrets/update-daemon/environment";
package = self.packages.x86_64-linux.update-daemon;
repos = {
github.serokell.update-daemon = { };
gitlab."tezosagora/agora" = { };
};
settings = {
author.email = "operations@serokell.io";
author.name = "Update Bot";
};
};
})
];
};
};
}