4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
52 lines
1.6 KiB
Nix
52 lines
1.6 KiB
Nix
{ lib, pkgs, stdenv, fetchFromGitHub, mypy, python3, nix, git, makeWrapper
|
|
, runtimeShell }:
|
|
let self = stdenv.mkDerivation rec {
|
|
pname = "nix-pin";
|
|
version = "0.4.0";
|
|
src = fetchFromGitHub {
|
|
owner = "timbertson";
|
|
repo = "nix-pin";
|
|
rev = "version-${version}";
|
|
sha256 = "1pccvc0iqapms7kidrh09g5fdx44x622r5l9k7bkmssp3v4c68vy";
|
|
};
|
|
buildInputs = [ python3 mypy makeWrapper ];
|
|
checkPhase = ''
|
|
mypy bin/*
|
|
'';
|
|
installPhase = ''
|
|
mkdir "$out"
|
|
cp -r bin share "$out"
|
|
wrapProgram $out/bin/nix-pin \
|
|
--prefix PATH : "${lib.makeBinPath [ nix git ]}"
|
|
'';
|
|
passthru =
|
|
let
|
|
defaults = import "${self}/share/nix/defaults.nix";
|
|
in {
|
|
api = { pinConfig ? defaults.pinConfig }:
|
|
let impl = import "${self}/share/nix/api.nix" { inherit pkgs pinConfig; }; in
|
|
{ inherit (impl) augmentedPkgs pins callPackage; };
|
|
updateScript = ''
|
|
#!${runtimeShell}
|
|
set -e
|
|
echo
|
|
cd ${toString ./.}
|
|
${pkgs.nix-update-source}/bin/nix-update-source \
|
|
--prompt version \
|
|
--replace-attr version \
|
|
--set owner timbertson \
|
|
--set repo nix-pin \
|
|
--set type fetchFromGitHub \
|
|
--set rev 'version-{version}' \
|
|
--substitute rev 'version-''${{version}}' \
|
|
--modify-nix default.nix
|
|
'';
|
|
};
|
|
meta = with lib; {
|
|
homepage = "https://github.com/timbertson/nix-pin";
|
|
description = "nixpkgs development utility";
|
|
license = licenses.mit;
|
|
maintainers = [ maintainers.timbertson ];
|
|
platforms = platforms.all;
|
|
};
|
|
}; in self
|