2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
2024-01-13 08:15:51 +00:00
|
|
|
, stdenv
|
2024-01-02 11:29:13 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitea
|
|
|
|
, pkg-config
|
|
|
|
, openssl
|
2024-01-13 08:15:51 +00:00
|
|
|
, nixVersions
|
2024-05-15 15:35:15 +00:00
|
|
|
, nixPackage ? nixVersions.nix_2_18
|
2024-01-13 08:15:51 +00:00
|
|
|
, darwin
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cargoFlags = [ "-p" "nix-web" ];
|
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "nix-web";
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "0.4.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "codeberg.org";
|
|
|
|
owner = "gorgon";
|
|
|
|
repo = "gorgon";
|
|
|
|
rev = "nix-web-v${version}";
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-lAk2VfhclHswsctA0RQgEj5oEX1fowh8TCaKykGEioY=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
2024-06-24 18:47:55 +00:00
|
|
|
cargoHash = "sha256-romL/RALr/pmwUA8/SN4AOwc+Vndspd1Yrqs0AHPYRY=";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2024-01-13 08:15:51 +00:00
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin) openssl
|
2024-06-24 18:47:55 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration ]);
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace nix-web/nix-web.service \
|
|
|
|
--replace 'ExecStart=nix-web' "ExecStart=$out/bin/nix-web"
|
|
|
|
'';
|
|
|
|
postInstall = ''
|
|
|
|
install -m 644 -D nix-web/nix-web.service $out/lib/systemd/system/nix-web.service
|
|
|
|
'';
|
|
|
|
|
|
|
|
cargoBuildFlags = cargoFlags;
|
|
|
|
cargoTestFlags = cargoFlags;
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
NIX_WEB_BUILD_NIX_CLI_PATH = "${nixPackage}/bin/nix";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Web interface for the Nix store";
|
|
|
|
homepage = "https://codeberg.org/gorgon/gorgon/src/branch/main/nix-web";
|
|
|
|
license = licenses.eupl12;
|
2024-01-13 08:15:51 +00:00
|
|
|
platforms = platforms.unix;
|
2024-01-02 11:29:13 +00:00
|
|
|
maintainers = with maintainers; [ embr ];
|
|
|
|
mainProgram = "nix-web";
|
|
|
|
};
|
|
|
|
}
|