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-05-15 15:35:15 +00:00
|
|
|
, nukeReferences
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cargoFlags = [ "-p" "nix-web" ];
|
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "nix-web";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.3.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "codeberg.org";
|
|
|
|
owner = "gorgon";
|
|
|
|
repo = "gorgon";
|
|
|
|
rev = "nix-web-v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-/tjcin3p+nE9Y7bhTCj7D4lpjKEFGM1bRqKE8T6igJE=";
|
|
|
|
|
|
|
|
# Various unit tests contain /nix/store/* paths. This breaks the fetcher in a very funny way:
|
|
|
|
# error: illegal path references in fixed-output derivation '/nix/store/52nmkc6v9qhdyzszlvbncndxyrcdfjn3-source.drv'
|
|
|
|
nativeBuildInputs = [ nukeReferences ];
|
|
|
|
postFetch = ''
|
|
|
|
find $out -name "*.rs" -print0 | xargs -0 nuke-refs
|
|
|
|
'';
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
cargoHash = "sha256-5pPn6APz0kdxuBdz9pgqvECTk6KhXnW/YTjxKgiuD9Q=";
|
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
|
|
|
|
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
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-05-15 15:35:15 +00:00
|
|
|
checkFlags = [
|
|
|
|
# Skip tests that rely on store paths nuked by `nuke-refs`.
|
|
|
|
"--skip=test_env_value_to_html_store_path_subpath"
|
|
|
|
"--skip=test_env_value_to_html_store_path"
|
|
|
|
];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
}
|