-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
77 lines (76 loc) · 1.95 KB
/
flake.nix
File metadata and controls
77 lines (76 loc) · 1.95 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
};
outputs = {
self,
nixpkgs,
crane,
...
}: (
builtins.foldl' (acc: elem: nixpkgs.lib.recursiveUpdate acc elem) {} (
builtins.map (
system: let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
in {
packages.${system} = rec {
hayabusa = craneLib.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [
pkg-config
openssl
];
meta = {
homepage = "https://github.com/Notarin/hayabusa/";
description = "Hayabusa is a swift rust fetch program.";
mainProgram = "hayabusa";
};
};
default = hayabusa;
};
devShells.${system}.default = craneLib.devShell {
packages = with pkgs; [
pkg-config
openssl
];
};
}
)
[
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
]
)
// {
nixosModules.default = {
pkgs,
lib,
config,
...
}: {
options = {
services.hayabusa = {
enable = lib.mkEnableOption "Enable the hayabusa system info daemon";
};
};
config = lib.mkIf config.services.hayabusa.enable {
systemd.services.hayabusa = {
after = ["network.target"];
wants = ["network-online.target"];
wantedBy = ["multi-user.target"];
serviceConfig = {
Restart = "always";
Type = "simple";
ExecStart = "${lib.getExe self.packages.${config._module.args.pkgs.stdenv.system}.default} -d";
};
};
};
};
}
);
}