2023-11-15 13:41:49 +00:00
|
|
|
{ lib
|
2023-12-01 18:52:36 +00:00
|
|
|
, stdenv
|
2023-11-15 13:41:49 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitea
|
|
|
|
, pkg-config
|
|
|
|
, openssl
|
2023-11-24 19:35:39 +00:00
|
|
|
, nixVersions
|
|
|
|
, nixPackage ? nixVersions.nix_2_17
|
2023-12-01 18:52:36 +00:00
|
|
|
, darwin
|
2023-11-15 13:41:49 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cargoFlags = [ "-p" "nix-web" ];
|
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "nix-web";
|
2023-11-24 19:35:39 +00:00
|
|
|
version = "0.2.0";
|
2023-11-15 13:41:49 +00:00
|
|
|
|
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "codeberg.org";
|
|
|
|
owner = "gorgon";
|
|
|
|
repo = "gorgon";
|
|
|
|
rev = "nix-web-v${version}";
|
2023-11-24 19:35:39 +00:00
|
|
|
hash = "sha256-M/0nlD2jUtvdWJ647QHrp8JcUUVYxiLJlGjnZ+cfpYU=";
|
2023-11-15 13:41:49 +00:00
|
|
|
};
|
2023-11-24 19:35:39 +00:00
|
|
|
cargoHash = "sha256-6kcpP/CFiy571B98Y96/cdcClH50gdyPLZ28Npva7B4=";
|
2023-11-15 13:41:49 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2023-12-01 18:52:36 +00:00
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin) openssl
|
|
|
|
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
2023-11-15 13:41:49 +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;
|
|
|
|
|
2023-11-24 19:35:39 +00:00
|
|
|
NIX_WEB_BUILD_NIX_CLI_PATH = "${nixPackage}/bin/nix";
|
2023-11-15 13:41:49 +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;
|
2023-12-01 18:52:36 +00:00
|
|
|
platforms = platforms.unix;
|
2023-11-15 13:41:49 +00:00
|
|
|
maintainers = with maintainers; [ embr ];
|
|
|
|
mainProgram = "nix-web";
|
|
|
|
};
|
|
|
|
}
|