comma/default.nix
Artturin cd0f4852ea remove prebuilt cache
it increases the closure size and limits the system we support
in the future we can implement this better in the script
2022-04-15 15:07:30 +03:00

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
'';
}