mirror of
https://github.com/nix-community/comma.git
synced 2024-10-26 05:58:05 +03:00
cd0f4852ea
it increases the closure size and limits the system we support in the future we can implement this better in the script
36 lines
879 B
Nix
36 lines
879 B
Nix
{ pkgs ? import <nixpkgs> { }
|
|
|
|
, stdenv ? pkgs.stdenv
|
|
, lib ? pkgs.lib
|
|
, fetchurl ? pkgs.fetchurl
|
|
, nix ? pkgs.nix
|
|
, fzy ? pkgs.fzy
|
|
, makeWrapper ? pkgs.makeWrapper
|
|
|
|
# We use this to add matchers for stuff that's not in upstream nixpkgs, but is
|
|
# in our own overlay. No fuzzy matching from multiple options here, it's just:
|
|
# Was the command `, mything`? Run `nixpkgs.mything`.
|
|
, overlayPackages ? []
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "comma";
|
|
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
installPhase = let
|
|
caseCondition = lib.concatStringsSep "|" (overlayPackages ++ [ "--placeholder--" ]);
|
|
in ''
|
|
mkdir -p $out/bin
|
|
sed -e 's/@OVERLAY_PACKAGES@/${caseCondition}/' < , > $out/bin/,
|
|
chmod +x $out/bin/,
|
|
wrapProgram $out/bin/, \
|
|
--prefix PATH : ${nix}/bin \
|
|
--prefix PATH : ${fzy}/bin
|
|
|
|
ln -s $out/bin/, $out/bin/comma
|
|
'';
|
|
}
|