-
-
Save boomshroom/74a1beaf5e66abfdc10882a2fb6e2930 to your computer and use it in GitHub Desktop.
User options for Nix derivation?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ fetchurl, stdenv, perl | |
, iproute, acpi, sysstat, xset, playerctl | |
, cmus, openvpn, lm_sensors, alsaUtils | |
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface" | |
"keyindicator" "load_average" "mediaplayer" "memory" | |
"openvpn" "temperature" "volume" "wifi" ] | |
}: | |
with stdenv.lib; | |
let | |
perlscripts = [ "battery" "cpu_usage" "keyindicator" | |
"mediaplayer" "openvpn" "temperature" ]; | |
contains_any = l1: l2: 0 < length( intersectLists l1 l2 ); | |
in | |
stdenv.mkDerivation rec { | |
name = "i3blocks-${version}"; | |
version = "1.4"; | |
src = fetchurl { | |
url = "https://github.com/vivien/i3blocks/releases/download/${version}/${name}.tar.gz"; | |
sha256 = "c64720057e22cc7cac5e8fcd58fd37e75be3a7d5a3cb8995841a7f18d30c0536"; | |
}; | |
buildFlags = "SYSCONFDIR=/etc all"; | |
installFlags = "PREFIX=\${out} VERSION=${version}"; | |
buildInputs = | |
optional (contains_any (builtins.trace scripts scripts) perlscripts) perl | |
++ optional ((elem "bandwidth" scripts) | |
|| (elem "iface" scripts)) iproute | |
++ optional (elem "battery" scripts) acpi | |
++ optional (elem "cpu_usage" scripts) sysstat | |
++ optional (elem "iface" scripts) iproute | |
++ optional (elem "keyindicator" scripts) xset | |
++ optionals (elem "mediaplayer" scripts) [playerctl cmus] | |
++ optional (elem "openvpn" scripts) openvpn | |
++ optional (elem "temperature" scripts) lm_sensors | |
++ optional (elem "volume" scripts) alsaUtils; | |
meta = { | |
description = "A flexible scheduler for your i3bar blocks"; | |
homepage = https://github.com/vivien/i3blocks; | |
license = licenses.gpl3; | |
platforms = with platforms; freebsd ++ linux; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
allowUnfree = true; | |
packageOverrides = pkgs: { | |
trimmedi3blocks = pkgs.i3blocks.override { | |
scripts = [ | |
"bandwidth" | |
"cpu_usage" | |
"disk" | |
"iface" | |
"memory" | |
"temperature" | |
"volume" | |
]; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment