mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
54 lines
1.4 KiB
Nix
54 lines
1.4 KiB
Nix
{ lib
|
|
, stdenv
|
|
, rustPlatform
|
|
, fetchFromGitea
|
|
, pkg-config
|
|
, openssl
|
|
, nixVersions
|
|
, nixPackage ? nixVersions.nix_2_18
|
|
, darwin
|
|
}:
|
|
|
|
let
|
|
cargoFlags = [ "-p" "nix-web" ];
|
|
in
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "nix-web";
|
|
version = "0.4.2";
|
|
|
|
src = fetchFromGitea {
|
|
domain = "codeberg.org";
|
|
owner = "gorgon";
|
|
repo = "gorgon";
|
|
rev = "nix-web-v${version}";
|
|
hash = "sha256-lAk2VfhclHswsctA0RQgEj5oEX1fowh8TCaKykGEioY=";
|
|
};
|
|
cargoHash = "sha256-romL/RALr/pmwUA8/SN4AOwc+Vndspd1Yrqs0AHPYRY=";
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = lib.optional (!stdenv.hostPlatform.isDarwin) openssl
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration ]);
|
|
|
|
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;
|
|
|
|
NIX_WEB_BUILD_NIX_CLI_PATH = "${nixPackage}/bin/nix";
|
|
|
|
meta = with lib; {
|
|
description = "Web interface for the Nix store";
|
|
homepage = "https://codeberg.org/gorgon/gorgon/src/branch/main/nix-web";
|
|
license = licenses.eupl12;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ embr ];
|
|
mainProgram = "nix-web";
|
|
};
|
|
}
|