uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,21 @@
{lib, stdenv, fetchurl}:
stdenv.mkDerivation rec {
pname = "915resolution";
version = "0.5.3";
src = fetchurl {
url = "http://915resolution.mango-lang.org/915resolution-${version}.tar.gz";
sha256 = "0hmmy4kkz3x6yigz6hk99416ybznd67dpjaxap50nhay9f1snk5n";
};
patchPhase = "rm *.o";
installPhase = "mkdir -p $out/sbin; cp 915resolution $out/sbin/";
meta = with lib; {
homepage = "http://915resolution.mango-lang.org/";
description = "A tool to modify Intel 800/900 video BIOS";
platforms = [ "i686-linux" "x86_64-linux" ];
license = licenses.publicDomain;
};
}

View file

@ -0,0 +1,35 @@
{ lib, stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
pname = "acpi-call";
version = "1.2.2";
name = "${pname}-${version}-${kernel.version}";
src = fetchFromGitHub {
owner = "nix-community";
repo = "acpi_call";
rev = "v${version}";
sha256 = "1s7h9y3adyfhw7cjldlfmid79lrwz3vqlvziw9nwd6x5qdj4w9vp";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
install -D acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc/acpi_call.ko
install -D -m755 examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
'';
meta = with lib; {
maintainers = with maintainers; [ raskin mic92 ];
homepage = "https://github.com/nix-community/acpi_call";
platforms = platforms.linux;
description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
license = licenses.gpl3Plus;
};
}

View file

@ -0,0 +1,25 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "acpi";
version = "1.7";
src = fetchurl {
url = "mirror://sourceforge/acpiclient/${version}/${pname}-${version}.tar.gz";
sha256 = "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp";
};
meta = with lib; {
description = "Show battery status and other ACPI information";
longDescription = ''
Linux ACPI client is a small command-line
program that attempts to replicate the functionality of
the "old" `apm' command on ACPI systems. It includes
battery and thermal information.
'';
homepage = "https://sourceforge.net/projects/acpiclient/";
license = lib.licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [ ];
};
}

View file

@ -0,0 +1,20 @@
{ lib, stdenv, fetchurl, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "acpid";
version = "2.0.33";
src = fetchurl {
url = "mirror://sourceforge/acpid2/acpid-${version}.tar.xz";
sha256 = "sha256-CFb3Gz6zShtmPQqOY2Pfy8UZ5j2EczBJiJhljily2+g=";
};
nativeBuildInputs = [ autoreconfHook ];
meta = with lib; {
homepage = "https://sourceforge.net/projects/acpid2/";
description = "A daemon for delivering ACPI events to userspace programs";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,52 @@
{lib, stdenv, fetchurl, fetchpatch}:
let
acpitool-patch-051-4 = params: fetchpatch rec {
inherit (params) name sha256;
url = "https://salsa.debian.org/debian/acpitool/raw/33e2ef42a663de820457b212ea2925e506df3b88/debian/patches/${name}";
};
in stdenv.mkDerivation rec {
pname = "acpitool";
version = "0.5.1";
src = fetchurl {
url = "mirror://sourceforge/acpitool/acpitool-${version}.tar.bz2";
sha256 = "004fb6cd43102918b6302cf537a2db7ceadda04aef2e0906ddf230f820dad34f";
};
patches = [
(acpitool-patch-051-4 {
name = "ac_adapter.patch";
sha256 = "0rn14vfv9x5gmwyvi6bha5m0n0pm4wbpg6h8kagmy3i1f8lkcfi8";
})
(acpitool-patch-051-4 {
name = "battery.patch";
sha256 = "190msm5cgqgammxp1j4dycfz206mggajm5904r7ifngkcwizh9m7";
})
(acpitool-patch-051-4 {
name = "kernel3.patch";
sha256 = "1qb47iqnv09i7kgqkyk9prr0pvlx0yaip8idz6wc03wci4y4bffg";
})
(acpitool-patch-051-4 {
name = "wakeup.patch";
sha256 = "1mmzf8n4zsvc7ngn51map2v42axm9vaf8yknbd5amq148sjf027z";
})
(acpitool-patch-051-4 {
name = "0001-Do-not-assume-fixed-line-lengths-for-proc-acpi-wakeu.patch";
sha256 = "10wwh7l3jbmlpa80fzdr18nscahrg5krl18pqwy77f7683mg937m";
})
(acpitool-patch-051-4 {
name = "typos.patch";
sha256 = "1178fqpk6sbqp1cyb1zf9qv7ahpd3pidgpid3bbpms7gyhqvvdpa";
})
];
meta = {
description = "A small, convenient command-line ACPI client with a lot of features";
homepage = "https://sourceforge.net/projects/acpitool/";
license = lib.licenses.gpl2Plus;
maintainers = [ lib.maintainers.guibert ];
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, fuse }:
stdenv.mkDerivation rec {
pname = "afuse";
version = "0.4.1";
src = fetchFromGitHub {
owner = "pcarrier";
repo = "afuse";
rev = "v${version}";
sha256 = "06i855h8a1w2jfly2gfy7vwhb2fp74yxbf3r69s28lki2kzwjar6";
};
nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = [ fuse ];
postPatch = lib.optionalString stdenv.isDarwin ''
# Fix the build on macOS with macFUSE installed
substituteInPlace configure.ac --replace \
'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH' \
""
'';
meta = {
description = "Automounter in userspace";
homepage = "https://github.com/pcarrier/afuse";
license = lib.licenses.gpl2;
maintainers = [ lib.maintainers.marcweber ];
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
pname = "akvcam";
version = "1.2.2";
src = fetchFromGitHub {
owner = "webcamoid";
repo = "akvcam";
rev = version;
sha256 = "1f0vjia2d7zj3y5c63lx1r537bdjx6821yxy29ilbrvsbjq2szj8";
};
sourceRoot = "source/src";
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
install -m644 -b -D akvcam.ko $out/lib/modules/${kernel.modDirVersion}/akvcam.ko
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Virtual camera driver for Linux";
homepage = "https://github.com/webcamoid/akvcam";
maintainers = with maintainers; [ freezeboy ];
platforms = platforms.linux;
license = licenses.gpl2Only;
broken = kernel.kernelAtLeast "5.18";
};
}

View file

@ -0,0 +1,38 @@
{ lib, buildPackages, stdenv, autoreconfHook, fetchurl }:
stdenv.mkDerivation rec {
pname = "alsa-firmware";
version = "1.2.4";
src = fetchurl {
url = "mirror://alsa/firmware/alsa-firmware-${version}.tar.bz2";
sha256 = "sha256-tnttfQi8/CR+9v8KuIqZwYgwWjz1euLf0LzZpbNs1bs=";
};
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ autoreconfHook ];
configureFlags = [
"--with-hotplug-dir=$(out)/lib/firmware"
];
dontStrip = true;
postInstall = ''
# These are lifted from the Arch PKGBUILD
# remove files which conflicts with linux-firmware
rm -rf $out/lib/firmware/{ct{efx,speq}.bin,ess,korg,sb16,yamaha}
# remove broken symlinks (broken upstream)
rm -rf $out/lib/firmware/turtlebeach
# remove empty dir
rm -rf $out/bin
'';
meta = with lib; {
homepage = "http://www.alsa-project.org/";
description = "Soundcard firmwares from the alsa project";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ l-as ];
};
}

View file

@ -0,0 +1,232 @@
diff --git a/src/control/control.c b/src/control/control.c
index d66ed75..42cecad 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -838,6 +838,10 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
#ifndef PIC
extern void *snd_control_open_symbols(void);
#endif
+
+ snd_config_t *libs = NULL;
+ const char *libs_lib = NULL;
+
if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
SNDERR("Invalid type for CTL %s definition", name);
@@ -879,6 +883,19 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
SNDERR("Invalid type for %s", id);
goto _err;
}
+
+ continue;
+ }
+ // Handle an array of extra libs.
+ if (strcmp(id, "libs") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for libs definition in CTL %s definition",
+ str);
+ goto _err;
+ }
+
+ libs = n;
+
continue;
}
if (strcmp(id, "open") == 0) {
@@ -903,7 +920,62 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
open_name = buf;
sprintf(buf, "_snd_ctl_%s_open", str);
}
- if (!lib) {
+
+#ifndef PIC
+ snd_control_open_symbols();
+#endif
+
+ // Normal alsa behaviour when there is no libs array.
+ if (!libs) {
+ if (lib) {
+ open_func = snd_dlobj_cache_get(lib, open_name,
+ SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION), 1);
+ }
+ }
+ // Handle libs array.
+ // Suppresses error messages if any function is loaded successfully.
+ else {
+ if (lib) {
+ open_func = snd_dlobj_cache_get(lib, open_name,
+ SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION), 0);
+ }
+
+ if (!open_func) {
+ snd_config_for_each(i, next, libs) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+
+ err = snd_config_get_string(n, &libs_lib);
+ if (err < 0) {
+ SNDERR("Invalid entry in CTL %s libs definition", str);
+ goto _err;
+ }
+
+ if (!open_func) {
+ open_func = snd_dlobj_cache_get(libs_lib, open_name,
+ SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION), 0);
+ }
+ }
+ }
+
+ // Print error messages.
+ if (!open_func) {
+ if (lib) {
+ SNDERR("Either %s cannot be opened or %s was not defined inside",
+ lib, open_name);
+ }
+
+ snd_config_for_each(i, next, libs) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+
+ snd_config_get_string(n, &libs_lib);
+ SNDERR("Either %s cannot be opened or %s was not defined inside",
+ libs_lib, open_name);
+ }
+ }
+ }
+
+ // Look in ALSA_PLUGIN_DIR iff we found nowhere else to look.
+ if (!lib && (!libs || !libs_lib)) {
const char *const *build_in = build_in_ctls;
while (*build_in) {
if (!strcmp(*build_in, str))
@@ -919,12 +991,11 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
lib = buf1;
sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str);
}
- }
-#ifndef PIC
- snd_control_open_symbols();
-#endif
- open_func = snd_dlobj_cache_get(lib, open_name,
+
+ open_func = snd_dlobj_cache_get(lib, open_name,
SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION), 1);
+ }
+
if (open_func) {
err = open_func(ctlp, name, ctl_root, ctl_conf, mode);
if (err >= 0) {
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 2e24338..7f489f4 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -2116,6 +2116,10 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
#ifndef PIC
extern void *snd_pcm_open_symbols(void);
#endif
+
+ snd_config_t *libs = NULL;
+ const char *libs_lib = NULL;
+
if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
char *val;
id = NULL;
@@ -2160,6 +2164,19 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
SNDERR("Invalid type for %s", id);
goto _err;
}
+
+ continue;
+ }
+ // Handle an array of extra libs.
+ if (strcmp(id, "libs") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for libs definition in PCM %s definition",
+ str);
+ goto _err;
+ }
+
+ libs = n;
+
continue;
}
if (strcmp(id, "open") == 0) {
@@ -2184,7 +2201,62 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
open_name = buf;
sprintf(buf, "_snd_pcm_%s_open", str);
}
- if (!lib) {
+
+#ifndef PIC
+ snd_pcm_open_symbols(); /* this call is for static linking only */
+#endif
+
+ // Normal alsa behaviour when there is no libs array.
+ if (!libs) {
+ if (lib) {
+ open_func = snd_dlobj_cache_get(lib, open_name,
+ SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION), 1);
+ }
+ }
+ // Handle libs array.
+ // Suppresses error messages if any function is loaded successfully.
+ else {
+ if (lib) {
+ open_func = snd_dlobj_cache_get(lib, open_name,
+ SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION), 0);
+ }
+
+ if (!open_func) {
+ snd_config_for_each(i, next, libs) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+
+ err = snd_config_get_string(n, &libs_lib);
+ if (err < 0) {
+ SNDERR("Invalid entry in PCM %s libs definition", str);
+ goto _err;
+ }
+
+ if (!open_func) {
+ open_func = snd_dlobj_cache_get(libs_lib, open_name,
+ SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION), 0);
+ }
+ }
+ }
+
+ // Print error messages.
+ if (!open_func) {
+ if (lib) {
+ SNDERR("Either %s cannot be opened or %s was not defined inside",
+ lib, open_name);
+ }
+
+ snd_config_for_each(i, next, libs) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+
+ snd_config_get_string(n, &libs_lib);
+ SNDERR("Either %s cannot be opened or %s was not defined inside",
+ libs_lib, open_name);
+ }
+ }
+ }
+
+ // Look in ALSA_PLUGIN_DIR iff we found nowhere else to look.
+ if (!lib && (!libs || !libs_lib)) {
const char *const *build_in = build_in_pcms;
while (*build_in) {
if (!strcmp(*build_in, str))
@@ -2200,12 +2272,11 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
lib = buf1;
sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
}
- }
-#ifndef PIC
- snd_pcm_open_symbols(); /* this call is for static linking only */
-#endif
- open_func = snd_dlobj_cache_get(lib, open_name,
+
+ open_func = snd_dlobj_cache_get(lib, open_name,
SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION), 1);
+ }
+
if (open_func) {
err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
if (err >= 0) {

View file

@ -0,0 +1,47 @@
{ lib
, stdenv
, fetchurl
, alsa-topology-conf
, alsa-ucm-conf
}:
stdenv.mkDerivation rec {
pname = "alsa-lib";
version = "1.2.6.1";
src = fetchurl {
url = "mirror://alsa/lib/${pname}-${version}.tar.bz2";
hash = "sha256-rVgpk9Us21+xWaC+q2CmrFfqsMwb34XcTbbWGX8CMz8=";
};
patches = [
# Add a "libs" field to the syntax recognized in the /etc/asound.conf file.
# The nixos modules for pulseaudio, jack, and pipewire are leveraging this
# "libs" field to declare locations for both native and 32bit plugins, in
# order to support apps with 32bit sound running on x86_64 architecture.
./alsa-plugin-conf-multilib.patch
];
enableParallelBuilding = true;
postInstall = ''
ln -s ${alsa-ucm-conf}/share/alsa/{ucm,ucm2} $out/share/alsa
ln -s ${alsa-topology-conf}/share/alsa/topology $out/share/alsa
'';
outputs = [ "out" "dev" ];
meta = with lib; {
homepage = "http://www.alsa-project.org/";
description = "ALSA, the Advanced Linux Sound Architecture libraries";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.lgpl21Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ l-as ];
};
}

View file

@ -0,0 +1,31 @@
{lib, stdenv, fetchurl, alsa-lib, gettext, ncurses, libsamplerate}:
stdenv.mkDerivation rec {
pname = "alsa-oss";
version = "1.1.8";
src = fetchurl {
url = "mirror://alsa/oss-lib/${pname}-${version}.tar.bz2";
sha256 = "13nn6n6wpr2sj1hyqx4r9nb9bwxnhnzw8r2f08p8v13yjbswxbb4";
};
buildInputs = [ alsa-lib ncurses libsamplerate ];
nativeBuildInputs = [ gettext ];
configureFlags = [ "--disable-xmlto" ];
installFlags = [ "ASOUND_STATE_DIR=$(TMPDIR)/dummy" ];
meta = with lib; {
homepage = "http://www.alsa-project.org/";
description = "ALSA, the Advanced Linux Sound Architecture alsa-oss emulation";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.gpl2;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,27 @@
{ stdenv, fetchurl, lib, pkg-config, alsa-lib, libogg, libpulseaudio ? null, libjack2 ? null }:
stdenv.mkDerivation rec {
pname = "alsa-plugins";
version = "1.2.6";
src = fetchurl {
url = "mirror://alsa/plugins/${pname}-${version}.tar.bz2";
sha256 = "sha256-BogYpLVdjAKdqgABXYU9RRE/VrIkt8ZOHhF5iMglsqA=";
};
nativeBuildInputs = [ pkg-config ];
# ToDo: a52, etc.?
buildInputs =
[ alsa-lib libogg ]
++ lib.optional (libpulseaudio != null) libpulseaudio
++ lib.optional (libjack2 != null) libjack2;
meta = with lib; {
description = "Various plugins for ALSA";
homepage = "http://alsa-project.org/";
license = licenses.lgpl21;
maintainers = [ maintainers.marcweber ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,10 @@
{ stdenv
, alsa-plugins
, writeShellScriptBin
}:
let
arch = if stdenv.hostPlatform.system == "i686-linux" then "32" else "64";
in
writeShellScriptBin "ap${arch}" ''
ALSA_PLUGIN_DIRS=${alsa-plugins}/lib/alsa-lib "$@"
''

View file

@ -0,0 +1,54 @@
{ lib, stdenv, fetchurl, alsa-lib, pkg-config, gtk2, gtk3, fltk13 }:
# Comes from upstream as as bundle of several tools,
# some use gtk2, some gtk3 (and some even fltk13).
stdenv.mkDerivation rec {
pname = "alsa-tools";
version = "1.2.5";
src = fetchurl {
url = "mirror://alsa/tools/${pname}-${version}.tar.bz2";
sha256 = "sha256-NacQJ6AfTX3kci4iNSDpQN5os8VwtsZxaRVnrij5iT4=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ alsa-lib gtk2 gtk3 fltk13 ];
patchPhase = ''
export tools="as10k1 hda-verb hdspmixer echomixer hdajackretask hdspconf hwmixvolume mixartloader rmedigicontrol sscape_ctl vxloader envy24control hdajacksensetest hdsploader ld10k1 pcxhrloader sb16_csp us428control"
# export tools="as10k1 hda-verb hdspmixer qlo10k1 seq usx2yloader echomixer hdajackretask hdspconf hwmixvolume mixartloader rmedigicontrol sscape_ctl vxloader envy24control hdajacksensetest hdsploader ld10k1 pcxhrloader sb16_csp us428control"
'';
configurePhase = ''
for tool in $tools; do
echo "Tool: $tool:"
cd "$tool"; ./configure --prefix="$out"; cd -
done
'';
buildPhase = ''
for tool in $tools; do
cd "$tool"; make; cd -
done
'';
installPhase = ''
for tool in $tools; do
cd "$tool"; make install; cd -
done
'';
meta = with lib; {
homepage = "http://www.alsa-project.org/";
description = "ALSA, the Advanced Linux Sound Architecture tools";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = [ maintainers.fps ];
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
name = "alsa-topology-conf-${version}";
version = "1.2.5.1";
src = fetchurl {
url = "mirror://alsa/lib/${name}.tar.bz2";
sha256 = "sha256-98W64VRavNc4JLyX9OcsNA4Rq+oYi6DxwG9eCtd2sXk=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/alsa
cp -r topology $out/share/alsa
runHook postInstall
'';
meta = with lib; {
homepage = "https://www.alsa-project.org/";
description = "ALSA topology configuration files";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.bsd3;
maintainers = [ maintainers.roastiek ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "alsa-ucm-conf";
version = "1.2.6.3";
src = fetchurl {
url = "mirror://alsa/lib/${pname}-${version}.tar.bz2";
sha256 = "sha256-uKA6o4emJKL2XtwgG/d3QhGQtgUpqSCHZGgjr72Wxc0=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/alsa
cp -r ucm ucm2 $out/share/alsa
runHook postInstall
'';
meta = with lib; {
homepage = "https://www.alsa-project.org/";
description = "ALSA Use Case Manager configuration";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.bsd3;
maintainers = [ maintainers.roastiek ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,36 @@
{lib, stdenv, fetchurl, alsa-lib, gettext, makeWrapper, ncurses, libsamplerate, pciutils, which, fftw}:
stdenv.mkDerivation rec {
pname = "alsa-utils";
version = "1.2.6";
src = fetchurl {
url = "mirror://alsa/utils/${pname}-${version}.tar.bz2";
sha256 = "sha256-ah79ih8dnTjkiWM+rsH/+lwxVmOzFsq4BL5IaIfmFF0=";
};
nativeBuildInputs = [ gettext makeWrapper ];
buildInputs = [ alsa-lib ncurses libsamplerate fftw ];
configureFlags = [ "--disable-xmlto" "--with-udev-rules-dir=$(out)/lib/udev/rules.d" ];
installFlags = [ "ASOUND_STATE_DIR=$(TMPDIR)/dummy" ];
postFixup = ''
mv $out/bin/alsa-info.sh $out/bin/alsa-info
wrapProgram $out/bin/alsa-info --prefix PATH : "${lib.makeBinPath [ which pciutils ]}"
'';
meta = with lib; {
homepage = "http://www.alsa-project.org/";
description = "ALSA, the Advanced Linux Sound Architecture utils";
longDescription = ''
The Advanced Linux Sound Architecture (ALSA) provides audio and
MIDI functionality to the Linux-based operating system.
'';
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = [ maintainers.AndersonTorres ];
};
}

View file

@ -0,0 +1,222 @@
{ lib
, stdenv
, fetchurl
, elfutils
, xorg
, patchelf
, libxcb
, libxshmfence
, perl
, zlib
, expat
, libffi
, libselinux
, libdrm
, udev
, kernel ? null
}:
with lib;
let
bitness = if stdenv.is64bit then "64" else "32";
libArch =
if stdenv.hostPlatform.system == "i686-linux" then
"i386-linux-gnu"
else if stdenv.hostPlatform.system == "x86_64-linux" then
"x86_64-linux-gnu"
else throw "amdgpu-pro is Linux only. Sorry.";
in stdenv.mkDerivation rec {
version = "21.30";
pname = "amdgpu-pro";
build = "${version}-1290604";
src = fetchurl {
url = "https://drivers.amd.com/drivers/linux/amdgpu-pro-${build}-ubuntu-20.04.tar.xz";
sha256 = "sha256-WECqxjo2WLP3kMWeVyJgYufkvHTzwGaj57yeMGXiQ4I=";
curlOpts = "--referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-30";
};
postUnpack = ''
mkdir root
pushd $sourceRoot
for deb in *_all.deb *_${if stdenv.is64bit then "amd64" else "i386"}.deb
do
ar p $deb data.tar.xz | tar -C ../root -xJ
done
popd
# if we don't use a short sourceRoot, compilation can fail due to command
# line length
sourceRoot=root
'';
passthru = optionalAttrs (kernel != null) {
kmod = stdenv.mkDerivation rec {
inherit version src postUnpack;
name = "${pname}-${version}-kmod-${kernel.dev.version}";
postPatch = ''
pushd usr/src/amdgpu-*
patchShebangs amd/dkms/*.sh
substituteInPlace amd/dkms/pre-build.sh --replace "./configure" "./configure --with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source --with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
popd
'';
preConfigure = ''
pushd usr/src/amdgpu-*
makeFlags="$makeFlags M=$(pwd)"
amd/dkms/pre-build.sh ${kernel.version}
popd
'';
postBuild = ''
pushd usr/src/amdgpu-*
find -name \*.ko -exec xz {} \;
popd
'';
makeFlags = optionalString (kernel != null) "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build modules";
installPhase = ''
runHook preInstall
pushd usr/src/amdgpu-*
find -name \*.ko.xz -exec install -Dm444 {} $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/{} \;
popd
runHook postInstall
'';
# without this we get a collision with the ttm module from linux
meta.priority = 4;
};
fw = stdenv.mkDerivation rec {
inherit version src postUnpack;
name = "${pname}-${version}-fw";
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp -r usr/src/amdgpu-*/firmware $out/lib/firmware
runHook postInstall
'';
};
};
outputs = [ "out" "vulkan" ];
depLibPath = makeLibraryPath [
stdenv.cc.cc.lib
zlib
libxcb
libxshmfence
elfutils
expat
libffi
libselinux
# libudev is not listed in any dependencies, but is loaded dynamically
udev
xorg.libXext
xorg.libX11
xorg.libXfixes
xorg.libXdamage
xorg.libXxf86vm
];
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r usr/lib/${libArch} $out/lib
cp -r usr/share $out/share
mkdir -p $out/opt/amdgpu{,-pro}
cp -r opt/amdgpu-pro/lib/${libArch} $out/opt/amdgpu-pro/lib
cp -r opt/amdgpu/lib/${libArch} $out/opt/amdgpu/lib
pushd $out/lib
ln -s ../opt/amdgpu-pro/lib/libGL.so* .
ln -s ../opt/amdgpu-pro/lib/libEGL.so* .
popd
# short name to allow replacement below
ln -s lib/dri $out/dri
'' + optionalString (stdenv.is64bit) ''
mkdir -p $out/etc
pushd etc
cp -r modprobe.d udev amd $out/etc
popd
cp -r lib/udev/rules.d/* $out/etc/udev/rules.d
cp -r opt/amdgpu/lib/xorg $out/lib/xorg
cp -r opt/amdgpu-pro/lib/xorg/* $out/lib/xorg
cp -r opt/amdgpu/share $out/opt/amdgpu/share
'' + ''
mkdir -p $vulkan/share/vulkan/icd.d
install opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd${bitness}.json $vulkan/share/vulkan/icd.d
runHook postInstall
'';
preFixup = (if stdenv.is64bit
# this could also be done with LIBGL_DRIVERS_PATH, but it would need to be
# set in the user session and for Xorg
then ''
expr1='s:/opt/amdgpu/lib/x86_64-linux-gnu/dri\0:/run/opengl-driver/lib/dri\0\0\0\0\0\0\0\0\0\0\0:g'
expr2='s:/usr/lib/x86_64-linux-gnu/dri[\0\:]:/run/opengl-driver/lib/dri\0\0\0\0:g'
perl -pi -e "$expr2" $out/lib/xorg/modules/extensions/libglx.so
''
else ''
expr1='s:/opt/amdgpu/lib/i386-linux-gnu/dri\0:/run/opengl-driver-32/lib/dri\0\0\0\0\0\0:g'
# we replace a different path on 32-bit because it's the only one long
# enough to fit the target path :(
expr2='s:/usr/lib/i386-linux-gnu/dri[\0\:]:/run/opengl-driver-32/dri\0\0\0:g'
'') + ''
perl -pi -e "$expr1" \
$out/opt/amdgpu/lib/libEGL.so.1.0.0 \
$out/opt/amdgpu/lib/libgbm.so.1.0.0 \
$out/opt/amdgpu/lib/libGL.so.1.2.0
perl -pi -e "$expr2" \
$out/opt/amdgpu-pro/lib/libEGL.so.1 \
$out/opt/amdgpu-pro/lib/libGL.so.1.2 \
$out/opt/amdgpu-pro/lib/libGLX_amd.so.0
find $out -type f -exec perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' {} \;
find $out -type f -exec perl -pi -e 's:/opt/amdgpu/:/run/amdgpu/:g' {} \;
substituteInPlace $vulkan/share/vulkan/icd.d/*.json --replace /opt/amdgpu-pro/lib/${libArch} "$out/opt/amdgpu-pro/lib"
'';
# doing this in post because shrinking breaks things that dynamically load
postFixup = ''
libPath="$out/opt/amdgpu/lib:$out/opt/amdgpu-pro/lib:$depLibPath"
find "$out" -name '*.so*' -type f -exec patchelf --set-rpath "$libPath" {} \;
'';
buildInputs = [
libdrm
patchelf
perl
];
enableParallelBuilding = true;
meta = with lib; {
description = "AMDGPU-PRO drivers";
homepage = "https://www.amd.com/en/support";
license = licenses.unfree;
platforms = platforms.linux;
maintainers = with maintainers; [ corngood ];
};
}

View file

@ -0,0 +1,159 @@
{ lib, stdenv, fetchFromGitHub, fetchurl
, cmake, pkg-config, dbus, makeWrapper
, boost
, elfutils # for libdw
, git
, glib
, glm
, gtest
, libbfd
, libcap
, libdwarf
, libGL
, libglvnd
, lxc
, mesa
, properties-cpp
, protobuf
, protobufc
, python3
, runtimeShell
, SDL2
, SDL2_image
, systemd
, writeText
, writeScript
}:
let
dbus-service = writeText "org.anbox.service" ''
[D-BUS Service]
Name=org.anbox
Exec=@out@/libexec/anbox-session-manager
'';
anbox-application-manager = writeScript "anbox-application-manager" ''
#!${runtimeShell}
${systemd}/bin/busctl --user call \
org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus \
StartServiceByName "su" org.anbox 0
@out@/bin/anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
'';
in
stdenv.mkDerivation rec {
pname = "anbox";
version = "unstable-2021-10-20";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "84f0268012cbe322ad858d76613f4182074510ac";
sha256 = "sha256-QXWhatewiUDQ93cH1UZsYgbjUxpgB1ajtGFYZnKmabc=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
];
buildInputs = [
boost
dbus
elfutils # libdw
glib
glm
gtest
libbfd
libcap
libdwarf
libGL
lxc
mesa
properties-cpp
protobuf protobufc
python3
SDL2 SDL2_image
systemd
];
patchPhase = ''
patchShebangs scripts
cat >cmake/FindGMock.cmake <<'EOF'
add_library(gtest INTERFACE)
target_include_directories(gtest INTERFACE ${gtest.dev}/include)
target_link_libraries(gtest INTERFACE ${gtest}/lib/libgtest.so ''${CMAKE_THREAD_LIBS_INIT})
add_dependencies(gtest GMock)
add_library(gtest_main INTERFACE)
target_include_directories(gtest_main INTERFACE ${gtest.dev}/include)
target_link_libraries(gtest_main INTERFACE ${gtest}/lib/libgtest_main.so gtest)
add_library(gmock INTERFACE)
target_include_directories(gmock INTERFACE ${gtest.dev}/include)
target_link_libraries(gmock INTERFACE ${gtest}/lib/libgmock.so gtest)
add_library(gmock_main INTERFACE)
target_include_directories(gmock_main INTERFACE ${gtest.dev}/include)
target_link_libraries(gmock_main INTERFACE ${gtest}/lib/libgmock_main.so gmock gtest_main)
set(GTEST_LIBRARIES gtest)
set(GTEST_MAIN_LIBRARIES gtest_main)
set(GMOCK_LIBRARIES gmock gmock_main)
set(GTEST_BOTH_LIBRARIES ''${GTEST_LIBRARIES} ''${GTEST_MAIN_LIBRARIES})
EOF
'';
postInstall = ''
wrapProgram $out/bin/anbox \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libGL libglvnd]} \
--prefix PATH : ${git}/bin
mkdir -p $out/share/dbus-1/services
substitute ${dbus-service} $out/share/dbus-1/services/org.anbox.service \
--subst-var out
mkdir $out/libexec
makeWrapper $out/bin/anbox $out/libexec/anbox-session-manager \
--add-flags session-manager
substitute ${anbox-application-manager} $out/bin/anbox-application-manager \
--subst-var out
'';
passthru.image = let
imgroot = "https://build.anbox.io/android-images";
in
{
armv7l-linux = fetchurl {
url = imgroot + "/2017/06/12/android_1_armhf.img";
sha256 = "1za4q6vnj8wgphcqpvyq1r8jg6khz7v6b7h6ws1qkd5ljangf1w5";
};
aarch64-linux = fetchurl {
url = imgroot + "/2017/08/04/android_1_arm64.img";
sha256 = "02yvgpx7n0w0ya64y5c7bdxilaiqj9z3s682l5s54vzfnm5a2bg5";
};
x86_64-linux = fetchurl {
url = imgroot + "/2018/07/19/android_amd64.img";
sha256 = "1jlcda4q20w30cm9ikm6bjq01p547nigik1dz7m4v0aps4rws13b";
};
}.${stdenv.system} or null;
meta = with lib; {
homepage = "https://anbox.io";
description = "Android in a box";
license = licenses.gpl2;
maintainers = with maintainers; [ edwtjo ];
platforms = [ "armv7l-linux" "aarch64-linux" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub }:
## Usage
# In NixOS, simply add this package to services.udev.packages:
# services.udev.packages = [ pkgs.android-udev-rules ];
stdenv.mkDerivation rec {
pname = "android-udev-rules";
version = "20220102";
src = fetchFromGitHub {
owner = "M0Rf30";
repo = "android-udev-rules";
rev = version;
sha256 = "sha256-D2dPFvuFcZtosfTfsW0lmK5y8zqHdIxJBlvmP/R91CE=";
};
installPhase = ''
runHook preInstall
install -D 51-android.rules $out/lib/udev/rules.d/51-android.rules
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/M0Rf30/android-udev-rules";
description = "Android udev rules list aimed to be the most comprehensive on the net";
platforms = platforms.linux;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,45 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, kernel
}:
stdenv.mkDerivation {
pname = "apfs";
version = "unstable-2022-02-03-${kernel.version}";
src = fetchFromGitHub {
owner = "linux-apfs";
repo = "linux-apfs-rw";
rev = "a0d6a4dca69b6eab3cabaaee4d4284807828a266";
sha256 = "sha256-3T1BNc6g3SDTxb0VrronLUIp/CWbwnzXTsc8Qk5c4jY=";
};
patches = [
# Fix build for Linux 5.18+.
# https://github.com/linux-apfs/linux-apfs-rw/pull/24
(fetchpatch {
url = "https://github.com/linux-apfs/linux-apfs-rw/commit/93b93767acab614c4e6426c9fd38bdf9af00bc13.patch";
sha256 = "1ss7cal851qadcmkn3jcckpa2f003nzb03xsx1g8vkb1cl0n8gi7";
})
];
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"INSTALL_MOD_PATH=$(out)"
];
meta = with lib; {
description = "APFS module for linux";
homepage = "https://github.com/linux-apfs/linux-apfs-rw";
license = licenses.gpl2Only;
platforms = platforms.linux;
broken = kernel.kernelOlder "4.9";
maintainers = with maintainers; [ Luflosi ];
};
}

View file

@ -0,0 +1,347 @@
{ stdenv, lib, fetchFromGitLab, fetchpatch, makeWrapper, autoreconfHook
, pkg-config, which
, flex, bison
, linuxHeaders ? stdenv.cc.libc.linuxHeaders
, gawk
, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && lib.meta.availableOn stdenv.hostPlatform perl, perl
, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && lib.meta.availableOn stdenv.hostPlatform python3, python3
, swig
, ncurses
, pam
, libnotify
, buildPackages
, coreutils
, bash
, gnugrep
, gnused
, kmod
, writeShellScript
, closureInfo
, runCommand
}:
let
apparmor-version = "3.0.4";
apparmor-meta = component: with lib; {
homepage = "https://apparmor.net/";
description = "A mandatory access control system - ${component}";
license = licenses.gpl2;
maintainers = with maintainers; [ joachifm julm thoughtpolice ];
platforms = platforms.linux;
};
apparmor-sources = fetchFromGitLab {
owner = "apparmor";
repo = "apparmor";
rev = "v${apparmor-version}";
sha256 = "1a217j28rgfq4lsmpn0wv1xgmdr9ba8iysv9i6q477kj6z77zrb9";
};
aa-teardown = writeShellScript "aa-teardown" ''
PATH="${lib.makeBinPath [coreutils gnused gnugrep]}:$PATH"
. ${apparmor-parser}/lib/apparmor/rc.apparmor.functions
remove_profiles
'';
prePatchCommon = ''
chmod a+x ./common/list_capabilities.sh ./common/list_af_names.sh
patchShebangs ./common/list_capabilities.sh ./common/list_af_names.sh
substituteInPlace ./common/Make.rules \
--replace "/usr/bin/pod2man" "${buildPackages.perl}/bin/pod2man" \
--replace "/usr/bin/pod2html" "${buildPackages.perl}/bin/pod2html" \
--replace "/usr/share/man" "share/man"
substituteInPlace ./utils/Makefile \
--replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h"
'';
patches = lib.optionals stdenv.hostPlatform.isMusl [
(fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/testing/apparmor/0003-Added-missing-typedef-definitions-on-parser.patch?id=74b8427cc21f04e32030d047ae92caa618105b53";
name = "0003-Added-missing-typedef-definitions-on-parser.patch";
sha256 = "0yyaqz8jlmn1bm37arggprqz0njb4lhjni2d9c8qfqj0kll0bam0";
})
];
python = python3.withPackages (ps: with ps; [ setuptools ]);
# Set to `true` after the next FIXME gets fixed or this gets some
# common derivation infra. Too much copy-paste to fix one by one.
doCheck = false;
# FIXME: convert these to a single multiple-outputs package?
libapparmor = stdenv.mkDerivation {
pname = "libapparmor";
version = apparmor-version;
src = apparmor-sources;
# checking whether python bindings are enabled... yes
# checking for python3... no
# configure: error: python is required when enabling python bindings
strictDeps = false;
nativeBuildInputs = [
autoreconfHook
bison
flex
pkg-config
swig
ncurses
which
perl
] ++ lib.optional withPython python;
buildInputs = lib.optional withPerl perl
++ lib.optional withPython python;
# required to build apparmor-parser
dontDisableStatic = true;
prePatch = prePatchCommon + ''
substituteInPlace ./libraries/libapparmor/swig/perl/Makefile.am --replace install_vendor install_site
'';
inherit patches;
postPatch = ''
cd ./libraries/libapparmor
'';
# https://gitlab.com/apparmor/apparmor/issues/1
configureFlags = [
(lib.withFeature withPerl "perl")
(lib.withFeature withPython "python")
];
outputs = [ "out" ] ++ lib.optional withPython "python";
postInstall = lib.optionalString withPython ''
mkdir -p $python/lib
mv $out/lib/python* $python/lib/
'';
inherit doCheck;
meta = apparmor-meta "library";
};
apparmor-utils = stdenv.mkDerivation {
pname = "apparmor-utils";
version = apparmor-version;
src = apparmor-sources;
strictDeps = true;
nativeBuildInputs = [ makeWrapper which python ];
buildInputs = [
bash
perl
python
libapparmor
libapparmor.python
];
prePatch = prePatchCommon +
# Do not build vim file
lib.optionalString stdenv.hostPlatform.isMusl ''
sed -i ./utils/Makefile -e "/\<vim\>/d"
'' + ''
for file in utils/apparmor/easyprof.py utils/apparmor/aa.py utils/logprof.conf; do
substituteInPlace $file --replace "/sbin/apparmor_parser" "${apparmor-parser}/bin/apparmor_parser"
done
'';
inherit patches;
postPatch = "cd ./utils";
makeFlags = [ "LANGS=" ];
installFlags = [ "DESTDIR=$(out)" "BINDIR=$(out)/bin" "VIM_INSTALL_PATH=$(out)/share" "PYPREFIX=" ];
postInstall = ''
sed -i $out/bin/aa-unconfined -e "/my_env\['PATH'\]/d"
for prog in aa-audit aa-autodep aa-cleanprof aa-complain aa-disable aa-enforce aa-genprof aa-logprof aa-mergeprof aa-unconfined ; do
wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python.sitePackages}:$PYTHONPATH"
done
substituteInPlace $out/bin/aa-notify \
--replace /usr/bin/notify-send ${libnotify}/bin/notify-send \
--replace /usr/bin/perl "${perl}/bin/perl -I ${libapparmor}/${perl.libPrefix}"
substituteInPlace $out/bin/aa-remove-unknown \
--replace "/lib/apparmor/rc.apparmor.functions" "${apparmor-parser}/lib/apparmor/rc.apparmor.functions"
wrapProgram $out/bin/aa-remove-unknown \
--prefix PATH : ${lib.makeBinPath [ gawk ]}
ln -s ${aa-teardown} $out/bin/aa-teardown
'';
inherit doCheck;
meta = apparmor-meta "user-land utilities" // {
broken = !(withPython && withPerl);
};
};
apparmor-bin-utils = stdenv.mkDerivation {
pname = "apparmor-bin-utils";
version = apparmor-version;
src = apparmor-sources;
nativeBuildInputs = [
pkg-config
libapparmor
which
];
buildInputs = [
libapparmor
];
prePatch = prePatchCommon;
postPatch = ''
cd ./binutils
'';
makeFlags = [ "LANGS=" "USE_SYSTEM=1" ];
installFlags = [ "DESTDIR=$(out)" "BINDIR=$(out)/bin" "SBINDIR=$(out)/bin" ];
inherit doCheck;
meta = apparmor-meta "binary user-land utilities";
};
apparmor-parser = stdenv.mkDerivation {
name = "apparmor-parser";
version = apparmor-version;
src = apparmor-sources;
nativeBuildInputs = [ bison flex which ];
buildInputs = [ libapparmor ];
prePatch = prePatchCommon + ''
## techdoc.pdf still doesn't build ...
substituteInPlace ./parser/Makefile \
--replace "/usr/bin/bison" "${bison}/bin/bison" \
--replace "/usr/bin/flex" "${flex}/bin/flex" \
--replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h" \
--replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
substituteInPlace parser/rc.apparmor.functions \
--replace "/sbin/apparmor_parser" "$out/bin/apparmor_parser"
sed -i parser/rc.apparmor.functions -e '2i . ${./fix-rc.apparmor.functions.sh}'
'';
inherit patches;
postPatch = ''
cd ./parser
'';
makeFlags = [
"LANGS=" "USE_SYSTEM=1" "INCLUDEDIR=${libapparmor}/include"
"AR=${stdenv.cc.bintools.targetPrefix}ar"
];
installFlags = [ "DESTDIR=$(out)" "DISTRO=unknown" ];
inherit doCheck;
meta = apparmor-meta "rule parser";
};
apparmor-pam = stdenv.mkDerivation {
pname = "apparmor-pam";
version = apparmor-version;
src = apparmor-sources;
nativeBuildInputs = [ pkg-config which ];
buildInputs = [ libapparmor pam ];
postPatch = ''
cd ./changehat/pam_apparmor
'';
makeFlags = [ "USE_SYSTEM=1" ];
installFlags = [ "DESTDIR=$(out)" ];
inherit doCheck;
meta = apparmor-meta "PAM service";
};
apparmor-profiles = stdenv.mkDerivation {
pname = "apparmor-profiles";
version = apparmor-version;
src = apparmor-sources;
nativeBuildInputs = [ which ];
postPatch = ''
cd ./profiles
'';
installFlags = [ "DESTDIR=$(out)" "EXTRAS_DEST=$(out)/share/apparmor/extra-profiles" ];
inherit doCheck;
meta = apparmor-meta "profiles";
};
apparmor-kernel-patches = stdenv.mkDerivation {
pname = "apparmor-kernel-patches";
version = apparmor-version;
src = apparmor-sources;
dontBuild = true;
installPhase = ''
mkdir "$out"
cp -R ./kernel-patches/* "$out"
'';
inherit doCheck;
meta = apparmor-meta "kernel patches";
};
# Generate generic AppArmor rules in a file, from the closure of given
# rootPaths. To be included in an AppArmor profile like so:
#
# include "${apparmorRulesFromClosure { } [ pkgs.hello ]}"
apparmorRulesFromClosure =
{ # The store path of the derivation is given in $path
additionalRules ? []
# TODO: factorize here some other common paths
# that may emerge from use cases.
, baseRules ? [
"r $path"
"r $path/etc/**"
"r $path/share/**"
# Note that not all libraries are prefixed with "lib",
# eg. glibc-2.30/lib/ld-2.30.so
"mr $path/lib/**.so*"
# eg. glibc-2.30/lib/gconv/gconv-modules
"r $path/lib/**"
]
, name ? ""
}: rootPaths: runCommand
( "apparmor-closure-rules"
+ lib.optionalString (name != "") "-${name}" ) {} ''
touch $out
while read -r path
do printf >>$out "%s,\n" ${lib.concatMapStringsSep " " (x: "\"${x}\"") (baseRules ++ additionalRules)}
done <${closureInfo { inherit rootPaths; }}/store-paths
'';
in
{
inherit
libapparmor
apparmor-utils
apparmor-bin-utils
apparmor-parser
apparmor-pam
apparmor-profiles
apparmor-kernel-patches
apparmorRulesFromClosure;
}

View file

@ -0,0 +1,32 @@
aa_action() {
STRING=$1
shift
$*
rc=$?
if [ $rc -eq 0 ] ; then
aa_log_success_msg $"$STRING "
else
aa_log_failure_msg $"$STRING "
fi
return $rc
}
aa_log_success_msg() {
[ -n "$1" ] && echo -n $1
echo ": done."
}
aa_log_warning_msg() {
[ -n "$1" ] && echo -n $1
echo ": Warning."
}
aa_log_failure_msg() {
[ -n "$1" ] && echo -n $1
echo ": Failed."
}
aa_log_skipped_msg() {
[ -n "$1" ] && echo -n $1
echo ": Skipped."
}

View file

@ -0,0 +1,28 @@
{ stdenv, lib, fetchFromGitHub, pkg-config, alsa-lib, glib, json-glib }:
stdenv.mkDerivation {
pname = "aseq2json";
version = "unstable-2018-04-28";
src = fetchFromGitHub {
owner = "google";
repo = "midi-dump-tools";
rev = "8572e6313a0d7ec95492dcab04a46c5dd30ef33a";
sha256 = "LQ9LLVumi3GN6c9tuMSOd1Bs2pgrwrLLQbs5XF+NZeA=";
};
sourceRoot = "source/aseq2json";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ alsa-lib glib json-glib ];
installPhase = ''
install -D --target-directory "$out/bin" aseq2json
'';
meta = with lib; {
description = "Listens for MIDI events on the Alsa sequencer and outputs as JSON to stdout";
homepage = "https://github.com/google/midi-dump-tools";
license = licenses.asl20;
maintainers = [ maintainers.queezle ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
name = "asus-ec-sensors-${version}-${kernel.version}";
version = "unstable-2021-12-16";
src = fetchFromGitHub {
owner = "zeule";
repo = "asus-ec-sensors";
rev = "3621741c4ecb93216d546942707a9c413e971787";
sha256 = "0akdga2854q3w0pyi0jywa6cxr32541ifz0ka1hgn6j4czk39kyn";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = [
"KERNELRELEASE=${kernel.modDirVersion}"
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
];
installPhase = ''
install asus-ec-sensors.ko -Dm444 -t ${placeholder "out"}/lib/modules/${kernel.modDirVersion}/kernel/drivers/hwmon
'';
meta = with lib; {
description = "Linux HWMON sensors driver for ASUS motherboards to read sensor data from the embedded controller";
homepage = "https://github.com/zeule/asus-ec-sensors";
license = licenses.gpl2;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ nickhu ];
};
}

View file

@ -0,0 +1,37 @@
{ lib, stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
name = "asus-wmi-sensors-${version}-${kernel.version}";
version = "unstable-2019-11-07";
# The original was deleted from github, but this seems to be an active fork
src = fetchFromGitHub {
owner = "electrified";
repo = "asus-wmi-sensors";
rev = "8daafd45d1b860cf5b17eee1c94d93feb04164a9";
sha256 = "0kc0xlrsmf783ln5bqyj6qxzmrhdxdfdd2b9ygf2lbl2153i04vc";
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
preConfigure = ''
sed -i 's|depmod|#depmod|' Makefile
'';
makeFlags = [
"TARGET=${kernel.modDirVersion}"
"KERNEL_MODULES=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
"MODDESTDIR=${placeholder "out"}/lib/modules/${kernel.modDirVersion}/kernel/drivers/hwmon"
];
meta = with lib; {
description = "Linux HWMON (lmsensors) sensors driver for various ASUS Ryzen and Threadripper motherboards";
homepage = "https://github.com/electrified/asus-wmi-sensors";
license = licenses.gpl2;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = with maintainers; [ Frostman ];
broken = versionOlder kernel.version "4.12";
};
}

View file

@ -0,0 +1,10 @@
--- a/atop.service
+++ b/atop.service
@@ -9,5 +9,6 @@
Environment=LOGPATH=/var/log/atop
-EnvironmentFile=/etc/default/atop
+EnvironmentFile=-/etc/default/atop
ExecStartPre=/bin/sh -c 'test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL"'
ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"'
+ExecStartPre=/bin/sh -c 'mkdir -p "${LOGPATH}"'
ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'

View file

@ -0,0 +1,7 @@
--- a/atopacct.service
+++ b/atopacct.service
@@ -9,3 +9,3 @@
Type=forking
-PIDFile=/var/run/atopacctd.pid
+PIDFile=/run/atopacctd.pid
ExecStart=@out@/bin/atopacctd

View file

@ -0,0 +1,95 @@
{ lib
, stdenv
, fetchurl
, zlib
, ncurses
, findutils
, systemd
, python3
# makes the package unfree via pynvml
, withAtopgpu ? false
}:
stdenv.mkDerivation rec {
pname = "atop";
version = "2.7.1";
src = fetchurl {
url = "https://www.atoptool.nl/download/atop-${version}.tar.gz";
sha256 = "sha256-ykjS8X4HHe6tXm6cyeOIv2oycNaV5hl2s3lNTZJ7XE4=";
};
nativeBuildInputs = lib.optionals withAtopgpu [
python3.pkgs.wrapPython
];
buildInputs = [
zlib
ncurses
] ++ lib.optionals withAtopgpu [
python3
];
pythonPath = lib.optionals withAtopgpu [
python3.pkgs.pynvml
];
makeFlags = [
"DESTDIR=$(out)"
"BINPATH=/bin"
"SBINPATH=/bin"
"MAN1PATH=/share/man/man1"
"MAN5PATH=/share/man/man5"
"MAN8PATH=/share/man/man8"
"SYSDPATH=/lib/systemd/system"
"PMPATHD=/lib/systemd/system-sleep"
];
patches = [
# Fix paths in atop.service, atop-rotate.service, atopgpu.service, atopacct.service,
# and atop-pm.sh
./fix-paths.patch
# Don't fail on missing /etc/default/atop, make sure /var/log/atop exists pre-start
./atop.service.patch
# Specify PIDFile in /run, not /var/run to silence systemd warning
./atopacct.service.patch
];
preConfigure = ''
for f in *.{sh,service}; do
findutils=${findutils} systemd=${systemd} substituteAllInPlace "$f"
done
substituteInPlace Makefile --replace 'chown' 'true'
substituteInPlace Makefile --replace 'chmod 04711' 'chmod 0711'
'';
preInstall = ''
mkdir -p $out/bin
'';
postInstall = ''
# Remove extra files we don't need
rm -r $out/{var,etc} $out/bin/atop{sar,}-${version}
'' + (if withAtopgpu then ''
wrapPythonPrograms
'' else ''
rm $out/lib/systemd/system/atopgpu.service $out/bin/atopgpud $out/share/man/man8/atopgpud.8
'');
meta = with lib; {
platforms = platforms.linux;
maintainers = with maintainers; [ raskin ];
description = "Console system performance monitor";
longDescription = ''
Atop is an ASCII full-screen performance monitor that is capable of reporting the activity of
all processes (even if processes have finished during the interval), daily logging of system
and process activity for long-term analysis, highlighting overloaded system resources by using
colors, etc. At regular intervals, it shows system-level activity related to the CPU, memory,
swap, disks and network layers, and for every active process it shows the CPU utilization,
memory growth, disk utilization, priority, username, state, and exit code.
'';
license = licenses.gpl2Plus;
downloadPage = "http://atoptool.nl/downloadatop.php";
};
}

View file

@ -0,0 +1,48 @@
--- a/atop.service
+++ b/atop.service
@@ -12,4 +12,4 @@
ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"'
-ExecStart=/bin/sh -c 'exec /usr/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
-ExecStartPost=/usr/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
+ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
+ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
KillSignal=SIGUSR2
--- a/atop-rotate.service
+++ b/atop-rotate.service
@@ -4,3 +4,3 @@
[Service]
Type=oneshot
-ExecStart=/usr/bin/systemctl try-restart atop.service
+ExecStart=@systemd@/bin/systemctl try-restart atop.service
--- a/atopgpu.service
+++ b/atopgpu.service
@@ -6,5 +6,5 @@
[Service]
-ExecStart=/usr/sbin/atopgpud
+ExecStart=@out@/bin/atopgpud
Type=oneshot
RemainAfterExit=yes
--- a/atopacct.service
+++ b/atopacct.service
@@ -10,3 +10,3 @@
PIDFile=/var/run/atopacctd.pid
-ExecStart=/usr/sbin/atopacctd
+ExecStart=@out@/bin/atopacctd
--- a/atop-pm.sh
+++ b/atop-pm.sh
@@ -2,8 +2,8 @@
case "$1" in
- pre) /usr/bin/systemctl stop atop
+ pre) @systemd@/bin/systemctl stop atop
exit 0
;;
- post) /usr/bin/systemctl start atop
+ post) @systemd@/bin/systemctl start atop
exit 0
;;

View file

@ -0,0 +1,103 @@
{
lib, stdenv, buildPackages, fetchurl, fetchpatch,
runCommand,
autoreconfHook,
autoconf, automake, libtool, bash,
# Enabling python support while cross compiling would be possible, but
# the configure script tries executing python to gather info instead of
# relying on python3-config exclusively
enablePython ? stdenv.hostPlatform == stdenv.buildPlatform, python3, swig,
linuxHeaders ? stdenv.cc.libc.linuxHeaders
}:
stdenv.mkDerivation rec {
pname = "audit";
version = "2.8.5"; # at the next release, remove the patches below!
src = fetchurl {
url = "https://people.redhat.com/sgrubb/audit/audit-${version}.tar.gz";
sha256 = "1dzcwb2q78q7x41shcachn7f4aksxbxd470yk38zh03fch1l2p8f";
};
outputs = [ "bin" "dev" "out" "man" ];
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ autoreconfHook ]
++ lib.optionals enablePython [ python3 swig ];
buildInputs = [ bash ];
configureFlags = [
# z/OS plugin is not useful on Linux,
# and pulls in an extra openldap dependency otherwise
"--disable-zos-remote"
(if enablePython then "--with-python" else "--without-python")
"--with-arm"
"--with-aarch64"
];
enableParallelBuilding = true;
# TODO: Remove the musl patches when
# https://github.com/linux-audit/audit-userspace/pull/25
# is available with the next release.
patches = [
./patches/weak-symbols.patch
(fetchpatch {
# upstream build fix against -fno-common compilers like >=gcc-10
url = "https://github.com/linux-audit/audit-userspace/commit/017e6c6ab95df55f34e339d2139def83e5dada1f.patch";
sha256 = "100xa1rzkv0mvhjbfgpfm72f7c4p68syflvgc3xm6pxgrqqmfq8h";
})
(
let patch = fetchpatch {
url = "https://github.com/linux-audit/audit-userspace/commit/d579a08bb1cde71f939c13ac6b2261052ae9f77e.patch";
name = "Add-substitue-functions-for-strndupa-rawmemchr.patch";
sha256 = "015bvzflg1s1k5viap30nznlpjj44a66khyc8yq0waa68qwvdlsd";
};
in
runCommand "Add-substitue-functions-for-strndupa-rawmemchr.patch-fix-copyright-merge-conflict" {} ''
cp ${patch} $out
substituteInPlace $out --replace \
'-* Copyright (c) 2007-09,2011-16,2018 Red Hat Inc., Durham, North Carolina.' \
'-* Copyright (c) 2007-09,2011-16 Red Hat Inc., Durham, North Carolina.'
''
)
# upstream fix for linux-headers-5.15 which removed ipx.h
(fetchpatch {
name = "no-ipx.patch";
url = "https://github.com/linux-audit/audit-userspace/commit/6b09724c69d91668418ddb3af00da6db6755208c.patch";
sha256 = "0qjq41ridyamajz9v9nyplgq7f8nn3fxw375s9sa5a0igsrx9pm0";
excludes = [ "ChangeLog" ];
})
# Fix pending upstream inclusion for linux-headers-5.17 support:
# https://github.com/linux-audit/audit-userspace/pull/253
(fetchpatch {
name = "ignore-flexible-array.patch";
url = "https://github.com/linux-audit/audit-userspace/commit/beed138222421a2eb4212d83cb889404bd7efc49.patch";
sha256 = "1hf02zaxv6x0wmn4ca9fj48y2shks7vfna43i1zz58xw9jq7sza0";
})
];
postPatch = ''
sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
substituteInPlace bindings/swig/src/auditswig.i \
--replace "/usr/include/linux/audit.h" \
"${linuxHeaders}/include/linux/audit.h"
''
# According to https://stackoverflow.com/questions/13089166
# --whole-archive linker flag is required to be sure that linker
# correctly chooses strong version of symbol regardless of order of
# object files at command line.
+ lib.optionalString stdenv.hostPlatform.isStatic ''
export LDFLAGS=-Wl,--whole-archive
'';
meta = {
description = "Audit Library";
homepage = "https://people.redhat.com/sgrubb/audit/";
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ ];
};
}

View file

@ -0,0 +1,147 @@
Executables in src/ directory are built from source files in src/
and are linked to libauparse, with both src/auditd-config.c and
auparse/auditd-config.c defining "free_config" function.
It is known (although obscure) behaviour of shared libraries that
symbol defined in binary itself overrides symbol in shared library;
with static linkage it expectedly results in multiple definition
error.
This set of fixes explicitly marks libauparse versions of
conflicting functions as weak to have behaviour coherent with
dynamic linkage version -- definitions in src/ overriding definition
in auparse/.
Still, this architecture is very strange and confusing.
diff -r -U5 audit-2.8.5-orig/auparse/auditd-config.c audit-2.8.5/auparse/auditd-config.c
--- audit-2.8.5-orig/auparse/auditd-config.c 2019-03-01 20:19:13.000000000 +0000
+++ audit-2.8.5/auparse/auditd-config.c 2021-01-13 11:36:12.716226498 +0000
@@ -68,10 +68,11 @@
};
/*
* Set everything to its default value
*/
+#pragma weak clear_config
void clear_config(struct daemon_conf *config)
{
config->local_events = 1;
config->qos = QOS_NON_BLOCKING;
config->sender_uid = 0;
@@ -322,10 +323,11 @@
if (config->log_file == NULL)
return 1;
return 0;
}
+#pragma weak free_config
void free_config(struct daemon_conf *config)
{
free((void*)config->log_file);
}
diff -r -U5 audit-2.8.5-orig/auparse/interpret.c audit-2.8.5/auparse/interpret.c
--- audit-2.8.5-orig/auparse/interpret.c 2019-03-01 20:19:13.000000000 +0000
+++ audit-2.8.5/auparse/interpret.c 2021-01-13 11:39:42.107217224 +0000
@@ -545,10 +545,11 @@
else
snprintf(buf, size, "unknown(%d)", uid);
return buf;
}
+#pragma weak aulookup_destroy_uid_list
void aulookup_destroy_uid_list(void)
{
if (uid_cache_created == 0)
return;
@@ -2810,10 +2811,11 @@
/*
* This is the main entry point for the auparse library. Call chain is:
* auparse_interpret_field -> nvlist_interp_cur_val -> interpret
*/
+#pragma weak interpret
const char *interpret(const rnode *r, auparse_esc_t escape_mode)
{
const nvlist *nv = &r->nv;
int type;
idata id;
diff -r -U5 audit-2.8.5-orig/auparse/nvlist.c audit-2.8.5/auparse/nvlist.c
--- audit-2.8.5-orig/auparse/nvlist.c 2019-02-04 14:26:52.000000000 +0000
+++ audit-2.8.5/auparse/nvlist.c 2021-01-13 11:37:37.190222757 +0000
@@ -27,10 +27,11 @@
#include "nvlist.h"
#include "interpret.h"
#include "auparse-idata.h"
+#pragma weak nvlist_create
void nvlist_create(nvlist *l)
{
l->head = NULL;
l->cur = NULL;
l->cnt = 0;
@@ -47,17 +48,19 @@
while (node->next)
node = node->next;
l->cur = node;
}
+#pragma weak nvlist_next
nvnode *nvlist_next(nvlist *l)
{
if (l->cur)
l->cur = l->cur->next;
return l->cur;
}
+#pragma weak nvlist_append
void nvlist_append(nvlist *l, nvnode *node)
{
nvnode* newnode = malloc(sizeof(nvnode));
newnode->name = node->name;
@@ -141,10 +144,11 @@
if (l->cur->interp_val)
return l->cur->interp_val;
return interpret(r, escape_mode);
}
+#pragma weak nvlist_clear
void nvlist_clear(nvlist* l)
{
nvnode* nextnode;
register nvnode* current;
diff -r -U5 audit-2.8.5-orig/auparse/strsplit.c audit-2.8.5/auparse/strsplit.c
--- audit-2.8.5-orig/auparse/strsplit.c 2019-03-01 21:15:30.000000000 +0000
+++ audit-2.8.5/auparse/strsplit.c 2021-01-13 11:38:04.306221556 +0000
@@ -54,10 +54,11 @@
return NULL;
return s;
}
}
+#pragma weak audit_strsplit
char *audit_strsplit(char *s)
{
static char *str = NULL;
char *ptr;
diff -r -U5 audit-2.8.5-orig/lib/strsplit.c audit-2.8.5/lib/strsplit.c
--- audit-2.8.5-orig/lib/strsplit.c 2019-03-01 20:19:13.000000000 +0000
+++ audit-2.8.5/lib/strsplit.c 2021-01-13 11:38:29.444220443 +0000
@@ -23,10 +23,11 @@
#include <string.h>
#include "libaudit.h"
#include "private.h"
+#pragma weak audit_strsplit_r
char *audit_strsplit_r(char *s, char **savedpp)
{
char *ptr;
if (s)

View file

@ -0,0 +1,60 @@
{ lib, stdenv, fetchurl, flex, bison, linuxHeaders, libtirpc, mount, umount, nfs-utils, e2fsprogs
, libxml2, libkrb5, kmod, openldap, sssd, cyrus_sasl, openssl, rpcsvc-proto
, fetchpatch
}:
stdenv.mkDerivation rec {
version = "5.1.6";
pname = "autofs";
src = fetchurl {
url = "mirror://kernel/linux/daemons/autofs/v5/autofs-${version}.tar.xz";
sha256 = "1vya21mb4izj3khcr3flibv7xc15vvx2v0rjfk5yd31qnzcy7pnx";
};
patches = [
# glibc 2.34 compat
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/autofs/raw/cc745af5e42396d540d5b3b92fae486e232bf6bd/f/autofs-5.1.7-use-default-stack-size-for-threads.patch";
sha256 = "sha256-6ETDFbW7EhHR03xFWF+6OJBgn9NX3WW3bGhTNGodaOc=";
excludes = [ "CHANGELOG" ];
})
];
preConfigure = ''
configureFlags="--enable-force-shutdown --enable-ignore-busy --with-path=$PATH"
export sssldir="${sssd}/lib/sssd/modules"
export HAVE_SSS_AUTOFS=1
export MOUNT=${mount}/bin/mount
export MOUNT_NFS=${nfs-utils}/bin/mount.nfs
export UMOUNT=${umount}/bin/umount
export MODPROBE=${kmod}/bin/modprobe
export E2FSCK=${e2fsprogs}/bin/fsck.ext2
export E3FSCK=${e2fsprogs}/bin/fsck.ext3
export E4FSCK=${e2fsprogs}/bin/fsck.ext4
unset STRIP # Makefile.rules defines a usable STRIP only without the env var.
'';
# configure script is not finding the right path
NIX_CFLAGS_COMPILE = [ "-I${libtirpc.dev}/include/tirpc" ];
installPhase = ''
make install SUBDIRS="lib daemon modules man" # all but samples
#make install SUBDIRS="samples" # impure!
'';
buildInputs = [ linuxHeaders libtirpc libxml2 libkrb5 kmod openldap sssd
openssl cyrus_sasl rpcsvc-proto ];
nativeBuildInputs = [ flex bison ];
meta = {
description = "Kernel-based automounter";
homepage = "https://www.kernel.org/pub/linux/daemons/autofs/";
license = lib.licenses.gpl2Plus;
executables = [ "automount" ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,60 @@
{ lib
, fetchFromGitHub
, python3
}:
python3.pkgs.buildPythonApplication rec {
pname = "autosuspend";
version = "4.1.1";
src = fetchFromGitHub {
owner = "languitar";
repo = pname;
rev = "v${version}";
sha256 = "sha256-UdHaz1JIofUrw9G/K40AVhBWdvMdTK4Wa7FWb6ntwr0=";
};
postPatch = ''
substituteInPlace setup.cfg \
--replace '--cov-config=setup.cfg' ""
'';
propagatedBuildInputs = with python3.pkgs; [
portalocker
psutil
dbus-python
];
checkInputs = with python3.pkgs; [
pytestCheckHook
python-dbusmock
pytest-httpserver
dateutils
freezegun
pytest-mock
requests
requests-file
icalendar
tzlocal
jsonpath-ng
mpd2
lxml
pytest-datadir
];
# Disable tests that need root
disabledTests = [
"test_smoke"
"test_multiple_sessions"
];
doCheck = true;
meta = with lib ; {
description = "A daemon to automatically suspend and wake up a system";
homepage = "https://autosuspend.readthedocs.io";
license = licenses.gpl2Only;
maintainers = [ maintainers.bzizou ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, pkg-config, gpsd, libcap, libnl }:
let cfg = import ./version.nix; in
stdenv.mkDerivation rec {
pname = "alfred";
inherit (cfg) version;
src = fetchurl {
url = "https://downloads.open-mesh.org/batman/releases/batman-adv-${version}/${pname}-${version}.tar.gz";
sha256 = cfg.sha256.${pname};
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gpsd libcap libnl ];
preBuild = ''
makeFlags="PREFIX=$out PKG_CONFIG=${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config"
'';
meta = {
homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2, information distribution tool";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ fpletz ];
platforms = with lib.platforms; linux;
};
}

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, pkg-config, libnl }:
let cfg = import ./version.nix; in
stdenv.mkDerivation rec {
pname = "batctl";
inherit (cfg) version;
src = fetchurl {
url = "https://downloads.open-mesh.org/batman/releases/batman-adv-${version}/${pname}-${version}.tar.gz";
sha256 = cfg.sha256.${pname};
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libnl ];
preBuild = ''
makeFlags="PREFIX=$out PKG_CONFIG=${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config"
'';
meta = {
homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2, control tool";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ fpletz ];
platforms = with lib.platforms; linux;
};
}

View file

@ -0,0 +1,38 @@
{ lib
, stdenv
, fetchurl
, fetchpatch
, kernel
}:
let cfg = import ./version.nix; in
stdenv.mkDerivation rec {
pname = "batman-adv";
version = "${cfg.version}-${kernel.version}";
src = fetchurl {
url = "http://downloads.open-mesh.org/batman/releases/${pname}-${cfg.version}/${pname}-${cfg.version}.tar.gz";
sha256 = cfg.sha256.${pname};
};
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"KERNELPATH=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
hardeningDisable = [ "pic" ];
preBuild = ''
sed -i -e "s,INSTALL_MOD_DIR=,INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=," \
-e /depmod/d Makefile
'';
meta = {
homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ fpletz hexa ];
platforms = with lib.platforms; linux;
};
}

View file

@ -0,0 +1,9 @@
{
version = "2022.1";
sha256 = {
batman-adv = "sha256-bQQdNTCr1LJJq/Wpb8Ki4kFDG/lEO1R/2yWi2P0ymkA=";
alfred = "sha256-OgrCuybgyz8nMtSHNmmgoi6YJej5qOerrJhjY/J1CX8=";
batctl = "sha256-h+iak4lxuGJCJoG7NBBOmytLZRLR0WXelTYw3zjWGmg=";
};
}

View file

@ -0,0 +1,69 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, kernel, runtimeShell }:
let
baseName = "bbswitch";
version = "0.8";
name = "${baseName}-${version}-${kernel.version}";
in
stdenv.mkDerivation {
inherit name;
src = fetchFromGitHub {
owner = "Bumblebee-Project";
repo = "bbswitch";
rev = "v${version}";
hash = "sha256-FHC8myKnouNDERVds2QCJj1ZstjHrOzFpb+FDiSBjL4=";
};
patches = [
(fetchpatch {
url = "https://github.com/Bumblebee-Project/bbswitch/pull/102.patch";
sha256 = "1lbr6pyyby4k9rn2ry5qc38kc738d0442jhhq57vmdjb6hxjya7m";
})
(fetchpatch {
url = "https://github.com/Bumblebee-Project/bbswitch/pull/196.patch";
sha256 = "02ihy3piws7783qbm9q0mb9s18ipn5ckdy1iar74xn31qjrsn99n";
})
];
nativeBuildInputs = kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" ];
preBuild = ''
substituteInPlace Makefile \
--replace "\$(shell uname -r)" "${kernel.modDirVersion}" \
--replace "/lib/modules" "${kernel.dev}/lib/modules"
'';
makeFlags = kernel.makeFlags;
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc
cp bbswitch.ko $out/lib/modules/${kernel.modDirVersion}/misc
mkdir -p $out/bin
tee $out/bin/discrete_vga_poweroff << EOF
#!${runtimeShell}
echo -n OFF > /proc/acpi/bbswitch
EOF
tee $out/bin/discrete_vga_poweron << EOF
#!${runtimeShell}
echo -n ON > /proc/acpi/bbswitch
EOF
chmod +x $out/bin/discrete_vga_poweroff $out/bin/discrete_vga_poweron
'';
meta = with lib; {
description = "A module for powering off hybrid GPUs";
platforms = [ "x86_64-linux" "i686-linux" ];
homepage = "https://github.com/Bumblebee-Project/bbswitch";
maintainers = with maintainers; [ abbradar ];
license = licenses.gpl2Plus;
broken = kernel.kernelAtLeast "5.18";
};
}

View file

@ -0,0 +1,43 @@
From 01e793163231c5085afced37471df32b94a313f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 30 Dec 2021 06:34:41 +0100
Subject: [PATCH] absolute ausyscall
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
libbpf-tools/syscall_helpers.c | 2 +-
src/python/bcc/syscall.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libbpf-tools/syscall_helpers.c b/libbpf-tools/syscall_helpers.c
index e114a08f..62adea78 100644
--- a/libbpf-tools/syscall_helpers.c
+++ b/libbpf-tools/syscall_helpers.c
@@ -47,7 +47,7 @@ void init_syscall_names(void)
int err;
FILE *f;
- f = popen("ausyscall --dump 2>/dev/null", "r");
+ f = popen("@ausyscall@ --dump 2>/dev/null", "r");
if (!f) {
warn("popen: ausyscall --dump: %s\n", strerror(errno));
return;
diff --git a/src/python/bcc/syscall.py b/src/python/bcc/syscall.py
index 1346b4e8..e7e29a11 100644
--- a/src/python/bcc/syscall.py
+++ b/src/python/bcc/syscall.py
@@ -376,7 +376,7 @@ def _parse_syscall(line):
try:
# Skip the first line, which is a header. The rest of the lines are simply
# SYSCALL_NUM\tSYSCALL_NAME pairs.
- out = subprocess.check_output(['ausyscall', '--dump'], stderr=subprocess.STDOUT)
+ out = subprocess.check_output(['@ausyscall@', '--dump'], stderr=subprocess.STDOUT)
# remove the first line of expected output
out = out.split(b'\n',1)[1]
syscalls = dict(map(_parse_syscall, out.strip().split(b'\n')))
--
2.34.0

View file

@ -0,0 +1,90 @@
{ lib, stdenv, fetchFromGitHub
, makeWrapper, cmake, llvmPackages
, flex, bison, elfutils, python, luajit, netperf, iperf, libelf
, bash, libbpf, nixosTests
, audit
}:
python.pkgs.buildPythonApplication rec {
pname = "bcc";
version = "0.24.0";
disabled = !stdenv.isLinux;
src = fetchFromGitHub {
owner = "iovisor";
repo = "bcc";
rev = "v${version}";
sha256 = "sha256-5Nq6LmphiyiiIyru/P2rCCmA25cwJIWn08oK1+eM3cQ=";
};
format = "other";
buildInputs = with llvmPackages; [
llvm llvm.dev libclang
elfutils luajit netperf iperf
flex bash libbpf
];
patches = [
# This is needed until we fix
# https://github.com/NixOS/nixpkgs/issues/40427
./fix-deadlock-detector-import.patch
];
propagatedBuildInputs = [ python.pkgs.netaddr ];
nativeBuildInputs = [ makeWrapper cmake flex bison llvmPackages.llvm.dev ];
cmakeFlags = [
"-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules"
"-DREVISION=${version}"
"-DENABLE_USDT=ON"
"-DENABLE_CPP_API=ON"
"-DCMAKE_USE_LIBBPF_PACKAGE=ON"
];
# to replace this executable path:
# https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384
ausyscall = "${audit}/bin/ausyscall";
postPatch = ''
substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
patch -p1 < libbcc-path.patch
substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch
patch -p1 < absolute-ausyscall.patch
'';
postInstall = ''
mkdir -p $out/bin $out/share
rm -r $out/share/bcc/tools/old
mv $out/share/bcc/tools/doc $out/share
mv $out/share/bcc/man $out/share/
find $out/share/bcc/tools -type f -executable -print0 | \
while IFS= read -r -d ''$'\0' f; do
bin=$out/bin/$(basename $f)
if [ ! -e $bin ]; then
ln -s $f $bin
fi
substituteInPlace "$f" \
--replace '$(dirname $0)/lib' "$out/share/bcc/tools/lib"
done
sed -i -e "s!lib=.*!lib=$out/bin!" $out/bin/{java,ruby,node,python}gc
'';
postFixup = ''
wrapPythonProgramsIn "$out/share/bcc/tools" "$out $pythonPath"
'';
passthru.tests = {
bpf = nixosTests.bpf;
};
meta = with lib; {
description = "Dynamic Tracing Tools for Linux";
homepage = "https://iovisor.github.io/bcc/";
license = licenses.asl20;
maintainers = with maintainers; [ ragge mic92 thoughtpolice martinetd ];
};
}

View file

@ -0,0 +1,14 @@
--- source.org/tools/deadlock.py 1980-01-02 00:00:00.000000000 +0000
+++ source/tools/deadlock.py 2018-05-29 13:57:11.807126673 +0100
@@ -44,9 +44,8 @@
#
# 01-Feb-2017 Kenny Yu Created this.
-from __future__ import (
- absolute_import, division, unicode_literals, print_function
-)
+from __future__ import absolute_import, division, unicode_literals, print_function
+
from bcc import BPF
from collections import defaultdict
import argparse

View file

@ -0,0 +1,11 @@
--- source.org/src/python/bcc/libbcc.py 2018-05-13 08:35:06.850522883 +0100
+++ source/src/python/bcc/libbcc.py 2018-05-13 08:36:24.602733151 +0100
@@ -14,7 +14,7 @@
import ctypes as ct
-lib = ct.CDLL("libbcc.so.0", use_errno=True)
+lib = ct.CDLL("@out@/lib/libbcc.so.0", use_errno=True)
# keep in sync with bpf_common.h
lib.bpf_module_create_b.restype = ct.c_void_p

View file

@ -0,0 +1,44 @@
{ stdenv
, lib
, fetchFromGitHub
, installShellFiles
, binutils-unwrapped
, systemd }:
stdenv.mkDerivation rec {
pname = "beefi";
version = "0.1.1";
src = fetchFromGitHub {
owner = "jfeick";
repo = "beefi";
rev = version;
sha256 = "1180avalbw414q1gnfqdgc9zg3k9y0401kw9qvcn51qph81d04v5";
};
nativeBuildInputs = [ installShellFiles ];
buildInputs = [
binutils-unwrapped
systemd
];
patchPhase = ''
substituteInPlace beefi \
--replace objcopy ${binutils-unwrapped}/bin/objcopy \
--replace /usr/lib/systemd ${systemd}/lib/systemd
'';
installPhase = ''
install -Dm755 beefi $out/bin/beefi
installManPage beefi.1
'';
meta = with lib; {
description = "A small script to create bootable EFISTUB kernel images";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ tu-maurice ];
homepage = "https://github.com/jfeick/beefi";
};
}

View file

@ -0,0 +1,148 @@
{ stdenv, stdenvNoCC, lib, fetchzip, pkgs
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
let
choosePlatform =
let pname = stdenv.targetPlatform.parsed.cpu.name; in
pset: pset.${pname} or (throw "bionic-prebuilt: unsupported platform ${pname}");
prebuilt_crt = choosePlatform {
aarch64 = fetchzip {
url = "https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/98dce673ad97a9640c5d90bbb1c718e75c21e071/lib/gcc/aarch64-linux-android/4.9.x.tar.gz";
sha256 = "sha256-LLD2OJi78sNN5NulOsJZl7Ei4F1EUYItGG6eUsKWULc=";
stripRoot = false;
};
x86_64 = fetchzip {
url = "https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/+archive/7e8507d2a2d4df3bced561b894576de70f065be4/lib/gcc/x86_64-linux-android/4.9.x.tar.gz";
sha256 = "sha256-y7CFLF76pTlj+oYev9taBnL2nlT3+Tx8c6wmicWmKEw=";
stripRoot = false;
};
};
prebuilt_libs = choosePlatform {
aarch64 = fetchzip {
url = "https://android.googlesource.com/platform/prebuilts/ndk/+archive/f2c77d8ba8a7f5c2d91771e31164f29be0b8ff98/platform/platforms/android-30/arch-arm64/usr/lib.tar.gz";
sha256 = "sha256-TZBV7+D1QvKOCEi+VNGT5SStkgj0xRbyWoLH65zSrjw=";
stripRoot = false;
};
x86_64 = fetchzip {
url = "https://android.googlesource.com/platform/prebuilts/ndk/+archive/f2c77d8ba8a7f5c2d91771e31164f29be0b8ff98/platform/platforms/android-30/arch-x86_64/usr/lib64.tar.gz";
sha256 = "sha256-n2EuOKy3RGKmEYofNlm+vDDBuiQRuAJEJT6wq6NEJQs=";
stripRoot = false;
};
};
prebuilt_ndk_crt = choosePlatform {
aarch64 = fetchzip {
url = "https://android.googlesource.com/toolchain/prebuilts/ndk/r23/+archive/6c5fa4c0d3999b9ee932f6acbd430eb2f31f3151/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/30.tar.gz";
sha256 = "sha256-KHw+cCwAwlm+5Nwp1o8WONqdi4BBDhFaVVr+7GxQ5uE=";
stripRoot = false;
};
x86_64 = fetchzip {
url = "https://android.googlesource.com/toolchain/prebuilts/ndk/r23/+archive/6c5fa4c0d3999b9ee932f6acbd430eb2f31f3151/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/30.tar.gz";
sha256 = "sha256-XEd7L3cBzn+1pKfji40V92G/uZhHSMMuZcRZaiKkLnk=";
stripRoot = false;
};
};
ndk_support_headers = fetchzip {
url ="https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/0e7f808fa26cce046f444c9616d9167dafbfb272/clang-r416183b/include/c++/v1/support.tar.gz";
sha256 = "sha256-NBv7Pk1CEaz8ns9moleEERr3x/rFmVmG33LgFSeO6fY=";
stripRoot = false;
};
kernelHeaders = pkgs.makeLinuxHeaders {
version = "android-common-11-5.4";
src = fetchzip {
url = "https://android.googlesource.com/kernel/common/+archive/48ffcbf0b9e7f0280bfb8c32c68da0aaf0fdfef6.tar.gz";
sha256 = "1y7cmlmcr5vdqydd9n785s139yc4aylc3zhqa59xsylmkaf5habk";
stripRoot = false;
};
};
in
stdenvNoCC.mkDerivation rec {
pname = "bionic-prebuilt";
version = "ndk-release-r23";
name = "${stdenv.targetPlatform.parsed.cpu.name}-${pname}-${version}";
src = fetchzip {
url = "https://android.googlesource.com/platform/bionic/+archive/00e8ce1142d8823b0d2fc8a98b40119b0f1f02cd.tar.gz";
sha256 = "10z5mp4w0acvjvgxv7wlqa7m70hcyarmjdlfxbd9rwzf4mrsr8d1";
stripRoot = false;
};
NIX_DONT_SET_RPATH = true;
dontConfigure = true;
dontBuild = true;
patches = [
./ndk-version.patch
];
postPatch = ''
substituteInPlace libc/include/sys/cdefs.h --replace \
"__has_builtin(__builtin_umul_overflow)" "1"
substituteInPlace libc/include/bits/ioctl.h --replace \
"!defined(BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD)" "0"
'';
installPhase= ''
# copy the bionic headers
mkdir -p $out/include/support $out/include/android
cp -vr libc/include/* $out/include
# copy the kernel headers
cp -vr ${kernelHeaders}/include/* $out/include/
chmod -R +w $out/include/linux
# fix a bunch of kernel headers so that things can actually be found
sed -i 's,struct epoll_event {,#include <bits/epoll_event.h>\nstruct Xepoll_event {,' $out/include/linux/eventpoll.h
sed -i 's,struct in_addr {,typedef unsigned int in_addr_t;\nstruct in_addr {,' $out/include/linux/in.h
sed -i 's,struct udphdr {,struct Xudphdr {,' $out/include/linux/udp.h
sed -i 's,union semun {,union Xsemun {,' $out/include/linux/sem.h
sed -i 's,struct __kernel_sockaddr_storage,#define sockaddr_storage __kernel_sockaddr_storage\nstruct __kernel_sockaddr_storage,' $out/include/linux/socket.h
sed -i 's,#ifndef __UAPI_DEF_.*$,#if 1,' $out/include/linux/libc-compat.h
substituteInPlace $out/include/linux/in.h --replace "__be32 imr_" "struct in_addr imr_"
substituteInPlace $out/include/linux/in.h --replace "__be32 imsf_" "struct in_addr imsf_"
substituteInPlace $out/include/linux/sysctl.h --replace "__unused" "_unused"
# what could possibly live in <linux/compiler.h>
touch $out/include/linux/compiler.h
# copy the support headers
cp -vr ${ndk_support_headers}* $out/include/support/
mkdir $out/lib
cp -v ${prebuilt_crt.out}/*.o $out/lib/
cp -v ${prebuilt_crt.out}/libgcc.a $out/lib/
cp -v ${prebuilt_ndk_crt.out}/*.o $out/lib/
'' + lib.optionalString enableShared ''
for i in libc.so libm.so libdl.so liblog.so; do
cp -v ${prebuilt_libs.out}/$i $out/lib/
done
'' + lib.optionalString enableStatic ''
# no liblog.a; while it's also part of the base libraries,
# it's only available as shared object in the prebuilts.
for i in libc.a libm.a libdl.a; do
cp -v ${prebuilt_ndk_crt.out}/$i $out/lib/
done
'' + ''
mkdir -p $dev/include
cp -v $out/include/*.h $dev/include/
'';
outputs = [ "out" "dev" ];
passthru.linuxHeaders = kernelHeaders;
meta = with lib; {
description = "The Android libc implementation";
homepage = "https://android.googlesource.com/platform/bionic/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ s1341 ];
};
}

View file

@ -0,0 +1,42 @@
--- a/libc/include/android/ndk-version.h 2021-04-01 16:08:03.109183965 +0300
+++ b/libc/include/android/ndk-version.h 2021-04-01 16:07:19.811424641 +0300
@@ -0,0 +1,39 @@
+#pragma once
+
+/**
+ * Set to 1 if this is an NDK, unset otherwise. See
+ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ */
+#define __ANDROID_NDK__ 1
+
+/**
+ * Major version of this NDK.
+ *
+ * For example: 16 for r16.
+ */
+#define __NDK_MAJOR__ 22
+
+/**
+ * Minor version of this NDK.
+ *
+ * For example: 0 for r16 and 1 for r16b.
+ */
+#define __NDK_MINOR__ 0
+
+/**
+ * Set to 0 if this is a release build, or 1 for beta 1,
+ * 2 for beta 2, and so on.
+ */
+#define __NDK_BETA__ 0
+
+/**
+ * Build number for this NDK.
+ *
+ * For a local development build of the NDK, this is -1.
+ */
+#define __NDK_BUILD__ 7026061
+
+/**
+ * Set to 1 if this is a canary build, 0 if not.
+ */
+#define __NDK_CANARY__ 0

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchurl, libaio }:
stdenv.mkDerivation rec {
pname = "blktrace";
version = "1.3.0";
# Official source
# "git://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git"
src = fetchurl {
url = "https://brick.kernel.dk/snaps/blktrace-${version}.tar.bz2";
sha256 = "sha256-1t7aA4Yt4r0bG5+6cpu7hi2bynleaqf3yoa2VoEacNY=";
};
buildInputs = [ libaio ];
preConfigure = ''
sed s,/usr/local,$out, -i Makefile
'';
meta = with lib; {
description = "Block layer IO tracing mechanism";
maintainers = with maintainers; [ ];
license = licenses.gpl2;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,152 @@
{ stdenv
, lib
, fetchurl
, fetchpatch
, alsa-lib
, dbus
, ell
, glib
, json_c
, libical
, docutils
, pkg-config
, python3
, readline
, systemd
, udev
, withExperimental ? false
}: let
pythonPath = with python3.pkgs; [
dbus-python
pygobject3
recursivePthLoader
];
in stdenv.mkDerivation rec {
pname = "bluez";
version = "5.64";
src = fetchurl {
url = "mirror://kernel/linux/bluetooth/${pname}-${version}.tar.xz";
sha256 = "sha256-rkN+ZbazBwwZi8WwEJ/pzeueqjhzgOIHL53mX+ih3jQ=";
};
buildInputs = [
alsa-lib
dbus
ell
glib
json_c
libical
python3
readline
udev
];
nativeBuildInputs = [
docutils
pkg-config
python3.pkgs.wrapPython
];
outputs = [ "out" "dev" ] ++ lib.optional doCheck "test";
patches = [
# https://github.com/bluez/bluez/commit/0905a06410d4a5189f0be81e25eb3c3e8a2199c5
# which fixes https://github.com/bluez/bluez/issues/329
# and is already merged upstream and not yet in a release.
(fetchpatch {
name = "StateDirectory_and_ConfigurationDirectory.patch";
url = "https://github.com/bluez/bluez/commit/0905a06410d4a5189f0be81e25eb3c3e8a2199c5.patch";
sha256 = "sha256-MI6yPTiDLHsSTjLvNqtWnuy2xUMYpSat1WhMbeoedSM=";
})
];
postPatch = ''
substituteInPlace tools/hid2hci.rules \
--replace /sbin/udevadm ${systemd}/bin/udevadm \
--replace "hid2hci " "$out/lib/udev/hid2hci "
# Disable some tests:
# - test-mesh-crypto depends on the following kernel settings:
# CONFIG_CRYPTO_[USER|USER_API|USER_API_AEAD|USER_API_HASH|AES|CCM|AEAD|CMAC]
if [[ ! -f unit/test-mesh-crypto.c ]]; then echo "unit/test-mesh-crypto.c no longer exists"; false; fi
echo 'int main() { return 77; }' > unit/test-mesh-crypto.c
'';
configureFlags = [
"--localstatedir=/var"
"--enable-library"
"--enable-cups"
"--enable-pie"
"--enable-external-ell"
"--with-dbusconfdir=${placeholder "out"}/share"
"--with-dbussystembusdir=${placeholder "out"}/share/dbus-1/system-services"
"--with-dbussessionbusdir=${placeholder "out"}/share/dbus-1/services"
"--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
"--with-systemduserunitdir=${placeholder "out"}/etc/systemd/user"
"--with-udevdir=${placeholder "out"}/lib/udev"
"--enable-health"
"--enable-mesh"
"--enable-midi"
"--enable-nfc"
"--enable-sap"
"--enable-sixaxis"
"--enable-btpclient"
"--enable-hid2hci"
"--enable-logger"
# To provide ciptool, sdptool, and rfcomm (unmaintained)
# superseded by new D-Bus APIs
"--enable-deprecated"
] ++ lib.optional withExperimental "--enable-experimental";
# Work around `make install' trying to create /var/lib/bluetooth.
installFlags = [ "statedir=$(TMPDIR)/var/lib/bluetooth" ];
makeFlags = [ "rulesdir=${placeholder "out"}/lib/udev/rules.d" ];
doCheck = stdenv.hostPlatform.isx86_64;
postInstall = lib.optionalString doCheck ''
mkdir -p $test/{bin,test}
cp -a test $test
pushd $test/test
for a in \
simple-agent \
test-adapter \
test-device \
test-thermometer \
list-devices \
monitor-bluetooth \
; do
ln -s ../test/$a $test/bin/bluez-$a
done
popd
wrapPythonProgramsIn $test/test "$test/test ${toString pythonPath}"
'' + ''
# for bluez4 compatibility for NixOS
mkdir $out/sbin
ln -s ../libexec/bluetooth/bluetoothd $out/sbin/bluetoothd
ln -s ../libexec/bluetooth/obexd $out/sbin/obexd
# Add extra configuration
mkdir $out/etc/bluetooth
ln -s /etc/bluetooth/main.conf $out/etc/bluetooth/main.conf
# Add missing tools, ref https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/bluez
for files in `find tools/ -type f -perm -755`; do
filename=$(basename $files)
install -Dm755 tools/$filename $out/bin/$filename
done
install -Dm755 attrib/gatttool $out/bin/gatttool
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Bluetooth support for Linux";
homepage = "http://www.bluez.org/";
license = with licenses; [ gpl2 lgpl21 ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,12 @@
diff --git a/scripts/meson-install.sh b/scripts/meson-install.sh
index 859ae81..05a1c58 100644
--- a/scripts/meson-install.sh
+++ b/scripts/meson-install.sh
@@ -7,5 +7,5 @@ fi
BOLT_DBDIR=$1
-echo "Creating database dir: ${BOLT_DBDIR}"
-mkdir -p "${DESTDIR}/${BOLT_DBDIR}"
+# echo "Creating database dir: ${BOLT_DBDIR}"
+# mkdir -p "${DESTDIR}/${BOLT_DBDIR}"

View file

@ -0,0 +1,96 @@
{ stdenv
, lib
, meson
, ninja
, pkg-config
, fetchFromGitLab
, fetchpatch
, python3
, umockdev
, gobject-introspection
, dbus
, asciidoc
, libxml2
, libxslt
, docbook_xml_dtd_45
, docbook-xsl-nons
, glib
, systemd
, polkit
}:
stdenv.mkDerivation rec {
pname = "bolt";
version = "0.9.2";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "bolt";
repo = "bolt";
rev = version;
sha256 = "eXjj7oD5HOW/AG2uxDa0tSleKmbouFd2fwlL2HHFiMA=";
};
patches = [
# meson install tries to create /var/lib/boltd
./0001-skip-mkdir.patch
# Test does not work on ZFS with atime disabled.
# Upstream issue: https://gitlab.freedesktop.org/bolt/bolt/-/issues/167
(fetchpatch {
url = "https://gitlab.freedesktop.org/bolt/bolt/-/commit/c2f1d5c40ad71b20507e02faa11037b395fac2f8.diff";
revert = true;
sha256 = "6w7ll65W/CydrWAVi/qgzhrQeDv1PWWShulLxoglF+I=";
})
];
nativeBuildInputs = [
asciidoc
docbook_xml_dtd_45
docbook-xsl-nons
libxml2
libxslt
meson
ninja
pkg-config
] ++ lib.optional (!doCheck) python3;
buildInputs = [
glib
polkit
systemd
];
doCheck = true;
preCheck = ''
export LD_LIBRARY_PATH=${umockdev.out}/lib/
'';
checkInputs = [
dbus
gobject-introspection
umockdev
(python3.withPackages
(p: [ p.pygobject3 p.dbus-python p.python-dbusmock ]))
];
postPatch = ''
patchShebangs scripts tests
'';
mesonFlags = [
"-Dlocalstatedir=/var"
];
PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev";
meta = with lib; {
description = "Thunderbolt 3 device management daemon";
homepage = "https://gitlab.freedesktop.org/bolt/bolt";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ callahad ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,24 @@
{ stdenv, fetchFromGitHub, lib, libpcap, yascreen }:
stdenv.mkDerivation rec {
pname = "bpfmon";
version = "2.50";
src = fetchFromGitHub {
owner = "bbonev";
repo = "bpfmon";
rev = "v${version}";
sha256 = "sha256-x4EuGZBtg45bD9q1B/6KwjDRXXeRsdFmRllREsech+E=";
};
buildInputs = [ libpcap yascreen ];
makeFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
description = "BPF based visual packet rate monitor";
homepage = "https://github.com/bbonev/bpfmon";
maintainers = with maintainers; [ arezvov ];
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,38 @@
{ lib, stdenv
, libopcodes, libbfd, libelf, readline
, linuxPackages_latest, zlib
, python3, bison, flex
}:
stdenv.mkDerivation {
pname = "bpftools";
inherit (linuxPackages_latest.kernel) version src;
nativeBuildInputs = [ python3 bison flex ];
buildInputs = [ libopcodes libbfd libelf zlib readline ];
preConfigure = ''
patchShebangs scripts/bpf_doc.py
cd tools/bpf
substituteInPlace ./bpftool/Makefile \
--replace '/usr/local' "$out" \
--replace '/usr' "$out" \
--replace '/sbin' '/bin'
'';
buildFlags = [ "bpftool" "bpf_asm" "bpf_dbg" ];
installPhase = ''
make -C bpftool install
install -Dm755 -t $out/bin bpf_asm
install -Dm755 -t $out/bin bpf_dbg
'';
meta = with lib; {
description = "Debugging/program analysis tools for the eBPF subsystem";
license = [ licenses.gpl2 licenses.bsd2 ];
platforms = platforms.linux;
maintainers = with maintainers; [ thoughtpolice ];
};
}

View file

@ -0,0 +1,39 @@
diff -ur source/src/btf.cpp new/src/btf.cpp
--- source/src/btf.cpp 1970-01-01 09:00:01.000000000 +0900
+++ new/src/btf.cpp 2021-12-04 21:46:59.337023489 +0900
@@ -225,7 +225,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -496,7 +496,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -554,7 +554,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{
@@ -648,7 +648,7 @@
char err_buf[256];
int err;
- dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
+ dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
err = libbpf_get_error(dump);
if (err)
{

View file

@ -0,0 +1,81 @@
{ lib, stdenv, fetchFromGitHub
, cmake, pkg-config, flex, bison
, llvmPackages, elfutils
, libelf, libbfd, libbpf, libopcodes, bcc
, cereal, asciidoctor
, nixosTests
, util-linux
}:
stdenv.mkDerivation rec {
pname = "bpftrace";
version = "0.14.1";
# Cherry-picked from merged PR, remove this hook on next update
# https://github.com/iovisor/bpftrace/pull/2242
# Cannot `fetchpatch` such pure renaming diff since
# https://github.com/iovisor/bpftrace/commit/2df807dbae4037aa8bf0afc03f52fb3f6321c62a.patch
# does not contain any diff in unified format but just this instead:
# ...
# man/man8/{bashreadline.8 => bashreadline.bt.8} | 0
# ...
# 35 files changed, 0 insertions(+), 0 deletions(-)
# rename man/man8/{bashreadline.8 => bashreadline.bt.8} (100%)
# ...
# on witch `fetchpatch` fails with
# error: Normalized patch '/build/patch' is empty (while the fetched file was not)!
# Did you maybe fetch a HTML representation of a patch instead of a raw patch?
postUnpack = ''
rename .8 .bt.8 "$sourceRoot"/man/man8/*.8
'';
src = fetchFromGitHub {
owner = "iovisor";
repo = "bpftrace";
rev = "v${version}";
sha256 = "sha256-QDqHAEVM/XHCFMS0jMLdKJfDUOpkUqONOf8+Fbd5dCY=";
};
# libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
# btf_dump__new() but that's not valid c++.
# see https://github.com/iovisor/bpftrace/issues/2068
patches = [ ./btf-dump-new-0.6.0.patch ];
buildInputs = with llvmPackages;
[ llvm libclang
elfutils libelf bcc
libbpf libbfd libopcodes
cereal asciidoctor
];
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev util-linux ];
# tests aren't built, due to gtest shenanigans. see:
#
# https://github.com/iovisor/bpftrace/issues/161#issuecomment-453606728
# https://github.com/iovisor/bpftrace/pull/363
#
cmakeFlags =
[ "-DBUILD_TESTING=FALSE"
"-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
];
# nuke the example/reference output .txt files, for the included tools,
# stuffed inside $out. we don't need them at all.
postInstall = ''
rm -rf $out/share/bpftrace/tools/doc
'';
outputs = [ "out" "man" ];
passthru.tests = {
bpf = nixosTests.bpf;
};
meta = with lib; {
description = "High-level tracing language for Linux eBPF";
homepage = "https://github.com/iovisor/bpftrace";
license = licenses.asl20;
maintainers = with maintainers; [ rvl thoughtpolice martinetd ];
};
}

View file

@ -0,0 +1,21 @@
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@ dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
+AC_CHECK_TOOL([AR], [ar])
dnl Checks for header files.
AC_HEADER_STDC
--- a/libbridge/Makefile.in
+++ b/libbridge/Makefile.in
@@ -1,7 +1,7 @@
KERNEL_HEADERS=-I@KERNEL_HEADERS@
-AR=ar
+AR=@AR@
RANLIB=@RANLIB@
CC=@CC@

View file

@ -0,0 +1,22 @@
{ lib, stdenv, fetchurl, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "bridge-utils";
version = "1.7.1";
src = fetchurl {
url = "https://kernel.org/pub/linux/utils/net/bridge-utils/bridge-utils-${version}.tar.xz";
sha256 = "sha256-ph2L5PGhQFxgyO841UTwwYwFszubB+W0sxAzU2Fl5g4=";
};
patches = [ ./autoconf-ar.patch ];
nativeBuildInputs = [ autoreconfHook ];
meta = {
description = "An userspace tool to configure linux bridges (deprecated in favour or iproute2).";
homepage = "https://wiki.linuxfoundation.org/networking/bridge";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,34 @@
{ lib, stdenv, fetchFromGitLab , go-md2man, coreutils, substituteAll }:
stdenv.mkDerivation rec {
pname = "brillo";
version = "1.4.10";
src = fetchFromGitLab {
owner= "cameronnemo";
repo= "brillo";
rev= "v${version}";
sha256 = "sha256-x8K6CMkOyR+kWRlqa/BmJogZo41LvsL1kfz6CZ5PaUI=";
};
patches = [
(substituteAll {
src = ./udev-rule.patch;
inherit coreutils;
})
];
nativeBuildInputs = [ go-md2man ];
makeFlags = [ "PREFIX=$(out)" "AADIR=$(out)/etc/apparmor.d" ];
installTargets = [ "install-dist" ];
meta = with lib; {
description = "Backlight and Keyboard LED control tool";
homepage = "https://gitlab.com/cameronnemo/brillo";
license = [ licenses.gpl3 licenses.bsd0 ];
platforms = platforms.linux;
maintainers = [ maintainers.alexarice ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/contrib/udev.in b/contrib/udev.in
index 0625952..a6c940e 100644
--- a/contrib/udev.in
+++ b/contrib/udev.in
@@ -1,4 +1,4 @@
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp @group@ /sys/class/backlight/%k/brightness"
-ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
-ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp @group@ /sys/class/leds/%k/brightness"
-ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"
+ACTION=="add", SUBSYSTEM=="backlight", RUN+="@coreutils@/bin/chgrp @group@ /sys/class/backlight/%k/brightness"
+ACTION=="add", SUBSYSTEM=="backlight", RUN+="@coreutils@/bin/chmod g+w /sys/class/backlight/%k/brightness"
+ACTION=="add", SUBSYSTEM=="leds", RUN+="@coreutils@/bin/chgrp @group@ /sys/class/leds/%k/brightness"
+ACTION=="add", SUBSYSTEM=="leds", RUN+="@coreutils@/bin/chmod g+w /sys/class/leds/%k/brightness"

View file

@ -0,0 +1,71 @@
{ lib, stdenv, fetchurl, kernel }:
let
version = "6.30.223.271";
hashes = {
i686-linux = "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg";
x86_64-linux = "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz";
};
arch = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "_64";
tarballVersion = lib.replaceStrings ["."] ["_"] version;
tarball = "hybrid-v35${arch}-nodebug-pcoem-${tarballVersion}.tar.gz";
in
stdenv.mkDerivation {
name = "broadcom-sta-${version}-${kernel.version}";
src = fetchurl {
url = "https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/${tarball}";
sha256 = hashes.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
patches = [
./i686-build-failure.patch
./license.patch
./linux-4.7.patch
# source: https://git.archlinux.org/svntogit/community.git/tree/trunk/004-linux48.patch?h=packages/broadcom-wl-dkms
./linux-4.8.patch
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux411.patch?h=broadcom-wl
./linux-4.11.patch
# source: https://aur.archlinux.org/cgit/aur.git/tree/linux412.patch?h=broadcom-wl
./linux-4.12.patch
./linux-4.15.patch
./linux-5.1.patch
# source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
./linux-5.6.patch
# source: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
./linux-5.9.patch
# source: https://github.com/archlinux/svntogit-community/blob/5ec5b248976f84fcd7e3d7fae49ee91289912d12/trunk/012-linux517.patch
./linux-5.17.patch
./null-pointer-fix.patch
./gcc.patch
];
makeFlags = [ "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}" ];
unpackPhase = ''
sourceRoot=broadcom-sta
mkdir "$sourceRoot"
tar xvf "$src" -C "$sourceRoot"
'';
installPhase = ''
binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
docDir="$out/share/doc/broadcom-sta/"
mkdir -p "$binDir" "$docDir"
cp wl.ko "$binDir"
cp lib/LICENSE.txt "$docDir"
'';
meta = {
description = "Kernel module driver for some Broadcom's wireless cards";
homepage = "http://www.broadcom.com/support/802.11/linux_sta.php";
license = lib.licenses.unfreeRedistributable;
maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,11 @@
--- a/Makefile 2014-06-26 10:42:08.000000000 +0000
+++ b/Makefile 2014-07-17 22:44:01.662297228 +0000
@@ -126,6 +126,8 @@
EXTRA_CFLAGS += -I$(src)/src/shared/bcmwifi/include
#EXTRA_CFLAGS += -DBCMDBG_ASSERT -DBCMDBG_ERR
+EXTRA_CFLAGS += -Wno-date-time
+
EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
KBASE ?= /lib/modules/`uname -r`

View file

@ -0,0 +1,18 @@
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b
diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c
--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300
+++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200
@@ -932,7 +932,11 @@
uint cycles;
#if defined(__i386__)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
+ cycles = (u32)rdtsc();
+#else
rdtscl(cycles);
+#endif
#else
cycles = 0;
#endif

View file

@ -0,0 +1,13 @@
diff -Naur hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c
--- hybrid-portsrc-x86_32-v5_10_91_9.orig/src/wl/sys/wl_linux.c 2009-04-23 02:48:59.000000000 +0900
+++ hybrid-portsrc-x86_32-v5_10_91_9/src/wl/sys/wl_linux.c 2009-05-08 00:48:20.000000000 +0900
@@ -171,6 +171,8 @@
static void wl_free_if(wl_info_t *wl, wl_if_t *wlif);
static void wl_get_driver_info(struct net_device *dev, struct ethtool_drvinfo *info);
+MODULE_LICENSE("MIXED/Proprietary");
+
#if defined(WL_CONFIG_RFKILL)
#include <linux/rfkill.h>
static int wl_init_rfkill(wl_info_t *wl);

View file

@ -0,0 +1,52 @@
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index a9671e2..da36405 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -30,6 +30,9 @@
#include <linux/kthread.h>
#include <linux/netdevice.h>
#include <linux/ieee80211.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#include <linux/sched/signal.h>
+#endif
#include <net/cfg80211.h>
#include <linux/nl80211.h>
#include <net/rtnetlink.h>
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 489c9f5..f8278ad 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -117,6 +117,9 @@ int wl_found = 0;
typedef struct priv_link {
wl_if_t *wlif;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ unsigned long last_rx;
+#endif
} priv_link_t;
#define WL_DEV_IF(dev) ((wl_if_t*)((priv_link_t*)DEV_PRIV(dev))->wlif)
@@ -2450,6 +2453,9 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
{
struct sk_buff *oskb = (struct sk_buff *)p;
struct sk_buff *skb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ priv_link_t *priv_link;
+#endif
uchar *pdata;
uint len;
@@ -2916,7 +2922,13 @@ wl_monitor(wl_info_t *wl, wl_rxsts_t *rxsts, void *p)
if (skb == NULL) return;
skb->dev = wl->monitor_dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ priv_link = MALLOC(wl->osh, sizeof(priv_link_t));
+ priv_link = netdev_priv(skb->dev);
+ priv_link->last_rx = jiffies;
+#else
skb->dev->last_rx = jiffies;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
skb_reset_mac_header(skb);
#else

View file

@ -0,0 +1,68 @@
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index da36405..d3741eb 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -53,7 +53,11 @@ u32 wl_dbg_level = WL_DBG_ERR;
#endif
static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ enum nl80211_iftype type, struct vif_params *params);
+#else
enum nl80211_iftype type, u32 *flags, struct vif_params *params);
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
static s32
wl_cfg80211_scan(struct wiphy *wiphy,
@@ -466,7 +470,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
static s32
wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ enum nl80211_iftype type,
+#else
enum nl80211_iftype type, u32 *flags,
+#endif
struct vif_params *params)
{
struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
@@ -2361,6 +2369,20 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
{
struct wl_cfg80211_connect_info *conn_info = wl_to_conn(wl);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ struct cfg80211_bss *bss;
+ struct wlc_ssid *ssid;
+ ssid = &wl->profile->ssid;
+ bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
+ ssid->SSID, ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+ struct cfg80211_roam_info roam_info = {
+ .bss = bss,
+ .req_ie = conn_info->req_ie,
+ .req_ie_len = conn_info->req_ie_len,
+ .resp_ie = conn_info->resp_ie,
+ .resp_ie_len = conn_info->resp_ie_len,
+ };
+#endif
s32 err = 0;
wl_get_assoc_ies(wl);
@@ -2368,12 +2390,17 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
wl_update_bss_info(wl);
cfg80211_roamed(ndev,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ &roam_info,
+#else
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
&wl->conf->channel,
#endif
(u8 *)&wl->bssid,
conn_info->req_ie, conn_info->req_ie_len,
- conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
+ conn_info->resp_ie, conn_info->resp_ie_len,
+#endif
+ GFP_KERNEL);
WL_DBG(("Report roaming result\n"));
set_bit(WL_STATUS_CONNECTED, &wl->status);

View file

@ -0,0 +1,47 @@
See: https://lkml.org/lkml/2017/11/25/90
diff -urNZ a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
--- a/src/wl/sys/wl_linux.c 2015-09-18 22:47:30.000000000 +0000
+++ b/src/wl/sys/wl_linux.c 2018-01-31 22:52:10.859856221 +0000
@@ -93,7 +93,11 @@
#include <wlc_wowl.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+static void wl_timer(struct timer_list *tl);
+#else
static void wl_timer(ulong data);
+#endif
static void _wl_timer(wl_timer_t *t);
static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
@@ -2298,9 +2302,15 @@
}
static void
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+wl_timer(struct timer_list *tl)
+{
+ wl_timer_t *t = from_timer(t, tl, timer);
+#else
wl_timer(ulong data)
{
wl_timer_t *t = (wl_timer_t *)data;
+#endif
if (!WL_ALL_PASSIVE_ENAB(t->wl))
_wl_timer(t);
@@ -2352,9 +2362,13 @@
bzero(t, sizeof(wl_timer_t));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+ timer_setup(&t->timer, wl_timer, 0);
+#else
init_timer(&t->timer);
t->timer.data = (ulong) t;
t->timer.function = wl_timer;
+#endif
t->wl = wl;
t->fn = fn;
t->arg = arg;

View file

@ -0,0 +1,109 @@
Since Linux 4.7, the enum ieee80211_band is no longer used
This shall cause no problem's since both enums ieee80211_band
and nl80211_band were added in the same commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
Reference:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500
+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500
@@ -236,7 +236,7 @@
#endif
#define CHAN2G(_channel, _freq, _flags) { \
- .band = IEEE80211_BAND_2GHZ, \
+ .band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -245,7 +245,7 @@
}
#define CHAN5G(_channel, _flags) { \
- .band = IEEE80211_BAND_5GHZ, \
+ .band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -379,7 +379,7 @@
};
static struct ieee80211_supported_band __wl_band_2ghz = {
- .band = IEEE80211_BAND_2GHZ,
+ .band = NL80211_BAND_2GHZ,
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
@@ -387,7 +387,7 @@
};
static struct ieee80211_supported_band __wl_band_5ghz_a = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
@@ -395,7 +395,7 @@
};
static struct ieee80211_supported_band __wl_band_5ghz_n = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_n_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
.bitrates = wl_a_rates,
@@ -1876,8 +1876,8 @@
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
#endif
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = __wl_cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -2000,7 +2000,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
#endif
@@ -2116,7 +2116,7 @@
return err;
}
chan = wf_chspec_ctlchan(chanspec);
- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
freq = ieee80211_channel_to_frequency(chan, band);
channel = ieee80211_get_channel(wiphy, freq);
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
@@ -2250,10 +2250,10 @@
join_params->params.chanspec_list[0] =
ieee80211_frequency_to_channel(chan->center_freq);
- if (chan->band == IEEE80211_BAND_2GHZ) {
+ if (chan->band == NL80211_BAND_2GHZ) {
chanspec |= WL_CHANSPEC_BAND_2G;
}
- else if (chan->band == IEEE80211_BAND_5GHZ) {
+ else if (chan->band == NL80211_BAND_5GHZ) {
chanspec |= WL_CHANSPEC_BAND_5G;
}
else {
@@ -2885,7 +2885,7 @@
if (phy == 'n' || phy == 'a' || phy == 'v') {
wiphy = wl_to_wiphy(wl);
- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
}
return err;

View file

@ -0,0 +1,64 @@
From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Fri, 2 Sep 2016 17:35:34 +0200
Subject: [PATCH 1/1] Add support for Linux 4.8
Orginal author: Krzysztof Kolasa
---
src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 2fc71fe..ec5e472 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
s32 err = 0;
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}
@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
scan_done_out:
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = false,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, false);
+#endif
wl->scan_request = NULL;
}
rtnl_unlock();
@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
s32 err = 0;
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}
--
2.7.4

View file

@ -0,0 +1,32 @@
commit bcb06af629a36eb84f9a35ac599ec7e51e2d39fb
Author: georgewhewell <georgerw@gmail.com>
Date: Sat May 18 21:22:37 2019 +0100
find src -type f -name \'*.c\' -exec sed -i "s/get_ds()/KERNEL_DS/g" {} \;
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 7b606e0..51c81bc 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -450,7 +450,7 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
ifr.ifr_data = (caddr_t)&ioc;
fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
#if defined(WL_USE_NETDEV_OPS)
err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
#else
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
index c4c610b..9c3c74e 100644
--- a/src/wl/sys/wl_iw.c
+++ b/src/wl/sys/wl_iw.c
@@ -117,7 +117,7 @@ dev_wlc_ioctl(
ifr.ifr_data = (caddr_t) &ioc;
fs = get_fs();
- set_fs(get_ds());
+ set_fs(KERNEL_DS);
#if defined(WL_USE_NETDEV_OPS)
ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
#else

View file

@ -0,0 +1,39 @@
diff -u -r a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
--- a/src/wl/sys/wl_linux.c 2022-03-23 00:35:42.930416350 +0000
+++ b/src/wl/sys/wl_linux.c 2022-03-23 00:40:12.903771013 +0000
@@ -2980,7 +2980,11 @@
else
dev->type = ARPHRD_IEEE80211_RADIOTAP;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
bcopy(wl->dev->dev_addr, dev->dev_addr, ETHER_ADDR_LEN);
+#else
+ eth_hw_addr_set(wl->dev, dev->dev_addr);
+#endif
#if defined(WL_USE_NETDEV_OPS)
dev->netdev_ops = &wl_netdev_monitor_ops;
@@ -3261,7 +3265,11 @@
static ssize_t
wl_proc_read(struct file *filp, char __user *buffer, size_t length, loff_t *offp)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
wl_info_t * wl = PDE_DATA(file_inode(filp));
+#else
+ wl_info_t * wl = pde_data(file_inode(filp));
+#endif
#endif
int bcmerror, len;
int to_user = 0;
@@ -3318,7 +3326,11 @@
static ssize_t
wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t *offp)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
wl_info_t * wl = PDE_DATA(file_inode(filp));
+#else
+ wl_info_t * wl = pde_data(file_inode(filp));
+#endif
#endif
int from_user = 0;
int bcmerror;

View file

@ -0,0 +1,87 @@
From dd057e40a167f4febb1a7c77dd32b7d36056952c Mon Sep 17 00:00:00 2001
From: Herman van Hazendonk <github.com@herrie.org>
Date: Tue, 31 Mar 2020 17:09:55 +0200
Subject: [PATCH] Add fixes for 5.6 kernel
Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
---
src/shared/linux_osl.c | 6 +++++-
src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
index 6157d18..dcfc075 100644
--- a/src/shared/linux_osl.c
+++ b/src/shared/linux_osl.c
@@ -942,7 +942,11 @@ osl_getcycles(void)
void *
osl_reg_map(uint32 pa, uint size)
{
- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ return (ioremap((unsigned long)pa, (unsigned long)size));
+ #else
+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
}
void
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 0d05100..6d9dd0d 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -582,10 +582,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
}
wl->bcm_bustype = bustype;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
+ goto fail;
+ }
+ #else
if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
WL_ERROR(("wl%d: ioremap() failed\n", unit));
goto fail;
}
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
wl->bar1_addr = bar1_addr;
wl->bar1_size = bar1_size;
@@ -772,8 +779,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
bar1_size = pci_resource_len(pdev, 2);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+ bar1_size);
+ #else
bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
bar1_size);
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
pdev->irq, bar1_addr, bar1_size);
@@ -3335,12 +3347,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+static const struct proc_ops wl_fops = {
+ .proc_read = wl_proc_read,
+ .proc_write = wl_proc_write,
+};
+#else
static const struct file_operations wl_fops = {
.owner = THIS_MODULE,
.read = wl_proc_read,
.write = wl_proc_write,
};
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
static int
wl_reg_proc_entry(wl_info_t *wl)

View file

@ -0,0 +1,184 @@
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 4b3298f..c45ad48 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -41,6 +41,7 @@
#include <wlioctl.h>
#include <proto/802.11.h>
#include <wl_cfg80211_hybrid.h>
+#include <wl_linux.h>
#define EVENT_TYPE(e) dtoh32((e)->event_type)
#define EVENT_FLAGS(e) dtoh16((e)->flags)
@@ -442,30 +443,7 @@ static void key_endian_to_host(struct wl_wsec_key *key)
static s32
wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
{
- struct ifreq ifr;
- struct wl_ioctl ioc;
- mm_segment_t fs;
- s32 err = 0;
-
- BUG_ON(len < sizeof(int));
-
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
- strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t)&ioc;
-
- fs = get_fs();
- set_fs(KERNEL_DS);
-#if defined(WL_USE_NETDEV_OPS)
- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#else
- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#endif
- set_fs(fs);
-
- return err;
+ return wlc_ioctl_internal(dev, cmd, arg, len);
}
static s32
diff --git a/src/wl/sys/wl_iw.c b/src/wl/sys/wl_iw.c
index 9c3c74e..e346b15 100644
--- a/src/wl/sys/wl_iw.c
+++ b/src/wl/sys/wl_iw.c
@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
#include <wl_dbg.h>
#include <wl_iw.h>
+#include <wl_linux.h>
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
uint32 reason, char* stringBuf, uint buflen);
@@ -103,29 +104,7 @@ dev_wlc_ioctl(
int len
)
{
- struct ifreq ifr;
- wl_ioctl_t ioc;
- mm_segment_t fs;
- int ret;
-
- memset(&ioc, 0, sizeof(ioc));
- ioc.cmd = cmd;
- ioc.buf = arg;
- ioc.len = len;
-
- strcpy(ifr.ifr_name, dev->name);
- ifr.ifr_data = (caddr_t) &ioc;
-
- fs = get_fs();
- set_fs(KERNEL_DS);
-#if defined(WL_USE_NETDEV_OPS)
- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#else
- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
-#endif
- set_fs(fs);
-
- return ret;
+ return wlc_ioctl_internal(dev, cmd, arg, len);
}
static int
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index c990c70..5bb9480 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -1664,10 +1664,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
goto done2;
}
- if (segment_eq(get_fs(), KERNEL_DS))
- buf = ioc.buf;
-
- else if (ioc.buf) {
+ if (ioc.buf) {
if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
bcmerror = BCME_NORESOURCE;
goto done2;
@@ -1688,7 +1685,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
WL_UNLOCK(wl);
done1:
- if (ioc.buf && (ioc.buf != buf)) {
+ if (ioc.buf) {
if (copy_to_user(ioc.buf, buf, ioc.len))
bcmerror = BCME_BADADDR;
MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
@@ -1701,6 +1698,39 @@ done2:
return (OSL_ERROR(bcmerror));
}
+int
+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
+{
+ wl_info_t *wl;
+ wl_if_t *wlif;
+ int bcmerror;
+
+ if (!dev)
+ return -ENETDOWN;
+
+ wl = WL_INFO(dev);
+ wlif = WL_DEV_IF(dev);
+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
+ return -ENETDOWN;
+
+ bcmerror = 0;
+
+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
+
+ WL_LOCK(wl);
+ if (!capable(CAP_NET_ADMIN)) {
+ bcmerror = BCME_EPERM;
+ } else {
+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
+ }
+ WL_UNLOCK(wl);
+
+ ASSERT(VALID_BCMERROR(bcmerror));
+ if (bcmerror != 0)
+ wl->pub->bcmerror = bcmerror;
+ return (OSL_ERROR(bcmerror));
+}
+
static struct net_device_stats*
wl_get_stats(struct net_device *dev)
{
diff --git a/src/wl/sys/wl_linux.h b/src/wl/sys/wl_linux.h
index 5b1048e..c8c1f41 100644
--- a/src/wl/sys/wl_linux.h
+++ b/src/wl/sys/wl_linux.h
@@ -22,6 +22,7 @@
#define _wl_linux_h_
#include <wlc_types.h>
+#include <wlc_pub.h>
typedef struct wl_timer {
struct timer_list timer;
@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
extern void wl_free(wl_info_t *wl);
extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
extern struct net_device * wl_netdev_get(wl_info_t *wl);
#endif
diff --git a/src/wl/sys/wlc_pub.h b/src/wl/sys/wlc_pub.h
index 53a98b8..2b5a029 100644
--- a/src/wl/sys/wlc_pub.h
+++ b/src/wl/sys/wlc_pub.h
@@ -24,6 +24,7 @@
#include <wlc_types.h>
#include <wlc_utils.h>
+#include <siutils.h>
#include "proto/802.11.h"
#include "proto/bcmevent.h"

View file

@ -0,0 +1,13 @@
diff -urN a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
--- a/src/wl/sys/wl_linux.c 2015-01-06 12:33:42.981659618 +0100
+++ b/src/wl/sys/wl_linux.c 2015-01-06 12:34:05.647395418 +0100
@@ -2157,8 +2157,8 @@
wlif = WL_DEV_IF(dev);
wl = WL_INFO(dev);
+ skb->prev = NULL;
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
- skb->prev = NULL;
TXQ_LOCK(wl);

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config
, python3, boost, fuse, libtorrent-rasterbar, curl }:
stdenv.mkDerivation rec {
pname = "btfs";
version = "2.24";
src = fetchFromGitHub {
owner = "johang";
repo = pname;
rev = "v${version}";
sha256 = "sha256-fkS0U/MqFRQNi+n7NE4e1cnNICvfST2IQ9FMoJUyj6w=";
};
nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = [
boost fuse libtorrent-rasterbar curl python3
];
meta = with lib; {
description = "A bittorrent filesystem based on FUSE";
homepage = "https://github.com/johang/btfs";
license = licenses.gpl3;
maintainers = with maintainers; [ rnhmjoj ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,23 @@
Allow BusyBox to be invoked as "<something>-busybox". This is
necessary when it's run from the Nix store as <hash>-busybox during
stdenv bootstrap.
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -947,7 +947,7 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar
static NORETURN void run_applet_and_exit(const char *name, char **argv)
{
# if ENABLE_BUSYBOX
- if (is_prefixed_with(name, "busybox"))
+ if (strstr(name, "busybox") != 0)
exit(busybox_main(/*unused:*/ 0, argv));
# endif
# if NUM_APPLETS > 0
@@ -1045,7 +1045,7 @@ int main(int argc UNUSED_PARAM, char **argv)
lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
# if !ENABLE_BUSYBOX
- if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox"))
+ if (argv[1] && strstr(bb_basename(argv[0]), "busybox") != 0)
argv++;
# endif
applet_name = argv[0];

View file

@ -0,0 +1,37 @@
diff --git a/Makefile b/Makefile
index 6fedcffba..3385836c4 100644
--- a/Makefile
+++ b/Makefile
@@ -271,8 +271,8 @@ export quiet Q KBUILD_VERBOSE
# Look for make include files relative to root of kernel src
MAKEFLAGS += --include-dir=$(srctree)
-HOSTCC = gcc
-HOSTCXX = g++
+HOSTCC = cc
+HOSTCXX = c++
HOSTCFLAGS :=
HOSTCXXFLAGS :=
# We need some generic definitions
@@ -289,7 +289,7 @@ MAKEFLAGS += -rR
# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
-CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)cc
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA
index f155108d7..185257064 100644
--- a/scripts/Makefile.IMA
+++ b/scripts/Makefile.IMA
@@ -39,7 +39,7 @@ ifndef HOSTCC
HOSTCC = cc
endif
AS = $(CROSS_COMPILE)as
-CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)cc
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar

View file

@ -0,0 +1,170 @@
{ stdenv, lib, buildPackages, fetchurl, fetchFromGitLab
, enableStatic ? stdenv.hostPlatform.isStatic
, enableMinimal ? false
, enableAppletSymlinks ? true
# Allow forcing musl without switching stdenv itself, e.g. for our bootstrapping:
# nix build -f pkgs/top-level/release.nix stdenvBootstrapTools.x86_64-linux.dist
, useMusl ? stdenv.hostPlatform.libc == "musl", musl
, extraConfig ? ""
}:
assert stdenv.hostPlatform.libc == "musl" -> useMusl;
let
configParser = ''
function parseconfig {
while read LINE; do
NAME=`echo "$LINE" | cut -d \ -f 1`
OPTION=`echo "$LINE" | cut -d \ -f 2`
if ! [[ "$NAME" =~ ^CONFIG_ ]]; then continue; fi
echo "parseconfig: removing $NAME"
sed -i /$NAME'\(=\| \)'/d .config
echo "parseconfig: setting $NAME=$OPTION"
echo "$NAME=$OPTION" >> .config
done
}
'';
libcConfig = lib.optionalString useMusl ''
CONFIG_FEATURE_UTMP n
CONFIG_FEATURE_WTMP n
'';
# The debian version lags behind the upstream version and also contains
# a debian-specific suffix. We only fetch the debian repository to get the
# default.script
debianVersion = "1.30.1-6";
debianSource = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "installer-team";
repo = "busybox";
rev = "debian/1%${debianVersion}";
sha256 = "sha256-6r0RXtmqGXtJbvLSD1Ma1xpqR8oXL2bBKaUE/cSENL8=";
};
debianDispatcherScript = "${debianSource}/debian/tree/udhcpc/etc/udhcpc/default.script";
outDispatchPath = "$out/default.script";
in
stdenv.mkDerivation rec {
pname = "busybox";
version = "1.35.0";
# Note to whoever is updating busybox: please verify that:
# nix-build pkgs/stdenv/linux/make-bootstrap-tools.nix -A test
# still builds after the update.
src = fetchurl {
url = "https://busybox.net/downloads/${pname}-${version}.tar.bz2";
sha256 = "sha256-+u6yRMNaNIozT0pZ5EYm7ocPsHtohNaMEK6LwZ+DppQ=";
};
hardeningDisable = [ "format" "pie" ]
++ lib.optionals enableStatic [ "fortify" ];
patches = [
./busybox-in-store.patch
(fetchurl {
name = "CVE-2022-28391.patch";
url = "https://git.alpinelinux.org/aports/plain/main/busybox/0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch?id=ed92963eb55bbc8d938097b9ccb3e221a94653f4";
sha256 = "sha256-yviw1GV+t9tbHbY7YNxEqPi7xEreiXVqbeRyf8c6Awo=";
})
(fetchurl {
name = "CVE-2022-28391.patch";
url = "https://git.alpinelinux.org/aports/plain/main/busybox/0002-nslookup-sanitize-all-printed-strings-with-printable.patch?id=ed92963eb55bbc8d938097b9ccb3e221a94653f4";
sha256 = "sha256-vl1wPbsHtXY9naajjnTicQ7Uj3N+EQ8pRNnrdsiow+w=";
})
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./clang-cross.patch;
separateDebugInfo = true;
postPatch = "patchShebangs .";
configurePhase = ''
export KCONFIG_NOTIMESTAMP=1
make ${if enableMinimal then "allnoconfig" else "defconfig"}
${configParser}
cat << EOF | parseconfig
CONFIG_PREFIX "$out"
CONFIG_INSTALL_NO_USR y
CONFIG_LFS y
# More features for modprobe.
${lib.optionalString (!enableMinimal) ''
CONFIG_FEATURE_MODPROBE_BLACKLIST y
CONFIG_FEATURE_MODUTILS_ALIAS y
CONFIG_FEATURE_MODUTILS_SYMBOLS y
CONFIG_MODPROBE_SMALL n
''}
${lib.optionalString enableStatic ''
CONFIG_STATIC y
''}
${lib.optionalString (!enableAppletSymlinks) ''
CONFIG_INSTALL_APPLET_DONT y
CONFIG_INSTALL_APPLET_SYMLINKS n
''}
# Use the external mount.cifs program.
CONFIG_FEATURE_MOUNT_CIFS n
CONFIG_FEATURE_MOUNT_HELPERS y
# Set paths for console fonts.
CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
# Bump from 4KB, much faster I/O
CONFIG_FEATURE_COPYBUF_KB 64
# Set the path for the udhcpc script
CONFIG_UDHCPC_DEFAULT_SCRIPT "${outDispatchPath}"
${extraConfig}
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.targetPrefix}"
${libcConfig}
EOF
make oldconfig
runHook postConfigure
'';
postConfigure = lib.optionalString (useMusl && stdenv.hostPlatform.libc != "musl") ''
makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}cc -isystem ${musl.dev}/include -B${musl}/lib -L${musl}/lib")
'';
makeFlags = [ "SKIP_STRIP=y" ];
postInstall = ''
sed -e '
1 a busybox() { '$out'/bin/busybox "$@"; }\
logger() { '$out'/bin/logger "$@"; }\
' ${debianDispatcherScript} > ${outDispatchPath}
chmod 555 ${outDispatchPath}
HOST_PATH=$out/bin patchShebangs --host ${outDispatchPath}
'';
strictDeps = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
buildInputs = lib.optionals (enableStatic && !useMusl && stdenv.cc.libc ? static) [ stdenv.cc.libc stdenv.cc.libc.static ];
enableParallelBuilding = true;
doCheck = false; # tries to access the net
meta = with lib; {
description = "Tiny versions of common UNIX utilities in a single small executable";
homepage = "https://busybox.net/";
license = licenses.gpl2Only;
maintainers = with maintainers; [ TethysSvensson qyliss ];
platforms = platforms.linux;
priority = 10;
};
}

View file

@ -0,0 +1,26 @@
{ busybox}:
# Minimal shell for use as basic /bin/sh in sandbox builds
busybox.override {
enableStatic = true;
enableMinimal = true;
extraConfig = ''
CONFIG_FEATURE_FANCY_ECHO y
CONFIG_FEATURE_SH_MATH y
CONFIG_FEATURE_SH_MATH_64 y
CONFIG_FEATURE_TEST_64 y
CONFIG_ASH y
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
CONFIG_ASH_ALIAS y
CONFIG_ASH_BASH_COMPAT y
CONFIG_ASH_CMDCMD y
CONFIG_ASH_ECHO y
CONFIG_ASH_GETOPTS y
CONFIG_ASH_INTERNAL_GLOB y
CONFIG_ASH_JOB_CONTROL y
CONFIG_ASH_PRINTF y
CONFIG_ASH_TEST y
'';
}

View file

@ -0,0 +1,25 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "cachefilesd";
version = "0.10.10";
src = fetchurl {
url = "https://people.redhat.com/dhowells/fscache/${pname}-${version}.tar.bz2";
sha256 = "00hsw4cdlm13wijlygp8f0aq6gxdp0skbxs9r2vh5ggs3s2hj0qd";
};
installFlags = [
"ETCDIR=$(out)/etc"
"SBINDIR=$(out)/sbin"
"MANDIR=$(out)/share/man"
];
meta = with lib; {
description = "Local network file caching management daemon";
homepage = "https://people.redhat.com/dhowells/fscache/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, kernel, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "can-isotp";
version = "20200910";
hardeningDisable = [ "pic" ];
src = fetchFromGitHub {
owner = "hartkopp";
repo = "can-isotp";
rev = "21a3a59e2bfad246782896841e7af042382fcae7";
sha256 = "1laax93czalclg7cy9iq1r7hfh9jigh7igj06y9lski75ap2vhfq";
};
makeFlags = kernel.makeFlags ++ [
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"INSTALL_MOD_PATH=${placeholder "out"}"
];
buildFlags = [ "modules" ];
installTargets = [ "modules_install" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
meta = with lib; {
description = "Kernel module for ISO-TP (ISO 15765-2)";
homepage = "https://github.com/hartkopp/can-isotp";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = [ maintainers.evck ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "can-utils";
# There are no releases (source archives or git tags), so use the date of the
# latest commit in git master as version number.
version = "20170830";
src = fetchFromGitHub {
owner = "linux-can";
repo = "can-utils";
rev = "5b518a0a5fa56856f804372a6b99b518dedb5386";
sha256 = "1ygzp8rjr8f1gs48mb1pz7psdgbfhlvr6kjdnmzbsqcml06zvrpr";
};
# Fixup build with newer Linux headers.
postPatch = ''
sed '1i#include <linux/sockios.h>' -i \
slcanpty.c cansniffer.c canlogserver.c isotpdump.c isotpsniffer.c isotpperf.c
'';
preConfigure = ''makeFlagsArray+=(PREFIX="$out")'';
meta = with lib; {
description = "CAN userspace utilities and tools (for use with Linux SocketCAN)";
homepage = "https://github.com/linux-can/can-utils";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}

View file

@ -0,0 +1,47 @@
{ lib, rustPlatform, fetchFromGitHub
, fetchpatch
, fuse
, pkg-config
}:
rustPlatform.buildRustPackage rec {
pname = "catfs";
version = "unstable-2020-03-21";
src = fetchFromGitHub {
owner = "kahing";
repo = pname;
rev = "daa2b85798fa8ca38306242d51cbc39ed122e271";
sha256 = "0zca0c4n2p9s5kn8c9f9lyxdf3df88a63nmhprpgflj86bh8wgf5";
};
cargoSha256 = "1agcwq409s40kyij487wjrp8mj7942r9l2nqwks4xqlfb0bvaimf";
cargoPatches = [
# update cargo lock
(fetchpatch {
url = "https://github.com/kahing/catfs/commit/f838c1cf862cec3f1d862492e5be82b6dbe16ac5.patch";
sha256 = "1r1p0vbr3j9xyj9r1ahipg4acii3m4ni4m9mp3avbi1rfgzhblhw";
})
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ fuse ];
# require fuse module to be active to run tests
# instead, run command
doCheck = false;
doInstallCheck = true;
installCheckPhase = ''
$out/bin/catfs --help > /dev/null
'';
meta = with lib; {
description = "Caching filesystem written in Rust";
homepage = "https://github.com/kahing/catfs";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ jonringer ];
};
}

View file

@ -0,0 +1,43 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, makeWrapper
, gawk
}:
stdenv.mkDerivation rec {
pname = "cfs-zen-tweaks";
version = "1.2.0";
src = fetchFromGitHub {
owner = "igo95862";
repo = "cfs-zen-tweaks";
rev = version;
sha256 = "HRR2tdjNmWyrpbcMlihSdb/7g/tHma3YyXogQpRCVyo=";
};
postPatch = ''
patchShebangs set-cfs-zen-tweaks.bash
chmod +x set-cfs-zen-tweaks.bash
substituteInPlace set-cfs-zen-tweaks.bash \
--replace '$(gawk' '$(${gawk}/bin/gawk'
'';
buildInputs = [
gawk
];
nativeBuildInputs = [
cmake
makeWrapper
];
meta = with lib; {
description = "Tweak Linux CPU scheduler for desktop responsiveness";
homepage = "https://github.com/igo95862/cfs-zen-tweaks";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = with maintainers; [ mkg20001 ];
};
}

View file

@ -0,0 +1,24 @@
{ lib, stdenv, fetchurl, bison, flex, libsepol }:
stdenv.mkDerivation rec {
pname = "checkpolicy";
version = "3.3";
inherit (libsepol) se_url;
src = fetchurl {
url = "${se_url}/${version}/checkpolicy-${version}.tar.gz";
sha256 = "118l8c2vvnnckbd269saslr7adv6rdavr5rv0z5vh2m1lgglxj15";
};
nativeBuildInputs = [ bison flex ];
buildInputs = [ libsepol ];
makeFlags = [
"PREFIX=$(out)"
"LIBSEPOLA=${lib.getLib libsepol}/lib/libsepol.a"
];
meta = removeAttrs libsepol.meta ["outputsToInstall"] // {
description = "SELinux policy compiler";
};
}

View file

@ -0,0 +1,24 @@
From 5cfb08effd21d9278e3eb8901c85112a331c3181 Mon Sep 17 00:00:00 2001
From: Austin Seipp <aseipp@pobox.com>
Date: Tue, 26 Oct 2021 09:23:07 +0000
Subject: [PATCH] attempt to 'modprobe config' before checking kernel
---
checksec | 1 +
1 file changed, 1 insertion(+)
diff --git a/checksec b/checksec
index 5536250..895073b 100755
--- a/checksec
+++ b/checksec
@@ -1059,6 +1059,7 @@ kernelcheck() {
echo_message " options that harden the kernel itself against attack.\n\n" '' '' ''
echo_message " Kernel config:\n" '' '' '{ "kernel": '
+ modprobe configs 2> /dev/null
if [[ ! "${1}" == "" ]]; then
kconfig="cat ${1}"
echo_message " Warning: The config ${1} on disk may not represent running kernel config!\n\n" "${1}" "<kernel config=\"${1}\"" "{ \"KernelConfig\":\"${1}\""
--
2.33.0

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper, file, findutils
, binutils-unwrapped, glibc, coreutils, sysctl, openssl
}:
stdenv.mkDerivation rec {
pname = "checksec";
version = "2.5.0";
src = fetchFromGitHub {
owner = "slimm609";
repo = "checksec.sh";
rev = version;
sha256 = "sha256-GxWXocz+GCEssRrIQP6E9hjVIhVh2EmZrefELxQlV1Q=";
};
patches = [ ./0001-attempt-to-modprobe-config-before-checking-kernel.patch ];
nativeBuildInputs = [ makeWrapper ];
installPhase = let
path = lib.makeBinPath [
findutils file binutils-unwrapped sysctl openssl
];
in ''
mkdir -p $out/bin
install checksec $out/bin
substituteInPlace $out/bin/checksec --replace /lib/libc.so.6 ${glibc.out}/lib/libc.so.6
substituteInPlace $out/bin/checksec --replace "/usr/bin/id -" "${coreutils}/bin/id -"
wrapProgram $out/bin/checksec \
--prefix PATH : ${path}
'';
meta = with lib; {
description = "A tool for checking security bits on executables";
homepage = "https://www.trapkit.de/tools/checksec/";
license = licenses.bsd3;
platforms = platforms.linux;
maintainers = with maintainers; [ thoughtpolice globin ];
};
}

View file

@ -0,0 +1,8 @@
{ fetchFromGitiles }:
fetchFromGitiles {
name = "chromium-xorg-conf";
url = "https://chromium.googlesource.com/chromiumos/platform/xorg-conf";
rev = "26fb9d57e195c7e467616b35b17e2b5d279c1514";
sha256 = "0643y3l3hjk4mv4lm3h9z56h990q6k11hcr10lcqppgsii0d3zcf";
}

View file

@ -0,0 +1,29 @@
{ stdenv, lib, fetchurl, autoreconfHook, docutils, pkg-config
, libkrb5, keyutils, pam, talloc, python3 }:
stdenv.mkDerivation rec {
pname = "cifs-utils";
version = "6.15";
src = fetchurl {
url = "mirror://samba/pub/linux-cifs/cifs-utils/${pname}-${version}.tar.bz2";
sha256 = "sha256-p7aUDpMlDBZ2pvpmturZG3jNQ6X+6ZzEYkWci5zx5vQ=";
};
nativeBuildInputs = [ autoreconfHook docutils pkg-config ];
buildInputs = [ libkrb5 keyutils pam talloc python3 ];
configureFlags = [ "ROOTSBINDIR=$(out)/sbin" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# AC_FUNC_MALLOC is broken on cross builds.
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];
meta = with lib; {
homepage = "https://wiki.samba.org/index.php/LinuxCIFS_utils";
description = "Tools for managing Linux CIFS client filesystems";
platforms = platforms.linux;
license = licenses.lgpl3;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, btrfs-progs }:
stdenv.mkDerivation rec {
pname = "compsize";
version = "1.5";
src = fetchFromGitHub {
owner = "kilobyte";
repo = pname;
rev = "v${version}";
sha256 = "sha256-OX41ChtHX36lVRL7O2gH21Dfw6GPPEClD+yafR/PFm8=";
};
buildInputs = [ btrfs-progs ];
installFlags = [
"PREFIX=${placeholder "out"}"
];
preInstall = ''
mkdir -p $out/share/man/man8
'';
meta = with lib; {
description = "btrfs: Find compression type/ratio on a file or set of files";
homepage = "https://github.com/kilobyte/compsize";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ CrazedProgrammer ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,147 @@
{ config, lib, stdenv, fetchFromGitHub, pkg-config, cmake
# dependencies
, glib, libXinerama, catch2
# optional features without extra dependencies
, mpdSupport ? true
, ibmSupport ? true # IBM/Lenovo notebooks
# optional features with extra dependencies
# ouch, this is ugly, but this gives the man page
, docsSupport ? true, docbook2x, libxslt ? null
, man ? null, less ? null
, docbook_xsl ? null , docbook_xml_dtd_44 ? null
, ncursesSupport ? true , ncurses ? null
, x11Support ? true , xlibsWrapper ? null
, xdamageSupport ? x11Support, libXdamage ? null
, doubleBufferSupport ? x11Support
, imlib2Support ? x11Support, imlib2 ? null
, luaSupport ? true , lua ? null
, luaImlib2Support ? luaSupport && imlib2Support
, luaCairoSupport ? luaSupport && x11Support, cairo ? null
, toluapp ? null
, wirelessSupport ? true , wirelesstools ? null
, nvidiaSupport ? false , libXNVCtrl ? null
, pulseSupport ? config.pulseaudio or false, libpulseaudio ? null
, curlSupport ? true , curl ? null
, rssSupport ? curlSupport
, weatherMetarSupport ? curlSupport
, weatherXoapSupport ? curlSupport
, journalSupport ? true, systemd ? null
, libxml2 ? null
}:
assert docsSupport -> docbook2x != null && libxslt != null
&& man != null && less != null
&& docbook_xsl != null && docbook_xml_dtd_44 != null;
assert ncursesSupport -> ncurses != null;
assert x11Support -> xlibsWrapper != null;
assert xdamageSupport -> x11Support && libXdamage != null;
assert imlib2Support -> x11Support && imlib2 != null;
assert luaSupport -> lua != null;
assert luaImlib2Support -> luaSupport && imlib2Support
&& toluapp != null;
assert luaCairoSupport -> luaSupport && toluapp != null
&& cairo != null;
assert luaCairoSupport || luaImlib2Support
-> lua.luaversion == "5.3";
assert wirelessSupport -> wirelesstools != null;
assert nvidiaSupport -> libXNVCtrl != null;
assert pulseSupport -> libpulseaudio != null;
assert curlSupport -> curl != null;
assert rssSupport -> curlSupport && libxml2 != null;
assert weatherMetarSupport -> curlSupport;
assert weatherXoapSupport -> curlSupport && libxml2 != null;
assert journalSupport -> systemd != null;
with lib;
stdenv.mkDerivation rec {
pname = "conky";
version = "1.12.2";
src = fetchFromGitHub {
owner = "brndnmtthws";
repo = "conky";
rev = "v${version}";
sha256 = "sha256-x6bR5E5LIvKWiVM15IEoUgGas/hcRp3F/O4MTOhVPb8=";
};
postPatch = ''
sed -i -e '/include.*CheckIncludeFile)/i include(CheckIncludeFiles)' \
cmake/ConkyPlatformChecks.cmake
'' + optionalString docsSupport ''
# Drop examples, since they contain non-ASCII characters that break docbook2x :(
sed -i 's/ Example: .*$//' doc/config_settings.xml
substituteInPlace cmake/Conky.cmake --replace "# set(RELEASE true)" "set(RELEASE true)"
cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp
'';
NIX_LDFLAGS = "-lgcc_s";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ glib libXinerama ]
++ optionals docsSupport [ docbook2x docbook_xsl docbook_xml_dtd_44 libxslt man less ]
++ optional ncursesSupport ncurses
++ optional x11Support xlibsWrapper
++ optional xdamageSupport libXdamage
++ optional imlib2Support imlib2
++ optional luaSupport lua
++ optionals luaImlib2Support [ toluapp imlib2 ]
++ optionals luaCairoSupport [ toluapp cairo ]
++ optional wirelessSupport wirelesstools
++ optional curlSupport curl
++ optional rssSupport libxml2
++ optional weatherXoapSupport libxml2
++ optional nvidiaSupport libXNVCtrl
++ optional pulseSupport libpulseaudio
++ optional journalSupport systemd
;
cmakeFlags = []
++ optional docsSupport "-DMAINTAINER_MODE=ON"
++ optional curlSupport "-DBUILD_CURL=ON"
++ optional (!ibmSupport) "-DBUILD_IBM=OFF"
++ optional imlib2Support "-DBUILD_IMLIB2=ON"
++ optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON"
++ optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON"
++ optional (!mpdSupport) "-DBUILD_MPD=OFF"
++ optional (!ncursesSupport) "-DBUILD_NCURSES=OFF"
++ optional rssSupport "-DBUILD_RSS=ON"
++ optional (!x11Support) "-DBUILD_X11=OFF"
++ optional xdamageSupport "-DBUILD_XDAMAGE=ON"
++ optional doubleBufferSupport "-DBUILD_XDBE=ON"
++ optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON"
++ optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON"
++ optional wirelessSupport "-DBUILD_WLAN=ON"
++ optional nvidiaSupport "-DBUILD_NVIDIA=ON"
++ optional pulseSupport "-DBUILD_PULSEAUDIO=ON"
++ optional journalSupport "-DBUILD_JOURNAL=ON"
;
# `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`:
# src/conky.cc:137:23: fatal error: defconfig.h: No such file or directory
enableParallelBuilding = false;
doCheck = true;
meta = with lib; {
homepage = "http://conky.sourceforge.net/";
description = "Advanced, highly configurable system monitor based on torsmo";
maintainers = [ maintainers.guibert ];
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,29 @@
{ fetchurl, lib, stdenv, flex, bison, pkg-config, libmnl, libnfnetlink
, libnetfilter_conntrack, libnetfilter_queue, libnetfilter_cttimeout
, libnetfilter_cthelper, systemd
, libtirpc
}:
stdenv.mkDerivation rec {
pname = "conntrack-tools";
version = "1.4.6";
src = fetchurl {
url = "https://www.netfilter.org/projects/conntrack-tools/files/${pname}-${version}.tar.bz2";
sha256 = "0psx41bclqrh4514yzq03rvs3cq3scfpd1v4kkyxnic2hk65j22r";
};
buildInputs = [
libmnl libnfnetlink libnetfilter_conntrack libnetfilter_queue
libnetfilter_cttimeout libnetfilter_cthelper systemd libtirpc
];
nativeBuildInputs = [ flex bison pkg-config ];
meta = with lib; {
homepage = "http://conntrack-tools.netfilter.org/";
description = "Connection tracking userspace tools";
platforms = platforms.linux;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ fpletz ];
};
}

View file

@ -0,0 +1,37 @@
{ lib, stdenv, fetchurl, SDL }:
stdenv.mkDerivation rec {
pname = "linuxconsoletools";
version = "1.6.1";
src = fetchurl {
url = "mirror://sourceforge/linuxconsole/${pname}-${version}.tar.bz2";
sha256 = "0d2r3j916fl2y7pk1y82b9fvbr10dgs1gw7rqwzfpispdidb1mp9";
};
buildInputs = [ SDL ];
makeFlags = [ "DESTDIR=$(out)"];
installFlags = [ "PREFIX=\"\"" ];
meta = with lib; {
homepage = "https://sourceforge.net/projects/linuxconsole/";
description = "A set of tools for joysticks and serial peripherals";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ pSub ebzzry ];
longDescription = ''
The included tools are:
ffcfstress(1) - force-feedback stress test
ffmvforce(1) - force-feedback orientation test
ffset(1) - force-feedback configuration tool
fftest(1) - general force-feedback test
jstest(1) - joystick test
jscal(1) - joystick calibration tool
inputattach(1) - connects legacy serial devices to the input layer
'';
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, autoconf, automake, ncurses }:
stdenv.mkDerivation rec {
pname = "conspy";
version = "1.16";
src = fetchurl {
url = "mirror://sourceforge/project/conspy/conspy-${version}-1/conspy-${version}.tar.gz";
sha256 = "02andak806vd04bgjlr0y0d2ddx7cazyf8nvca80vlh8x94gcppf";
curlOpts = " -A application/octet-stream ";
};
nativeBuildInputs = [ autoconf automake ];
buildInputs = [
ncurses
];
preConfigure = ''
touch NEWS
echo "EPL 1.0" > COPYING
aclocal
automake --add-missing
autoconf
'';
meta = with lib; {
description = "Linux text console viewer";
license = licenses.epl10;
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, libtool, gettext }:
stdenv.mkDerivation rec {
pname = "cpufrequtils";
version = "008";
src = fetchurl {
url = "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils-${version}.tar.gz";
sha256 = "127i38d4w1hv2dzdy756gmbhq25q3k34nqb2s0xlhsfhhdqs0lq0";
};
patches = [
# I am not 100% sure that this is ok, but it breaks repeatable builds.
./remove-pot-creation-date.patch
];
patchPhase = ''
sed -e "s@= /usr/bin/@= @g" \
-e "s@/usr/@$out/@" \
-i Makefile
'';
buildInputs = [ stdenv.cc.libc.linuxHeaders libtool gettext ];
meta = with lib; {
description = "Tools to display or change the CPU governor settings";
homepage = "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html";
license = licenses.gpl2Only;
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,24 @@
diff -u cpufrequtils-008/Makefile cpufrequtils-008.new/Makefile
--- cpufrequtils-008/Makefile 2012-05-06 01:17:18.000000000 +0200
+++ cpufrequtils-008.new/Makefile 2013-08-16 20:52:29.961086536 +0200
@@ -205,7 +205,8 @@
@xgettext --default-domain=$(PACKAGE) --add-comments \
--keyword=_ --keyword=N_ $(UTIL_SRC) && \
test -f $(PACKAGE).po && \
- mv -f $(PACKAGE).po po/$(PACKAGE).pot
+ mv -f $(PACKAGE).po po/$(PACKAGE).pot && \
+ sed -i -e'/POT-Creation/d' po/*.pot
update-gmo: po/$(PACKAGE).pot
@for HLANG in $(LANGUAGES); do \
@@ -217,6 +218,7 @@
echo "msgmerge for $$HLANG failed!"; \
rm -f po/$$HLANG.new.po; \
fi; \
+ sed -i -e'/POT-Creation/d' po/*.po; \
msgfmt --statistics -o po/$$HLANG.gmo po/$$HLANG.po; \
done;
Common subdirectories: cpufrequtils-008/man and cpufrequtils-008.new/man
Common subdirectories: cpufrequtils-008/po and cpufrequtils-008.new/po
Common subdirectories: cpufrequtils-008/utils and cpufrequtils-008.new/utils

View file

@ -0,0 +1,55 @@
{ lib
, stdenv
, fetchurl
, perl
}:
stdenv.mkDerivation rec {
pname = "cpuid";
version = "20220224";
src = fetchurl {
url = "http://etallen.com/cpuid/${pname}-${version}.src.tar.gz";
sha256 = "sha256-ShneKhGK7kT4Vs0b7PpaGSV0tZV3lTcqhuN9yiTaH50=";
};
# For pod2man during the build process.
nativeBuildInputs = [
perl
];
# As runtime dependency for cpuinfo2cpuid.
buildInputs = [
perl
];
# The Makefile hardcodes $(BUILDROOT)/usr as installation
# destination. Just nuke all mentions of /usr to get the right
# installation location.
patchPhase = ''
sed -i -e 's,/usr/,/,' Makefile
'';
installPhase = ''
make install BUILDROOT=$out
if [ ! -x $out/bin/cpuid ]; then
echo Failed to properly patch Makefile.
exit 1
fi
'';
meta = with lib; {
description = "Linux tool to dump x86 CPUID information about the CPU";
longDescription = ''
cpuid dumps detailed information about the CPU(s) gathered from the CPUID
instruction, and also determines the exact model of CPU(s). It supports
Intel, AMD, VIA, Hygon, and Zhaoxin CPUs, as well as older Transmeta,
Cyrix, UMC, NexGen, Rise, and SiS CPUs.
'';
homepage = "http://etallen.com/cpuid.html";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ blitz ];
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,103 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, buildPythonApplication
, appstream-glib
, dbus-python
, desktop-file-utils
, gettext
, glib
, gobject-introspection
, gtk3
, hicolor-icon-theme
, libappindicator
, libhandy
, meson
, ninja
, pkg-config
, pygobject3
, pyxdg
, systemd
, wrapGAppsHook
}:
buildPythonApplication rec {
pname = "cpupower-gui";
version = "1.0.0";
# This packages doesn't have a setup.py
format = "other";
src = fetchFromGitHub {
owner = "vagnum08";
repo = pname;
rev = "v${version}";
sha256 = "05lvpi3wgyi741sd8lgcslj8i7yi3wz7jwl7ca3y539y50hwrdas";
};
patches = [
# Fix build with 0.61, can be removed on next update
# https://hydra.nixos.org/build/171052557/nixlog/1
(fetchpatch {
url = "https://github.com/vagnum08/cpupower-gui/commit/97f8ac02fe33e412b59d3f3968c16a217753e74b.patch";
sha256 = "XYnpm03kq8JLMjAT73BMCJWlzz40IAuHESm715VV6G0=";
})
];
nativeBuildInputs = [
appstream-glib
desktop-file-utils # needed for update-desktop-database
gettext
glib # needed for glib-compile-schemas
gobject-introspection # need for gtk namespace to be available
hicolor-icon-theme # needed for postinstall script
meson
ninja
pkg-config
wrapGAppsHook
# Python packages
dbus-python
libappindicator
pygobject3
pyxdg
];
buildInputs = [
glib
gtk3
libhandy
];
propagatedBuildInputs = [
dbus-python
libappindicator
pygobject3
pyxdg
];
mesonFlags = [
"-Dsystemddir=${placeholder "out"}/lib/systemd"
];
preConfigure = ''
patchShebangs build-aux/meson/postinstall.py
'';
strictDeps = false;
dontWrapGApps = true;
makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];
postFixup = ''
wrapPythonProgramsIn $out/lib "$out $propagatedBuildInputs"
'';
meta = with lib; {
description = "Change the frequency limits of your cpu and its governor";
homepage = "https://github.com/vagnum08/cpupower-gui/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ unode ];
};
}

View file

@ -0,0 +1,44 @@
{ lib, stdenv, buildPackages, kernel, pciutils, gettext }:
stdenv.mkDerivation {
pname = "cpupower";
inherit (kernel) version src;
nativeBuildInputs = [ gettext ];
buildInputs = [ pciutils ];
postPatch = ''
cd tools/power/cpupower
sed -i 's,/bin/true,${buildPackages.coreutils}/bin/true,' Makefile
sed -i 's,/bin/pwd,${buildPackages.coreutils}/bin/pwd,' Makefile
sed -i 's,/usr/bin/install,${buildPackages.coreutils}/bin/install,' Makefile
'';
makeFlags = [
"CROSS=${stdenv.cc.targetPrefix}"
"CC=${stdenv.cc.targetPrefix}cc"
"LD=${stdenv.cc.targetPrefix}cc"
];
installFlags = lib.mapAttrsToList
(n: v: "${n}dir=${placeholder "out"}/${v}") {
bin = "bin";
sbin = "sbin";
man = "share/man";
include = "include";
lib = "lib";
locale = "share/locale";
doc = "share/doc/cpupower";
conf = "etc";
bash_completion_ = "share/bash-completion/completions";
};
enableParallelBuilding = true;
meta = with lib; {
description = "Tool to examine and tune power saving features";
homepage = "https://www.kernel.org/";
license = licenses.gpl2;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,45 @@
{ lib
, fetchFromGitHub
, fetchpatch
, pythonPackages
}:
pythonPackages.buildPythonApplication rec {
pname = "cpuset";
version = "1.6";
propagatedBuildInputs = with pythonPackages; [
configparser
future
];
# https://github.com/lpechacek/cpuset/pull/36
patches = [
(fetchpatch {
url = "https://github.com/MawKKe/cpuset/commit/a4b6b275d0a43d2794ab9e82922d3431aeea9903.patch";
sha256 = "1mi1xrql81iczl67s4dk2rm9r1mk36qhsa19wn7zgryf95krsix2";
})
];
makeFlags = [ "prefix=$(out)" ];
src = fetchFromGitHub {
owner = "lpechacek";
repo = "cpuset";
rev = "v${version}";
sha256 = "0ig0ml2zd5542d0989872vmy7cs3qg7nxwa93k42bdkm50amhar4";
};
checkPhase = ''
cd t
make
'';
meta = with lib; {
description = "Python application that forms a wrapper around the standard Linux filesystem calls to make using the cpusets facilities in the Linux kernel easier";
homepage = "https://github.com/lpechacek/cpuset";
license = licenses.gpl2;
maintainers = with maintainers; [ thiagokokada wykurz ];
mainProgram = "cset";
};
}

View file

@ -0,0 +1,29 @@
{ stdenv, lib, fetchFromGitHub, ncurses }:
stdenv.mkDerivation rec {
pname = "cpustat";
version = "0.02.17";
src = fetchFromGitHub {
owner = "ColinIanKing";
repo = pname;
rev = "V${version}";
hash = "sha256-4HDXRtklzQSsywCGCTKdz6AtZta9R1mx7qkT7skX6Kc=";
};
buildInputs = [ ncurses ];
installFlags = [
"BINDIR=${placeholder "out"}/bin"
"MANDIR=${placeholder "out"}/share/man/man8"
"BASHDIR=${placeholder "out"}/share/bash-completion/completions"
];
meta = with lib; {
description = "CPU usage monitoring tool";
homepage = "https://github.com/ColinIanKing/cpustat";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ dtzWill ];
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv
, fetchurl
, zlib
}:
stdenv.mkDerivation rec {
pname = "cramfsprogs";
version = "1.1";
src = fetchurl {
url = "mirror://debian/pool/main/c/cramfs/cramfs_${version}.orig.tar.gz";
sha256 = "0s13sabykbkbp0pcw8clxddwzxckyq7ywm2ial343ip7qjiaqg0k";
};
# CramFs is unmaintained upstream: https://tracker.debian.org/pkg/cramfs.
# So patch the "missing include" bug ourselves.
patches = [ ./include-sysmacros.patch ];
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
];
installPhase = ''
install --target $out/bin -D cramfsck mkcramfs
'';
buildInputs = [ zlib ];
meta = with lib; {
description = "Tools to create, check, and extract content of CramFs images";
homepage = "https://packages.debian.org/jessie/cramfsprogs";
license = licenses.gpl2;
maintainers = with maintainers; [ pamplemousse ];
platforms = platforms.linux;
};
}

Some files were not shown because too many files have changed in this diff Show more