mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-13 09:13:17 +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" ```
60 lines
1.4 KiB
Nix
60 lines
1.4 KiB
Nix
{ lib, stdenv
|
|
, rustPlatform
|
|
, fetchCrate
|
|
, fetchFromGitHub
|
|
, openssl
|
|
, pkg-config
|
|
, Security
|
|
, SystemConfiguration
|
|
, IOKit
|
|
, installShellFiles
|
|
, nix
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "nixci";
|
|
version = "1.0.0";
|
|
|
|
src = fetchCrate {
|
|
inherit version;
|
|
pname = "nixci";
|
|
hash = "sha256-49I09hXYoVo6vzv1b6mkeiFwzfj6g1SkXTL/tCEdOYc=";
|
|
};
|
|
|
|
cargoHash = "sha256-trmWeYJNev7jYJtGp9XR/emmQiiI94NM0cPFrAuD7m0=";
|
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles nix ];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
|
openssl
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
IOKit
|
|
Security
|
|
SystemConfiguration
|
|
];
|
|
|
|
postInstall = ''
|
|
installShellCompletion --cmd nixci \
|
|
--bash <($out/bin/nixci completion bash) \
|
|
--fish <($out/bin/nixci completion fish) \
|
|
--zsh <($out/bin/nixci completion zsh)
|
|
'';
|
|
|
|
# The rust program expects an environment (at build time) that points to the
|
|
# devour-flake flake.
|
|
env.DEVOUR_FLAKE = fetchFromGitHub {
|
|
owner = "srid";
|
|
repo = "devour-flake";
|
|
rev = "v4";
|
|
hash = "sha256-Vey9n9hIlWiSAZ6CCTpkrL6jt4r2JvT2ik9wa2bjeC0=";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Define and build CI for Nix projects anywhere";
|
|
homepage = "https://github.com/srid/nixci";
|
|
license = licenses.agpl3Only;
|
|
maintainers = with maintainers; [ srid shivaraj-bh rsrohitsingh682 ];
|
|
mainProgram = "nixci";
|
|
};
|
|
}
|