Skip to content

Instantly share code, notes, and snippets.

@sheenobu
Last active February 18, 2017 14:11
Show Gist options
  • Save sheenobu/0cbd2ff121a61ca7c5496c26ec30b5af to your computer and use it in GitHub Desktop.
Save sheenobu/0cbd2ff121a61ca7c5496c26ec30b5af to your computer and use it in GitHub Desktop.
[BAD, don't do this] wrapBinary for wrapping chromium with additional flags (not sure if i like this yet)
with import <nixpkgs> {};
let
# wrapBinary builds a new derivation that wraps the given package and binary file with makeWrapper,
# using the given params. Supports wrapping a binary without forcing a recompilation.
# * name - Package name
# * package - The package we are wrapping
# * binary - Binary the binary name within $package/bin/$binary
# * params - The parameters passed to makeWrapper
wrapBinary = { name, package, binary, params }: stdenv.mkDerivation {
inherit name;
src = pkgs.writeText "src" ''
'';
phases = [ "installPhase" ];
buildInputs = [ package pkgs.makeWrapper ];
installPhase = '' makeWrapper ${package}/bin/${binary} $out/bin/${binary} ${params} '';
};
in
{
packageOverrides = pkgs: {
chromium_dpi = wrapBinary {
name = "chromium-dpi";
package = pkgs.chromium;
binary = "chromium";
params = ''--add-flags "--force-device-scale-factor=1"'';
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment