-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathflake.nix
More file actions
126 lines (106 loc) · 3.71 KB
/
Copy pathflake.nix
File metadata and controls
126 lines (106 loc) · 3.71 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
# Nix flake for dtop
#
# Usage:
# nix run github:amir20/dtop # Run using pre-built binary (fast)
# nix run github:amir20/dtop#source # Run building from source
#
# UPDATING (when releasing a new version):
# ./scripts/update-nix-hashes.sh <VERSION>
{
description = "Terminal dashboard for Docker monitoring across multiple hosts";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = "0.7.11";
# Binary release configuration
platformMap = {
"x86_64-linux" = "x86_64-unknown-linux-gnu";
"aarch64-linux" = "aarch64-unknown-linux-gnu";
"x86_64-darwin" = "x86_64-apple-darwin";
"aarch64-darwin" = "aarch64-apple-darwin";
};
hashes = {
"x86_64-linux" = "sha256-Qk/QI+/1dhmPQu1V1m3tuXe8fks2y2R3IZH/nYi1zzo=";
"aarch64-linux" = "sha256-F9Y8hRYnwX+iqiShcGnQodFaJE4oGCqrb21UWtmx914=";
"x86_64-darwin" = "sha256-p0RQZi3qVZ9XV9VUIhyUb43QUhnSC238l2fPf1ck744=";
"aarch64-darwin" = "sha256-BqFmfa2JJ0MZcTNI4BieGnPzlxAsB29n4nfI0UYm5Jk=";
};
platform = platformMap.${system} or (throw "Unsupported system: ${system}");
meta = {
description = "Terminal dashboard for Docker monitoring across multiple hosts with Dozzle integration";
homepage = "https://github.com/amir20/dtop";
changelog = "https://github.com/amir20/dtop/blob/main/CHANGELOG.md";
license = pkgs.lib.licenses.mit;
mainProgram = "dtop";
platforms = pkgs.lib.platforms.unix;
};
in
{
packages = {
# Default: pre-built binary (fast install)
default = pkgs.stdenv.mkDerivation {
pname = "dtop";
inherit version meta;
src = pkgs.fetchurl {
url = "https://github.com/amir20/dtop/releases/download/v${version}/dtop-${platform}.tar.gz";
hash = hashes.${system};
};
sourceRoot = "dtop-${platform}";
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.autoPatchelfHook
];
buildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.openssl
pkgs.stdenv.cc.cc.lib
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
install -Dm755 dtop $out/bin/dtop
runHook postInstall
'';
};
# Build from source
source = pkgs.rustPlatform.buildRustPackage {
pname = "dtop";
inherit version meta;
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [
pkgs.openssl
]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
# Disable auto update
buildNoDefaultFeatures = true;
};
};
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.source ];
packages = with pkgs; [
cargo
rustc
rust-analyzer
clippy
rustfmt
];
};
formatter = pkgs.nixfmt-tree;
}
);
}