aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/os-specific
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
committerMx Kookie <kookie@spacekookie.de>2020-10-31 19:35:09 +0100
commitc4625b175f8200f643fd6e11010932ea44c78433 (patch)
treebce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/os-specific
parent49f735974dd103039ddc4cb576bb76555164a9e7 (diff)
parentd661aa56a8843e991261510c1bb28fdc2f6975ae (diff)
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7 git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/os-specific')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/default.nix5
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/builder.sh122
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh6
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix676
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh4
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/getent.patch455
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/locale.patch85
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/CoreSymbolication/default.nix19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/DarwinTools/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh9
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/default.nix241
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/frameworks.nix127
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix256
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh10
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix187
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/CrashReporterClient.h51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix9
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix158
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/reexported_libraries41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_c_symbols1320
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_kernel_symbols1172
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols1
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/PowerManagement/default.nix10
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix116
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/default.nix19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix91
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix56
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bsdmake/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix213
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix9
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/default.nix259
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/rpcgen-support-hyper-and-quad-types.patch66
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dtrace/default.nix53
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix10
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/file_cmds/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/auto_dtrace.h129
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/default.nix84
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix10
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix50
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix118
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch107
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix15
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/default.nix50
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix104
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/text_cmds/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/top/default.nix16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix139
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/binutils/default.nix62
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/port.nix106
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/chunkwm/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/darling/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/discrete-scroll/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/duti/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/goku/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/insert_dylib/default.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ios-deploy/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/iproute2mac/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/org.nixos.khd.plist33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/org.nixos.kwm.plist26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/libtapi/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/lsusb/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/m-cli/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/maloader/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/native-x11-and-opengl/default.nix14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/noah/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/opencflite/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxfuse/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxsnarf/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/qes/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/reattach-to-user-namespace/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/org.nixos.skhd.plist23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/smimesign/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/spacebar/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/stubs/default.nix15
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix114
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/libdispatch.nix12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/usr-include/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/wifi-password/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix58
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix77
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/darwin/yabai/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi-call/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpid/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/afuse/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/cross.patch347
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/alsa-plugin-conf-multilib.patch232
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-oss/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/wrapper.nix4
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-tools/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-topology-conf/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-ucm-conf/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-utils/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/default.nix183
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch71
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c5
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/default.nix140
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/kmod.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/android-udev-rules/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix272
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/asus-wmi-sensors/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/builder.sh302
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/default.nix140
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.12-xstate-fp.patch26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-kcl_str.patch14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-mtrr.patch27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-preempt.patch103
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-sep_printf.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch70
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.9-get_user_pages.patch28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-get_user_pages.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-page_cache_release-put_page.patch16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/patch-samples.patch26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.upstream4
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/audit/default.nix66
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/autofs/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/alfred.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/batctl.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/version.nix9
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix63
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/default.nix83
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/libbcc-path.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/blktrace/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bluez/default.nix122
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/default.nix61
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftool/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/default.nix63
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/fix-kernel-include-dir.patch22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/add-ip6-header.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/autoconf-ar.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/udev-rule.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/default.nix67
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/gcc.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/i686-build-failure.patch18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/license.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.11.patch52
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.12.patch68
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.15.patch47
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.7.patch109
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.8.patch64
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.1.patch32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.6.patch87
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/null-pointer-fix.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/btfs/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-Fix-build-with-glibc-2.31.patch71
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-wget-implement-TLS-verification-with-ENABLE_FEATURE_.patch94
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/busybox-in-store.patch23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/clang-cross.patch37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/default.nix144
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/sandbox-shell.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cachefilesd/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-isotp/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-utils/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/checkpolicy/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/0001-attempt-to-modprobe-config-before-checking-kernel.patch28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/chromium-xorg-conf/default.nix8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cifs-utils/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/compsize/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/conky/default.nix143
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/conntrack-tools/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/consoletools/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.upstream5
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/remove-pot-creation-date.patch24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuid/default.nix50
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpupower/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuset/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpustat/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/include-sysmacros.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsswap/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/crda/default.nix78
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/criu/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptodev/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/disable-failing-tests.patch19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dbus-broker/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ddcci/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/raspberrypi.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/digimend/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/directvnc/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix75
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix63
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/hardening-format.patch18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/ld-linux-so-buffer-size.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dpdk/default.nix75
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/fix-glibc-compilation.patch24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch15
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dropwatch/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/dstat/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/e1000e/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/fix-dbus-path.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ebtables/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/default.nix47
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/fix-dbus-tests.patch65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ena/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/eudev/default.nix60
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/evdi/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/eventstat/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/exfat/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/extrace/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/facetimehd/default.nix61
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fatrace/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/default.nix62
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/select.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/default.nix108
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/fix-build.patch26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.nix90
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.upstream3
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/no-root-install.patch18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/5.1.138.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/6.30.163.46.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/broadcom-bt-firmware/default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/bt-fw-converter/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-manager/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch177
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/default.nix322
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/install-fwupdplugin-to-out.patch37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/intel2200BGFirmware/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/openelec-dvb-firmware/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix53
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/tools.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rt5677/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8723bs-firmware/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtlwifi_new-firmware/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/sof-firmware/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/zd1211/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/flashbench/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fnotifystat/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/forkstat/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.upstream2
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/freefall/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscrypt/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscryptctl/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_buffer_overflow.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_printf_format.patch20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/common.nix102
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/default.nix17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse2-Do-not-set-FUSERMOUNT_DIR.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-Do-not-set-FUSERMOUNT_DIR.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-install.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/module.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/fxload/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/default.nix88
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/pid_location.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gfxtablet/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gobi_loader/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/config-paths.patch39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/gcc46-include-fix.patch22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gpu-switch/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/gradm/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/guvcview/default.nix78
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hal-flash/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/postInstall.sh7
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdparm/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/health-check/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/gen-manpages.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/hibernate.patch37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/install.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hostapd/default.nix105
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hwdata/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/hyperv-daemons/default.nix114
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/i2c-tools/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/default.nix58
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/qt5.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/i810switch/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifenslave/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifmetric/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iio-sensor-proxy/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/xattr.patch73
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/input-utils/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-compute-runtime/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-ocl/default.nix73
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-speed-select/default.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iomelt/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ioport/default.nix17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iotop/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/default.nix53
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2015-4047.patch16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2016-10396.patch193
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/dont-create-localstatedir-during-install.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipset/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptables/default.nix55
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptstate/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iputils/default.nix61
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipvsadm/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/irqbalance/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/it87/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iw/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/iwd/default.nix90
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ixgbevf/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/jfbview/default.nix73
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/cli.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/source.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/default.nix72
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/keymaps.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/search-paths.patch71
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbdlight/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/default.nix83
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/no-relocs.patch7
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/bridge-stp-helper.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix822
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.11.patch784
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.4.patch407
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.9.patch784
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/README.md21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/default.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch60
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gen-kheaders-metadata.patch86
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generate-config.pl147
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix182
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/genksyms-fix-segfault.patch19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gpio-utils.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/anthraxx.asc325
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/config.nix86
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/tag-hardened.patch7
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/update.py276
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.8.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.9.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-94.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-95.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rpi.nix70
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.6.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mac-nvme-t2.patch283
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix313
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mptcp-config.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/p9-fixes.patch85
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/patches.nix95
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/perf.nix78
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/randstruct-provide-seed.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper-updated.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper.patch13
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-libre.sh33
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-rt.sh77
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update.sh68
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kexectools/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/conf-symlink.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-debian-aliases/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/aggregator.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch123
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/enable-static.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/module-dir.patch157
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscon/default.nix59
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ldm/default.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ledger-udev-rules/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libaio/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap/default.nix60
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcgroup/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libevdevc/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/include-fix.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libnl/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libratbag/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libselinux/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsemanage/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsepol/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsmbios/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libudev0-shim/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/uvcdynctrl_symlink_support_and_take_data_dir_from_env.patch65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/light/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lightum/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/linuxptp/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lockdep/default.nix61
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/logitech-udev-rules/default.nix19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/lsb_release.sh190
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsiutil/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lttng-modules/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix128
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/default.nix99
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/support-db2x.patch16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxcfs/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/macchanger/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mbpfan/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mcelog/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/no-self-references.patch130
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/metastore/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/amd.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/intel.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/iucode-tool.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/miraclecast/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mmc-utils/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/molly-guard/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/msr-tools/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mstpd/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/default.nix47
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/json-c-0.14.patch21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/musl/default.nix129
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mwprocapture/default.nix67
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/no-sbin.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/config.h79
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/mptcp.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/netatop/default.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nfs-utils/default.nix131
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nftables/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nmon/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/crashes.patch104
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/nss_ldap-265-glibc-2.16.patch139
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numactl/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/numad-linker-flags.patch33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numatop/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/50-numworks-calculator.rules2
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/default.nix21
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/update.sh3
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/builder.sh180
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix93
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix109
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/persistenced.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/settings.nix107
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/vm_operations_struct-fault.patch31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidiabl/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvme-cli/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/oci-seccomp-bpf-hook/default.nix58
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/odp-dpdk/default.nix60
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ofp/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-iscsi/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-isns/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix20
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/openrazer/driver.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/default.nix65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/lts.nix82
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/patches/lts-ssl.patch274
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/otpw/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pagemon/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/default.nix72
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_gnupg/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_p11/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_pgsql/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/multiple-key-files.patch365
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_u2f/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix76
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pax-utils/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/setup-hook.sh8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxtest/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcm/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix55
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pflask/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/phc-intel/default.nix53
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/piper/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pipework/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/ply/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/plymouth/default.nix64
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix55
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pmount/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/policycoreutils/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pommed-light/default.nix65
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/power-calibrate/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/powerstat/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/powertop/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pps-tools/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/autostart.desktop8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/default.nix168
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/procdump/default.nix49
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/procps-ng/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pscircle/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/psftools/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/psmisc/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8125/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8168/default.nix56
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontools/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontop/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rdma-core/default.nix53
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/read-edid/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/regionset/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/reptyr/default.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rewritefs/default.nix32
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/udev.nix56
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/roccat-tools/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtkit/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8192eu/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8723bs/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix50
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8814au/default.nix39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821au/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821ce/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821cu/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88x2bu/default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88xxau-aircrack/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtlwifi_new/default.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/s6-linux-utils/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/schedtool/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sd-switch/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/sdnotify-wrapper.c172
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix18
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-python/default.nix51
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-sandbox/default.nix61
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/semodule-utils/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sepolgen/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/default.nix28
-rwxr-xr-xinfra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh224
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/setools/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/seturgent/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/default.nix90
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/keep-path.patch19
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/respect-xml-catalog-files-var.patch30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sinit/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/smem/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/speedometer/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sssd/default.nix98
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/statifier/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/syscall_limiter/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.nix64
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.upstream8
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/systemd.patch845
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/union-wait.patch11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/syslinux/default.nix100
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/install.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-acpi/default.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-io/default.nix38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd-wait/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch124
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch108
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch132
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch314
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch38
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-revert-get-rid-of-seat_can_multi_session.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix289
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysvinit/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/targetcli/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tbs/default.nix63
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/cdecls.patch31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/default.nix75
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/tcp-wrappers-7.6-headers.patch295
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/thunderbolt/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiptop/default.nix35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiscamera/default.nix86
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tmon/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tomb/default.nix44
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/default.nix48
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/update.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tpacpi-bat/default.nix34
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch35
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/kernelshark.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/src.nix5
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trezor-udev-rules/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/trinity/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/turbostat/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/tuxedo-keyboard/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/uclibc/default.nix114
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks-glue/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/1-default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/2-default.nix89
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/fix-paths.patch131
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/force-path.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/glibc.patch25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/no-pci-db.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/purity.patch57
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/undervolt/default.nix27
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/unstick/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/untie/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/upower/default.nix71
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbguard/default.nix63
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch13
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbtop/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/fix-paths.patch16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/usermount/default.nix28
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/default.nix73
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch69
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/uvcdynctrl/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l-utils/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l2loopback/default.nix37
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/v86d/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/virtualbox/default.nix22
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireguard/default.nix42
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireless-tools/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules9
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/default.nix114
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/gui.nix41
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix25
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86info/default.nix40
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-cmt/default.nix36
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-wacom/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xpadneo/default.nix43
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/default.nix23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/remove-unused-variables.patch39
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/replace-deprecated-gtk.patch168
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenmonitor/default.nix26
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenpower/default.nix32
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenstates/default.nix54
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/BACKPORT-Linux-5.8-compat-__vmalloc.patch154
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/default.nix214
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/solo5/default.nix58
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/cygwin-setup/default.nix46
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/default.nix45
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/jom/default.nix31
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/libgnurx/default.nix16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/mcfgthreads/default.nix24
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/default.nix30
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/headers.nix11
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/pthreads.nix10
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingwrt/default.nix17
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/pthread-w32/default.nix29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/w32api/default.nix16
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/windows/wxMSW-2.8/default.nix37
764 files changed, 43201 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/default.nix
new file mode 100644
index 000000000000..ee7158e2a8c5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/default.nix
@@ -0,0 +1,5 @@
+{ callPackages, recurseIntoAttrs }:
+
+{
+ netbsd = recurseIntoAttrs (callPackages ./netbsd {});
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/builder.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/builder.sh
new file mode 100644
index 000000000000..925001567f79
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/builder.sh
@@ -0,0 +1,122 @@
+source $stdenv/setup
+
+# NetBSD makefiles should be able to detect this
+# but without they end up using gcc on Darwin stdenv
+addMakeFlags() {
+ export setOutputFlags=
+
+ export LIBCRT0=
+ export LIBCRTI=
+ export LIBCRTEND=
+ export LIBCRTBEGIN=
+ export LIBC=
+ export LIBUTIL=
+ export LIBSSL=
+ export LIBCRYPTO=
+ export LIBCRYPT=
+ export LIBCURSES=
+ export LIBTERMINFO=
+ export LIBM=
+ export LIBL=
+
+ export _GCC_CRTBEGIN=
+ export _GCC_CRTBEGINS=
+ export _GCC_CRTEND=
+ export _GCC_CRTENDS=
+ export _GCC_LIBGCCDIR=
+ export _GCC_CRTI=
+ export _GCC_CRTN=
+ export _GCC_CRTDIR=
+
+ # Definitions passed to share/mk/*.mk. Should be pretty simple -
+ # eventually maybe move it to a configure script.
+ export DESTDIR=
+ export USETOOLS=never
+ export NOCLANGERROR=yes
+ export NOGCCERROR=yes
+ export LEX=flex
+ export MKUNPRIVED=yes
+ export EXTERNAL_TOOLCHAIN=yes
+
+ export INSTALL_FILE="install -U -c"
+ export INSTALL_DIR="xinstall -U -d"
+ export INSTALL_LINK="install -U -l h"
+ export INSTALL_SYMLINK="install -U -l s"
+
+ makeFlags="MACHINE=$MACHINE $makeFlags"
+ makeFlags="MACHINE_ARCH=$MACHINE_ARCH $makeFlags"
+ makeFlags="AR=$AR $makeFlags"
+ makeFlags="CC=$CC $makeFlags"
+ makeFlags="CPP=$CPP $makeFlags"
+ makeFlags="CXX=$CXX $makeFlags"
+ makeFlags="LD=$LD $makeFlags"
+ makeFlags="STRIP=$STRIP $makeFlags"
+
+ makeFlags="BINDIR=${!outputBin}/bin $makeFlags"
+ makeFlags="LIBDIR=${!outputLib}/lib $makeFlags"
+ makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags"
+ makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
+ makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags"
+ makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags"
+ makeFlags="LOCALEDIR=${!outputLib}/share/locale $makeFlags"
+
+ # Parallel building. Needs the space.
+ makeFlags="-j $NIX_BUILD_CORES $makeFlags"
+}
+
+setNetBSDSourceDir() {
+ # merge together all extra paths
+ # there should be a better way to do this
+ sourceRoot=$PWD/$sourceRoot
+ export NETBSDSRCDIR=$sourceRoot
+ export BSDSRCDIR=$NETBSDSRCDIR
+ export _SRC_TOP_=$NETBSDSRCDIR
+ chmod -R u+w $sourceRoot
+ for path in $extraPaths; do
+ cd $path
+ find . -type d -exec mkdir -p $sourceRoot/\{} \;
+ find . -type f -exec cp -pr \{} $sourceRoot/\{} \;
+ chmod -R u+w $sourceRoot
+ done
+
+ cd $sourceRoot
+ if [ -d "$NETBSD_PATH" ]
+ then sourceRoot=$sourceRoot/$NETBSD_PATH
+ fi
+}
+
+includesPhase() {
+ if [ -z "${skipIncludesPhase:-}" ]; then
+
+ local flagsArray=(
+ $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
+ DESTDIR=${!outputInclude} includes
+ )
+
+ echoCmd 'includes flags' "${flagsArray[@]}"
+ make ${makefile:+-f $makefile} "${flagsArray[@]}"
+
+ moveUsrDir
+
+ fi
+}
+
+moveUsrDir() {
+ if [ -d $prefix ]; then
+ # Remove lingering /usr references
+ if [ -d $prefix/usr ]; then
+ cd $prefix/usr
+ find . -type d -exec mkdir -p $out/\{} \;
+ find . \( -type f -o -type l \) -exec mv \{} $out/\{} \;
+ fi
+
+ find $prefix -type d -empty -delete
+ fi
+}
+
+postUnpackHooks+=(setNetBSDSourceDir)
+preConfigureHooks+=(addMakeFlags)
+preInstallHooks+=(includesPhase)
+fixupOutputHooks+=(moveUsrDir)
+
+genericBuild
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh
new file mode 100644
index 000000000000..3c49337a937c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-setup-hook.sh
@@ -0,0 +1,6 @@
+# See pkgs/build-support/setup-hooks/role.bash
+getHostRole
+
+export NIX_LDFLAGS${role_post}+=" -lnbcompat"
+export NIX_CFLAGS_COMPILE${role_post}+=" -DHAVE_NBTOOL_CONFIG_H"
+export NIX_CFLAGS_COMPILE${role_post}+=" -include nbtool_config.h"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch
new file mode 100644
index 000000000000..f67ca2e50791
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch
@@ -0,0 +1,18 @@
+diff -u -r1.35.2.1 nbtool_config.h.in
+--- a/nbtool_config.h.in 22 Apr 2015 07:18:58 -0000 1.35.2.1
++++ b/nbtool_config.h.in 31 May 2018 01:46:53 -0000
+@@ -680,5 +680,14 @@
+ /* Define if you have u_int8_t, but not uint8_t. */
+ #undef uint8_t
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #include "compat_defs.h"
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* !__NETBSD_NBTOOL_CONFIG_H__ */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix
new file mode 100644
index 000000000000..2d51c11f04a6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix
@@ -0,0 +1,676 @@
+{ stdenv, stdenvNoCC, fetchcvs, lib, groff, mandoc, zlib, yacc, flex
+, writeText, buildPackages, splicePackages, symlinkJoin }:
+
+let
+ fetchNetBSD = path: version: sha256: fetchcvs {
+ cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
+ module = "src/${path}";
+ inherit sha256;
+ tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE";
+ };
+
+ # Splice packages so we get the correct package when using
+ # nativeBuildInputs...
+ nbSplicedPackages = splicePackages {
+ pkgsBuildBuild = buildPackages.buildPackages.netbsd;
+ pkgsBuildHost = buildPackages.netbsd;
+ pkgsBuildTarget = {};
+ pkgsHostHost = {};
+ pkgsHostTarget = netbsd;
+ pkgsTargetTarget = {};
+ };
+
+ netbsd = with nbSplicedPackages; {
+
+ mkDerivation = lib.makeOverridable (attrs: let
+ stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
+ in stdenv'.mkDerivation ({
+ name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}";
+ src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256;
+
+ extraPaths = [ ];
+
+ nativeBuildInputs = [ makeMinimal install tsort lorder mandoc groff stat ];
+ buildInputs = [ compat ];
+ # depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+ OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
+ HOST_SH = "${buildPackages.bash}/bin/sh";
+
+ MACHINE_ARCH = {
+ i686 = "i386";
+ }.${stdenv'.hostPlatform.parsed.cpu.name}
+ or stdenv'.hostPlatform.parsed.cpu.name;
+
+ MACHINE = {
+ x86_64 = "amd64";
+ aarch64 = "evbarm64";
+ i686 = "i386";
+ }.${stdenv'.hostPlatform.parsed.cpu.name}
+ or stdenv'.hostPlatform.parsed.cpu.name;
+
+ AR = "${stdenv'.cc.targetPrefix or ""}ar";
+ CC = "${stdenv'.cc.targetPrefix or ""}cc";
+ CPP = "${stdenv'.cc.targetPrefix or ""}cpp";
+ CXX = "${stdenv'.cc.targetPrefix or ""}c++";
+ LD = "${stdenv'.cc.targetPrefix or ""}ld";
+ STRIP = "${stdenv'.cc.targetPrefix or ""}strip";
+
+ NETBSD_PATH = attrs.path;
+
+ builder = ./builder.sh;
+
+ meta = with lib; {
+ maintainers = with maintainers; [matthewbauer];
+ platforms = platforms.unix;
+ license = licenses.bsd2;
+ };
+ } // lib.optionalAttrs stdenv'.isDarwin {
+ MKRELRO = "no";
+ } // lib.optionalAttrs (stdenv'.cc.isClang or false) {
+ HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+ } // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
+ HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+ } // lib.optionalAttrs (attrs.headersOnly or false) {
+ installPhase = "includesPhase";
+ dontBuild = true;
+ } // attrs));
+
+ ##
+ ## START BOOTSTRAPPING
+ ##
+ makeMinimal = mkDerivation {
+ path = "tools/make";
+ sha256 = "1xbzfd4i7allrkk1if74a8ymgpizyj0gkvdigzzj37qar7la7nc1";
+ version = "8.0";
+
+ buildInputs = [];
+ nativeBuildInputs = [];
+
+ skipIncludesPhase = true;
+
+ postPatch = ''
+ patchShebangs configure
+ ${make.postPatch}
+ '';
+ buildPhase = ''
+ runHook preBuild
+
+ sh ./buildmake.sh
+
+ runHook postBuild
+ '';
+ installPhase = ''
+ runHook preInstall
+
+ install -D nbmake $out/bin/nbmake
+ ln -s $out/bin/nbmake $out/bin/make
+ mkdir -p $out/share
+ cp -r $NETBSDSRCDIR/share/mk $out/share/mk
+
+ runHook postInstall
+ '';
+ extraPaths = [ make.src ] ++ make.extraPaths;
+ };
+
+ compat = if stdenv.hostPlatform.isNetBSD then stdenv else mkDerivation rec {
+ path = "tools/compat";
+ sha256 = "050449lq5gpxqsripdqip5ks49g5ypjga188nd3ss8dg1zf7ydz3";
+ version = "8.0";
+
+ setupHooks = [
+ ../../../build-support/setup-hooks/role.bash
+ ./compat-setup-hook.sh
+ ];
+
+ # override defaults to prevent infinite recursion
+ nativeBuildInputs = [ makeMinimal ];
+ buildInputs = [ zlib ];
+
+ # the build system re-runs `./configure` with `HOST_CC` (which is their
+ # name for Build CC) as a compiler to make `defs.mk`, which is installed
+ depsBuildBuild = [ buildPackages.stdenv.cc ] ++ buildInputs;
+ HOST_CC = "${buildPackages.stdenv.cc.targetPrefix}cc";
+
+ # temporarily use gnuinstall for bootstrapping
+ # bsdinstall will be built later
+ makeFlags = [
+ "INSTALL=${buildPackages.coreutils}/bin/install"
+ "TOOLDIR=$(out)"
+ ];
+ RENAME = "-D";
+
+ patches = [ ./compat.patch ];
+
+ postInstall = ''
+ mv $out/include/compat/* $out/include
+ rmdir $out/include/compat
+
+ # why aren't these installed by netbsd?
+ install -D compat_defs.h $out/include/compat_defs.h
+ install -D $NETBSDSRCDIR/include/cdbw.h $out/include/cdbw.h
+ install -D $NETBSDSRCDIR/sys/sys/cdbr.h $out/include/cdbr.h
+ install -D $NETBSDSRCDIR/sys/sys/featuretest.h \
+ $out/include/sys/featuretest.h
+ install -D $NETBSDSRCDIR/sys/sys/md5.h $out/include/md5.h
+ install -D $NETBSDSRCDIR/sys/sys/rmd160.h $out/include/rmd160.h
+ install -D $NETBSDSRCDIR/sys/sys/sha1.h $out/include/sha1.h
+ install -D $NETBSDSRCDIR/sys/sys/sha2.h $out/include/sha2.h
+ install -D $NETBSDSRCDIR/sys/sys/queue.h $out/include/sys/queue.h
+ install -D $NETBSDSRCDIR/include/vis.h $out/include/vis.h
+ install -D $NETBSDSRCDIR/include/db.h $out/include/db.h
+ install -D $NETBSDSRCDIR/include/netconfig.h $out/include/netconfig.h
+ install -D $NETBSDSRCDIR/include/rpc/types.h $out/include/rpc/types.h
+ install -D $NETBSDSRCDIR/include/utmpx.h $out/include/utmpx.h
+ install -D $NETBSDSRCDIR/include/tzfile.h $out/include/tzfile.h
+ install -D $NETBSDSRCDIR/sys/sys/tree.h $out/include/sys/tree.h
+ install -D $NETBSDSRCDIR/include/nl_types.h $out/include/nl_types.h
+ install -D $NETBSDSRCDIR/include/stringlist.h $out/include/stringlist.h
+ '' + lib.optionalString stdenv.isDarwin ''
+ mkdir -p $out/include/ssp
+ touch $out/include/ssp/ssp.h
+ '' + ''
+ mkdir -p $out/lib/pkgconfig
+ substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \
+ --subst-var-by out $out \
+ --subst-var-by version ${version}
+ '';
+ extraPaths = [ libc.src libutil.src
+ (fetchNetBSD "include" "8.0" "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq")
+ (fetchNetBSD "external/bsd/flex" "8.0" "0yxcjshz9nj827qhmjwwjmzvmmqgaf0d25b42k7lj84vliwrgyr6")
+ (fetchNetBSD "sys/sys" "8.0" "0b0yjjy0c0cvk5nyffppqwxlwh2s1qr2xzl97a9ldck00dibar94")
+ ] ++ libutil.extraPaths ++ libc.extraPaths;
+ };
+
+ # HACK: to ensure parent directories exist. This emulates GNU
+ # install’s -D option. No alternative seems to exist in BSD install.
+ install = let binstall = writeText "binstall" ''
+ #!${stdenv.shell}
+ for last in $@; do true; done
+ mkdir -p $(dirname $last)
+ xinstall "$@"
+ ''; in mkDerivation {
+ path = "usr.bin/xinstall";
+ version = "8.0";
+ sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
+ extraPaths = [ mtree.src make.src ];
+ nativeBuildInputs = [ makeMinimal mandoc groff ];
+ skipIncludesPhase = true;
+ buildInputs = [ compat fts ];
+ installPhase = ''
+ runHook preInstall
+
+ install -D install.1 $out/share/man/man1/install.1
+ install -D xinstall $out/bin/xinstall
+ install -D -m 0550 ${binstall} $out/bin/binstall
+ ln -s $out/bin/binstall $out/bin/install
+
+ runHook postInstall
+ '';
+ };
+
+ fts = mkDerivation {
+ pname = "fts";
+ path = "include/fts.h";
+ sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
+ version = "8.0";
+ nativeBuildInputs = [ ];
+ propagatedBuildInputs = [ compat ];
+ extraPaths = [
+ (fetchNetBSD "lib/libc/gen/fts.c" "8.0" "1a8hmf26242nmv05ipn3ircxb0jqmmi66rh78kkyi9vjwkfl3qn7")
+ (fetchNetBSD "lib/libc/include/namespace.h" "8.0" "1sjvh9nw3prnk4rmdwrfsxh6gdb9lmilkn46jcfh3q5c8glqzrd7")
+ (fetchNetBSD "lib/libc/gen/fts.3" "8.0" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
+ ];
+ skipIncludesPhase = true;
+ buildPhase = ''
+ "$CC" -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
+ -o lib/libc/gen/fts.o
+ "$AR" -rsc libfts.a lib/libc/gen/fts.o
+ '';
+ installPhase = ''
+ runHook preInstall
+
+ install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
+ install -D include/fts.h $out/include/fts.h
+ install -D lib/libc/include/namespace.h $out/include/namespace.h
+ install -D libfts.a $out/lib/libfts.a
+
+ runHook postInstall
+ '';
+ setupHooks = [
+ ../../../build-support/setup-hooks/role.bash
+ ./fts-setup-hook.sh
+ ];
+ };
+
+ stat = mkDerivation {
+ path = "usr.bin/stat";
+ version = "8.0";
+ sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh";
+ nativeBuildInputs = [ makeMinimal install mandoc groff ];
+ };
+
+ tsort = mkDerivation {
+ path = "usr.bin/tsort";
+ version = "8.0";
+ sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
+ nativeBuildInputs = [ makeMinimal install mandoc groff ];
+ };
+
+ lorder = mkDerivation {
+ path = "usr.bin/lorder";
+ version = "8.0";
+ sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
+ nativeBuildInputs = [ makeMinimal install mandoc groff ];
+ };
+ ##
+ ## END BOOTSTRAPPING
+ ##
+
+ ##
+ ## START COMMAND LINE TOOLS
+ ##
+ make = mkDerivation {
+ path = "usr.bin/make";
+ sha256 = "103643qs3w5kiahir6cca2rkm5ink81qbg071qyzk63qvspfq10c";
+ version = "8.0";
+ postPatch = ''
+ # make needs this to pick up our sys make files
+ export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
+
+ substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
+ --replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
+ substituteInPlace $NETBSDSRCDIR/share/mk/bsd.kinc.mk \
+ --replace /bin/rm rm
+ '' + lib.optionalString stdenv.isDarwin ''
+ substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
+ --replace '-Wl,--fatal-warnings' "" \
+ --replace '-Wl,--warn-shared-textrel' ""
+ '';
+ postInstall = ''
+ make -C $NETBSDSRCDIR/share/mk FILESDIR=$out/share/mk install
+ '';
+ extraPaths = [
+ (fetchNetBSD "share/mk" "8.0" "033q4w3rmvwznz6m7fn9xcf13chyhwwl8ijj3a9mrn80fkwm55qs")
+ ];
+ };
+
+ mtree = mkDerivation {
+ path = "usr.sbin/mtree";
+ version = "8.0";
+ sha256 = "0hanmzm8bgwz2bhsinmsgfmgy6nbdhprwmgwbyjm6bl17vgn7vid";
+ extraPaths = [ mknod.src ];
+ };
+
+ mknod = mkDerivation {
+ path = "sbin/mknod";
+ version = "8.0";
+ sha256 = "0vq66v0hj0r4z2r2z2d3l3c5vh48pvcdmddc8bhm8hzq2civ5df2";
+ };
+
+ getent = mkDerivation {
+ path = "usr.bin/getent";
+ sha256 = "1ylhw4dnpyrmcy8n5kjcxywm8qc9p124dqnm17x4magiqx1kh9iz";
+ version = "8.0";
+ patches = [ ./getent.patch ];
+ };
+
+ getconf = mkDerivation {
+ path = "usr.bin/getconf";
+ sha256 = "122vslz4j3h2mfs921nr2s6m078zcj697yrb75rwp2hnw3qz4s8q";
+ version = "8.0";
+ };
+
+ locale = mkDerivation {
+ path = "usr.bin/locale";
+ version = "8.0";
+ sha256 = "0kk6v9k2bygq0wf9gbinliqzqpzs9bgxn0ndyl2wcv3hh2bmsr9p";
+ patches = [ ./locale.patch ];
+ NIX_CFLAGS_COMPILE = "-DYESSTR=__YESSTR -DNOSTR=__NOSTR";
+ };
+
+ rpcgen = mkDerivation {
+ path = "usr.bin/rpcgen";
+ version = "8.0";
+ sha256 = "1kfgfx54jg98wbg0d95p0rvf4w0302v8fz724b0bdackdsrd4988";
+ };
+
+ genassym = mkDerivation {
+ path = "usr.bin/genassym";
+ version = "8.0";
+ sha256 = "1acl1dz5kvh9h5806vkz2ap95rdsz7phmynh5i3x5y7agbki030c";
+ };
+
+ gencat = mkDerivation {
+ path = "usr.bin/gencat";
+ version = "8.0";
+ sha256 = "1696lgh2lhz93247lklvpvkd0f5asg6z27w2g4bmpfijlgw2h698";
+ };
+
+ nbperf = mkDerivation {
+ path = "usr.bin/nbperf";
+ version = "8.0";
+ sha256 = "0gzm0zv2400lasnsswnjw9bwzyizhxzdbrcjwcl1k65aj86aqyqb";
+ };
+
+ tic = mkDerivation {
+ path = "tools/tic";
+ version = "8.0";
+ sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz";
+ HOSTPROG = "tic";
+ buildInputs = [ compat ];
+ nativeBuildInputs = [ makeMinimal install mandoc groff nbperf ];
+ makeFlags = [ "TOOLDIR=$(out)" ];
+ extraPaths = [
+ libterminfo.src
+ (fetchNetBSD "usr.bin/tic" "8.0" "0diirnzmdnpc5bixyb34c9rid9paw2a4zfczqrpqrfvjsf1nnljf")
+ (fetchNetBSD "tools/Makefile.host" "8.0" "1p23dsc4qrv93vc6gzid9w2479jwswry9qfn88505s0pdd7h6nvp")
+ ];
+ };
+ ##
+ ## END COMMAND LINE TOOLS
+ ##
+
+ ##
+ ## START HEADERS
+ ##
+ include = mkDerivation {
+ path = "include";
+ version = "8.0";
+ sha256 = "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq";
+ nativeBuildInputs = [ makeMinimal install mandoc groff nbperf rpcgen ];
+ extraPaths = [ common.src ];
+ headersOnly = true;
+ noCC = true;
+ # meta.platforms = lib.platforms.netbsd;
+ makeFlags = [ "RPCGEN_CPP=${buildPackages.gcc-unwrapped}/bin/cpp" ];
+ };
+
+ common = mkDerivation {
+ path = "common";
+ version = "8.0";
+ sha256 = "1fsm2b7p7zkhiz523jw75088cq2h39iknp0fp3di9a64bikwbhi1";
+ };
+
+ # The full kernel
+ sys = mkDerivation {
+ path = "sys";
+ version = "8.0";
+ sha256 = "123ilg8fqmp69bw6bs6nh98fpi1v2n9lamrzar61p27ji6sj7g0w";
+ propagatedBuildInputs = [ include ];
+ #meta.platforms = lib.platforms.netbsd;
+ extraPaths = [ common.src ];
+ MKKMOD = "no";
+ };
+
+ headers = symlinkJoin {
+ name = "netbsd-headers-8.0";
+ paths = [ include ] ++ map (pkg: pkg.override (_: {
+ installPhase = "includesPhase";
+ dontBuild = true;
+ noCC = true;
+ meta.platforms = lib.platforms.all;
+ })) [ sys libpthread ];
+ };
+ ##
+ ## END HEADERS
+ ##
+
+ ##
+ ## START LIBRARIES
+ ##
+ libutil = mkDerivation {
+ path = "lib/libutil";
+ version = "8.0";
+ sha256 = "077syyxd303m4x7avs5nxzk4c9n13d5lyk5aicsacqjvx79qrk3i";
+ extraPaths = [ common.src ];
+ };
+
+ libedit = mkDerivation {
+ path = "lib/libedit";
+ version = "8.0";
+ sha256 = "0pmqh2mkfp70bwchiwyrkdyq9jcihx12g1awd6alqi9bpr3f9xmd";
+ buildInputs = [ libterminfo libcurses ];
+ propagatedBuildInputs = [ compat ];
+ postPatch = ''
+ sed -i '1i #undef bool_t' el.h
+ substituteInPlace config.h \
+ --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
+ substituteInPlace readline/Makefile --replace /usr/include "$out/include"
+ '';
+ NIX_CFLAGS_COMPILE = [
+ "-D__noinline="
+ "-D__scanflike(a,b)="
+ "-D__va_list=va_list"
+ ];
+ };
+
+ libterminfo = mkDerivation {
+ path = "lib/libterminfo";
+ version = "8.0";
+ sha256 = "14gp0d6fh6zjnbac2yjhyq5m6rca7gm6q1s9gilhzpdgl9m7vb9r";
+ buildInputs = [ compat ];
+ postPatch = ''
+ substituteInPlace term.c --replace /usr/share $out/share
+ substituteInPlace setupterm.c \
+ --replace '#include <curses.h>' 'void use_env(bool);'
+ '';
+ postInstall = ''
+ make -C $NETBSDSRCDIR/share/terminfo BINDIR=$out/share install
+ '';
+ extraPaths = [
+ (fetchNetBSD "share/terminfo" "8.0" "18db0fk1dw691vk6lsm6dksm4cf08g8kdm0gc4052ysdagg2m6sm")
+ ];
+ };
+
+ libcurses = mkDerivation {
+ path = "lib/libcurses";
+ version = "8.0";
+ sha256 = "0azhzh1910v24dqx45zmh4z4dl63fgsykajrbikx5xfvvmkcq7xs";
+ buildInputs = [ libterminfo ];
+ NIX_CFLAGS_COMPILE = [
+ "-D__scanflike(a,b)="
+ "-D__va_list=va_list"
+ "-D__warn_references(a,b)="
+ ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
+ propagatedBuildInputs = [ compat ];
+ MKDOC = "no"; # missing vfontedpr
+ postPatch = lib.optionalString (!stdenv.isDarwin) ''
+ substituteInPlace printw.c \
+ --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \
+ --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));'
+ substituteInPlace scanw.c \
+ --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));'
+ '';
+ };
+
+ libkern = mkDerivation {
+ path = "lib/libkern";
+ version = "8.0";
+ sha256 = "1wirqr9bms69n4b5sr32g1b1k41hcamm7c9n7i8c440m73r92yv4";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ column = mkDerivation {
+ path = "usr.bin/column";
+ version = "8.0";
+ sha256 = "0r6b0hjn5ls3j3sv6chibs44fs32yyk2cg8kh70kb4cwajs4ifyl";
+ };
+
+ libossaudio = mkDerivation {
+ path = "lib/libossaudio";
+ version = "8.0";
+ sha256 = "03azp5anavhjr15sinjlik9792lyf7w4zmkcihlkksrywhs05axh";
+ meta.platforms = lib.platforms.netbsd;
+ postPatch = ''
+ substituteInPlace rpc/Makefile --replace /usr $out
+ '';
+ };
+
+ librpcsvc = mkDerivation {
+ path = "lib/librpcsvc";
+ version = "8.0";
+ sha256 = "14ri9w6gdhsm4id5ck133syyvbmkbknfa8w0xkklm726nskhfkj7";
+ makeFlags = [ "INCSDIR=$(out)/include/rpcsvc" ];
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ librt = mkDerivation {
+ path = "lib/librt";
+ version = "8.0";
+ sha256 = "078qsi4mg1hyyxr1awvjs9b0c2gicg3zw4vl603g1m9vm8gfxw9l";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ libcrypt = mkDerivation {
+ path = "lib/libcrypt";
+ version = "8.0";
+ sha256 = "0siqan1wdqmmhchh2n8w6a8x1abbff8n4yb6jrqxap3hqn8ay54g";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ libpthread = mkDerivation {
+ path = "lib/libpthread";
+ version = "8.0";
+ sha256 = "0pcz61klc3ijf5z2zf8s78nj7bwjfblzjllx7vr4z5qv3m0sdb3j";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ libresolv = mkDerivation {
+ path = "lib/libresolv";
+ version = "8.0";
+ sha256 = "11vpb3p2343wyrhw4v9gwz7i0lcpb9ysmfs9gsx56b5gkgipdy4v";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ libm = mkDerivation {
+ path = "lib/libm";
+ version = "8.0";
+ sha256 = "0i22603cgj6n00gn2m446v4kn1pk109qs1g6ylrslmihfmiy2h1d";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ i18n_module = mkDerivation {
+ path = "lib/i18n_module";
+ version = "8.0";
+ sha256 = "0w6y5v3binm7gf2kn7y9jja8k18rhnyl55cvvfnfipjqdxvxd9jd";
+ meta.platforms = lib.platforms.netbsd;
+ };
+
+ csu = mkDerivation {
+ path = "lib/csu";
+ version = "8.0";
+ sha256 = "0630lbvz6v4ic13bfg8ccwfhqkgcv76bfdw9f36rfsnwfgpxqsmq";
+ meta.platforms = lib.platforms.netbsd;
+ nativeBuildInputs = [ makeMinimal install mandoc groff flex
+ yacc genassym gencat lorder tsort stat ];
+ extraPaths = [ sys.src ld_elf_so.src ];
+ };
+
+ ld_elf_so = mkDerivation {
+ path = "libexec/ld.elf_so";
+ version = "8.0";
+ sha256 = "1jmqpi0kg2daiqnvpwdyfy8rpnszxsm70sxizz0r7wn53xjr5hva";
+ meta.platforms = lib.platforms.netbsd;
+ USE_FORT = "yes";
+ extraPaths = [ libc.src ] ++ libc.extraPaths;
+ };
+
+ libc = mkDerivation {
+ path = "lib/libc";
+ version = "8.0";
+ sha256 = "0lgbc58qgn8kwm3l011x1ml1kgcf7jsgq7hbf0hxhlbvxq5bljl3";
+ USE_FORT = "yes";
+ MKPROFILE = "no";
+ extraPaths = [ common.src i18n_module.src sys.src
+ ld_elf_so.src libpthread.src libm.src libresolv.src
+ librpcsvc.src libutil.src librt.src libcrypt.src ];
+ buildInputs = [ buildPackages.netbsd.headers csu ];
+ nativeBuildInputs = [ makeMinimal install mandoc groff flex
+ yacc genassym gencat lorder tsort stat ];
+ NIX_CFLAGS_COMPILE = "-B${csu}/lib";
+ meta.platforms = lib.platforms.netbsd;
+ SHLIBINSTALLDIR = "$(out)/lib";
+ NLSDIR = "$(out)/share/nls";
+ makeFlags = [ "FILESDIR=$(out)/var/db"];
+ postInstall = ''
+ pushd ${buildPackages.netbsd.headers}
+ find . -type d -exec mkdir -p $out/\{} \;
+ find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
+ popd
+
+ pushd ${csu}
+ find . -type d -exec mkdir -p $out/\{} \;
+ find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
+ popd
+
+ NIX_CFLAGS_COMPILE+=" -B$out/lib"
+ NIX_CFLAGS_COMPILE+=" -I$out/include"
+ NIX_LDFLAGS+=" -L$out/lib"
+
+ make -C $NETBSDSRCDIR/lib/libpthread $makeFlags
+ make -C $NETBSDSRCDIR/lib/libpthread $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/libm $makeFlags
+ make -C $NETBSDSRCDIR/lib/libm $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/libresolv $makeFlags
+ make -C $NETBSDSRCDIR/lib/libresolv $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags
+ make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags
+ make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/libutil $makeFlags
+ make -C $NETBSDSRCDIR/lib/libutil $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/librt $makeFlags
+ make -C $NETBSDSRCDIR/lib/librt $makeFlags install
+
+ make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags
+ make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags install
+ '';
+ postPatch = ''
+ substituteInPlace sys/Makefile.inc \
+ --replace /usr/include/sys/syscall.h ${buildPackages.netbsd.headers}/include/sys/syscall.h
+ '';
+ };
+ #
+ # END LIBRARIES
+ #
+
+ #
+ # START MISCELLANEOUS
+ #
+ dict = mkDerivation {
+ path = "share/dict";
+ noCC = true;
+ version = "8.0";
+ sha256 = "1pk0y3xc5ihc2k89wjkh33qqx3w9q34k03k2qcffvbqh1l6wm36l";
+ makeFlags = [ "BINDIR=$(out)/share" ];
+ };
+
+ misc = mkDerivation {
+ path = "share/misc";
+ noCC = true;
+ version = "8.0";
+ sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch8";
+ makeFlags = [ "BINDIR=$(out)/share" ];
+ };
+
+ man = mkDerivation {
+ path = "share/man";
+ noCC = true;
+ version = "8.0";
+ sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch0";
+ makeFlags = [ "FILESDIR=$(out)/share" ];
+ };
+ #
+ # END MISCELLANEOUS
+ #
+
+ };
+
+in netbsd
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh
new file mode 100644
index 000000000000..b6cb5aaca05b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/fts-setup-hook.sh
@@ -0,0 +1,4 @@
+# See pkgs/build-support/setup-hooks/role.bash
+getHostRole
+
+export NIX_LDFLAGS${role_post}+=" -lfts"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/getent.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/getent.patch
new file mode 100644
index 000000000000..e9e34d19a315
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/getent.patch
@@ -0,0 +1,455 @@
+Author: Matthew Bauer
+Description: Remove unavailable getent databases
+Version: 7.1.2
+--- a/getent.c 2018-04-16 13:33:49.000000000 -0500
++++ b/getent.c 2018-04-16 13:29:30.000000000 -0500
+@@ -42,7 +42,6 @@
+ #include <grp.h>
+ #include <limits.h>
+ #include <netdb.h>
+-#include <netgroup.h>
+ #include <pwd.h>
+ #include <stdio.h>
+ #include <stdarg.h>
+@@ -57,27 +56,16 @@
+ #include <arpa/nameser.h>
+
+ #include <net/if.h>
+-#include <net/if_ether.h>
+
+ #include <netinet/in.h> /* for INET6_ADDRSTRLEN */
+
+-#include <rpc/rpcent.h>
+-
+-#include <disktab.h>
+-
+ static int usage(void) __attribute__((__noreturn__));
+ static int parsenum(const char *, unsigned long *);
+-static int disktab(int, char *[]);
+-static int gettytab(int, char *[]);
+-static int ethers(int, char *[]);
+ static int group(int, char *[]);
+ static int hosts(int, char *[]);
+-static int netgroup(int, char *[]);
+ static int networks(int, char *[]);
+ static int passwd(int, char *[]);
+-static int printcap(int, char *[]);
+ static int protocols(int, char *[]);
+-static int rpc(int, char *[]);
+ static int services(int, char *[]);
+ static int shells(int, char *[]);
+
+@@ -92,17 +80,11 @@
+ const char *name;
+ int (*callback)(int, char *[]);
+ } databases[] = {
+- { "disktab", disktab, },
+- { "ethers", ethers, },
+- { "gettytab", gettytab, },
+ { "group", group, },
+ { "hosts", hosts, },
+- { "netgroup", netgroup, },
+ { "networks", networks, },
+ { "passwd", passwd, },
+- { "printcap", printcap, },
+ { "protocols", protocols, },
+- { "rpc", rpc, },
+ { "services", services, },
+ { "shells", shells, },
+
+@@ -195,49 +177,6 @@
+ (void)printf("\n");
+ }
+
+-
+- /*
+- * ethers
+- */
+-
+-static int
+-ethers(int argc, char *argv[])
+-{
+- char hostname[MAXHOSTNAMELEN + 1], *hp;
+- struct ether_addr ea, *eap;
+- int i, rv;
+-
+- assert(argc > 1);
+- assert(argv != NULL);
+-
+-#define ETHERSPRINT (void)printf("%-17s %s\n", ether_ntoa(eap), hp)
+-
+- rv = RV_OK;
+- if (argc == 2) {
+- warnx("Enumeration not supported on ethers");
+- rv = RV_NOENUM;
+- } else {
+- for (i = 2; i < argc; i++) {
+- if ((eap = ether_aton(argv[i])) == NULL) {
+- eap = &ea;
+- hp = argv[i];
+- if (ether_hostton(hp, eap) != 0) {
+- rv = RV_NOTFOUND;
+- break;
+- }
+- } else {
+- hp = hostname;
+- if (ether_ntohost(hp, eap) != 0) {
+- rv = RV_NOTFOUND;
+- break;
+- }
+- }
+- ETHERSPRINT;
+- }
+- }
+- return rv;
+-}
+-
+ /*
+ * group
+ */
+@@ -298,7 +237,7 @@
+ hosts(int argc, char *argv[])
+ {
+ struct hostent *he;
+- char addr[IN6ADDRSZ];
++ char addr[NS_IN6ADDRSZ];
+ int i, rv;
+
+ assert(argc > 1);
+@@ -312,9 +251,9 @@
+ } else {
+ for (i = 2; i < argc; i++) {
+ if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0)
+- he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
++ he = gethostbyaddr(addr, NS_IN6ADDRSZ, AF_INET6);
+ else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0)
+- he = gethostbyaddr(addr, INADDRSZ, AF_INET);
++ he = gethostbyaddr(addr, NS_INADDRSZ, AF_INET);
+ else
+ he = gethostbyname(argv[i]);
+ if (he != NULL)
+@@ -330,48 +269,6 @@
+ }
+
+ /*
+- * netgroup
+- */
+-static int
+-netgroup(int argc, char *argv[])
+-{
+- int rv, i;
+- bool first;
+- const char *host, *user, *domain;
+-
+- assert(argc > 1);
+- assert(argv != NULL);
+-
+-#define NETGROUPPRINT(s) (((s) != NULL) ? (s) : "")
+-
+- rv = RV_OK;
+- if (argc == 2) {
+- warnx("Enumeration not supported on netgroup");
+- rv = RV_NOENUM;
+- } else {
+- for (i = 2; i < argc; i++) {
+- setnetgrent(argv[i]);
+- first = true;
+- while (getnetgrent(&host, &user, &domain) != 0) {
+- if (first) {
+- first = false;
+- (void)fputs(argv[i], stdout);
+- }
+- (void)printf(" (%s,%s,%s)",
+- NETGROUPPRINT(host),
+- NETGROUPPRINT(user),
+- NETGROUPPRINT(domain));
+- }
+- if (!first)
+- (void)putchar('\n');
+- endnetgrent();
+- }
+- }
+-
+- return rv;
+-}
+-
+- /*
+ * networks
+ */
+
+@@ -464,227 +361,6 @@
+ return rv;
+ }
+
+-static char *
+-mygetent(const char * const * db_array, const char *name)
+-{
+- char *buf = NULL;
+- int error;
+-
+- switch (error = cgetent(&buf, db_array, name)) {
+- case -3:
+- warnx("tc= loop in record `%s' in `%s'", name, db_array[0]);
+- break;
+- case -2:
+- warn("system error fetching record `%s' in `%s'", name,
+- db_array[0]);
+- break;
+- case -1:
+- case 0:
+- break;
+- case 1:
+- warnx("tc= reference not found in record for `%s' in `%s'",
+- name, db_array[0]);
+- break;
+- default:
+- warnx("unknown error %d in record `%s' in `%s'", error, name,
+- db_array[0]);
+- break;
+- }
+- return buf;
+-}
+-
+-static char *
+-mygetone(const char * const * db_array, int first)
+-{
+- char *buf = NULL;
+- int error;
+-
+- switch (error = (first ? cgetfirst : cgetnext)(&buf, db_array)) {
+- case -2:
+- warnx("tc= loop in `%s'", db_array[0]);
+- break;
+- case -1:
+- warn("system error fetching record in `%s'", db_array[0]);
+- break;
+- case 0:
+- case 1:
+- break;
+- case 2:
+- warnx("tc= reference not found in `%s'", db_array[0]);
+- break;
+- default:
+- warnx("unknown error %d in `%s'", error, db_array[0]);
+- break;
+- }
+- return buf;
+-}
+-
+-static void
+-capprint(const char *cap)
+-{
+- char *c = strchr(cap, ':');
+- if (c)
+- if (c == cap)
+- (void)printf("true\n");
+- else {
+- int l = (int)(c - cap);
+- (void)printf("%*.*s\n", l, l, cap);
+- }
+- else
+- (void)printf("%s\n", cap);
+-}
+-
+-static void
+-prettyprint(char *b)
+-{
+-#define TERMWIDTH 65
+- int did = 0;
+- size_t len;
+- char *s, c;
+-
+- for (;;) {
+- len = strlen(b);
+- if (len <= TERMWIDTH) {
+-done:
+- if (did)
+- printf("\t:");
+- printf("%s\n", b);
+- return;
+- }
+- for (s = b + TERMWIDTH; s > b && *s != ':'; s--)
+- continue;
+- if (*s++ != ':')
+- goto done;
+- c = *s;
+- *s = '\0';
+- if (did)
+- printf("\t:");
+- did++;
+- printf("%s\\\n", b);
+- *s = c;
+- b = s;
+- }
+-}
+-
+-static void
+-handleone(const char * const *db_array, char *b, int recurse, int pretty,
+- int level)
+-{
+- char *tc;
+-
+- if (level && pretty)
+- printf("\n");
+- if (pretty)
+- prettyprint(b);
+- else
+- printf("%s\n", b);
+- if (!recurse || cgetstr(b, "tc", &tc) <= 0)
+- return;
+-
+- b = mygetent(db_array, tc);
+- free(tc);
+-
+- if (b == NULL)
+- return;
+-
+- handleone(db_array, b, recurse, pretty, ++level);
+- free(b);
+-}
+-
+-static int
+-handlecap(const char *db, int argc, char *argv[])
+-{
+- static const char sfx[] = "=#:";
+- const char *db_array[] = { db, NULL };
+- char *b, *cap;
+- int i, rv, c;
+- size_t j;
+- int expand = 1, recurse = 0, pretty = 0;
+-
+- assert(argc > 1);
+- assert(argv != NULL);
+-
+- argc--;
+- argv++;
+- while ((c = getopt(argc, argv, "pnr")) != -1)
+- switch (c) {
+- case 'n':
+- expand = 0;
+- break;
+- case 'r':
+- expand = 0;
+- recurse = 1;
+- break;
+- case 'p':
+- pretty = 1;
+- break;
+- default:
+- usage();
+- break;
+- }
+-
+- argc -= optind;
+- argv += optind;
+- csetexpandtc(expand);
+- rv = RV_OK;
+- if (argc == 0) {
+- for (b = mygetone(db_array, 1); b; b = mygetone(db_array, 0)) {
+- handleone(db_array, b, recurse, pretty, 0);
+- free(b);
+- }
+- } else {
+- if ((b = mygetent(db_array, argv[0])) == NULL)
+- return RV_NOTFOUND;
+- if (argc == 1)
+- handleone(db_array, b, recurse, pretty, 0);
+- else {
+- for (i = 2; i < argc; i++) {
+- for (j = 0; j < sizeof(sfx) - 1; j++) {
+- cap = cgetcap(b, argv[i], sfx[j]);
+- if (cap) {
+- capprint(cap);
+- break;
+- }
+- }
+- if (j == sizeof(sfx) - 1)
+- printf("false\n");
+- }
+- }
+- free(b);
+- }
+- return rv;
+-}
+-
+- /*
+- * gettytab
+- */
+-
+-static int
+-gettytab(int argc, char *argv[])
+-{
+- return handlecap(_PATH_GETTYTAB, argc, argv);
+-}
+-
+- /*
+- * printcap
+- */
+-
+-static int
+-printcap(int argc, char *argv[])
+-{
+- return handlecap(_PATH_PRINTCAP, argc, argv);
+-}
+-
+- /*
+- * disktab
+- */
+-
+-static int
+-disktab(int argc, char *argv[])
+-{
+- return handlecap(_PATH_DISKTAB, argc, argv);
+-}
+-
+ /*
+ * protocols
+ */
+@@ -726,47 +402,6 @@
+ }
+
+ /*
+- * rpc
+- */
+-
+-static int
+-rpc(int argc, char *argv[])
+-{
+- struct rpcent *re;
+- unsigned long id;
+- int i, rv;
+-
+- assert(argc > 1);
+- assert(argv != NULL);
+-
+-#define RPCPRINT printfmtstrings(re->r_aliases, " ", " ", \
+- "%-16s %6d", \
+- re->r_name, re->r_number)
+-
+- setrpcent(1);
+- rv = RV_OK;
+- if (argc == 2) {
+- while ((re = getrpcent()) != NULL)
+- RPCPRINT;
+- } else {
+- for (i = 2; i < argc; i++) {
+- if (parsenum(argv[i], &id))
+- re = getrpcbynumber((int)id);
+- else
+- re = getrpcbyname(argv[i]);
+- if (re != NULL)
+- RPCPRINT;
+- else {
+- rv = RV_NOTFOUND;
+- break;
+- }
+- }
+- }
+- endrpcent();
+- return rv;
+-}
+-
+- /*
+ * services
+ */
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc
new file mode 100644
index 000000000000..3aadabe50882
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc
@@ -0,0 +1,11 @@
+prefix=@out@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: nbcompat
+Description: NetBSD compatibility framework
+Version: @version@
+URL: https://www.netbsd.org/
+Libs: -L${libdir} -lnbcompat
+Cflags: -I${includedir} -DHAVE_NBTOOL_CONFIG_H -include nbtool_config.h
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/locale.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/locale.patch
new file mode 100644
index 000000000000..1df9eb385625
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/bsd/netbsd/locale.patch
@@ -0,0 +1,85 @@
+--- a/locale.c 2018-06-11 14:39:06.449762000 -0400
++++ b/locale.c 2018-06-11 14:42:28.461122899 -0400
+@@ -56,14 +56,8 @@
+ #include <stringlist.h>
+ #include <unistd.h>
+
+-#include "citrus_namespace.h"
+-#include "citrus_region.h"
+-#include "citrus_lookup.h"
+-#include "setlocale_local.h"
+-
+ /* Local prototypes */
+ void init_locales_list(void);
+-void init_locales_list_alias(void);
+ void list_charmaps(void);
+ void list_locales(void);
+ const char *lookup_localecat(int);
+@@ -221,6 +215,8 @@
+ };
+ #define NKWINFO (sizeof(kwinfo)/sizeof(kwinfo[0]))
+
++const char *_PathLocale = NULL;
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -411,8 +407,7 @@
+ while ((dp = readdir(dirp)) != NULL) {
+ /* exclude "." and "..", _LOCALE_ALIAS_NAME */
+ if ((dp->d_name[0] != '.' || (dp->d_name[1] != '\0' &&
+- (dp->d_name[1] != '.' || dp->d_name[2] != '\0'))) &&
+- strcmp(_LOCALE_ALIAS_NAME, dp->d_name) != 0) {
++ (dp->d_name[1] != '.' || dp->d_name[2] != '\0')))) {
+ s = strdup(dp->d_name);
+ if (s == NULL)
+ err(1, "could not allocate memory");
+@@ -431,48 +426,10 @@
+ if (sl_find(locales, "C") == NULL)
+ sl_add(locales, "C");
+
+- init_locales_list_alias();
+-
+ /* make output nicer, sort the list */
+ qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
+ }
+
+-void
+-init_locales_list_alias(void)
+-{
+- char aliaspath[PATH_MAX];
+- struct _lookup *hlookup;
+- struct _region key, dat;
+- size_t n;
+- char *s, *t;
+-
+- _DIAGASSERT(locales != NULL);
+- _DIAGASSERT(_PathLocale != NULL);
+-
+- (void)snprintf(aliaspath, sizeof(aliaspath),
+- "%s/" _LOCALE_ALIAS_NAME, _PathLocale);
+-
+- if (_lookup_seq_open(&hlookup, aliaspath,
+- _LOOKUP_CASE_SENSITIVE) == 0) {
+- while (_lookup_seq_next(hlookup, &key, &dat) == 0) {
+- n = _region_size((const struct _region *)&key);
+- s = _region_head((const struct _region *)&key);
+- for (t = s; n > 0 && *s!= '/'; --n, ++s);
+- n = (size_t)(s - t);
+- s = malloc(n + 1);
+- if (s == NULL)
+- err(1, "could not allocate memory");
+- memcpy(s, t, n);
+- s[n] = '\0';
+- if (sl_find(locales, s) == NULL)
+- sl_add(locales, s);
+- else
+- free(s);
+- }
+- _lookup_seq_close(hlookup);
+- }
+-}
+-
+ /*
+ * Show current locale status, depending on environment variables
+ */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/CoreSymbolication/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/CoreSymbolication/default.nix
new file mode 100644
index 000000000000..aa73c7f86c40
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/CoreSymbolication/default.nix
@@ -0,0 +1,19 @@
+{ fetchFromGitHub, stdenv }:
+
+# Reverse engineered CoreSymbolication to make dtrace buildable
+
+stdenv.mkDerivation rec {
+ name = "CoreSymbolication";
+
+ src = fetchFromGitHub {
+ repo = name;
+ owner = "matthewbauer";
+ rev = "671fcb66c82eac1827f3f53dc4cc4e9b1b94da0a";
+ sha256 = "0qpw46gwgjxiwqqjxksb8yghp2q8dwad6hzaf4zl82xpvk9n5ahj";
+ };
+
+ installPhase = ''
+ mkdir -p $out/include
+ cp -r CoreSymbolication $out/include
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/DarwinTools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/DarwinTools/default.nix
new file mode 100644
index 000000000000..174f9478633c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/DarwinTools/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "DarwinTools-1";
+
+ src = fetchurl {
+ url = "https://opensource.apple.com/tarballs/DarwinTools/${name}.tar.gz";
+ sha256 = "0hh4jl590jv3v830p77r3jcrnpndy7p2b8ajai3ldpnx2913jfhp";
+ };
+
+ patchPhase = ''
+ substituteInPlace Makefile \
+ --replace gcc cc
+ '';
+
+ configurePhase = ''
+ export SRCROOT=.
+ export SYMROOT=.
+ export DSTROOT=$out
+ '';
+
+ postInstall = ''
+ mv $out/usr/* $out
+ rmdir $out/usr
+ '';
+
+ meta = {
+ maintainers = [ stdenv.lib.maintainers.matthewbauer ];
+ platforms = stdenv.lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh
new file mode 100644
index 000000000000..86c241cd0f56
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh
@@ -0,0 +1,9 @@
+linkSystemCoreFoundationFramework() {
+ NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}"
+ # gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not
+ # in the opensource release
+ # if the package needs private headers, we assume they also want to link with system CF
+ NIX_LDFLAGS+=" /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
+}
+
+preConfigureHooks+=(linkSystemCoreFoundationFramework)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/default.nix
new file mode 100644
index 000000000000..89c13d0b92d7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/default.nix
@@ -0,0 +1,241 @@
+{ stdenv, fetchurl, xar, cpio, pkgs, python3, pbzx, lib }:
+
+let version = "10.12"; in
+
+# Ensure appleSdkVersion is up to date.
+assert stdenv.isDarwin -> stdenv.appleSdkVersion == version;
+
+let
+ # sadly needs to be exported because security_tool needs it
+ sdk = stdenv.mkDerivation rec {
+ pname = "MacOS_SDK";
+ inherit version;
+
+ # This URL comes from https://swscan.apple.com/content/catalogs/others/index-10.12.merged-1.sucatalog, which we found by:
+ # 1. Google: site:swscan.apple.com and look for a name that seems appropriate for your version
+ # 2. In the resulting file, search for a file called DevSDK ending in .pkg
+ # 3. ???
+ # 4. Profit
+ src = fetchurl {
+ url = "http://swcdn.apple.com/content/downloads/33/36/041-90419-A_7JJ4H9ZHO2/xs88ob5wjz6riz7g6764twblnvksusg4ps/DevSDK_OSX1012.pkg";
+ sha256 = "13xq34sb7383b37hwy076gnhf96prpk1b4087p87xnwswxbrisih";
+ };
+
+ nativeBuildInputs = [ xar cpio python3 pbzx ];
+
+ outputs = [ "out" "dev" "man" ];
+
+ unpackPhase = ''
+ xar -x -f $src
+ '';
+
+ installPhase = ''
+ start="$(pwd)"
+ mkdir -p $out
+ cd $out
+ pbzx -n $start/Payload | cpio -idm
+
+ mv usr/* .
+ rmdir usr
+
+ mv System/* .
+ rmdir System
+
+ pushd lib
+ ln -s -L /usr/lib/libcups*.dylib .
+ popd
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Apple SDK ${version}";
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ };
+ };
+
+ framework = name: deps: stdenv.mkDerivation {
+ name = "apple-framework-${name}";
+
+ dontUnpack = true;
+
+ # because we copy files from the system
+ preferLocalBuild = true;
+
+ disallowedRequisites = [ sdk ];
+
+ installPhase = ''
+ linkFramework() {
+ local path="$1"
+ local nested_path="$1"
+ local dest="$out/Library/Frameworks/$path"
+ if [ "$path" == "JavaNativeFoundation.framework" ]; then
+ local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework"
+ fi
+ if [ "$path" == "JavaRuntimeSupport.framework" ]; then
+ local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaRuntimeSupport.framework"
+ fi
+ local name="$(basename "$path" .framework)"
+ local current="$(readlink "/System/Library/Frameworks/$nested_path/Versions/Current")"
+ if [ -z "$current" ]; then
+ current=A
+ fi
+
+ mkdir -p "$dest"
+ pushd "$dest" >/dev/null
+
+ # Keep track of if this is a child or a child rescue as with
+ # ApplicationServices in the 10.9 SDK
+ local isChild=0
+
+ if [ -d "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" ]; then
+ isChild=1
+ cp -R "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" .
+ elif [ -d "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" ]; then
+ current="$(readlink "/System/Library/Frameworks/$name.framework/Versions/Current")"
+ cp -R "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" .
+ fi
+ ln -s -L "/System/Library/Frameworks/$nested_path/Versions/$current/$name"
+ ln -s -L "/System/Library/Frameworks/$nested_path/Versions/$current/Resources"
+
+ if [ -f "/System/Library/Frameworks/$nested_path/module.map" ]; then
+ ln -s "/System/Library/Frameworks/$nested_path/module.map"
+ fi
+
+ pushd "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current" >/dev/null
+ local children=$(echo Frameworks/*.framework)
+ popd >/dev/null
+
+ for child in $children; do
+ childpath="$path/Versions/$current/$child"
+ linkFramework "$childpath"
+ done
+
+ if [ -d "$dest/Versions/$current" ]; then
+ mv $dest/Versions/$current/* .
+ fi
+
+ popd >/dev/null
+ }
+
+ linkFramework "${name}.framework"
+ '';
+
+ propagatedBuildInputs = deps;
+
+ # don't use pure CF for dylibs that depend on frameworks
+ setupHook = ./framework-setup-hook.sh;
+
+ # Not going to be more specific than this for now
+ __propagatedImpureHostDeps = stdenv.lib.optionals (name != "Kernel") [
+ # The setup-hook ensures that everyone uses the impure CoreFoundation who uses these SDK frameworks, so let's expose it
+ "/System/Library/Frameworks/CoreFoundation.framework"
+ "/System/Library/Frameworks/${name}.framework"
+ "/System/Library/Frameworks/${name}.framework/${name}"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Apple SDK framework ${name}";
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ };
+ };
+in rec {
+ libs = {
+ xpc = stdenv.mkDerivation {
+ name = "apple-lib-xpc";
+ dontUnpack = true;
+
+ installPhase = ''
+ mkdir -p $out/include
+ pushd $out/include >/dev/null
+ cp -r "${lib.getDev sdk}/include/xpc" $out/include/xpc
+ cp "${lib.getDev sdk}/include/launch.h" $out/include/launch.h
+ popd >/dev/null
+ '';
+ };
+
+ Xplugin = stdenv.mkDerivation {
+ name = "apple-lib-Xplugin";
+ dontUnpack = true;
+
+ # Not enough
+ __propagatedImpureHostDeps = [ "/usr/lib/libXplugin.1.dylib" ];
+
+ propagatedBuildInputs = with frameworks; [
+ OpenGL ApplicationServices Carbon IOKit CoreGraphics CoreServices CoreText
+ ];
+
+ installPhase = ''
+ mkdir -p $out/include $out/lib
+ ln -s "${lib.getDev sdk}/include/Xplugin.h" $out/include/Xplugin.h
+ ln -s "/usr/lib/libXplugin.1.dylib" $out/lib/libXplugin.dylib
+ '';
+ };
+
+ utmp = stdenv.mkDerivation {
+ name = "apple-lib-utmp";
+ dontUnpack = true;
+
+ installPhase = ''
+ mkdir -p $out/include
+ pushd $out/include >/dev/null
+ ln -s "${lib.getDev sdk}/include/utmp.h"
+ ln -s "${lib.getDev sdk}/include/utmpx.h"
+ popd >/dev/null
+ '';
+ };
+ };
+
+ overrides = super: {
+ AppKit = stdenv.lib.overrideDerivation super.AppKit (drv: {
+ __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps ++ [
+ "/System/Library/PrivateFrameworks/"
+ ];
+ });
+
+ CoreFoundation = stdenv.lib.overrideDerivation super.CoreFoundation (drv: {
+ setupHook = ./cf-setup-hook.sh;
+ });
+
+ CoreMedia = stdenv.lib.overrideDerivation super.CoreMedia (drv: {
+ __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps ++ [
+ "/System/Library/Frameworks/CoreImage.framework"
+ ];
+ });
+
+ CoreMIDI = stdenv.lib.overrideDerivation super.CoreMIDI (drv: {
+ __propagatedImpureHostDeps = drv.__propagatedImpureHostDeps ++ [
+ "/System/Library/PrivateFrameworks/"
+ ];
+ setupHook = ./private-frameworks-setup-hook.sh;
+ });
+
+ Security = stdenv.lib.overrideDerivation super.Security (drv: {
+ setupHook = ./security-setup-hook.sh;
+ });
+
+ QuartzCore = stdenv.lib.overrideDerivation super.QuartzCore (drv: {
+ installPhase = drv.installPhase + ''
+ f="$out/Library/Frameworks/QuartzCore.framework/Headers/CoreImage.h"
+ substituteInPlace "$f" \
+ --replace "QuartzCore/../Frameworks/CoreImage.framework/Headers" "CoreImage"
+ '';
+ });
+
+ MetalKit = stdenv.lib.overrideDerivation super.MetalKit (drv: {
+ installPhase = drv.installPhase + ''
+ mkdir -p $out/include/simd
+ cp ${lib.getDev sdk}/include/simd/*.h $out/include/simd/
+ '';
+ });
+ };
+
+ bareFrameworks = stdenv.lib.mapAttrs framework (import ./frameworks.nix {
+ inherit frameworks libs;
+ inherit (pkgs.darwin) libobjc;
+ });
+
+ frameworks = bareFrameworks // overrides bareFrameworks;
+
+ inherit sdk;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
new file mode 100644
index 000000000000..b0d5915fc1fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
@@ -0,0 +1,42 @@
+# On macOS, frameworks are linked to the system CoreFoundation but
+# dynamic libraries built with nix use a pure version of CF this
+# causes segfaults for binaries that depend on it at runtime. This
+# can be solved in two ways.
+# 1. Rewrite references to the pure CF using this setup hook, this
+# works for the simple case but this can still cause problems if other
+# dependencies (eg. python) use the pure CF.
+# 2. Create a wrapper for the binary that sets DYLD_FRAMEWORK_PATH to
+# /System/Library/Frameworks. This will make everything load the
+# system's CoreFoundation framework while still keeping the
+# dependencies pure for other packages.
+
+fixupOutputHooks+=('fixDarwinFrameworksIn $prefix')
+
+fixDarwinFrameworks() {
+ local systemPrefix='/System/Library/Frameworks'
+
+ for fn in "$@"; do
+ if [ -L "$fn" ]; then continue; fi
+ echo "$fn: fixing dylib"
+
+ for framework in $(otool -L "$fn" | awk '/CoreFoundation\.framework/ {print $1}'); do
+ install_name_tool -change "$framework" "$systemPrefix/CoreFoundation.framework/Versions/A/CoreFoundation" "$fn" >&2
+ done
+ done
+}
+
+fixDarwinFrameworksIn() {
+ local dir="$1"
+ fixDarwinFrameworks $(find "$dir" -name "*.dylib")
+}
+
+
+# This configures the stdenv to use /System/Library/Frameworks/CoreFoundation.framework
+# instead of the nix version by including the system frameworks path
+# as an rpath entry when creating binaries.
+
+useSystemCoreFoundationFramework () {
+ export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
+}
+
+addEnvHooks "$hostOffset" useSystemCoreFoundationFramework
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/frameworks.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
new file mode 100644
index 000000000000..02e2421f3472
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/frameworks.nix
@@ -0,0 +1,127 @@
+# Current as of 10.9
+# Epic weird knot-tying happening here.
+# TODO: clean up the process for generating this and include it
+
+{ frameworks, libs, libobjc, }:
+
+with frameworks; with libs; {
+ AGL = [ Carbon OpenGL ];
+ AVFoundation = [ ApplicationServices CoreGraphics ];
+ AVKit = [];
+ Accounts = [];
+ AddressBook = [ Carbon ];
+ AppKit = [ AudioToolbox AudioUnit Foundation QuartzCore ];
+ AppKitScripting = [];
+ AppleScriptKit = [];
+ AppleScriptObjC = [];
+ AudioToolbox = [ CoreAudio CoreMIDI ];
+ AudioUnit = [ AudioToolbox Carbon CoreAudio ];
+ AudioVideoBridging = [ Foundation ];
+ Automator = [];
+ CFNetwork = [];
+ CalendarStore = [];
+ Cocoa = [ AppKit ];
+ Collaboration = [];
+ # Impure version of CoreFoundation, this should not be used unless another
+ # framework includes headers that are not available in the pure version.
+ CoreFoundation = [];
+ CoreAudio = [ IOKit ];
+ CoreAudioKit = [ AudioUnit ];
+ CoreData = [];
+ CoreGraphics = [ Accelerate IOKit IOSurface SystemConfiguration ];
+ CoreImage = [];
+ CoreLocation = [];
+ CoreMIDI = [];
+ CoreMIDIServer = [];
+ CoreMedia = [ ApplicationServices AudioToolbox AudioUnit CoreAudio CoreGraphics CoreVideo ];
+ CoreMediaIO = [ CoreMedia ];
+ CoreText = [ CoreGraphics ];
+ CoreVideo = [ ApplicationServices CoreGraphics IOSurface OpenGL ];
+ CoreWLAN = [ SecurityFoundation ];
+ DVDPlayback = [];
+ DirectoryService = [];
+ DiscRecording = [ CoreServices IOKit ];
+ DiscRecordingUI = [];
+ DiskArbitration = [ IOKit ];
+ EventKit = [];
+ ExceptionHandling = [];
+ FWAUserLib = [];
+ ForceFeedback = [ IOKit ];
+ Foundation = [ libobjc CoreFoundation Security ApplicationServices SystemConfiguration ];
+ GLKit = [];
+ GLUT = [ OpenGL ];
+ GSS = [];
+ GameController = [];
+ GameKit = [ Foundation ];
+ Hypervisor = [];
+ ICADevices = [ Carbon IOBluetooth ];
+ IMServicePlugIn = [];
+ IOBluetoothUI = [ IOBluetooth ];
+ IOKit = [];
+ IOSurface = [ IOKit xpc ];
+ ImageCaptureCore = [];
+ ImageIO = [ CoreGraphics ];
+ InputMethodKit = [ Carbon ];
+ InstallerPlugins = [];
+ InstantMessage = [];
+ JavaFrameEmbedding = [];
+ JavaNativeFoundation = [];
+ JavaRuntimeSupport = [];
+ JavaScriptCore = [];
+ Kerberos = [];
+ Kernel = [ IOKit ];
+ LDAP = [];
+ LatentSemanticMapping = [ Carbon ];
+ LocalAuthentication = [];
+ MapKit = [];
+ MediaAccessibility = [ CoreGraphics CoreText QuartzCore ];
+ MediaPlayer = [];
+ MediaToolbox = [ AudioToolbox AudioUnit CoreMedia ];
+ Metal = [];
+ MetalKit = [ ModelIO Metal ];
+ ModelIO = [ ];
+ NetFS = [];
+ OSAKit = [ Carbon ];
+ OpenAL = [];
+ OpenCL = [ IOSurface OpenGL ];
+ OpenGL = [];
+ PCSC = [ CoreData ];
+ PreferencePanes = [];
+ PubSub = [];
+ QTKit = [ CoreMediaIO CoreMedia MediaToolbox QuickTime VideoToolbox ];
+ QuickLook = [ ApplicationServices ];
+ SceneKit = [];
+ ScreenSaver = [];
+ Scripting = [];
+ ScriptingBridge = [];
+ Security = [ IOKit ];
+ SecurityFoundation = [];
+ SecurityInterface = [ Security ];
+ ServiceManagement = [ Security ];
+ Social = [];
+ SpriteKit = [];
+ StoreKit = [];
+ SyncServices = [];
+ SystemConfiguration = [ Security ];
+ TWAIN = [ Carbon ];
+ Tcl = [];
+ VideoDecodeAcceleration = [ CoreVideo ];
+ VideoToolbox = [ CoreMedia CoreVideo ];
+ WebKit = [ ApplicationServices Carbon JavaScriptCore OpenGL ];
+
+ # Umbrellas
+ Accelerate = [ CoreWLAN IOBluetooth ];
+ ApplicationServices = [ CoreServices CoreText ImageIO ];
+ Carbon = [ ApplicationServices CoreServices Foundation IOKit Security QuartzCore ];
+ CoreBluetooth = [];
+ # TODO: figure out which part of the umbrella depends on CoreFoundation and move it there.
+ CoreServices = [ CFNetwork CoreFoundation CoreAudio CoreData DiskArbitration Security NetFS OpenDirectory ServiceManagement ];
+ IOBluetooth = [ IOKit ];
+ JavaVM = [];
+ OpenDirectory = [];
+ Quartz = [ QuickLook QTKit ];
+ QuartzCore = [ ApplicationServices CoreVideo OpenCL CoreImage Metal ];
+ QuickTime = [ ApplicationServices AudioUnit Carbon CoreAudio CoreServices OpenGL QuartzCore ];
+
+ vmnet = [];
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix
new file mode 100644
index 000000000000..c111492f2b3d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix
@@ -0,0 +1,256 @@
+rec {
+ CFNetwork = [
+ "/System/Library/Frameworks/CFNetwork.framework"
+ "/usr/lib/libsqlite3.dylib"
+ "/usr/lib/libxml2.2.dylib"
+ ];
+ ForceFeedback = [
+ "/System/Library/Frameworks/ForceFeedback.framework"
+ ];
+ AGL = [
+ "/System/Library/Frameworks/AGL.framework"
+ ];
+ IOKit = [
+ "/System/Library/Frameworks/IOKit.framework"
+ ];
+ JavaScriptCore = [
+ "/System/Library/Frameworks/JavaScriptCore.framework"
+ ];
+ QuickLook = [
+ "/System/Library/Frameworks/QuickLook.framework"
+ ];
+ Quartz = [
+ "/System/Library/Frameworks/Quartz.framework"
+ "/System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo"
+ "/System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/CorePDF"
+ "/usr/lib/libspindump.dylib"
+ ];
+ ImageCaptureCore = [
+ "/System/Library/Frameworks/ImageCaptureCore.framework"
+ ];
+ VideoToolbox = [
+ "/System/Library/Frameworks/VideoToolbox.framework"
+ "/System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA"
+ ];
+ QuickTime = [
+ "/System/Library/Frameworks/QuickTime.framework"
+ ];
+ CoreMedia = [
+ "/System/Library/Frameworks/CoreMedia.framework"
+ ];
+ CoreMediaIO = [
+ "/System/Library/Frameworks/CoreMediaIO.framework"
+ "/System/Library/PrivateFrameworks/AppSandbox.framework/Versions/A/AppSandbox"
+ "/System/Library/PrivateFrameworks/AppContainer.framework/Versions/A/AppContainer"
+ "/System/Library/PrivateFrameworks/SecCodeWrapper.framework/Versions/A/SecCodeWrapper"
+ "/System/Library/PrivateFrameworks/XPCService.framework/Versions/A/XPCService"
+ "/usr/lib/libsandbox.1.dylib"
+ "/usr/lib/libMatch.1.dylib"
+ ];
+ MediaToolbox = [
+ "/System/Library/Frameworks/MediaToolbox.framework"
+ "/System/Library/PrivateFrameworks/CoreAUC.framework/Versions/A/CoreAUC"
+ "/System/Library/PrivateFrameworks/NetworkStatistics.framework/Versions/A/NetworkStatistics"
+ ];
+ QTKit = [
+ "/System/Library/Frameworks/QTKit.framework"
+ "/System/Library/PrivateFrameworks/CoreMediaAuthoring.framework/Versions/A/CoreMediaAuthoring"
+ ];
+ OSAKit = [
+ "/System/Library/Frameworks/OSAKit.framework"
+ "/usr/lib/libexslt.0.dylib"
+ ];
+ WebKit = [
+ "/System/Library/Frameworks/WebKit.framework"
+ ];
+ DiskArbitration = [
+ "/System/Library/Frameworks/DiskArbitration.framework"
+ ];
+ Security = [
+ "/System/Library/Frameworks/Security.framework"
+ "/usr/lib/libbsm.0.dylib"
+ "/usr/lib/libbz2.1.0.dylib"
+ "/usr/lib/libpam.2.dylib"
+ "/usr/lib/libxar.1.dylib"
+ "/usr/lib/libxml2.2.dylib"
+ "/usr/lib/libsqlite3.dylib"
+ ];
+ GSS = [
+ "/System/Library/Frameworks/GSS.framework"
+ ];
+ Kerberos = [
+ "/System/Library/Frameworks/Kerberos.framework"
+ ];
+ CoreServices = [
+ "/System/Library/Frameworks/CoreServices.framework"
+ "/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore"
+ "/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC"
+ "/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling"
+ "/usr/lib/libmecabra.dylib"
+ "/usr/lib/libcmph.dylib"
+ "/usr/lib/libiconv.2.dylib"
+ "/usr/lib/libxslt.1.dylib"
+ ] ++ Foundation;
+ IOSurface = [
+ "/System/Library/Frameworks/IOSurface.framework"
+ ];
+ CoreGraphics = [
+ "/System/Library/Frameworks/CoreGraphics.framework"
+ "/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport"
+ "/usr/lib/libbsm.0.dylib"
+ "/usr/lib/libz.1.dylib"
+ ];
+ CoreText = [
+ "/System/Library/Frameworks/CoreText.framework"
+ ];
+ ImageIO = [
+ "/System/Library/Frameworks/ImageIO.framework"
+ ];
+ ApplicationServices = [
+ "/System/Library/Frameworks/ApplicationServices.framework"
+ "/usr/lib/libcups.2.dylib"
+ "/usr/lib/libresolv.9.dylib"
+ ] ++ AudioToolbox;
+ OpenGL = [
+ "/System/Library/Frameworks/OpenGL.framework"
+ ];
+ CoreVideo = [
+ "/System/Library/Frameworks/CoreVideo.framework"
+ ];
+ QuartzCore = [
+ "/System/Library/Frameworks/QuartzCore.framework"
+ "/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport"
+ ];
+ PCSC = [
+ "/System/Library/Frameworks/PCSC.framework"
+ ];
+ AppKit = [
+ "/System/Library/Frameworks/AppKit.framework"
+ "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211"
+ "/System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG"
+ "/System/Library/PrivateFrameworks/AppleVPA.framework/Versions/A/AppleVPA"
+ "/System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup"
+ "/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary"
+ "/System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth"
+ "/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication"
+ "/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI"
+ "/System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi"
+ "/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport"
+ "/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore"
+ "/System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols"
+ "/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv"
+ "/System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore"
+ "/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage"
+ "/System/Library/PrivateFrameworks/Heimdal.framework/Heimdal"
+ "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/Current"
+ "/System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal"
+ "/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices"
+ "/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling"
+ "/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport"
+ "/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth"
+ "/System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis"
+ "/System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices"
+ "/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing"
+ "/System/Library/PrivateFrameworks/SpeechRecognitionCore.framework/Versions/A/SpeechRecognitionCore"
+ "/System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication"
+ "/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC"
+ "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation"
+ "/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport"
+ "/usr/lib/libCRFSuite.dylib"
+ "/usr/lib/libOpenScriptingUtil.dylib"
+ "/usr/lib/libarchive.2.dylib"
+ "/usr/lib/libbsm.0.dylib"
+ "/usr/lib/libbz2.1.0.dylib"
+ "/usr/lib/libc++.1.dylib"
+ "/usr/lib/libc++abi.dylib"
+ "/usr/lib/libcmph.dylib"
+ "/usr/lib/libcups.2.dylib"
+ "/usr/lib/libextension.dylib"
+ "/usr/lib/libheimdal-asn1.dylib"
+ "/usr/lib/libiconv.2.dylib"
+ "/usr/lib/libicucore.A.dylib"
+ "/usr/lib/liblangid.dylib"
+ "/usr/lib/liblzma.5.dylib"
+ "/usr/lib/libmecabra.dylib"
+ "/usr/lib/libpam.2.dylib"
+ "/usr/lib/libresolv.9.dylib"
+ "/usr/lib/libsqlite3.dylib"
+ "/usr/lib/libxar.1.dylib"
+ "/usr/lib/libxml2.2.dylib"
+ "/usr/lib/libxslt.1.dylib"
+ "/usr/lib/libz.1.dylib"
+ ];
+ Foundation = [
+ "/System/Library/Frameworks/Foundation.framework"
+ "/usr/lib/libextension.dylib"
+ "/usr/lib/libarchive.2.dylib"
+ "/usr/lib/liblzma.5.dylib"
+ "/usr/lib/liblangid.dylib"
+ "/usr/lib/libCRFSuite.dylib"
+ ];
+ CoreData = [
+ "/System/Library/Frameworks/CoreData.framework"
+ ];
+ Cocoa = [
+ "/System/Library/Frameworks/Cocoa.framework"
+ "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation"
+ "/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A"
+ ];
+ Carbon = [
+ "/System/Library/Frameworks/Carbon.framework"
+ "/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI"
+ "/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv"
+ "/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices"
+ "/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary"
+ "/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing"
+ "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211"
+ "/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage"
+ ];
+ CoreAudio = [
+ "/System/Library/Frameworks/CoreAudio.framework"
+ ];
+ AudioUnit = [
+ "/System/Library/Frameworks/AudioUnit.framework"
+ ];
+ CoreMIDI = [
+ "/System/Library/Frameworks/CoreMIDI.framework"
+ ];
+ AudioToolbox = [
+ "/System/Library/Frameworks/AudioToolbox.framework"
+ ];
+ SystemConfiguration = [
+ "/System/Library/Frameworks/SystemConfiguration.framework"
+ ];
+ NetFS = [
+ "/System/Library/Frameworks/NetFS.framework"
+ "/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth"
+ "/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport"
+ ];
+ Accelerate = [
+ "/System/Library/Frameworks/Accelerate.framework"
+ ];
+ OpenDirectory = [
+ "/System/Library/Frameworks/OpenDirectory.framework"
+ ];
+ ServiceManagement = [
+ "/System/Library/Frameworks/ServiceManagement.framework"
+ ];
+ OpenCL = [
+ "/System/Library/Frameworks/OpenCL.framework"
+ ];
+ CoreWLAN = [
+ "/System/Library/Frameworks/CoreWLAN.framework"
+ ];
+ IOBluetooth = [
+ "/System/Library/Frameworks/IOBluetooth.framework"
+ ] ++ AudioUnit ++ CoreBluetooth;
+ CoreBluetooth = [
+ "/System/Library/Frameworks/CoreBluetooth.framework"
+ ];
+ SecurityFoundation = [
+ "/System/Library/Frameworks/SecurityFoundation.framework"
+ ];
+ Kernel = [
+ "/System/Library/Frameworks/Kernel.framework"
+ ];
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh
new file mode 100644
index 000000000000..a351c39de130
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/private-frameworks-setup-hook.sh
@@ -0,0 +1,8 @@
+addPrivateFrameworks() {
+ flag="-F/System/Library/PrivateFrameworks"
+ if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
+ NIX_CFLAGS_COMPILE+=" $flag"
+ fi
+}
+
+addEnvHooks "$hostOffset" addPrivateFrameworks
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh
new file mode 100644
index 000000000000..35cea773f98b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh
@@ -0,0 +1,10 @@
+noDeprecatedDeclarations() {
+ # Security.framework has about 2000 deprecated constants, all of which the user will be
+ # warned about at compilation time
+ flag="-Wno-deprecated-declarations"
+ if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
+ NIX_CFLAGS_COMPILE+=" $flag"
+ fi
+}
+
+addEnvHooks "$hostOffset" noDeprecatedDeclarations
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix
new file mode 100644
index 000000000000..5c6d54aeb9c3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CarbonHeaders/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir -p $out/include
+ cp MacTypes.h $out/include
+ cp ConditionalMacros.h $out/include
+
+ substituteInPlace $out/include/MacTypes.h \
+ --replace "CarbonCore/" ""
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix
new file mode 100644
index 000000000000..ad51f1df2bcd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/CommonCrypto/default.nix
@@ -0,0 +1,14 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/include/CommonCrypto
+ cp include/* $out/include/CommonCrypto
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix
new file mode 100644
index 000000000000..7fd32a64fe57
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Csu/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ prePatch = ''
+ substituteInPlace Makefile \
+ --replace /usr/lib /lib \
+ --replace /usr/local/lib /lib \
+ --replace /usr/bin "" \
+ --replace /bin/ "" \
+ --replace "CC = " "CC = cc #" \
+ --replace "SDK_DIR = " "SDK_DIR = . #" \
+
+ # Mac OS didn't support rpaths back before 10.5, but we don't care about it.
+ substituteInPlace Makefile \
+ --replace -mmacosx-version-min=10.4 -mmacosx-version-min=10.6 \
+ --replace -mmacosx-version-min=10.5 -mmacosx-version-min=10.6
+ '';
+
+ installFlags = [ "DSTROOT=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "Apple's common startup stubs for darwin";
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch
new file mode 100644
index 000000000000..fd9df8129407
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch
@@ -0,0 +1,22 @@
+diff --git a/icuSources/i18n/ucoleitr.cpp b/icuSources/i18n/ucoleitr.cpp
+index ecc94c9..936452f 100644
+--- a/icuSources/i18n/ucoleitr.cpp
++++ b/icuSources/i18n/ucoleitr.cpp
+@@ -320,7 +320,7 @@ ucol_nextProcessed(UCollationElements *elems,
+ int32_t *ixHigh,
+ UErrorCode *status)
+ {
+- return (UCollationPCE::UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status);
++ return (UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status);
+ }
+
+
+@@ -384,7 +384,7 @@ ucol_previousProcessed(UCollationElements *elems,
+ int32_t *ixHigh,
+ UErrorCode *status)
+ {
+- return (UCollationPCE::UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status);
++ return (UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status);
+ }
+
+ U_NAMESPACE_BEGIN
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
new file mode 100644
index 000000000000..761ff3ea9252
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
@@ -0,0 +1,23 @@
+{ appleDerivation }:
+
+appleDerivation {
+ patches = [ ./clang-5.patch ];
+
+ postPatch = ''
+ substituteInPlace makefile \
+ --replace /usr/bin/ "" \
+ --replace '$(ISYSROOT)' "" \
+ --replace 'shell xcodebuild -version -sdk' 'shell true' \
+ --replace 'shell xcrun -sdk $(SDKPATH) -find' 'shell echo' \
+ --replace '-install_name $(libdir)' "-install_name $out/lib/" \
+ --replace /usr/local/bin/ /bin/ \
+ --replace /usr/lib/ /lib/ \
+ '';
+
+ makeFlags = [ "DSTROOT=$(out)" ];
+
+ postInstall = ''
+ mv $out/usr/local/include $out/include
+ rm -rf $out/usr
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix
new file mode 100644
index 000000000000..4b82209f176c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/IOKit/default.nix
@@ -0,0 +1,187 @@
+{ stdenv, appleDerivation, IOKitSrcs, xnu }:
+
+# Someday it'll make sense to split these out into their own packages, but today is not that day.
+appleDerivation {
+ srcs = stdenv.lib.attrValues IOKitSrcs;
+ sourceRoot = ".";
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ __propagatedImpureHostDeps = [
+ "/System/Library/Frameworks/IOKit.framework/IOKit"
+ "/System/Library/Frameworks/IOKit.framework/Resources"
+ "/System/Library/Frameworks/IOKit.framework/Versions"
+ ];
+
+ installPhase = ''
+ ###### IMPURITIES
+ mkdir -p $out/Library/Frameworks/IOKit.framework
+ pushd $out/Library/Frameworks/IOKit.framework
+ ln -s /System/Library/Frameworks/IOKit.framework/IOKit
+ ln -s /System/Library/Frameworks/IOKit.framework/Resources
+ popd
+
+ ###### HEADERS
+
+ export dest=$out/Library/Frameworks/IOKit.framework/Headers
+ mkdir -p $dest
+
+ pushd $dest
+ mkdir audio avc DV firewire graphics hid hidsystem i2c kext ndrvsupport
+ mkdir network ps pwr_mgt sbp2 scsi serial storage stream usb video
+ popd
+
+ # root: complete
+ cp IOKitUser-*/IOCFBundle.h $dest
+ cp IOKitUser-*/IOCFPlugIn.h $dest
+ cp IOKitUser-*/IOCFSerialize.h $dest
+ cp IOKitUser-*/IOCFUnserialize.h $dest
+ cp IOKitUser-*/IOCFURLAccess.h $dest
+ cp IOKitUser-*/IODataQueueClient.h $dest
+ cp IOKitUser-*/IOKitLib.h $dest
+ cp IOKitUser-*/iokitmig.h $dest
+ cp ${xnu}/Library/PrivateFrameworks/IOKit.framework/Versions/A/Headers/*.h $dest
+
+ # audio: complete
+ cp IOAudioFamily-*/IOAudioDefines.h $dest/audio
+ cp IOKitUser-*/audio.subproj/IOAudioLib.h $dest/audio
+ cp IOAudioFamily-*/IOAudioTypes.h $dest/audio
+
+ # avc: complete
+ cp IOFireWireAVC-*/IOFireWireAVC/IOFireWireAVCConsts.h $dest/avc
+ cp IOFireWireAVC-*/IOFireWireAVCLib/IOFireWireAVCLib.h $dest/avc
+
+ # DV: complete
+ cp IOFWDVComponents-*/DVFamily.h $dest/DV
+
+ # firewire: complete
+ cp IOFireWireFamily-*/IOFireWireFamily.kmodproj/IOFireWireFamilyCommon.h $dest/firewire
+ cp IOFireWireFamily-*/IOFireWireLib.CFPlugInProj/IOFireWireLib.h $dest/firewire
+ cp IOFireWireFamily-*/IOFireWireLib.CFPlugInProj/IOFireWireLibIsoch.h $dest/firewire
+ cp IOFireWireFamily-*/IOFireWireFamily.kmodproj/IOFWIsoch.h $dest/firewire
+
+ # graphics: missing AppleGraphicsDeviceControlUserCommand.h
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelClientConnect.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelSurfaceConnect.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOAccelTypes.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOFramebufferShared.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsEngine.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsInterface.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsInterfaceTypes.h $dest/graphics
+ cp IOKitUser-*/graphics.subproj/IOGraphicsLib.h $dest/graphics
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/graphics/IOGraphicsTypes.h $dest/graphics
+
+ # hid: complete
+ cp IOKitUser-*/hid.subproj/IOHIDBase.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDDevice.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDDevicePlugIn.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDElement.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDLib.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDManager.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDQueue.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDTransaction.h $dest/hid
+ cp IOKitUser-*/hid.subproj/IOHIDValue.h $dest/hid
+ cp IOHIDFamily-*/IOHIDFamily/IOHIDKeys.h $dest/hid
+ cp IOHIDFamily-*/IOHIDFamily/IOHIDUsageTables.h $dest/hid
+ cp IOHIDFamily-*/IOHIDLib/IOHIDLibObsolete.h $dest/hid
+
+ # hidsystem: complete
+ cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/ev_keymap.h $dest/hidsystem
+ cp IOKitUser-*/hidsystem.subproj/event_status_driver.h $dest/hidsystem
+ cp IOKitUser-*/hidsystem.subproj/IOHIDLib.h $dest/hidsystem
+ cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDParameter.h $dest/hidsystem
+ cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDShared.h $dest/hidsystem
+ cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOHIDTypes.h $dest/hidsystem
+ cp IOHIDFamily-*/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h $dest/hidsystem
+
+
+ # i2c: complete
+ cp IOGraphics-*/IOGraphicsFamily/IOKit/i2c/IOI2CInterface.h $dest/i2c
+
+ # kext: complete
+ cp IOKitUser-*/kext.subproj/KextManager.h $dest/kext
+
+ # ndrvsupport: complete
+ cp IOGraphics-*/IONDRVSupport/IOKit/ndrvsupport/IOMacOSTypes.h $dest/ndrvsupport
+ cp IOGraphics-*/IONDRVSupport/IOKit/ndrvsupport/IOMacOSVideo.h $dest/ndrvsupport
+
+ # network: complete
+ cp IONetworkingFamily-*/IOEthernetController.h $dest/network
+ cp IONetworkingFamily-*/IOEthernetInterface.h $dest/network
+ cp IONetworkingFamily-*/IOEthernetStats.h $dest/network
+ cp IONetworkingFamily-*/IONetworkController.h $dest/network
+ cp IONetworkingFamily-*/IONetworkData.h $dest/network
+ cp IONetworkingFamily-*/IONetworkInterface.h $dest/network
+ cp IOKitUser-*/network.subproj/IONetworkLib.h $dest/network
+ cp IONetworkingFamily-*/IONetworkMedium.h $dest/network
+ cp IONetworkingFamily-*/IONetworkStack.h $dest/network
+ cp IONetworkingFamily-*/IONetworkStats.h $dest/network
+ cp IONetworkingFamily-*/IONetworkUserClient.h $dest/network
+
+ # ps: missing IOUPSPlugIn.h
+ cp IOKitUser-*/ps.subproj/IOPowerSources.h $dest/ps
+ cp IOKitUser-*/ps.subproj/IOPSKeys.h $dest/ps
+
+ # pwr_mgt: complete
+ cp IOKitUser-*/pwr_mgt.subproj/IOPMKeys.h $dest/pwr_mgt
+ cp IOKitUser-*/pwr_mgt.subproj/IOPMLib.h $dest/pwr_mgt
+ cp ${xnu}/Library/PrivateFrameworks/IOKit.framework/Versions/A/Headers/pwr_mgt/*.h $dest/pwr_mgt
+ cp IOKitUser-*/pwr_mgt.subproj/IOPMLibPrivate.h $dest/pwr_mgt # Private
+
+ # sbp2: complete
+ cp IOFireWireSBP2-*/IOFireWireSBP2Lib/IOFireWireSBP2Lib.h $dest/sbp2
+
+ # scsi: omitted for now
+
+ # serial: complete
+ cp IOSerialFamily-*/IOSerialFamily.kmodproj/IOSerialKeys.h $dest/serial
+ cp IOSerialFamily-*/IOSerialFamily.kmodproj/ioss.h $dest/serial
+
+ # storage: complete
+ # Needs ata subdirectory
+ cp IOStorageFamily-*/IOAppleLabelScheme.h $dest/storage
+ cp IOStorageFamily-*/IOApplePartitionScheme.h $dest/storage
+ cp IOBDStorageFamily-*/IOBDBlockStorageDevice.h $dest/storage
+ cp IOBDStorageFamily-*/IOBDMedia.h $dest/storage
+ cp IOBDStorageFamily-*/IOBDMediaBSDClient.h $dest/storage
+ cp IOBDStorageFamily-*/IOBDTypes.h $dest/storage
+ cp IOStorageFamily-*/IOBlockStorageDevice.h $dest/storage
+ cp IOStorageFamily-*/IOBlockStorageDriver.h $dest/storage
+ cp IOCDStorageFamily-*/IOCDBlockStorageDevice.h $dest/storage
+ cp IOCDStorageFamily-*/IOCDMedia.h $dest/storage
+ cp IOCDStorageFamily-*/IOCDMediaBSDClient.h $dest/storage
+ cp IOCDStorageFamily-*/IOCDPartitionScheme.h $dest/storage
+ cp IOCDStorageFamily-*/IOCDTypes.h $dest/storage
+ cp IODVDStorageFamily-*/IODVDBlockStorageDevice.h $dest/storage
+ cp IODVDStorageFamily-*/IODVDMedia.h $dest/storage
+ cp IODVDStorageFamily-*/IODVDMediaBSDClient.h $dest/storage
+ cp IODVDStorageFamily-*/IODVDTypes.h $dest/storage
+ cp IOStorageFamily-*/IOFDiskPartitionScheme.h $dest/storage
+ cp IOStorageFamily-*/IOFilterScheme.h $dest/storage
+ cp IOFireWireSerialBusProtocolTransport-*/IOFireWireStorageCharacteristics.h $dest/storage
+ cp IOStorageFamily-*/IOGUIDPartitionScheme.h $dest/storage
+ cp IOStorageFamily-*/IOMedia.h $dest/storage
+ cp IOStorageFamily-*/IOMediaBSDClient.h $dest/storage
+ cp IOStorageFamily-*/IOPartitionScheme.h $dest/storage
+ cp IOStorageFamily-*/IOStorage.h $dest/storage
+ cp IOStorageFamily-*/IOStorageCardCharacteristics.h $dest/storage
+ cp IOStorageFamily-*/IOStorageDeviceCharacteristics.h $dest/storage
+ cp IOStorageFamily-*/IOStorageProtocolCharacteristics.h $dest/storage
+
+ # stream: missing altogether
+
+ # usb: complete
+ cp IOUSBFamily-630.4.5/IOUSBFamily/Headers/IOUSBLib.h $dest/usb
+ cp IOUSBFamily-630.4.5/IOUSBUserClient/Headers/IOUSBUserClient.h $dest/usb
+ cp IOUSBFamily-560.4.2/IOUSBFamily/Headers/USB.h $dest/usb # This file is empty in 630.4.5!
+ cp IOUSBFamily-630.4.5/IOUSBFamily/Headers/USBSpec.h $dest/usb
+
+ # video: missing altogether
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ joelteon copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix
new file mode 100644
index 000000000000..29aa3d64cb08
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/825_40_1.nix
@@ -0,0 +1,13 @@
+{ appleDerivation, ed, unifdef }:
+
+appleDerivation {
+ nativeBuildInputs = [ ed unifdef ];
+
+ installPhase = ''
+ export SRCROOT=$PWD
+ export DSTROOT=$out
+ export PUBLIC_HEADERS_FOLDER_PATH=include
+ export PRIVATE_HEADERS_FOLDER_PATH=include
+ bash xcodescripts/headers.sh
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/CrashReporterClient.h b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/CrashReporterClient.h
new file mode 100644
index 000000000000..a1cbb72b9176
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/CrashReporterClient.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/***********************************************************************
+ * Not to be installed in /usr/local/include
+ ***********************************************************************/
+
+#ifndef _LIBC_CRASHREPORTERCLIENT_H
+#define _LIBC_CRASHREPORTERCLIENT_H
+
+#include "stdint.h"
+
+/* Fake the CrashReporterClient API */
+#define CRGetCrashLogMessage() 0
+#define CRSetCrashLogMessage(m) true
+
+#define CRASH_REPORTER_CLIENT_HIDDEN __attribute__((visibility("hidden")))
+#define CRASHREPORTER_ANNOTATIONS_VERSION 4
+#define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info"
+
+struct crashreporter_annotations_t {
+ uint64_t version; // unsigned long
+ uint64_t message; // char *
+ uint64_t signature_string; // char *
+ uint64_t backtrace; // char *
+ uint64_t message2; // char *
+ uint64_t thread; // uint64_t
+ uint64_t dialog_mode; // unsigned int
+};
+
+#endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix
new file mode 100644
index 000000000000..6ebb470145d5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libc/default.nix
@@ -0,0 +1,32 @@
+{ appleDerivation, ed, unifdef, Libc_old, Libc_10-9 }:
+
+appleDerivation {
+ nativeBuildInputs = [ ed unifdef ];
+
+ # TODO: asl.h actually comes from syslog project now
+ installPhase = ''
+ export SRCROOT=$PWD
+ export DSTROOT=$out
+ export PUBLIC_HEADERS_FOLDER_PATH=include
+ export PRIVATE_HEADERS_FOLDER_PATH=include
+ bash xcodescripts/headers.sh
+
+ cp ${./CrashReporterClient.h} $out/include/CrashReporterClient.h
+
+ cp ${Libc_10-9}/include/NSSystemDirectories.h $out/include
+
+ # Ugh Apple stopped releasing this stuff so we need an older one...
+ cp ${Libc_old}/include/spawn.h $out/include
+ cp ${Libc_old}/include/setjmp.h $out/include
+ cp ${Libc_old}/include/ucontext.h $out/include
+ cp ${Libc_old}/include/pthread*.h $out/include
+ cp ${Libc_old}/include/sched.h $out/include
+ cp -R ${Libc_old}/include/malloc $out/include
+
+ mkdir -p $out/include/libkern
+ cp ${Libc_old}/include/asl.h $out/include
+ cp ${Libc_old}/include/libproc.h $out/include
+ cp ${Libc_old}/include/libkern/OSAtomic.h $out/include/libkern
+ cp ${Libc_old}/include/libkern/OSCacheControl.h $out/include/libkern
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix
new file mode 100644
index 000000000000..add51a61d3d3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libinfo/default.nix
@@ -0,0 +1,14 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ substituteInPlace xcodescripts/install_files.sh \
+ --replace "/usr/local/" "/" \
+ --replace "/usr/" "/" \
+ --replace '-o "$INSTALL_OWNER" -g "$INSTALL_GROUP"' "" \
+ --replace "ln -h" "ln -n"
+
+ export DSTROOT=$out
+ sh xcodescripts/install_files.sh
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix
new file mode 100644
index 000000000000..df5f6b7b8fd6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libm/default.nix
@@ -0,0 +1,11 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/include
+
+ cp Source/Intel/math.h $out/include
+ cp Source/Intel/fenv.h $out/include
+ cp Source/complex.h $out/include
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix
new file mode 100644
index 000000000000..2ee80d702646
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libnotify/default.nix
@@ -0,0 +1,9 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/include
+ cp notify.h $out/include
+ cp notify_keys.h $out/include
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix
new file mode 100644
index 000000000000..a7b2bd7d981d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, appleDerivation, developer_cmds }:
+
+appleDerivation {
+ buildInputs = [ developer_cmds ];
+
+ installPhase = ''
+ export DSTROOT=$out
+ export SRCROOT=$PWD
+ export OBJROOT=$PWD
+
+ . ./xcodescripts/install_rpcsvc.sh
+
+ mv $out/usr/* $out
+ rmdir $out/usr/
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ matthewbauer ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
new file mode 100644
index 000000000000..99d670028032
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -0,0 +1,158 @@
+{ stdenv, appleDerivation, cpio, xnu, Libc, Libm, libdispatch, cctools, Libinfo
+, dyld, Csu, architecture, libclosure, CarbonHeaders, ncurses, CommonCrypto
+, copyfile, removefile, libresolv, Libnotify, libplatform, libpthread
+, mDNSResponder, launchd, libutil, hfs, darling }:
+
+appleDerivation {
+ dontBuild = true;
+ dontFixup = true;
+
+ nativeBuildInputs = [ cpio ];
+
+ installPhase = ''
+ export NIX_ENFORCE_PURITY=
+
+ mkdir -p $out/lib $out/include
+
+ # Set up our include directories
+ (cd ${xnu}/include && find . -name '*.h' -or -name '*.defs' | cpio -pdm $out/include)
+ cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/Availability*.h $out/include
+ cp ${xnu}/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h $out/include
+
+ for dep in ${Libc} ${Libm} ${Libinfo} ${dyld} ${architecture} \
+ ${libclosure} ${CarbonHeaders} ${libdispatch} ${ncurses.dev} \
+ ${CommonCrypto} ${copyfile} ${removefile} ${libresolv} \
+ ${Libnotify} ${libplatform} ${mDNSResponder} ${launchd} \
+ ${libutil} ${libpthread} ${hfs}; do
+ (cd $dep/include && find . -name '*.h' | cpio -pdm $out/include)
+ done
+
+ (cd ${cctools.dev}/include/mach-o && find . -name '*.h' | cpio -pdm $out/include/mach-o)
+
+ mkdir -p $out/include/os
+
+ cp ${darling.src}/src/libc/os/activity.h $out/include/os
+ cp ${darling.src}/src/libc/os/log.h $out/include/os
+ cp ${darling.src}/src/duct/include/os/trace.h $out/include/os
+
+ cat <<EOF > $out/include/os/availability.h
+ #ifndef __OS_AVAILABILITY__
+ #define __OS_AVAILABILITY__
+ #include <AvailabilityInternal.h>
+
+ #if defined(__has_feature) && defined(__has_attribute) && __has_attribute(availability)
+ #define API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1)(__VA_ARGS__)
+ #define API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_MSG5, __API_DEPRECATED_MSG4, __API_DEPRECATED_MSG3, __API_DEPRECATED_MSG2, __API_DEPRECATED_MSG1)(__VA_ARGS__)
+ #define API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__, __API_DEPRECATED_REP5, __API_DEPRECATED_REP4, __API_DEPRECATED_REP3, __API_DEPRECATED_REP2, __API_DEPRECATED_REP1)(__VA_ARGS__)
+ #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__, __API_UNAVAILABLE3, __API_UNAVAILABLE2, __API_UNAVAILABLE1)(__VA_ARGS__)
+ #else
+
+ #define API_AVAILABLE(...)
+ #define API_DEPRECATED(...)
+ #define API_DEPRECATED_WITH_REPLACEMENT(...)
+ #define API_UNAVAILABLE(...)
+
+ #endif
+ #endif
+ EOF
+
+ cat <<EOF > $out/include/TargetConditionals.h
+ #ifndef __TARGETCONDITIONALS__
+ #define __TARGETCONDITIONALS__
+ #define TARGET_OS_MAC 1
+ #define TARGET_OS_OSX 1
+ #define TARGET_OS_WIN32 0
+ #define TARGET_OS_UNIX 0
+ #define TARGET_OS_EMBEDDED 0
+ #define TARGET_OS_IPHONE 0
+ #define TARGET_IPHONE_SIMULATOR 0
+ #define TARGET_OS_LINUX 0
+
+ #define TARGET_CPU_PPC 0
+ #define TARGET_CPU_PPC64 0
+ #define TARGET_CPU_68K 0
+ #define TARGET_CPU_X86 0
+ #define TARGET_CPU_X86_64 1
+ #define TARGET_CPU_ARM 0
+ #define TARGET_CPU_MIPS 0
+ #define TARGET_CPU_SPARC 0
+ #define TARGET_CPU_ALPHA 0
+ #define TARGET_RT_MAC_CFM 0
+ #define TARGET_RT_MAC_MACHO 1
+ #define TARGET_RT_LITTLE_ENDIAN 1
+ #define TARGET_RT_BIG_ENDIAN 0
+ #define TARGET_RT_64_BIT 1
+ #endif /* __TARGETCONDITIONALS__ */
+ EOF
+
+ # The startup object files
+ cp ${Csu}/lib/* $out/lib
+
+ # We can't re-exported libsystem_c and libsystem_kernel directly,
+ # so we link against the central library here.
+ mkdir -p $out/lib/system
+ ld -macosx_version_min 10.7 -arch x86_64 -dylib \
+ -o $out/lib/system/libsystem_c.dylib \
+ /usr/lib/libSystem.dylib \
+ -reexported_symbols_list ${./system_c_symbols}
+
+ ld -macosx_version_min 10.7 -arch x86_64 -dylib \
+ -o $out/lib/system/libsystem_kernel.dylib \
+ /usr/lib/libSystem.dylib \
+ -reexported_symbols_list ${./system_kernel_symbols}
+
+ # The umbrella libSystem also exports some symbols,
+ # but we don't want to pull in everything from the other libraries.
+ ld -macosx_version_min 10.7 -arch x86_64 -dylib \
+ -o $out/lib/libSystem_internal.dylib \
+ /usr/lib/libSystem.dylib \
+ -reexported_symbols_list ${./system_symbols}
+
+ # We used to determine these impurely based on the host system, but then when we got some 10.12 Hydra boxes,
+ # one of them accidentally built this derivation, referenced libsystem_symptoms.dylib, which doesn't exist on
+ # 10.11, and then broke all subsequent builds on 10.11. By picking a 10.11 compatible subset of the libraries,
+ # we avoid scary impurity issues like that.
+ libs=$(cat ${./reexported_libraries} | grep -v '^#')
+
+ for i in $libs; do
+ if [ "$i" != "/usr/lib/system/libsystem_kernel.dylib" ] && [ "$i" != "/usr/lib/system/libsystem_c.dylib" ]; then
+ args="$args -reexport_library $i"
+ fi
+ done
+
+ ld -macosx_version_min 10.7 -arch x86_64 -dylib \
+ -o $out/lib/libSystem.B.dylib \
+ -compatibility_version 1.0 \
+ -current_version 1226.10.1 \
+ -reexport_library $out/lib/system/libsystem_c.dylib \
+ -reexport_library $out/lib/system/libsystem_kernel.dylib \
+ -reexport_library $out/lib/libSystem_internal.dylib \
+ $args
+
+ ln -s libSystem.B.dylib $out/lib/libSystem.dylib
+
+ # Set up links to pretend we work like a conventional unix (Apple's design, not mine!)
+ for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do
+ ln -s libSystem.dylib $out/lib/lib$name.dylib
+ done
+
+ # This probably doesn't belong here, but we want to stay similar to glibc, which includes resolv internally...
+ cp ${libresolv}/lib/libresolv.9.dylib $out/lib/libresolv.9.dylib
+ resolv_libSystem=$(otool -L "$out/lib/libresolv.9.dylib" | tail -n +3 | grep -o "$NIX_STORE.*-\S*") || true
+ echo $libs
+
+ chmod +w $out/lib/libresolv.9.dylib
+ install_name_tool \
+ -id $out/lib/libresolv.9.dylib \
+ -change "$resolv_libSystem" $out/lib/libSystem.dylib \
+ $out/lib/libresolv.9.dylib
+ ln -s libresolv.9.dylib $out/lib/libresolv.dylib
+ '';
+
+ meta = with stdenv.lib; {
+ description = "The Mac OS libc/libSystem (impure symlinks to binaries with pure headers)";
+ maintainers = with maintainers; [ copumpkin gridaphobe ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/reexported_libraries b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/reexported_libraries
new file mode 100644
index 000000000000..edc2e759a29e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/reexported_libraries
@@ -0,0 +1,41 @@
+# These are generated with otool -L /usr/lib/libSystem.dylib on a 10.11 machine
+/usr/lib/system/libcache.dylib
+/usr/lib/system/libcommonCrypto.dylib
+/usr/lib/system/libcompiler_rt.dylib
+/usr/lib/system/libcopyfile.dylib
+/usr/lib/system/libcorecrypto.dylib
+/usr/lib/system/libdispatch.dylib
+/usr/lib/system/libdyld.dylib
+/usr/lib/system/libkeymgr.dylib
+/usr/lib/system/liblaunch.dylib
+/usr/lib/system/libmacho.dylib
+/usr/lib/system/libquarantine.dylib
+/usr/lib/system/libremovefile.dylib
+/usr/lib/system/libsystem_asl.dylib
+/usr/lib/system/libsystem_blocks.dylib
+
+# We handle this specially in the expression
+# /usr/lib/system/libsystem_c.dylib
+
+/usr/lib/system/libsystem_configuration.dylib
+/usr/lib/system/libsystem_coreservices.dylib
+# /usr/lib/system/libsystem_coretls.dylib # Removed in 10.13
+/usr/lib/system/libsystem_dnssd.dylib
+/usr/lib/system/libsystem_info.dylib
+
+# We handle this specially in the expression
+# /usr/lib/system/libsystem_kernel.dylib
+
+/usr/lib/system/libsystem_m.dylib
+/usr/lib/system/libsystem_malloc.dylib
+# /usr/lib/system/libsystem_network.dylib # Removed in 10.14
+/usr/lib/system/libsystem_networkextension.dylib
+/usr/lib/system/libsystem_notify.dylib
+/usr/lib/system/libsystem_platform.dylib
+/usr/lib/system/libsystem_pthread.dylib
+/usr/lib/system/libsystem_sandbox.dylib
+/usr/lib/system/libsystem_secinit.dylib
+/usr/lib/system/libsystem_trace.dylib
+/usr/lib/system/libunc.dylib
+/usr/lib/system/libunwind.dylib
+/usr/lib/system/libxpc.dylib
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_c_symbols b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_c_symbols
new file mode 100644
index 000000000000..1ec6c6332cf4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_c_symbols
@@ -0,0 +1,1320 @@
+__CurrentRuneLocale
+__DefaultRuneLocale
+__Exit
+__NSGetArgc
+__NSGetArgv
+__NSGetEnviron
+__NSGetMachExecuteHeader
+__NSGetProgname
+__PathLocale
+__Read_RuneMagi
+___Balloc_D2A
+___Bfree_D2A
+___ULtod_D2A
+____mb_cur_max
+____mb_cur_max_l
+____runetype
+____runetype_l
+____tolower
+____tolower_l
+____toupper
+____toupper_l
+___add_ovflpage
+___addel
+___any_on_D2A
+___assert_rtn
+___b2d_D2A
+___big_delete
+___big_insert
+___big_keydata
+___big_return
+___big_split
+___bigtens_D2A
+___bt_close
+___bt_cmp
+___bt_defcmp
+___bt_defpfx
+___bt_delete
+___bt_dleaf
+___bt_fd
+___bt_free
+___bt_get
+___bt_new
+___bt_open
+___bt_pgin
+___bt_pgout
+___bt_put
+___bt_ret
+___bt_search
+___bt_seq
+___bt_setcur
+___bt_split
+___bt_sync
+___buf_free
+___call_hash
+___cleanup
+___cmp_D2A
+___collate_equiv_match
+___collate_load_error
+___collate_lookup
+___copybits_D2A
+___cxa_atexit
+___cxa_finalize
+___cxa_finalize_ranges
+___cxa_thread_atexit
+___d2b_D2A
+___dbpanic
+___decrement_D2A
+___default_hash
+___default_utx
+___delpair
+___diff_D2A
+___dtoa
+___expand_table
+___fflush
+___fgetwc
+___find_bigpair
+___find_last_page
+___fix_locale_grouping_str
+___fread
+___free_ovflpage
+___freedtoa
+___gdtoa
+___gdtoa_locks
+___get_buf
+___get_page
+___gethex_D2A
+___getonlyClocaleconv
+___hash_open
+___hdtoa
+___hexdig_D2A
+___hexdig_init_D2A
+___hexnan_D2A
+___hi0bits_D2A
+___hldtoa
+___i2b_D2A
+___ibitmap
+___increment_D2A
+___isctype
+___istype
+___istype_l
+___ldtoa
+___libc_init
+___lo0bits_D2A
+___log2
+___lshift_D2A
+___maskrune
+___maskrune_l
+___match_D2A
+___mb_cur_max
+___mb_sb_limit
+___memccpy_chk
+___memcpy_chk
+___memmove_chk
+___memset_chk
+___mult_D2A
+___multadd_D2A
+___nrv_alloc_D2A
+___opendir2
+___opendir2$INODE64
+___ovfl_delete
+___ovfl_get
+___ovfl_put
+___pow5mult_D2A
+___put_page
+___quorem_D2A
+___ratio_D2A
+___rec_close
+___rec_delete
+___rec_dleaf
+___rec_fd
+___rec_fmap
+___rec_fpipe
+___rec_get
+___rec_iput
+___rec_open
+___rec_put
+___rec_ret
+___rec_search
+___rec_seq
+___rec_sync
+___rec_vmap
+___rec_vpipe
+___reclaim_buf
+___rshift_D2A
+___rv_alloc_D2A
+___s2b_D2A
+___sF
+___sclose
+___sdidinit
+___set_ones_D2A
+___setonlyClocaleconv
+___sflags
+___sflush
+___sfp
+___sfvwrite
+___sglue
+___sinit
+___slbexpand
+___smakebuf
+___snprintf_chk
+___split_page
+___sprintf_chk
+___sread
+___srefill
+___srget
+___sseek
+___stack_chk_fail
+___stack_chk_guard
+___stderrp
+___stdinp
+___stdoutp
+___stpcpy_chk
+___stpncpy_chk
+___strcat_chk
+___strcp_D2A
+___strcpy_chk
+___strlcat_chk
+___strlcpy_chk
+___strncat_chk
+___strncpy_chk
+___strtodg
+___strtopdd
+___strtopx
+___sum_D2A
+___svfscanf
+___swbuf
+___swhatbuf
+___swrite
+___swsetup
+___tens_D2A
+___tinytens_D2A
+___tolower
+___tolower_l
+___toupper
+___toupper_l
+___trailz_D2A
+___ulp_D2A
+___ungetc
+___ungetwc
+___vsnprintf_chk
+___vsprintf_chk
+___wcwidth
+___wcwidth_l
+__allocenvstate
+__atexit_receipt
+__c_locale
+__cleanup
+__closeutx
+__copyenv
+__cthread_init_routine
+__deallocenvstate
+__endutxent
+__flockfile_debug_stub
+__fseeko
+__ftello
+__fwalk
+__getenvp
+__getutxent
+__getutxid
+__getutxline
+__inet_aton_check
+__init_clock_port
+__int_to_time
+__libc_fork_child
+__libc_initializer
+__long_to_time
+__mkpath_np
+__mktemp
+__openutx
+__os_assert_log
+__os_assert_log_ctx
+__os_assumes_log
+__os_assumes_log_ctx
+__os_avoid_tail_call
+__os_crash
+__os_crash_callback
+__os_debug_log
+__os_debug_log_error_str
+__putenvp
+__pututxline
+__rand48_add
+__rand48_mult
+__rand48_seed
+__readdir_unlocked
+__readdir_unlocked$INODE64
+__reclaim_telldir
+__seekdir
+__seekdir$INODE64
+__setenvp
+__setutxent
+__sigaction_nobind
+__sigintr
+__signal_nobind
+__sigvec_nobind
+__sread
+__sseek
+__swrite
+__time32_to_time
+__time64_to_time
+__time_to_int
+__time_to_long
+__time_to_time32
+__time_to_time64
+__unsetenvp
+__utmpxname
+_a64l
+_abort
+_abort_report_np
+_abs
+_acl_add_flag_np
+_acl_add_perm
+_acl_calc_mask
+_acl_clear_flags_np
+_acl_clear_perms
+_acl_copy_entry
+_acl_copy_ext
+_acl_copy_ext_native
+_acl_copy_int
+_acl_copy_int_native
+_acl_create_entry
+_acl_create_entry_np
+_acl_delete_def_file
+_acl_delete_entry
+_acl_delete_fd_np
+_acl_delete_file_np
+_acl_delete_flag_np
+_acl_delete_link_np
+_acl_delete_perm
+_acl_dup
+_acl_free
+_acl_from_text
+_acl_get_entry
+_acl_get_fd
+_acl_get_fd_np
+_acl_get_file
+_acl_get_flag_np
+_acl_get_flagset_np
+_acl_get_link_np
+_acl_get_perm_np
+_acl_get_permset
+_acl_get_permset_mask_np
+_acl_get_qualifier
+_acl_get_tag_type
+_acl_init
+_acl_maximal_permset_mask_np
+_acl_set_fd
+_acl_set_fd_np
+_acl_set_file
+_acl_set_flagset_np
+_acl_set_link_np
+_acl_set_permset
+_acl_set_permset_mask_np
+_acl_set_qualifier
+_acl_set_tag_type
+_acl_size
+_acl_to_text
+_acl_valid
+_acl_valid_fd_np
+_acl_valid_file_np
+_acl_valid_link
+_addr2ascii
+_alarm
+_alphasort
+_alphasort$INODE64
+_arc4random
+_arc4random_addrandom
+_arc4random_buf
+_arc4random_stir
+_arc4random_uniform
+_ascii2addr
+_asctime
+_asctime_r
+_asprintf
+_asprintf_l
+_asxprintf
+_asxprintf_exec
+_atexit
+_atexit_b
+_atof
+_atof_l
+_atoi
+_atoi_l
+_atol
+_atol_l
+_atoll
+_atoll_l
+_backtrace
+_backtrace_symbols
+_backtrace_symbols_fd
+_basename
+_basename_r
+_bcmp
+_bcopy
+_brk
+_bsd_signal
+_bsearch
+_bsearch_b
+_btowc
+_btowc_l
+_bzero
+_catclose
+_catgets
+_catopen
+_cfgetispeed
+_cfgetospeed
+_cfmakeraw
+_cfsetispeed
+_cfsetospeed
+_cfsetspeed
+_cgetcap
+_cgetclose
+_cgetent
+_cgetfirst
+_cgetmatch
+_cgetnext
+_cgetnum
+_cgetset
+_cgetstr
+_cgetustr
+_chmodx_np
+_clearerr
+_clearerr_unlocked
+_clock
+_clock_getres
+_clock_gettime
+_clock_gettime_nsec_np
+_clock_port
+_clock_sem
+_clock_settime
+_closedir
+_compat_mode
+_confstr
+_copy_printf_domain
+_creat
+_creat$NOCANCEL
+_crypt
+_ctermid
+_ctermid_r
+_ctime
+_ctime_r
+_daemon
+_daemon$1050
+_daylight
+_dbm_clearerr
+_dbm_close
+_dbm_delete
+_dbm_dirfno
+_dbm_error
+_dbm_fetch
+_dbm_firstkey
+_dbm_nextkey
+_dbm_open
+_dbm_store
+_dbopen
+_devname
+_devname_r
+_difftime
+_digittoint
+_digittoint_l
+_dirfd
+_dirname
+_dirname_r
+_div
+_dprintf
+_dprintf_l
+_drand48
+_duplocale
+_dxprintf
+_dxprintf_exec
+_ecvt
+_encrypt
+_endttyent
+_endusershell
+_endutxent
+_endutxent_wtmp
+_erand48
+_err
+_err_set_exit
+_err_set_exit_b
+_err_set_file
+_errc
+_errx
+_execl
+_execle
+_execlp
+_execv
+_execvP
+_execvp
+_exit
+_f_prealloc
+_fchmodx_np
+_fclose
+_fcvt
+_fdopen
+_fdopen$DARWIN_EXTSN
+_fdopendir
+_fdopendir$INODE64
+_feof
+_feof_unlocked
+_ferror
+_ferror_unlocked
+_fflagstostr
+_fflush
+_fgetc
+_fgetln
+_fgetpos
+_fgetrune
+_fgets
+_fgetwc
+_fgetwc_l
+_fgetwln
+_fgetwln_l
+_fgetws
+_fgetws_l
+_fileno
+_fileno_unlocked
+_filesec_dup
+_filesec_free
+_filesec_get_property
+_filesec_init
+_filesec_query_property
+_filesec_set_property
+_filesec_unset_property
+_flockfile
+_fmtcheck
+_fmtmsg
+_fnmatch
+_fopen
+_fopen$DARWIN_EXTSN
+_fork
+_forkpty
+_fparseln
+_fprintf
+_fprintf_l
+_fpurge
+_fputc
+_fputrune
+_fputs
+_fputwc
+_fputwc_l
+_fputws
+_fputws_l
+_fread
+_free_printf_comp
+_free_printf_domain
+_freelocale
+_freopen
+_fscanf
+_fscanf_l
+_fseek
+_fseeko
+_fsetpos
+_fstatvfs
+_fstatx64_np
+_fstatx_np
+_fstatx_np$INODE64
+_fsync_volume_np
+_ftell
+_ftello
+_ftime
+_ftok
+_ftrylockfile
+_fts_children
+_fts_children$INODE64
+_fts_close
+_fts_close$INODE64
+_fts_open
+_fts_open$INODE64
+_fts_open_b
+_fts_open_b$INODE64
+_fts_read
+_fts_read$INODE64
+_fts_set
+_fts_set$INODE64
+_ftw
+_ftw$INODE64
+_fungetrune
+_funlockfile
+_funopen
+_fwide
+_fwprintf
+_fwprintf_l
+_fwrite
+_fwscanf
+_fwscanf_l
+_fxprintf
+_fxprintf_exec
+_gcvt
+_getbsize
+_getc
+_getc_unlocked
+_getchar
+_getchar_unlocked
+_getcwd
+_getdate
+_getdate_err
+_getdelim
+_getdiskbyname
+_getenv
+_getgroups$DARWIN_EXTSN
+_gethostid
+_gethostname
+_getipv4sourcefilter
+_getlastlogx
+_getlastlogxbyname
+_getline
+_getloadavg
+_getlogin
+_getlogin_r
+_getmntinfo
+_getmntinfo$INODE64
+_getmntinfo64
+_getmode
+_getopt
+_getopt_long
+_getopt_long_only
+_getpagesize
+_getpass
+_getpeereid
+_getprogname
+_gets
+_getsourcefilter
+_getsubopt
+_gettimeofday
+_getttyent
+_getttynam
+_getusershell
+_getutmp
+_getutmpx
+_getutxent
+_getutxent_wtmp
+_getutxid
+_getutxline
+_getvfsbyname
+_getw
+_getwc
+_getwc_l
+_getwchar
+_getwchar_l
+_getwd
+_glob
+_glob$INODE64
+_glob_b
+_glob_b$INODE64
+_globfree
+_gmtime
+_gmtime_r
+_grantpt
+_hash_create
+_hash_destroy
+_hash_purge
+_hash_search
+_hash_stats
+_hash_traverse
+_hcreate
+_hdestroy
+_heapsort
+_heapsort_b
+_hsearch
+_imaxabs
+_imaxdiv
+_index
+_inet_addr
+_inet_aton
+_inet_lnaof
+_inet_makeaddr
+_inet_net_ntop
+_inet_net_pton
+_inet_neta
+_inet_netof
+_inet_network
+_inet_nsap_addr
+_inet_nsap_ntoa
+_inet_ntoa
+_inet_ntop
+_inet_ntop4
+_inet_ntop6
+_inet_pton
+_initstate
+_insque
+_isalnum
+_isalnum_l
+_isalpha
+_isalpha_l
+_isascii
+_isatty
+_isblank
+_isblank_l
+_iscntrl
+_iscntrl_l
+_isdigit
+_isdigit_l
+_isgraph
+_isgraph_l
+_ishexnumber
+_ishexnumber_l
+_isideogram
+_isideogram_l
+_islower
+_islower_l
+_isnumber
+_isnumber_l
+_isphonogram
+_isphonogram_l
+_isprint
+_isprint_l
+_ispunct
+_ispunct_l
+_isrune
+_isrune_l
+_isspace
+_isspace_l
+_isspecial
+_isspecial_l
+_isupper
+_isupper_l
+_iswalnum
+_iswalnum_l
+_iswalpha
+_iswalpha_l
+_iswascii
+_iswblank
+_iswblank_l
+_iswcntrl
+_iswcntrl_l
+_iswctype
+_iswctype_l
+_iswdigit
+_iswdigit_l
+_iswgraph
+_iswgraph_l
+_iswhexnumber
+_iswhexnumber_l
+_iswideogram
+_iswideogram_l
+_iswlower
+_iswlower_l
+_iswnumber
+_iswnumber_l
+_iswphonogram
+_iswphonogram_l
+_iswprint
+_iswprint_l
+_iswpunct
+_iswpunct_l
+_iswrune
+_iswrune_l
+_iswspace
+_iswspace_l
+_iswspecial
+_iswspecial_l
+_iswupper
+_iswupper_l
+_iswxdigit
+_iswxdigit_l
+_isxdigit
+_isxdigit_l
+_jrand48
+_kOSThermalNotificationPressureLevelName
+_killpg
+_l64a
+_labs
+_lchflags
+_lchmod
+_lcong48
+_ldiv
+_lfind
+_link_addr
+_link_ntoa
+_llabs
+_lldiv
+_localeconv
+_localeconv_l
+_localtime
+_localtime_r
+_lockf
+_lockf$NOCANCEL
+_login
+_login_tty
+_logout
+_logwtmp
+_lrand48
+_lsearch
+_lstatx64_np
+_lstatx_np
+_lstatx_np$INODE64
+_lutimes
+_mblen
+_mblen_l
+_mbmb
+_mbrlen
+_mbrlen_l
+_mbrrune
+_mbrtowc
+_mbrtowc_l
+_mbrune
+_mbsinit
+_mbsinit_l
+_mbsnrtowcs
+_mbsnrtowcs_l
+_mbsrtowcs
+_mbsrtowcs_l
+_mbstowcs
+_mbstowcs_l
+_mbtowc
+_mbtowc_l
+_memccpy
+_memchr
+_memcmp
+_memcpy
+_memmem
+_memmove
+_memset
+_memset_pattern16
+_memset_pattern4
+_memset_pattern8
+_memset_s
+_mergesort
+_mergesort_b
+_mkdirx_np
+_mkdtemp
+_mkfifox_np
+_mkostemp
+_mkostemps
+_mkpath_np
+_mkpathat_np
+_mkstemp
+_mkstemp_dprotected_np
+_mkstemps
+_mktemp
+_mktime
+_monaddition
+_moncontrol
+_moncount
+_moninit
+_monitor
+_monoutput
+_monreset
+_monstartup
+_mpool_close
+_mpool_filter
+_mpool_get
+_mpool_new
+_mpool_open
+_mpool_put
+_mpool_sync
+_mrand48
+_nanosleep
+_nanosleep$NOCANCEL
+_new_printf_comp
+_new_printf_domain
+_newlocale
+_nextwctype
+_nextwctype_l
+_nftw
+_nftw$INODE64
+_nice
+_nl_langinfo
+_nl_langinfo_l
+_nrand48
+_nvis
+_off32
+_off64
+_offtime
+_opendev
+_opendir
+_opendir$INODE64
+_openpty
+_openx_np
+_optarg
+_opterr
+_optind
+_optopt
+_optreset
+_pause
+_pause$NOCANCEL
+_pclose
+_perror
+_popen
+_popen$DARWIN_EXTSN
+_posix2time
+_posix_openpt
+_posix_spawnp
+_printf
+_printf_l
+_psignal
+_psort
+_psort_b
+_psort_r
+_ptsname
+_putc
+_putc_unlocked
+_putchar
+_putchar_unlocked
+_putenv
+_puts
+_pututxline
+_putw
+_putwc
+_putwc_l
+_putwchar
+_putwchar_l
+_qsort
+_qsort_b
+_qsort_r
+_querylocale
+_radixsort
+_raise
+_rand
+_rand_r
+_random
+_rb_tree_count
+_rb_tree_find_node
+_rb_tree_find_node_geq
+_rb_tree_find_node_leq
+_rb_tree_init
+_rb_tree_insert_node
+_rb_tree_iterate
+_rb_tree_remove_node
+_readdir
+_readdir$INODE64
+_readdir_r
+_readdir_r$INODE64
+_readpassphrase
+_reallocf
+_realpath
+_realpath$DARWIN_EXTSN
+_recv
+_recv$NOCANCEL
+_regcomp
+_regcomp_l
+_regerror
+_regexec
+_regfree
+_register_printf_domain_function
+_register_printf_domain_render_std
+_regncomp
+_regncomp_l
+_regnexec
+_regwcomp
+_regwcomp_l
+_regwexec
+_regwncomp
+_regwncomp_l
+_regwnexec
+_remove
+_remque
+_rewind
+_rewinddir
+_rewinddir$INODE64
+_rindex
+_sbrk
+_scandir
+_scandir$INODE64
+_scandir_b
+_scandir_b$INODE64
+_scanf
+_scanf_l
+_seed48
+_seekdir
+_seekdir$INODE64
+_send
+_send$NOCANCEL
+_setbuf
+_setbuffer
+_setenv
+_sethostid
+_sethostname
+_setinvalidrune
+_setipv4sourcefilter
+_setkey
+_setlinebuf
+_setlocale
+_setlogin
+_setmode
+_setpgrp
+_setprogname
+_setrgid
+_setruid
+_setrunelocale
+_setsourcefilter
+_setstate
+_settimeofday
+_setttyent
+_setusershell
+_setutxent
+_setutxent_wtmp
+_setvbuf
+_sigaction
+_sigaddset
+_sigaltstack
+_sigblock
+_sigdelset
+_sigemptyset
+_sigfillset
+_sighold
+_sigignore
+_siginterrupt
+_sigismember
+_signal
+_sigpause
+_sigpause$NOCANCEL
+_sigrelse
+_sigset
+_sigsetmask
+_sigvec
+_skip
+_sl_add
+_sl_find
+_sl_free
+_sl_init
+_sleep
+_sleep$NOCANCEL
+_snprintf
+_snprintf_l
+_snvis
+_sockatmark
+_sprintf
+_sprintf_l
+_sradixsort
+_srand
+_srand48
+_sranddev
+_srandom
+_srandomdev
+_sscanf
+_sscanf_l
+_statvfs
+_statx64_np
+_statx_np
+_statx_np$INODE64
+_stpcpy
+_stpncpy
+_strcasecmp
+_strcasecmp_l
+_strcasestr
+_strcasestr_l
+_strcat
+_strchr
+_strcmp
+_strcoll
+_strcoll_l
+_strcpy
+_strcspn
+_strdup
+_strenvisx
+_strerror
+_strerror_r
+_strfmon
+_strfmon_l
+_strftime
+_strftime_l
+_strlcat
+_strlcpy
+_strlen
+_strmode
+_strncasecmp
+_strncasecmp_l
+_strncat
+_strncmp
+_strncpy
+_strndup
+_strnlen
+_strnstr
+_strnunvis
+_strnunvisx
+_strnvis
+_strnvisx
+_strpbrk
+_strptime
+_strptime_l
+_strrchr
+_strsenvisx
+_strsep
+_strsignal
+_strsnvis
+_strsnvisx
+_strspn
+_strstr
+_strsvis
+_strsvisx
+_strtod
+_strtod_l
+_strtof
+_strtof_l
+_strtofflags
+_strtoimax
+_strtoimax_l
+_strtok
+_strtok_r
+_strtol
+_strtol_l
+_strtold
+_strtold_l
+_strtoll
+_strtoll_l
+_strtoq
+_strtoq_l
+_strtoul
+_strtoul_l
+_strtoull
+_strtoull_l
+_strtoumax
+_strtoumax_l
+_strtouq
+_strtouq_l
+_strunvis
+_strunvisx
+_strvis
+_strvisx
+_strxfrm
+_strxfrm_l
+_suboptarg
+_svis
+_swab
+_swprintf
+_swprintf_l
+_swscanf
+_swscanf_l
+_sxprintf
+_sxprintf_exec
+_sync_volume_np
+_sys_errlist
+_sys_nerr
+_sys_siglist
+_sys_signame
+_sysconf
+_sysctl
+_sysctlbyname
+_sysctlnametomib
+_system
+_system$NOCANCEL
+_tcdrain
+_tcdrain$NOCANCEL
+_tcflow
+_tcflush
+_tcgetattr
+_tcgetpgrp
+_tcgetsid
+_tcsendbreak
+_tcsetattr
+_tcsetpgrp
+_tdelete
+_telldir
+_telldir$INODE64
+_tempnam
+_tfind
+_thread_stack_pcs
+_time
+_time2posix
+_timegm
+_timelocal
+_timeoff
+_times
+_timezone
+_timingsafe_bcmp
+_tmpfile
+_tmpnam
+_toascii
+_tolower
+_tolower_l
+_toupper
+_toupper_l
+_towctrans
+_towctrans_l
+_towlower
+_towlower_l
+_towupper
+_towupper_l
+_tre_ast_new_catenation
+_tre_ast_new_iter
+_tre_ast_new_literal
+_tre_ast_new_node
+_tre_ast_new_union
+_tre_compile
+_tre_fill_pmatch
+_tre_free
+_tre_mem_alloc_impl
+_tre_mem_destroy
+_tre_mem_new_impl
+_tre_parse
+_tre_stack_destroy
+_tre_stack_new
+_tre_stack_num_objects
+_tre_tnfa_run_backtrack
+_tre_tnfa_run_parallel
+_tsearch
+_ttyname
+_ttyname_r
+_ttyslot
+_twalk
+_tzname
+_tzset
+_tzsetwall
+_ualarm
+_ulimit
+_umaskx_np
+_uname
+_ungetc
+_ungetwc
+_ungetwc_l
+_unlockpt
+_unsetenv
+_unvis
+_uselocale
+_usleep
+_usleep$NOCANCEL
+_utime
+_utmpxname
+_uuid_clear
+_uuid_compare
+_uuid_copy
+_uuid_generate
+_uuid_generate_random
+_uuid_generate_time
+_uuid_is_null
+_uuid_pack
+_uuid_parse
+_uuid_unpack
+_uuid_unparse
+_uuid_unparse_lower
+_uuid_unparse_upper
+_vasprintf
+_vasprintf_l
+_vasxprintf
+_vasxprintf_exec
+_vdprintf
+_vdprintf_l
+_vdxprintf
+_vdxprintf_exec
+_verr
+_verrc
+_verrx
+_vfprintf
+_vfprintf_l
+_vfscanf
+_vfscanf_l
+_vfwprintf
+_vfwprintf_l
+_vfwscanf
+_vfwscanf_l
+_vfxprintf
+_vfxprintf_exec
+_vis
+_vprintf
+_vprintf_l
+_vscanf
+_vscanf_l
+_vsnprintf
+_vsnprintf_l
+_vsprintf
+_vsprintf_l
+_vsscanf
+_vsscanf_l
+_vswprintf
+_vswprintf_l
+_vswscanf
+_vswscanf_l
+_vsxprintf
+_vsxprintf_exec
+_vwarn
+_vwarnc
+_vwarnx
+_vwprintf
+_vwprintf_l
+_vwscanf
+_vwscanf_l
+_vxprintf
+_vxprintf_exec
+_wait
+_wait$NOCANCEL
+_wait3
+_waitpid
+_waitpid$NOCANCEL
+_warn
+_warnc
+_warnx
+_wcpcpy
+_wcpncpy
+_wcrtomb
+_wcrtomb_l
+_wcscasecmp
+_wcscasecmp_l
+_wcscat
+_wcschr
+_wcscmp
+_wcscoll
+_wcscoll_l
+_wcscpy
+_wcscspn
+_wcsdup
+_wcsftime
+_wcsftime_l
+_wcslcat
+_wcslcpy
+_wcslen
+_wcsncasecmp
+_wcsncasecmp_l
+_wcsncat
+_wcsncmp
+_wcsncpy
+_wcsnlen
+_wcsnrtombs
+_wcsnrtombs_l
+_wcspbrk
+_wcsrchr
+_wcsrtombs
+_wcsrtombs_l
+_wcsspn
+_wcsstr
+_wcstod
+_wcstod_l
+_wcstof
+_wcstof_l
+_wcstoimax
+_wcstoimax_l
+_wcstok
+_wcstol
+_wcstol_l
+_wcstold
+_wcstold_l
+_wcstoll
+_wcstoll_l
+_wcstombs
+_wcstombs_l
+_wcstoul
+_wcstoul_l
+_wcstoull
+_wcstoull_l
+_wcstoumax
+_wcstoumax_l
+_wcswidth
+_wcswidth_l
+_wcsxfrm
+_wcsxfrm_l
+_wctob
+_wctob_l
+_wctomb
+_wctomb_l
+_wctrans
+_wctrans_l
+_wctype
+_wctype_l
+_wcwidth
+_wcwidth_l
+_wmemchr
+_wmemcmp
+_wmemcpy
+_wmemmove
+_wmemset
+_wordexp
+_wordfree
+_wprintf
+_wprintf_l
+_wscanf
+_wscanf_l
+_wtmpxname
+_xprintf
+_xprintf_exec
+mcount
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_kernel_symbols b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_kernel_symbols
new file mode 100644
index 000000000000..7c5b90f95ed7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_kernel_symbols
@@ -0,0 +1,1172 @@
+_NDR_record
+_____old_semwait_signal_nocancel
+_____sigwait_nocancel
+____kernelVersionNumber
+____kernelVersionString
+___abort_with_payload
+___accept
+___accept_nocancel
+___access_extended
+___aio_suspend_nocancel
+___bind
+___bsdthread_create
+___bsdthread_ctl
+___bsdthread_register
+___bsdthread_terminate
+___carbon_delete
+___channel_get_info
+___channel_get_opt
+___channel_open
+___channel_set_opt
+___channel_sync
+___chmod
+___chmod_extended
+___close_nocancel
+___coalition
+___coalition_info
+___commpage_gettimeofday
+___connect
+___connect_nocancel
+___copyfile
+___csrctl
+___delete
+___disable_threadsignal
+___error
+___exit
+___fchmod
+___fchmod_extended
+___fcntl
+___fcntl_nocancel
+___fork
+___fs_snapshot
+___fstat64_extended
+___fstat_extended
+___fsync_nocancel
+___get_remove_counter
+___getattrlist
+___getdirentries64
+___gethostuuid
+___getlogin
+___getpeername
+___getpid
+___getrlimit
+___getsgroups
+___getsockname
+___gettid
+___gettimeofday
+___getwgroups
+___guarded_open_dprotected_np
+___guarded_open_np
+___identitysvc
+___inc_remove_counter
+___initgroups
+___ioctl
+___iopolicysys
+___kdebug_trace
+___kdebug_trace64
+___kdebug_trace_string
+___kdebug_typefilter
+___kill
+___lchown
+___libkernel_init
+___libkernel_voucher_init
+___listen
+___lseek
+___lstat64_extended
+___lstat_extended
+___mac_execve
+___mac_get_fd
+___mac_get_file
+___mac_get_link
+___mac_get_mount
+___mac_get_pid
+___mac_get_proc
+___mac_getfsstat
+___mac_mount
+___mac_set_fd
+___mac_set_file
+___mac_set_link
+___mac_set_proc
+___mac_syscall
+___microstackshot
+___mkdir_extended
+___mkfifo_extended
+___mmap
+___mprotect
+___msgctl
+___msgrcv_nocancel
+___msgsnd_nocancel
+___msgsys
+___msync
+___msync_nocancel
+___munmap
+___nexus_create
+___nexus_deregister
+___nexus_destroy
+___nexus_get_opt
+___nexus_open
+___nexus_register
+___nexus_set_opt
+___old_semwait_signal
+___open
+___open_dprotected_np
+___open_extended
+___open_nocancel
+___openat
+___openat_nocancel
+___os_nexus_ifattach
+___os_nexus_ifdetach
+___persona
+___pipe
+___poll_nocancel
+___posix_spawn
+___pread_nocancel
+___proc_info
+___process_policy
+___pselect
+___pselect_nocancel
+___psynch_cvbroad
+___psynch_cvclrprepost
+___psynch_cvsignal
+___psynch_cvwait
+___psynch_mutexdrop
+___psynch_mutexwait
+___psynch_rw_downgrade
+___psynch_rw_longrdlock
+___psynch_rw_rdlock
+___psynch_rw_unlock
+___psynch_rw_unlock2
+___psynch_rw_upgrade
+___psynch_rw_wrlock
+___psynch_rw_yieldwrlock
+___pthread_canceled
+___pthread_chdir
+___pthread_fchdir
+___pthread_kill
+___pthread_markcancel
+___pthread_sigmask
+___ptrace
+___pwrite_nocancel
+___read_nocancel
+___readv_nocancel
+___recvfrom
+___recvfrom_nocancel
+___recvmsg
+___recvmsg_nocancel
+___rename
+___renameat
+___renameatx_np
+___rmdir
+___sandbox_me
+___sandbox_mm
+___sandbox_ms
+___sandbox_msp
+___select
+___select_nocancel
+___sem_open
+___sem_wait_nocancel
+___semctl
+___semsys
+___semwait_signal
+___semwait_signal_nocancel
+___sendmsg
+___sendmsg_nocancel
+___sendto
+___sendto_nocancel
+___setattrlist
+___setlogin
+___setpriority
+___setregid
+___setreuid
+___setrlimit
+___setsgroups
+___settid
+___settid_with_pid
+___settimeofday
+___setwgroups
+___sfi_ctl
+___sfi_pidctl
+___shared_region_check_np
+___shared_region_map_and_slide_np
+___shm_open
+___shmctl
+___shmsys
+___sigaction
+___sigaltstack
+___sigreturn
+___sigsuspend
+___sigsuspend_nocancel
+___sigwait
+___socketpair
+___stack_snapshot_with_config
+___stat64_extended
+___stat_extended
+___syscall
+___syscall_logger
+___sysctl
+___sysctlbyname
+___telemetry
+___terminate_with_payload
+___thread_selfid
+___thread_selfusage
+___ulock_wait
+___ulock_wake
+___umask_extended
+___unlink
+___unlinkat
+___vfork
+___wait4
+___wait4_nocancel
+___waitid_nocancel
+___work_interval_ctl
+___workq_kernreturn
+___workq_open
+___write_nocancel
+___writev_nocancel
+__cpu_capabilities
+__cpu_has_altivec
+__exit
+__get_cpu_capabilities
+__getprivatesystemidentifier
+__host_page_size
+__init_cpu_capabilities
+__kernelrpc_host_create_mach_voucher
+__kernelrpc_mach_port_allocate
+__kernelrpc_mach_port_allocate_full
+__kernelrpc_mach_port_allocate_name
+__kernelrpc_mach_port_allocate_qos
+__kernelrpc_mach_port_allocate_trap
+__kernelrpc_mach_port_construct
+__kernelrpc_mach_port_construct_trap
+__kernelrpc_mach_port_deallocate
+__kernelrpc_mach_port_deallocate_trap
+__kernelrpc_mach_port_destroy
+__kernelrpc_mach_port_destroy_trap
+__kernelrpc_mach_port_destruct
+__kernelrpc_mach_port_destruct_trap
+__kernelrpc_mach_port_dnrequest_info
+__kernelrpc_mach_port_extract_member
+__kernelrpc_mach_port_extract_member_trap
+__kernelrpc_mach_port_extract_right
+__kernelrpc_mach_port_get_attributes
+__kernelrpc_mach_port_get_context
+__kernelrpc_mach_port_get_refs
+__kernelrpc_mach_port_get_set_status
+__kernelrpc_mach_port_get_srights
+__kernelrpc_mach_port_guard
+__kernelrpc_mach_port_guard_trap
+__kernelrpc_mach_port_insert_member
+__kernelrpc_mach_port_insert_member_trap
+__kernelrpc_mach_port_insert_right
+__kernelrpc_mach_port_insert_right_trap
+__kernelrpc_mach_port_kernel_object
+__kernelrpc_mach_port_kobject
+__kernelrpc_mach_port_mod_refs
+__kernelrpc_mach_port_mod_refs_trap
+__kernelrpc_mach_port_move_member
+__kernelrpc_mach_port_move_member_trap
+__kernelrpc_mach_port_names
+__kernelrpc_mach_port_peek
+__kernelrpc_mach_port_rename
+__kernelrpc_mach_port_request_notification
+__kernelrpc_mach_port_set_attributes
+__kernelrpc_mach_port_set_context
+__kernelrpc_mach_port_set_mscount
+__kernelrpc_mach_port_set_seqno
+__kernelrpc_mach_port_space_basic_info
+__kernelrpc_mach_port_space_info
+__kernelrpc_mach_port_type
+__kernelrpc_mach_port_unguard
+__kernelrpc_mach_port_unguard_trap
+__kernelrpc_mach_vm_allocate
+__kernelrpc_mach_vm_allocate_trap
+__kernelrpc_mach_vm_deallocate
+__kernelrpc_mach_vm_deallocate_trap
+__kernelrpc_mach_vm_map
+__kernelrpc_mach_vm_map_trap
+__kernelrpc_mach_vm_protect
+__kernelrpc_mach_vm_protect_trap
+__kernelrpc_mach_vm_purgable_control
+__kernelrpc_mach_vm_purgable_control_trap
+__kernelrpc_mach_vm_read
+__kernelrpc_mach_vm_remap
+__kernelrpc_mach_voucher_extract_attr_recipe
+__kernelrpc_task_set_port_space
+__kernelrpc_thread_policy
+__kernelrpc_thread_policy_set
+__kernelrpc_thread_set_policy
+__kernelrpc_vm_map
+__kernelrpc_vm_purgable_control
+__kernelrpc_vm_read
+__kernelrpc_vm_remap
+__mach_errors
+__mach_fork_child
+__mach_snprintf
+__mach_vsnprintf
+__os_alloc_once_table
+__register_gethostuuid_callback
+__thread_set_tsd_base
+_abort_with_payload
+_abort_with_reason
+_accept
+_accept$NOCANCEL
+_access
+_accessx_np
+_acct
+_act_get_state
+_act_set_state
+_adjtime
+_aio_cancel
+_aio_error
+_aio_fsync
+_aio_read
+_aio_return
+_aio_suspend
+_aio_suspend$NOCANCEL
+_aio_write
+_audit
+_audit_session_join
+_audit_session_port
+_audit_session_self
+_auditctl
+_auditon
+_bind
+_bootstrap_port
+_cerror
+_cerror_nocancel
+_change_fdguard_np
+_chdir
+_chflags
+_chmod
+_chown
+_chroot
+_clock_alarm
+_clock_alarm_reply
+_clock_get_attributes
+_clock_get_time
+_clock_set_attributes
+_clock_set_time
+_clock_sleep
+_clock_sleep_trap
+_clonefile
+_clonefileat
+_close
+_close$NOCANCEL
+_coalition_create
+_coalition_info_resource_usage
+_coalition_reap
+_coalition_terminate
+_connect
+_connect$NOCANCEL
+_connectx
+_csops
+_csops_audittoken
+_csr_check
+_csr_get_active_config
+_denap_boost_assertion_token
+_disconnectx
+_dup
+_dup2
+_errno
+_etap_trace_thread
+_exc_server
+_exc_server_routine
+_exception_raise
+_exception_raise_state
+_exception_raise_state_identity
+_exchangedata
+_execve
+_faccessat
+_fchdir
+_fchflags
+_fchmod
+_fchmodat
+_fchown
+_fchownat
+_fclonefileat
+_fcntl
+_fcntl$NOCANCEL
+_fdatasync
+_ffsctl
+_fgetattrlist
+_fgetxattr
+_fhopen
+_fileport_makefd
+_fileport_makeport
+_flistxattr
+_flock
+_fpathconf
+_fremovexattr
+_fs_snapshot_create
+_fs_snapshot_delete
+_fs_snapshot_list
+_fs_snapshot_mount
+_fs_snapshot_rename
+_fs_snapshot_revert
+_fsctl
+_fsetattrlist
+_fsetxattr
+_fsgetpath
+_fstat
+_fstat$INODE64
+_fstat64
+_fstatat
+_fstatat$INODE64
+_fstatat64
+_fstatfs
+_fstatfs$INODE64
+_fstatfs64
+_fsync
+_fsync$NOCANCEL
+_ftruncate
+_futimes
+_getattrlist
+_getattrlistat
+_getattrlistbulk
+_getaudit
+_getaudit_addr
+_getauid
+_getdirentries
+_getdirentriesattr
+_getdtablesize
+_getegid
+_getentropy
+_geteuid
+_getfh
+_getfsstat
+_getfsstat$INODE64
+_getfsstat64
+_getgid
+_getgroups
+_gethostuuid
+_getiopolicy_np
+_getitimer
+_getpeername
+_getpgid
+_getpgrp
+_getpid
+_getppid
+_getpriority
+_getrlimit
+_getrusage
+_getsgroups_np
+_getsid
+_getsockname
+_getsockopt
+_getuid
+_getwgroups_np
+_getxattr
+_grab_pgo_data
+_guarded_close_np
+_guarded_kqueue_np
+_guarded_open_dprotected_np
+_guarded_open_np
+_guarded_pwrite_np
+_guarded_write_np
+_guarded_writev_np
+_host_check_multiuser_mode
+_host_create_mach_voucher
+_host_create_mach_voucher_trap
+_host_default_memory_manager
+_host_get_UNDServer
+_host_get_atm_diagnostic_flag
+_host_get_boot_info
+_host_get_clock_control
+_host_get_clock_service
+_host_get_exception_ports
+_host_get_io_master
+_host_get_multiuser_config_flags
+_host_get_special_port
+_host_info
+_host_kernel_version
+_host_lockgroup_info
+_host_page_size
+_host_priv_statistics
+_host_processor_info
+_host_processor_set_priv
+_host_processor_sets
+_host_processors
+_host_reboot
+_host_register_mach_voucher_attr_manager
+_host_register_well_known_mach_voucher_attr_manager
+_host_request_notification
+_host_security_create_task_token
+_host_security_set_task_token
+_host_self
+_host_self_trap
+_host_set_UNDServer
+_host_set_atm_diagnostic_flag
+_host_set_exception_ports
+_host_set_multiuser_config_flags
+_host_set_special_port
+_host_statistics
+_host_statistics64
+_host_swap_exception_ports
+_host_virtual_physical_table_info
+_i386_get_ldt
+_i386_set_ldt
+_important_boost_assertion_token
+_internal_catch_exc_subsystem
+_ioctl
+_issetugid
+_kas_info
+_kdebug_is_enabled
+_kdebug_signpost
+_kdebug_signpost_end
+_kdebug_signpost_start
+_kdebug_trace
+_kdebug_trace_string
+_kdebug_typefilter
+_kevent
+_kevent64
+_kevent_qos
+_kext_request
+_kill
+_kmod_control
+_kmod_create
+_kmod_destroy
+_kmod_get_info
+_kpersona_alloc
+_kpersona_dealloc
+_kpersona_find
+_kpersona_get
+_kpersona_info
+_kpersona_pidinfo
+_kqueue
+_lchown
+_ledger
+_link
+_linkat
+_lio_listio
+_listen
+_listxattr
+_lock_acquire
+_lock_handoff
+_lock_handoff_accept
+_lock_make_stable
+_lock_release
+_lock_set_create
+_lock_set_destroy
+_lock_try
+_lseek
+_lstat
+_lstat$INODE64
+_lstat64
+_mach_absolute_time
+_mach_approximate_time
+_mach_boottime_usec
+_mach_continuous_approximate_time
+_mach_continuous_time
+_mach_error
+_mach_error_full_diag
+_mach_error_string
+_mach_error_type
+_mach_generate_activity_id
+_mach_get_times
+_mach_host_self
+_mach_init
+_mach_make_memory_entry
+_mach_make_memory_entry_64
+_mach_memory_info
+_mach_memory_object_memory_entry
+_mach_memory_object_memory_entry_64
+_mach_msg
+_mach_msg_destroy
+_mach_msg_overwrite
+_mach_msg_overwrite_trap
+_mach_msg_receive
+_mach_msg_send
+_mach_msg_server
+_mach_msg_server_importance
+_mach_msg_server_once
+_mach_msg_trap
+_mach_notify_dead_name
+_mach_notify_no_senders
+_mach_notify_port_deleted
+_mach_notify_port_destroyed
+_mach_notify_send_once
+_mach_port_allocate
+_mach_port_allocate_full
+_mach_port_allocate_name
+_mach_port_allocate_qos
+_mach_port_construct
+_mach_port_deallocate
+_mach_port_destroy
+_mach_port_destruct
+_mach_port_dnrequest_info
+_mach_port_extract_member
+_mach_port_extract_right
+_mach_port_get_attributes
+_mach_port_get_context
+_mach_port_get_refs
+_mach_port_get_set_status
+_mach_port_get_srights
+_mach_port_guard
+_mach_port_insert_member
+_mach_port_insert_right
+_mach_port_kernel_object
+_mach_port_kobject
+_mach_port_mod_refs
+_mach_port_move_member
+_mach_port_names
+_mach_port_peek
+_mach_port_rename
+_mach_port_request_notification
+_mach_port_set_attributes
+_mach_port_set_context
+_mach_port_set_mscount
+_mach_port_set_seqno
+_mach_port_space_basic_info
+_mach_port_space_info
+_mach_port_type
+_mach_port_unguard
+_mach_ports_lookup
+_mach_ports_register
+_mach_reply_port
+_mach_task_self
+_mach_task_self_
+_mach_thread_self
+_mach_timebase_info
+_mach_timebase_info_trap
+_mach_vm_allocate
+_mach_vm_behavior_set
+_mach_vm_copy
+_mach_vm_deallocate
+_mach_vm_inherit
+_mach_vm_machine_attribute
+_mach_vm_map
+_mach_vm_msync
+_mach_vm_page_info
+_mach_vm_page_query
+_mach_vm_protect
+_mach_vm_purgable_control
+_mach_vm_read
+_mach_vm_read_list
+_mach_vm_read_overwrite
+_mach_vm_region
+_mach_vm_region_recurse
+_mach_vm_remap
+_mach_vm_wire
+_mach_vm_write
+_mach_voucher_attr_command
+_mach_voucher_deallocate
+_mach_voucher_debug_info
+_mach_voucher_extract_all_attr_recipes
+_mach_voucher_extract_attr_content
+_mach_voucher_extract_attr_recipe
+_mach_voucher_extract_attr_recipe_trap
+_mach_wait_until
+_mach_zone_force_gc
+_mach_zone_info
+_macx_backing_store_recovery
+_macx_backing_store_suspend
+_macx_swapoff
+_macx_swapon
+_macx_triggers
+_madvise
+_memorystatus_control
+_memorystatus_get_level
+_mig_allocate
+_mig_dealloc_reply_port
+_mig_deallocate
+_mig_get_reply_port
+_mig_put_reply_port
+_mig_reply_setup
+_mig_strncpy
+_mig_strncpy_zerofill
+_mincore
+_minherit
+_mk_timer_arm
+_mk_timer_cancel
+_mk_timer_create
+_mk_timer_destroy
+_mkdir
+_mkdirat
+_mkfifo
+_mknod
+_mlock
+_mlockall
+_mmap
+_modwatch
+_mount
+_mprotect
+_mremap_encrypted
+_msg_receive
+_msg_rpc
+_msg_send
+_msgctl
+_msgget
+_msgrcv
+_msgrcv$NOCANCEL
+_msgsnd
+_msgsnd$NOCANCEL
+_msgsys
+_msync
+_msync$NOCANCEL
+_munlock
+_munlockall
+_munmap
+_necp_client_action
+_necp_match_policy
+_necp_open
+_netagent_trigger
+_netname_check_in
+_netname_check_out
+_netname_look_up
+_netname_version
+_nfsclnt
+_nfssvc
+_non_boost_assertion_token
+_normal_boost_assertion_token
+_open
+_open$NOCANCEL
+_open_dprotected_np
+_openat
+_openat$NOCANCEL
+_openbyid_np
+_os_channel_advance_slot
+_os_channel_attr_clone
+_os_channel_attr_create
+_os_channel_attr_destroy
+_os_channel_attr_get
+_os_channel_attr_get_key
+_os_channel_attr_set
+_os_channel_attr_set_key
+_os_channel_available_slot_count
+_os_channel_create
+_os_channel_create_extended
+_os_channel_destroy
+_os_channel_get_fd
+_os_channel_get_next_slot
+_os_channel_pending
+_os_channel_read_attr
+_os_channel_read_nexus_extension_info
+_os_channel_ring_id
+_os_channel_rx_ring
+_os_channel_set_slot_properties
+_os_channel_sync
+_os_channel_tx_ring
+_os_channel_write_attr
+_os_nexus_attr_clone
+_os_nexus_attr_create
+_os_nexus_attr_destroy
+_os_nexus_attr_get
+_os_nexus_attr_set
+_os_nexus_controller_alloc_provider_instance
+_os_nexus_controller_bind_provider_instance
+_os_nexus_controller_create
+_os_nexus_controller_deregister_provider
+_os_nexus_controller_destroy
+_os_nexus_controller_free_provider_instance
+_os_nexus_controller_get_fd
+_os_nexus_controller_read_provider_attr
+_os_nexus_controller_register_provider
+_os_nexus_controller_unbind_provider_instance
+_panic
+_panic_init
+_pathconf
+_peeloff
+_pid_for_task
+_pid_hibernate
+_pid_resume
+_pid_shutdown_sockets
+_pid_suspend
+_pipe
+_poll
+_poll$NOCANCEL
+_port_obj_init
+_port_obj_table
+_port_obj_table_size
+_posix_madvise
+_posix_spawn
+_posix_spawn_file_actions_addclose
+_posix_spawn_file_actions_adddup2
+_posix_spawn_file_actions_addinherit_np
+_posix_spawn_file_actions_addopen
+_posix_spawn_file_actions_destroy
+_posix_spawn_file_actions_init
+_posix_spawnattr_destroy
+_posix_spawnattr_get_darwin_role_np
+_posix_spawnattr_get_qos_clamp_np
+_posix_spawnattr_getbinpref_np
+_posix_spawnattr_getcpumonitor
+_posix_spawnattr_getflags
+_posix_spawnattr_getmacpolicyinfo_np
+_posix_spawnattr_getpcontrol_np
+_posix_spawnattr_getpgroup
+_posix_spawnattr_getprocesstype_np
+_posix_spawnattr_getsigdefault
+_posix_spawnattr_getsigmask
+_posix_spawnattr_init
+_posix_spawnattr_set_darwin_role_np
+_posix_spawnattr_set_importancewatch_port_np
+_posix_spawnattr_set_persona_gid_np
+_posix_spawnattr_set_persona_groups_np
+_posix_spawnattr_set_persona_np
+_posix_spawnattr_set_persona_uid_np
+_posix_spawnattr_set_qos_clamp_np
+_posix_spawnattr_setauditsessionport_np
+_posix_spawnattr_setbinpref_np
+_posix_spawnattr_setcoalition_np
+_posix_spawnattr_setcpumonitor
+_posix_spawnattr_setcpumonitor_default
+_posix_spawnattr_setexceptionports_np
+_posix_spawnattr_setflags
+_posix_spawnattr_setjetsam_ext
+_posix_spawnattr_setmacpolicyinfo_np
+_posix_spawnattr_setpcontrol_np
+_posix_spawnattr_setpgroup
+_posix_spawnattr_setprocesstype_np
+_posix_spawnattr_setsigdefault
+_posix_spawnattr_setsigmask
+_posix_spawnattr_setspecialport_np
+_pread
+_pread$NOCANCEL
+_proc_clear_cpulimits
+_proc_clear_delayidlesleep
+_proc_clear_dirty
+_proc_clear_vmpressure
+_proc_denap_assertion_begin_with_msg
+_proc_denap_assertion_complete
+_proc_disable_apptype
+_proc_disable_cpumon
+_proc_disable_wakemon
+_proc_donate_importance_boost
+_proc_enable_apptype
+_proc_get_cpumon_params
+_proc_get_dirty
+_proc_get_wakemon_params
+_proc_importance_assertion_begin_with_msg
+_proc_importance_assertion_complete
+_proc_kmsgbuf
+_proc_libversion
+_proc_list_uptrs
+_proc_listallpids
+_proc_listchildpids
+_proc_listcoalitions
+_proc_listpgrppids
+_proc_listpids
+_proc_listpidspath
+_proc_name
+_proc_pid_rusage
+_proc_pidfdinfo
+_proc_pidfileportinfo
+_proc_pidinfo
+_proc_pidoriginatorinfo
+_proc_pidpath
+_proc_regionfilename
+_proc_resume_cpumon
+_proc_rlimit_control
+_proc_set_cpumon_defaults
+_proc_set_cpumon_params
+_proc_set_cpumon_params_fatal
+_proc_set_delayidlesleep
+_proc_set_dirty
+_proc_set_owner_vmpressure
+_proc_set_wakemon_defaults
+_proc_set_wakemon_params
+_proc_setcpu_percentage
+_proc_setpcontrol
+_proc_setthread_cpupercent
+_proc_suppress
+_proc_terminate
+_proc_trace_log
+_proc_track_dirty
+_proc_uuid_policy
+_processor_assign
+_processor_control
+_processor_exit
+_processor_get_assignment
+_processor_info
+_processor_set_create
+_processor_set_default
+_processor_set_destroy
+_processor_set_info
+_processor_set_max_priority
+_processor_set_policy_control
+_processor_set_policy_disable
+_processor_set_policy_enable
+_processor_set_stack_usage
+_processor_set_statistics
+_processor_set_tasks
+_processor_set_threads
+_processor_start
+_pselect
+_pselect$1050
+_pselect$DARWIN_EXTSN
+_pselect$DARWIN_EXTSN$NOCANCEL
+_pselect$NOCANCEL
+_pthread_getugid_np
+_pthread_setugid_np
+_ptrace
+_pwrite
+_pwrite$NOCANCEL
+_quota
+_quotactl
+_read
+_read$NOCANCEL
+_readlink
+_readlinkat
+_readv
+_readv$NOCANCEL
+_reboot
+_recvfrom
+_recvfrom$NOCANCEL
+_recvmsg
+_recvmsg$NOCANCEL
+_recvmsg_x
+_removexattr
+_rename
+_rename_ext
+_renameat
+_renameatx_np
+_renamex_np
+_revoke
+_rmdir
+_searchfs
+_select
+_select$1050
+_select$DARWIN_EXTSN
+_select$DARWIN_EXTSN$NOCANCEL
+_select$NOCANCEL
+_sem_close
+_sem_destroy
+_sem_getvalue
+_sem_init
+_sem_open
+_sem_post
+_sem_trywait
+_sem_unlink
+_sem_wait
+_sem_wait$NOCANCEL
+_semaphore_create
+_semaphore_destroy
+_semaphore_signal
+_semaphore_signal_all
+_semaphore_signal_all_trap
+_semaphore_signal_thread
+_semaphore_signal_thread_trap
+_semaphore_signal_trap
+_semaphore_timedwait
+_semaphore_timedwait_signal
+_semaphore_timedwait_signal_trap
+_semaphore_timedwait_trap
+_semaphore_wait
+_semaphore_wait_signal
+_semaphore_wait_signal_trap
+_semaphore_wait_trap
+_semctl
+_semget
+_semop
+_semsys
+_sendfile
+_sendmsg
+_sendmsg$NOCANCEL
+_sendmsg_x
+_sendto
+_sendto$NOCANCEL
+_setattrlist
+_setaudit
+_setaudit_addr
+_setauid
+_setegid
+_seteuid
+_setgid
+_setgroups
+_setiopolicy_np
+_setitimer
+_setpgid
+_setpriority
+_setprivexec
+_setquota
+_setregid
+_setreuid
+_setrlimit
+_setsgroups_np
+_setsid
+_setsockopt
+_setuid
+_setwgroups_np
+_setxattr
+_sfi_get_class_offtime
+_sfi_process_get_flags
+_sfi_process_set_flags
+_sfi_set_class_offtime
+_shm_open
+_shm_unlink
+_shmat
+_shmctl
+_shmdt
+_shmget
+_shmsys
+_shutdown
+_sigpending
+_sigprocmask
+_sigsuspend
+_sigsuspend$NOCANCEL
+_socket
+_socket_delegate
+_socketpair
+_stackshot_capture_with_config
+_stackshot_config_create
+_stackshot_config_dealloc
+_stackshot_config_dealloc_buffer
+_stackshot_config_get_stackshot_buffer
+_stackshot_config_get_stackshot_size
+_stackshot_config_set_delta_timestamp
+_stackshot_config_set_flags
+_stackshot_config_set_pid
+_stackshot_config_set_size_hint
+_stat
+_stat$INODE64
+_stat64
+_statfs
+_statfs$INODE64
+_statfs64
+_swapon
+_swtch
+_swtch_pri
+_symlink
+_symlinkat
+_sync
+_syscall
+_syscall_thread_switch
+_system_get_sfi_window
+_system_override
+_system_set_sfi_window
+_task_assign
+_task_assign_default
+_task_create
+_task_for_pid
+_task_generate_corpse
+_task_get_assignment
+_task_get_dyld_image_infos
+_task_get_emulation_vector
+_task_get_exception_ports
+_task_get_mach_voucher
+_task_get_special_port
+_task_get_state
+_task_info
+_task_map_corpse_info
+_task_map_corpse_info_64
+_task_name_for_pid
+_task_policy
+_task_policy_get
+_task_policy_set
+_task_purgable_info
+_task_register_dyld_get_process_state
+_task_register_dyld_image_infos
+_task_register_dyld_set_dyld_state
+_task_register_dyld_shared_cache_image_info
+_task_resume
+_task_resume2
+_task_sample
+_task_self_
+_task_self_trap
+_task_set_emulation
+_task_set_emulation_vector
+_task_set_exception_ports
+_task_set_info
+_task_set_mach_voucher
+_task_set_phys_footprint_limit
+_task_set_policy
+_task_set_port_space
+_task_set_ras_pc
+_task_set_special_port
+_task_set_state
+_task_suspend
+_task_suspend2
+_task_swap_exception_ports
+_task_swap_mach_voucher
+_task_terminate
+_task_threads
+_task_unregister_dyld_image_infos
+_task_zone_info
+_terminate_with_payload
+_terminate_with_reason
+_thread_abort
+_thread_abort_safely
+_thread_assign
+_thread_assign_default
+_thread_create
+_thread_create_running
+_thread_depress_abort
+_thread_get_assignment
+_thread_get_exception_ports
+_thread_get_mach_voucher
+_thread_get_register_pointer_values
+_thread_get_special_port
+_thread_get_state
+_thread_info
+_thread_policy
+_thread_policy_get
+_thread_policy_set
+_thread_resume
+_thread_sample
+_thread_self_trap
+_thread_set_exception_ports
+_thread_set_mach_voucher
+_thread_set_policy
+_thread_set_special_port
+_thread_set_state
+_thread_suspend
+_thread_swap_exception_ports
+_thread_swap_mach_voucher
+_thread_switch
+_thread_terminate
+_thread_wire
+_truncate
+_umask
+_undelete
+_unlink
+_unlinkat
+_unmount
+_usrctl
+_utimes
+_vfork
+_vfs_purge
+_vm_allocate
+_vm_allocate_cpm
+_vm_behavior_set
+_vm_copy
+_vm_deallocate
+_vm_inherit
+_vm_kernel_page_mask
+_vm_kernel_page_shift
+_vm_kernel_page_size
+_vm_machine_attribute
+_vm_map
+_vm_map_page_query
+_vm_msync
+_vm_page_mask
+_vm_page_shift
+_vm_page_size
+_vm_pressure_monitor
+_vm_protect
+_vm_purgable_control
+_vm_read
+_vm_read_list
+_vm_read_overwrite
+_vm_region_64
+_vm_region_recurse_64
+_vm_remap
+_vm_wire
+_vm_write
+_voucher_mach_msg_adopt
+_voucher_mach_msg_clear
+_voucher_mach_msg_revert
+_voucher_mach_msg_set
+_vprintf_stderr_func
+_wait4
+_waitevent
+_waitid
+_waitid$NOCANCEL
+_watchevent
+_work_interval_create
+_work_interval_destroy
+_work_interval_notify
+_work_interval_notify_simple
+_write
+_write$NOCANCEL
+_writev
+_writev$NOCANCEL
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols
new file mode 100644
index 000000000000..75a00acac493
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols
@@ -0,0 +1 @@
+_mach_init_routine
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/PowerManagement/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/PowerManagement/default.nix
new file mode 100644
index 000000000000..5685d09e54fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/PowerManagement/default.nix
@@ -0,0 +1,10 @@
+{ appleDerivation, xcbuildHook, IOKit }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ IOKit ];
+ xcbuildFlags = [ "-target" "caffeinate" ];
+ installPhase = ''
+ install -D Products/Deployment/caffeinate $out/bin/caffeinate
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix
new file mode 100644
index 000000000000..e04142b8b11e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/boot.nix
@@ -0,0 +1,116 @@
+{ appleDerivation }:
+
+appleDerivation {
+ phases = [ "unpackPhase" "installPhase" ];
+
+ __propagatedImpureHostDeps = [
+ "/System/Library/Frameworks/Security.framework/Security"
+ "/System/Library/Frameworks/Security.framework/Resources"
+ "/System/Library/Frameworks/Security.framework/PlugIns"
+ "/System/Library/Frameworks/Security.framework/XPCServices"
+ "/System/Library/Frameworks/Security.framework/Versions"
+ ];
+
+ installPhase = ''
+ ###### IMPURITIES
+ mkdir -p $out/Library/Frameworks/Security.framework
+ pushd $out/Library/Frameworks/Security.framework
+ ln -s /System/Library/Frameworks/Security.framework/Security
+ ln -s /System/Library/Frameworks/Security.framework/Resources
+ ln -s /System/Library/Frameworks/Security.framework/PlugIns
+ ln -s /System/Library/Frameworks/Security.framework/XPCServices
+ popd
+
+ ###### HEADERS
+
+ export dest=$out/Library/Frameworks/Security.framework/Headers
+ mkdir -p $dest
+
+ cp libsecurity_asn1/lib/SecAsn1Coder.h $dest
+ cp libsecurity_asn1/lib/SecAsn1Templates.h $dest
+ cp libsecurity_asn1/lib/SecAsn1Types.h $dest
+ cp libsecurity_asn1/lib/oidsalg.h $dest
+ cp libsecurity_asn1/lib/oidsattr.h $dest
+
+ cp libsecurity_authorization/lib/AuthSession.h $dest
+ cp libsecurity_authorization/lib/Authorization.h $dest
+ cp libsecurity_authorization/lib/AuthorizationDB.h $dest
+ cp libsecurity_authorization/lib/AuthorizationPlugin.h $dest
+ cp libsecurity_authorization/lib/AuthorizationTags.h $dest
+
+ cp libsecurity_cms/lib/CMSDecoder.h $dest
+ cp libsecurity_cms/lib/CMSEncoder.h $dest
+
+ cp libsecurity_codesigning/lib/CSCommon.h $dest
+ cp libsecurity_codesigning/lib/CodeSigning.h $dest
+ cp libsecurity_codesigning/lib/SecCode.h $dest
+ cp libsecurity_codesigning/lib/SecCodeHost.h $dest
+ cp libsecurity_codesigning/lib/SecRequirement.h $dest
+ cp libsecurity_codesigning/lib/SecStaticCode.h $dest
+ cp libsecurity_codesigning/lib/SecTask.h $dest
+
+ cp libsecurity_cssm/lib/certextensions.h $dest
+ cp libsecurity_cssm/lib/cssm.h $dest
+ cp libsecurity_cssm/lib/cssmaci.h $dest
+ cp libsecurity_cssm/lib/cssmapi.h $dest
+ cp libsecurity_cssm/lib/cssmapple.h $dest
+ cp libsecurity_cssm/lib/cssmcli.h $dest
+ cp libsecurity_cssm/lib/cssmconfig.h $dest
+ cp libsecurity_cssm/lib/cssmcspi.h $dest
+ cp libsecurity_cssm/lib/cssmdli.h $dest
+ cp libsecurity_cssm/lib/cssmerr.h $dest
+ cp libsecurity_cssm/lib/cssmkrapi.h $dest
+ cp libsecurity_cssm/lib/cssmkrspi.h $dest
+ cp libsecurity_cssm/lib/cssmspi.h $dest
+ cp libsecurity_cssm/lib/cssmtpi.h $dest
+ cp libsecurity_cssm/lib/cssmtype.h $dest
+ cp libsecurity_cssm/lib/eisl.h $dest
+ cp libsecurity_cssm/lib/emmspi.h $dest
+ cp libsecurity_cssm/lib/emmtype.h $dest
+ cp libsecurity_cssm/lib/oidsbase.h $dest
+ cp libsecurity_cssm/lib/oidscert.h $dest
+ cp libsecurity_cssm/lib/oidscrl.h $dest
+ cp libsecurity_cssm/lib/x509defs.h $dest
+
+ cp libsecurity_keychain/lib/SecACL.h $dest
+ cp libsecurity_keychain/lib/SecAccess.h $dest
+ cp libsecurity_keychain/lib/SecBase.h $dest
+ cp libsecurity_keychain/lib/SecCertificate.h $dest
+ cp libsecurity_keychain/lib/SecCertificatePriv.h $dest # Private
+ cp libsecurity_keychain/lib/SecCertificateOIDs.h $dest
+ cp libsecurity_keychain/lib/SecIdentity.h $dest
+ cp libsecurity_keychain/lib/SecIdentitySearch.h $dest
+ cp libsecurity_keychain/lib/SecImportExport.h $dest
+ cp libsecurity_keychain/lib/SecItem.h $dest
+ cp libsecurity_keychain/lib/SecKey.h $dest
+ cp libsecurity_keychain/lib/SecKeychain.h $dest
+ cp libsecurity_keychain/lib/SecKeychainItem.h $dest
+ cp libsecurity_keychain/lib/SecKeychainSearch.h $dest
+ cp libsecurity_keychain/lib/SecPolicy.h $dest
+ cp libsecurity_keychain/lib/SecPolicySearch.h $dest
+ cp libsecurity_keychain/lib/SecRandom.h $dest
+ cp libsecurity_keychain/lib/SecTrust.h $dest
+ cp libsecurity_keychain/lib/SecTrustSettings.h $dest
+ cp libsecurity_keychain/lib/SecTrustedApplication.h $dest
+ cp libsecurity_keychain/lib/Security.h $dest
+
+ cp libsecurity_manifest/lib/SecureDownload.h $dest
+
+ cp libsecurity_mds/lib/mds.h $dest
+ cp libsecurity_mds/lib/mds_schema.h $dest
+
+ cp libsecurity_ssl/lib/CipherSuite.h $dest
+ cp libsecurity_ssl/lib/SecureTransport.h $dest
+
+ cp libsecurity_transform/lib/SecCustomTransform.h $dest
+ cp libsecurity_transform/lib/SecDecodeTransform.h $dest
+ cp libsecurity_transform/lib/SecDigestTransform.h $dest
+ cp libsecurity_transform/lib/SecEncodeTransform.h $dest
+ cp libsecurity_transform/lib/SecEncryptTransform.h $dest
+ cp libsecurity_transform/lib/SecReadTransform.h $dest
+ cp libsecurity_transform/lib/SecSignVerifyTransform.h $dest
+ cp libsecurity_transform/lib/SecTransform.h $dest
+ cp libsecurity_transform/lib/SecTransformReadTransform.h $dest
+
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/default.nix
new file mode 100644
index 000000000000..f1b5e19feb22
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Security/default.nix
@@ -0,0 +1,19 @@
+{ appleDerivation, xcbuildHook, xpc, dtrace, xnu }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook dtrace ];
+ # buildInputs = [ Foundation xpc darling ];
+ buildInputs = [ xpc xnu ];
+
+ xcbuildFlags = [ "-target" "Security_frameworks_osx" ];
+
+ # NIX_CFLAGS_COMPILE = "-Wno-error -I${xnu}/include/libkern -DPRIVATE -I${xnu}/Library/Frameworks/System.framework/Headers";
+
+ preBuild = ''
+ dtrace -h -C -s OSX/libsecurity_utilities/lib/security_utilities.d -o OSX/libsecurity_utilities/lib/utilities_dtrace.h
+
+ xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target copyHeadersToSystem
+ NIX_CFLAGS_COMPILE+=" -F./Products/Release"
+ ln -s $PWD/Products/Release/Security.bundle/Contents $PWD/Products/Release/Security.framework
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix
new file mode 100644
index 000000000000..2a2d4cbe4932
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix
@@ -0,0 +1,91 @@
+{ stdenv, appleDerivation, fetchzip, bsdmake, perl, flex, yacc
+}:
+
+# this derivation sucks
+# locale data was removed after adv_cmds-118, so our base is that because it's easier than
+# replicating the bizarre bsdmake file structure
+#
+# sadly adv_cmds-118 builds a mklocale and colldef that generate files that our libc can no
+# longer understand
+#
+# the more recent adv_cmds release is used for everything else in this package
+
+let recentAdvCmds = fetchzip {
+ url = "https://opensource.apple.com/tarballs/adv_cmds/adv_cmds-158.tar.gz";
+ sha256 = "0z081kcprzg5jcvqivfnwvvv6wfxzkjg2jc2lagsf8c7j7vgm8nn";
+};
+
+in appleDerivation {
+ nativeBuildInputs = [ bsdmake perl yacc flex ];
+ buildInputs = [ flex ];
+
+ patchPhase = ''
+ substituteInPlace BSDmakefile \
+ --replace chgrp true \
+ --replace /Developer/Makefiles/bin/compress-man-pages.pl true \
+ --replace "ps.tproj" "" --replace "gencat.tproj" "" --replace "md.tproj" "" \
+ --replace "tabs.tproj" "" --replace "cap_mkdb.tproj" "" \
+ --replace "!= tconf --test TARGET_OS_EMBEDDED" "= NO"
+
+ substituteInPlace Makefile --replace perl true
+
+ for subproject in colldef mklocale monetdef msgdef numericdef timedef; do
+ substituteInPlace usr-share-locale.tproj/$subproject/BSDmakefile \
+ --replace /usr/share/locale "" \
+ --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
+ --replace "rsync -a" "cp -r"
+ done
+ '';
+
+ preBuild = ''
+ cp -r --no-preserve=all ${recentAdvCmds}/colldef .
+ pushd colldef
+ mv locale/collate.h .
+ flex -t -8 -i scan.l > scan.c
+ yacc -d parse.y
+ clang *.c -o colldef -lfl
+ popd
+ mv colldef/colldef colldef.tproj/colldef
+
+ cp -r --no-preserve=all ${recentAdvCmds}/mklocale .
+ pushd mklocale
+ flex -t -8 -i lex.l > lex.c
+ yacc -d yacc.y
+ clang *.c -o mklocale -lfl
+ popd
+ mv mklocale/mklocale mklocale.tproj/mklocale
+ '';
+
+ buildPhase = ''
+ runHook preBuild
+
+ bsdmake -C usr-share-locale.tproj
+
+ clang ${recentAdvCmds}/ps/*.c -o ps
+ '';
+
+ installPhase = ''
+ bsdmake -C usr-share-locale.tproj install DESTDIR="$locale/share/locale"
+
+ # need to get rid of runtime dependency on flex
+ # install -d 0755 $locale/bin
+ # install -m 0755 colldef.tproj/colldef $locale/bin
+ # install -m 0755 mklocale.tproj/mklocale $locale/bin
+
+ install -d 0755 $ps/bin
+ install ps $ps/bin/ps
+ touch "$out"
+ '';
+
+ outputs = [
+ "out"
+ "ps"
+ "locale"
+ ];
+ setOutputFlags = false;
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ gridaphobe ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix
new file mode 100644
index 000000000000..0cbd7d81b902
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, appleDerivation, xcbuild, ncurses, libutil }:
+
+appleDerivation {
+ # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264
+
+ # pkill requires special private headers that are unavailable in
+ # NixPkgs. These ones are needed:
+ # - xpc/xpxc.h
+ # - os/base_private.h
+ # - _simple.h
+ # We disable it here for now. TODO: build pkill inside adv_cmds
+
+ # We also disable locale here because of some issues with a missing
+ # "lstdc++".
+ patchPhase = ''
+ substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
+ --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \
+ --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \
+ --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib'
+ '';
+
+ buildPhase = ''
+ targets=$(xcodebuild -list \
+ | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \
+ | tail -n +2 | sed 's/^[ \t]*//' \
+ | grep -v -e Desktop -e Embedded -e mklocale -e colldef)
+
+ for i in $targets; do
+ xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i
+ done
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $file $out/bin/$(basename $f)
+ fi
+ done
+
+ mkdir -p $out/System/Library/LaunchDaemons
+ install fingerd/finger.plist $out/System/Library/LaunchDaemons
+
+ # from variant_links.sh
+ # ln -s $out/bin/pkill $out/bin/pgrep
+ # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1
+ '';
+
+ nativeBuildInputs = [ xcbuild ];
+ buildInputs = [ ncurses libutil ];
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix
new file mode 100644
index 000000000000..ebeb3ef08845
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/architecture/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ dontBuild = true;
+
+ postPatch = ''
+ substituteInPlace Makefile \
+ --replace '/bin/mkdir' 'mkdir' \
+ --replace '/usr/bin/install' 'install'
+ '';
+
+ installFlags = [ "EXPORT_DSTDIR=/include/architecture" ];
+
+ DSTROOT = "$(out)";
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix
new file mode 100644
index 000000000000..eadf18e028ee
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, appleDerivation, xcbuildHook }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+
+ # These PBXcp calls should be patched in xcbuild to allow them to
+ # automatically be prefixed.
+ patchPhase = ''
+ substituteInPlace basic_cmds.xcodeproj/project.pbxproj \
+ --replace "dstPath = /usr/share/man/man1;" "dstPath = $out/share/man/man1;" \
+ --replace "dstPath = /usr/share/man/man5;" "dstPath = $out/share/man/man5;"
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+
+ for n in 1; do
+ mkdir -p $out/share/man/man$n
+ install */*.$n $out/share/man/man$n
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix
new file mode 100644
index 000000000000..256781f61b11
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bootstrap_cmds/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, appleDerivation, yacc, flex }:
+
+appleDerivation {
+ nativeBuildInputs = [ yacc flex ];
+
+ buildPhase = ''
+ cd migcom.tproj
+ yacc -d parser.y
+ flex --header-file=lexxer.yy.h -o lexxer.yy.c lexxer.l
+
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o error.o error.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o global.o global.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o handler.o header.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o header.o header.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o mig.o mig.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o routine.o routine.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o server.o server.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o statement.o statement.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o string.o string.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o type.o type.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o user.o user.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o utils.o utils.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o lexxer.yy.o lexxer.yy.c
+ cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o y.tab.o y.tab.c
+
+ cc -dead_strip -o migcom error.o global.o header.o mig.o routine.o server.o statement.o string.o type.o user.o utils.o lexxer.yy.o y.tab.o
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin $out/libexec $out/share/man/man1
+
+ chmod +x mig.sh
+ cp mig.sh $out/bin/mig
+ cp migcom $out/libexec
+ ln -s $out/libexec/migcom $out/bin/migcom
+ cp mig.1 $out/share/man/man1
+ cp migcom.1 $out/share/man/man1
+
+ substituteInPlace $out/bin/mig \
+ --replace 'arch=`/usr/bin/arch`' 'arch=i386' \
+ --replace '/usr/bin/' "" \
+ --replace '/bin/rmdir' "rmdir" \
+ --replace 'C=''${MIGCC}' "C=cc"
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bsdmake/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bsdmake/default.nix
new file mode 100644
index 000000000000..043c7b0bc70d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/bsdmake/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, appleDerivation, makeWrapper }:
+
+appleDerivation {
+ nativeBuildInputs = [ makeWrapper ];
+
+ patchPhase = ''
+ substituteInPlace mk/bsd.prog.mk \
+ --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
+ --replace '-o ''${SCRIPTSOWN_''${.ALLSRC:T}}' "" \
+ --replace '-g ''${SCRIPTSGRP_''${.ALLSRC:T}}' ""
+ substituteInPlace mk/bsd.lib.mk --replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
+ substituteInPlace mk/bsd.info.mk --replace '-o ''${INFOOWN} -g ''${INFOGRP}' ""
+ substituteInPlace mk/bsd.doc.mk --replace '-o ''${BINOWN} -g ''${BINGRP}' ""
+ substituteInPlace mk/bsd.man.mk --replace '-o ''${MANOWN} -g ''${MANGRP}' ""
+ substituteInPlace mk/bsd.files.mk \
+ --replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
+ --replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
+ --replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
+ substituteInPlace mk/bsd.incs.mk \
+ --replace '-o ''${''${group}OWN_''${.ALLSRC:T}}' "" \
+ --replace '-g ''${''${group}GRP_''${.ALLSRC:T}}' "" \
+ --replace '-o ''${''${group}OWN} -g ''${''${group}GRP}' ""
+ '';
+
+ buildPhase = ''
+ objs=()
+ for file in $(find . -name '*.c'); do
+ obj="$(basename "$file" .c).o"
+ objs+=("$obj")
+ $CC -c "$file" -o "$obj" -DDEFSHELLNAME='"sh"' -D__FBSDID=__RCSID -mdynamic-no-pic -g
+ done
+ $CC "''${objs[@]}" -o bsdmake
+ '';
+
+ installPhase = ''
+ install -d 0644 $out/bin
+ install -m 0755 bsdmake $out/bin
+ install -d 0644 $out/share/mk
+ install -m 0755 mk/* $out/share/mk
+ '';
+
+ preFixup = ''
+ wrapProgram "$out/bin/bsdmake" --add-flags "-m $out/share/mk"
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix
new file mode 100644
index 000000000000..20168d24dd71
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/configd/default.nix
@@ -0,0 +1,213 @@
+{ stdenv, appleDerivation, launchd, bootstrap_cmds, xnu, ppp, IOKit, eap8021x, Security }:
+
+appleDerivation {
+ meta.broken = stdenv.cc.nativeLibc;
+
+ nativeBuildInputs = [ bootstrap_cmds ];
+ buildInputs = [ launchd ppp IOKit eap8021x ];
+
+ propagatedBuildInputs = [ Security ];
+
+ patchPhase = ''
+ HACK=$PWD/hack
+ mkdir $HACK
+ cp -r ${xnu}/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/net $HACK
+
+
+ substituteInPlace SystemConfiguration.fproj/SCNetworkReachabilityInternal.h \
+ --replace '#include <xpc/xpc.h>' ""
+
+ substituteInPlace SystemConfiguration.fproj/SCNetworkReachability.c \
+ --replace ''$'#define\tHAVE_VPN_STATUS' ""
+
+ substituteInPlace SystemConfiguration.fproj/reachability/SCNetworkReachabilityServer_client.c \
+ --replace '#include <xpc/xpc.h>' '#include "fake_xpc.h"' \
+ --replace '#include <xpc/private.h>' "" \
+
+ # Our neutered CoreFoundation doesn't have this function, but I think we'll live...
+ substituteInPlace SystemConfiguration.fproj/SCNetworkConnectionPrivate.c \
+ --replace 'CFPreferencesAppValueIsForced(serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE' \
+ --replace 'CFPreferencesAppValueIsForced(userPrivate->serviceID, USER_PREFERENCES_APPLICATION_ID)' 'FALSE'
+
+ cat >SystemConfiguration.fproj/fake_xpc.h <<EOF
+ typedef void *xpc_type_t;
+ typedef void *xpc_object_t;
+ typedef void *xpc_connection_t;
+
+ xpc_type_t xpc_get_type(xpc_object_t object);
+ xpc_object_t xpc_dictionary_create(const char * const *keys, const xpc_object_t *values, size_t count);
+ char *xpc_copy_description(xpc_object_t object);
+ int64_t xpc_dictionary_get_int64(xpc_object_t xdict, const char *key);
+ uint64_t xpc_dictionary_get_uint64(xpc_object_t xdict, const char *key);
+ void xpc_connection_set_event_handler(xpc_connection_t connection, void *handler);
+
+ extern const struct _xpc_type_s _xpc_type_error;
+ #define XPC_TYPE_ERROR (&_xpc_type_error)
+
+ extern const struct _xpc_type_s _xpc_type_dictionary;
+ #define XPC_TYPE_DICTIONARY (&_xpc_type_dictionary)
+
+ extern const struct _xpc_type_s _xpc_type_array;
+ #define XPC_TYPE_ARRAY (&_xpc_type_array)
+
+ extern const struct _xpc_dictionary_s _xpc_error_connection_interrupted;
+ #define XPC_ERROR_CONNECTION_INTERRUPTED (&_xpc_error_connection_interrupted)
+
+ extern const struct _xpc_dictionary_s _xpc_error_connection_invalid;
+ #define XPC_ERROR_CONNECTION_INVALID (&_xpc_error_connection_invalid)
+
+ extern const char *const _xpc_error_key_description;
+ #define XPC_ERROR_KEY_DESCRIPTION _xpc_error_key_description
+
+ #define XPC_CONNECTION_MACH_SERVICE_PRIVILEGED (1 << 1)
+ EOF
+ '';
+
+ buildPhase = ''
+ pushd SystemConfiguration.fproj >/dev/null
+
+ mkdir -p SystemConfiguration.framework/Resources
+ cp ../get-mobility-info SystemConfiguration.framework/Resources
+ cp Info.plist SystemConfiguration.framework/Resources
+ cp -r English.lproj SystemConfiguration.framework/Resources
+ cp NetworkConfiguration.plist SystemConfiguration.framework/Resources
+
+ mkdir -p SystemConfiguration.framework/Headers
+ mkdir -p SystemConfiguration.framework/PrivateHeaders
+
+ # The standard public headers
+ cp SCSchemaDefinitions.h SystemConfiguration.framework/Headers
+ cp SystemConfiguration.h SystemConfiguration.framework/Headers
+ cp SCDynamicStore.h SystemConfiguration.framework/Headers
+ cp SCDynamicStoreCopySpecific.h SystemConfiguration.framework/Headers
+ cp SCPreferences.h SystemConfiguration.framework/Headers
+ cp CaptiveNetwork.h SystemConfiguration.framework/Headers
+ cp SCPreferencesPath.h SystemConfiguration.framework/Headers
+ cp SCDynamicStoreKey.h SystemConfiguration.framework/Headers
+ cp SCPreferencesSetSpecific.h SystemConfiguration.framework/Headers
+ cp SCNetworkConfiguration.h SystemConfiguration.framework/Headers
+ cp SCNetworkConnection.h SystemConfiguration.framework/Headers
+ cp SCNetworkReachability.h SystemConfiguration.framework/Headers
+ cp DHCPClientPreferences.h SystemConfiguration.framework/Headers
+ cp SCNetwork.h SystemConfiguration.framework/Headers
+ cp SCDynamicStoreCopyDHCPInfo.h SystemConfiguration.framework/Headers
+
+ # TODO: Do we want to preserve private headers or just make them public?
+ cp SCDPlugin.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCDynamicStorePrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCDynamicStoreCopySpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCDynamicStoreSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCValidation.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPreferencesPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp DeviceOnHold.h SystemConfiguration.framework/PrivateHeaders
+ cp LinkConfiguration.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPreferencesPathKey.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPreferencesSetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCNetworkConnectionPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPreferencesGetSpecificPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCSchemaDefinitionsPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCNetworkConfigurationPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCPreferencesKeychainPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp SCNetworkSignature.h SystemConfiguration.framework/PrivateHeaders
+ cp SCNetworkSignaturePrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp VPNPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp VPNConfiguration.h SystemConfiguration.framework/PrivateHeaders
+ cp VPNTunnelPrivate.h SystemConfiguration.framework/PrivateHeaders
+ cp VPNTunnel.h SystemConfiguration.framework/PrivateHeaders
+
+ mkdir derived
+
+ cat >derived/SystemConfiguration_vers.c <<EOF
+ const unsigned char SystemConfigurationVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:SystemConfiguration PROJECT:configd-" "\n"; const double SystemConfigurationVersionNumber __attribute__ ((used)) = (double)0.;
+ EOF
+
+ mig -arch x86_64 -header derived/shared_dns_info.h -user derived/shared_dns_infoUser.c -sheader /dev/null -server /dev/null ../dnsinfo/shared_dns_info.defs
+ mig -arch x86_64 -header derived/config.h -user derived/configUser.c -sheader /dev/null -server /dev/null config.defs
+ mig -arch x86_64 -header derived/helper.h -user derived/helperUser.c -sheader /dev/null -server /dev/null helper/helper.defs
+ mig -arch x86_64 -header derived/pppcontroller.h -user derived/pppcontrollerUser.c -sheader /dev/null -server /dev/null pppcontroller.defs
+
+ cc -I. -Ihelper -Iderived -F. -c SCSchemaDefinitions.c -o SCSchemaDefinitions.o
+ cc -I. -Ihelper -Iderived -F. -c SCD.c -o SCD.o
+ cc -I. -Ihelper -Iderived -F. -c SCDKeys.c -o SCDKeys.o
+ cc -I. -Ihelper -Iderived -F. -c SCDPrivate.c -o SCDPrivate.o
+ cc -I. -Ihelper -Iderived -F. -c SCDPlugin.c -o SCDPlugin.o
+ cc -I. -Ihelper -Iderived -F. -c CaptiveNetwork.c -o CaptiveNetwork.o
+ cc -I. -Ihelper -Iderived -F. -c SCDOpen.c -o SCDOpen.o
+ cc -I. -Ihelper -Iderived -F. -c SCDList.c -o SCDList.o
+ cc -I. -Ihelper -Iderived -F. -c SCDAdd.c -o SCDAdd.o
+ cc -I. -Ihelper -Iderived -F. -c SCDGet.c -o SCDGet.o
+ cc -I. -Ihelper -Iderived -F. -c SCDSet.c -o SCDSet.o
+ cc -I. -Ihelper -Iderived -F. -c SCDRemove.c -o SCDRemove.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotify.c -o SCDNotify.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierSetKeys.c -o SCDNotifierSetKeys.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierAdd.c -o SCDNotifierAdd.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierRemove.c -o SCDNotifierRemove.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierGetChanges.c -o SCDNotifierGetChanges.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierWait.c -o SCDNotifierWait.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaCallback.c -o SCDNotifierInformViaCallback.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaFD.c -o SCDNotifierInformViaFD.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierInformViaSignal.c -o SCDNotifierInformViaSignal.o
+ cc -I. -Ihelper -Iderived -F. -c SCDNotifierCancel.c -o SCDNotifierCancel.o
+ cc -I. -Ihelper -Iderived -F. -c SCDSnapshot.c -o SCDSnapshot.o
+ cc -I. -Ihelper -Iderived -F. -c SCP.c -o SCP.o
+ cc -I. -Ihelper -Iderived -F. -c SCPOpen.c -o SCPOpen.o
+ cc -I. -Ihelper -Iderived -F. -c SCPLock.c -o SCPLock.o
+ cc -I. -Ihelper -Iderived -F. -c SCPUnlock.c -o SCPUnlock.o
+ cc -I. -Ihelper -Iderived -F. -c SCPList.c -o SCPList.o
+ cc -I. -Ihelper -Iderived -F. -c SCPGet.c -o SCPGet.o
+ cc -I. -Ihelper -Iderived -F. -c SCPAdd.c -o SCPAdd.o
+ cc -I. -Ihelper -Iderived -F. -c SCPSet.c -o SCPSet.o
+ cc -I. -Ihelper -Iderived -F. -c SCPRemove.c -o SCPRemove.o
+ cc -I. -Ihelper -Iderived -F. -c SCPCommit.c -o SCPCommit.o
+ cc -I. -Ihelper -Iderived -F. -c SCPApply.c -o SCPApply.o
+ cc -I. -Ihelper -Iderived -F. -c SCPPath.c -o SCPPath.o
+ cc -I. -Ihelper -Iderived -F. -c SCDConsoleUser.c -o SCDConsoleUser.o
+ cc -I. -Ihelper -Iderived -F. -c SCDHostName.c -o SCDHostName.o
+ cc -I. -Ihelper -Iderived -F. -c SCLocation.c -o SCLocation.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetwork.c -o SCNetwork.o
+ cc -I. -Ihelper -Iderived -F. -c derived/pppcontrollerUser.c -o pppcontrollerUser.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkConnection.c -o SCNetworkConnection.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkConnectionPrivate.c -o SCNetworkConnectionPrivate.o
+ cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c SCNetworkReachability.c -o SCNetworkReachability.o
+ cc -I. -Ihelper -Iderived -F. -c SCProxies.c -o SCProxies.o
+ cc -I. -Ihelper -Iderived -F. -c DHCP.c -o DHCP.o
+ cc -I. -Ihelper -Iderived -F. -c moh.c -o moh.o
+ cc -I. -Ihelper -Iderived -F. -c DeviceOnHold.c -o DeviceOnHold.o
+ cc -I. -Ihelper -Iderived -I $HACK -F. -c LinkConfiguration.c -o LinkConfiguration.o
+ cc -I. -Ihelper -Iderived -F. -c dy_framework.c -o dy_framework.o
+ cc -I. -Ihelper -Iderived -I $HACK -F. -c VLANConfiguration.c -o VLANConfiguration.o
+ cc -I. -Ihelper -Iderived -F. -c derived/configUser.c -o configUser.o
+ cc -I. -Ihelper -Iderived -F. -c SCPreferencesPathKey.c -o SCPreferencesPathKey.o
+ cc -I. -Ihelper -Iderived -I../dnsinfo -F. -c derived/shared_dns_infoUser.c -o shared_dns_infoUser.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkConfigurationInternal.c -o SCNetworkConfigurationInternal.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkInterface.c -o SCNetworkInterface.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkProtocol.c -o SCNetworkProtocol.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkService.c -o SCNetworkService.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkSet.c -o SCNetworkSet.o
+ cc -I. -Ihelper -Iderived -I $HACK -F. -c BondConfiguration.c -o BondConfiguration.o
+ cc -I. -Ihelper -Iderived -I $HACK -F. -c BridgeConfiguration.c -o BridgeConfiguration.o
+ cc -I. -Ihelper -Iderived -F. -c helper/SCHelper_client.c -o SCHelper_client.o
+ cc -I. -Ihelper -Iderived -F. -c SCPreferencesKeychainPrivate.c -o SCPreferencesKeychainPrivate.o
+ cc -I. -Ihelper -Iderived -F. -c SCNetworkSignature.c -o SCNetworkSignature.o
+ cc -I. -Ihelper -Iderived -F. -c VPNPrivate.c -o VPNPrivate.o
+ cc -I. -Ihelper -Iderived -F. -c VPNConfiguration.c -o VPNConfiguration.o
+ cc -I. -Ihelper -Iderived -F. -c VPNTunnel.c -o VPNTunnel.o
+ cc -I. -Ihelper -Iderived -F. -c derived/helperUser.c -o helperUser.o
+ cc -I. -Ihelper -Iderived -F. -c reachability/SCNetworkReachabilityServer_client.c -o SCNetworkReachabilityServer_client.o
+ cc -I. -Ihelper -Iderived -F. -c reachability/rb.c -o rb.o
+ cc -I. -Ihelper -Iderived -F. -c derived/SystemConfiguration_vers.c -o SystemConfiguration_vers.o
+
+ cc -dynamiclib *.o -install_name $out/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration -dead_strip -framework CoreFoundation -single_module -o SystemConfiguration.framework/SystemConfiguration
+
+ popd >/dev/null
+ '';
+
+ installPhase = ''
+ mkdir -p $out/include
+ cp dnsinfo/*.h $out/include/
+
+ mkdir -p $out/Library/Frameworks/
+ mv SystemConfiguration.fproj/SystemConfiguration.framework $out/Library/Frameworks
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix
new file mode 100644
index 000000000000..7e1dc5309b1d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/copyfile/default.nix
@@ -0,0 +1,9 @@
+{ appleDerivation }:
+
+appleDerivation {
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p $out/include/
+ cp copyfile.h $out/include/
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/default.nix
new file mode 100644
index 000000000000..14c69b84eb41
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/default.nix
@@ -0,0 +1,259 @@
+{ stdenv, fetchurl, fetchzip, pkgs }:
+
+let
+ # This attrset can in theory be computed automatically, but for that to work nicely we need
+ # import-from-derivation to work properly. Currently it's rather ugly when we try to bootstrap
+ # a stdenv out of something like this. With some care we can probably get rid of this, but for
+ # now it's staying here.
+ versions = {
+ "osx-10.12.6" = {
+ xnu = "3789.70.16";
+ libiconv = "50";
+ Libnotify = "165.20.1";
+ objc4 = "709.1";
+ dyld = "433.5";
+ CommonCrypto = "60092.50.5";
+ copyfile = "138";
+ ppp = "838.50.1";
+ libclosure = "67";
+ Libinfo = "503.50.4";
+ Libsystem = "1238.60.2";
+ removefile = "45";
+ libresolv = "64";
+ libplatform = "126.50.8";
+ mDNSResponder = "765.50.9";
+ libutil = "47.30.1";
+ libunwind = "35.3";
+ Libc = "1158.50.2";
+ dtrace = "209.50.12";
+ libpthread = "218.60.3";
+ hfs = "366.70.1";
+ };
+ "osx-10.11.6" = {
+ PowerManagement = "572.50.1";
+ dtrace = "168";
+ xnu = "3248.60.10";
+ libpthread = "138.10.4";
+ libiconv = "44";
+ Libnotify = "150.40.1";
+ objc4 = "680";
+ eap8021x = "222.40.1";
+ dyld = "360.22";
+ architecture = "268";
+ CommonCrypto = "60075.50.1";
+ copyfile = "127";
+ Csu = "85";
+ ppp = "809.50.2";
+ libclosure = "65";
+ Libinfo = "477.50.4";
+ Libsystem = "1226.10.1";
+ removefile = "41";
+ libresolv = "60";
+
+ # Their release page is a bit of a mess here, so I'm going to lie a bit and say this version
+ # is the right one, even though it isn't. The version I have here doesn't appear to be linked
+ # to any OS releases, but Apple also doesn't mention mDNSResponder from 10.11 to 10.11.6, and
+ # neither of those versions are publicly available.
+ libplatform = "125";
+ mDNSResponder = "625.41.2";
+
+ libutil = "43";
+ libunwind = "35.3";
+ Librpcsvc = "26";
+ developer_cmds= "62";
+ network_cmds = "481.20.1";
+ basic_cmds = "55";
+ adv_cmds = "163";
+ file_cmds = "264.1.1";
+ shell_cmds = "187";
+ system_cmds = "550.6";
+ diskdev_cmds = "593";
+ top = "108";
+ text_cmds = "99";
+ };
+ "osx-10.11.5" = {
+ Libc = "1082.50.1"; # 10.11.6 still unreleased :/
+ };
+ "osx-10.10.5" = {
+ adv_cmds = "158";
+ CF = "1153.18";
+ ICU = "531.48";
+ libdispatch = "442.1.4";
+ Security = "57031.40.6";
+
+ IOAudioFamily = "203.3";
+ IOFireWireFamily = "458";
+ IOFWDVComponents = "207.4.1";
+ IOFireWireAVC = "423";
+ IOFireWireSBP2 = "427";
+ IOFireWireSerialBusProtocolTransport = "251.0.1";
+ IOGraphics = "485.40.1";
+ IOHIDFamily = "606.40.1";
+ IONetworkingFamily = "101";
+ IOSerialFamily = "74.20.1";
+ IOStorageFamily = "182.1.1";
+ IOBDStorageFamily = "14";
+ IOCDStorageFamily = "51";
+ IODVDStorageFamily = "35";
+ IOKitUser = "1050.20.2";
+ };
+ "osx-10.9.5" = {
+ launchd = "842.92.1";
+ libauto = "185.5";
+ Libc = "997.90.3"; # We use this, but not from here
+ Libsystem = "1197.1.1";
+ Security = "55471.14.18";
+ security_dotmac_tp = "55107.1";
+
+ IOStorageFamily = "172";
+ };
+ "osx-10.8.5" = {
+ configd = "453.19";
+ Libc = "825.40.1";
+ IOUSBFamily = "630.4.5";
+ };
+ "osx-10.8.4" = {
+ IOUSBFamily = "560.4.2";
+ };
+ "osx-10.7.4" = {
+ Libm = "2026";
+ };
+ "osx-10.6.2" = {
+ CarbonHeaders = "18.1";
+ };
+ "osx-10.5.8" = {
+ adv_cmds = "119";
+ };
+ "dev-tools-7.0" = {
+ bootstrap_cmds = "93";
+ };
+ "dev-tools-5.1" = {
+ bootstrap_cmds = "86";
+ };
+ "dev-tools-3.2.6" = {
+ bsdmake = "24";
+ };
+ };
+
+ fetchApple = version: sha256: name: let
+ # When cross-compiling, fetchurl depends on libiconv, resulting
+ # in an infinite recursion without this. It's not clear why this
+ # worked fine when not cross-compiling
+ fetch = if name == "libiconv"
+ then stdenv.fetchurlBoot
+ else fetchurl;
+ in fetch {
+ url = "http://www.opensource.apple.com/tarballs/${name}/${name}-${versions.${version}.${name}}.tar.gz";
+ inherit sha256;
+ };
+
+ appleDerivation_ = name: version: sha256: attrs: stdenv.mkDerivation ({
+ inherit version;
+ name = "${name}-${version}";
+ enableParallelBuilding = true;
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ };
+ } // (if attrs ? srcs then {} else {
+ src = fetchApple version sha256 name;
+ }) // attrs);
+
+ applePackage = namePath: version: sha256:
+ let
+ name = builtins.elemAt (stdenv.lib.splitString "/" namePath) 0;
+ appleDerivation = appleDerivation_ name version sha256;
+ callPackage = pkgs.newScope (packages // pkgs.darwin // { inherit appleDerivation name version; });
+ in callPackage (./. + "/${namePath}");
+
+ IOKitSpecs = {
+ IOAudioFamily = fetchApple "osx-10.10.5" "0ggq7za3iq8g02j16rj67prqhrw828jsw3ah3bxq8a1cvr55aqnq";
+ IOFireWireFamily = fetchApple "osx-10.10.5" "059qa1m668kwvchl90cqcx35b31zaqdg61zi11y1imn5s389y2g1";
+ IOFWDVComponents = fetchApple "osx-10.10.5" "1brr0yn6mxgapw3bvlhyissfksifzj2mqsvj9vmps6zwcsxjfw7m";
+ IOFireWireAVC = fetchApple "osx-10.10.5" "194an37gbqs9s5s891lmw6prvd1m2362602s8lj5m89fp9h8mbal";
+ IOFireWireSBP2 = fetchApple "osx-10.10.5" "1mym158kp46y1vfiq625b15ihh4jjbpimfm7d56wlw6l2syajqvi";
+ IOFireWireSerialBusProtocolTransport = fetchApple "osx-10.10.5" "09kiq907qpk94zbij1mrcfcnyyc5ncvlxavxjrj4v5braxm78lhi";
+ IOGraphics = fetchApple "osx-10.10.5" "1z0x3yrv0p8pfdqnvwf8rvrf9wip593lhm9q6yzbclz3fn53ad0p";
+ IOHIDFamily = fetchApple "osx-10.10.5" "0yibagwk74imp3j3skjycm703s5ybdqw0qlsmnml6zwjpbrz5894";
+ IONetworkingFamily = fetchApple "osx-10.10.5" "04as1hc8avncijf61mp9dmplz8vb1inhirkd1g74gah08lgrfs9j";
+ IOSerialFamily = fetchApple "osx-10.10.5" "0jh12aanxcigqi9w6wqzbwjdin9m48zwrhdj3n4ki0h41sg89y91";
+ IOStorageFamily = fetchApple "osx-10.9.5" "0w5yr8ppl82anwph2zba0ppjji6ipf5x410zhcm1drzwn4bbkxrj";
+ IOBDStorageFamily = fetchApple "osx-10.10.5" "1rbvmh311n853j5qb6hfda94vym9wkws5w736w2r7dwbrjyppc1q";
+ IOCDStorageFamily = fetchApple "osx-10.10.5" "1905sxwmpxdcnm6yggklc5zimx1558ygm3ycj6b34f9h48xfxzgy";
+ IODVDStorageFamily = fetchApple "osx-10.10.5" "1fv82rn199mi998l41c0qpnlp3irhqp2rb7v53pxbx7cra4zx3i6";
+ # There should be an IOStreamFamily project here, but they haven't released it :(
+ IOUSBFamily = fetchApple "osx-10.8.5" "1znqb6frxgab9mkyv7csa08c26p9p0ip6hqb4wm9c7j85kf71f4j"; # This is from 10.8 :(
+ IOUSBFamily_older = fetchApple "osx-10.8.4" "113lmpz8n6sibd27p42h8bl7a6c3myc6zngwri7gnvf8qlajzyml" "IOUSBFamily"; # This is even older :(
+ IOKitUser = fetchApple "osx-10.10.5" "1jzndziv97bhjxmla8nib5fpcswbvsxr04447g251ls81rw313lb";
+ # There should be an IOVideo here, but they haven't released it :(
+ };
+
+ IOKitSrcs = stdenv.lib.mapAttrs (name: value: if stdenv.lib.isFunction value then value name else value) IOKitSpecs;
+
+ # Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile.
+ adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "102ssayxbg9wb35mdmhswbnw0bg7js3pfd8fcbic83c5q3bqa6c6" {};
+
+ packages = {
+ inherit (adv_cmds-boot) ps locale;
+ architecture = applePackage "architecture" "osx-10.11.6" "1pbpjcd7is69hn8y29i98ci0byik826if8gnp824ha92h90w0fq3" {};
+ bootstrap_cmds = applePackage "bootstrap_cmds" "dev-tools-7.0" "1v5dv2q3af1xwj5kz0a5g54fd5dm6j4c9dd2g66n4kc44ixyrhp3" {};
+ bsdmake = applePackage "bsdmake" "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {};
+ CarbonHeaders = applePackage "CarbonHeaders" "osx-10.6.2" "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {};
+ CommonCrypto = applePackage "CommonCrypto" "osx-10.12.6" "0sgsqjcxbdm2g2zfpc50mzmk4b4ldyw7xvvkwiayhpczg1fga4ff" {};
+ configd = applePackage "configd" "osx-10.8.5" "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" {
+ Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {};
+ };
+ copyfile = applePackage "copyfile" "osx-10.12.6" "0a70bvzndkava1a946cdq42lnjhg7i7b5alpii3lap6r5fkvas0n" {};
+ Csu = applePackage "Csu" "osx-10.11.6" "0yh5mslyx28xzpv8qww14infkylvc1ssi57imhi471fs91sisagj" {};
+ dtrace = applePackage "dtrace" "osx-10.12.6" "0hpd6348av463yqf70n3xkygwmf1i5zza8kps4zys52sviqz3a0l" {};
+ dyld = applePackage "dyld" "osx-10.12.6" "0q4jmk78b5ajn33blh4agyq6v2a63lpb3fln78az0dy12bnp1qqk" {};
+ eap8021x = applePackage "eap8021x" "osx-10.11.6" "0iw0qdib59hihyx2275rwq507bq2a06gaj8db4a8z1rkaj1frskh" {};
+ ICU = applePackage "ICU" "osx-10.10.5" "1qihlp42n5g4dl0sn0f9pc0bkxy1452dxzf0vr6y5gqpshlzy03p" {};
+ IOKit = applePackage "IOKit" "osx-10.11.6" "0kcbrlyxcyirvg5p95hjd9k8a01k161zg0bsfgfhkb90kh2s8x00" { inherit IOKitSrcs; };
+ launchd = applePackage "launchd" "osx-10.9.5" "0w30hvwqq8j5n90s3qyp0fccxflvrmmjnicjri4i1vd2g196jdgj" {};
+ libauto = applePackage "libauto" "osx-10.9.5" "17z27yq5d7zfkwr49r7f0vn9pxvj95884sd2k6lq6rfaz9gxqhy3" {};
+ Libc = applePackage "Libc" "osx-10.12.6" "183wcy1nlj2wkpfsx3k3lyv917mk8r2p72qw8lb89mbjsw3yw0xx" {
+ Libc_10-9 = fetchzip {
+ url = "http://www.opensource.apple.com/tarballs/Libc/Libc-997.90.3.tar.gz";
+ sha256 = "1xchgxkxg5288r2b9yfrqji2gsgdap92k4wx2dbjwslixws12pq7";
+ };
+ Libc_old = applePackage "Libc/825_40_1.nix" "osx-10.8.5" "0xsx1im52gwlmcrv4lnhhhn9dyk5ci6g27k6yvibn9vj8fzjxwcf" {};
+ };
+ libclosure = applePackage "libclosure" "osx-10.11.6" "1zqy1zvra46cmqv6vsf1mcsz3a76r9bky145phfwh4ab6y15vjpq" {};
+ libdispatch = applePackage "libdispatch" "osx-10.10.5" "0jsfbzp87lwk9snlby0hd4zvj7j894p5q3cw0wdx9ny1mcp3kdcj" {};
+ libiconv = applePackage "libiconv" "osx-10.12.6" "1gg5h6z8sk851bhv87vyxzs54jmqz6lh57ny8j4s51j7srja0nly" {};
+ Libinfo = applePackage "Libinfo" "osx-10.11.6" "0qjgkd4y8sjvwjzv5wwyzkb61pg8wwg95bkp721dgzv119dqhr8x" {};
+ Libm = applePackage "Libm" "osx-10.7.4" "02sd82ig2jvvyyfschmb4gpz6psnizri8sh6i982v341x6y4ysl7" {};
+ Libnotify = applePackage "Libnotify" "osx-10.12.6" "0p5qhvalf6j1w6n8xwywhn6dvbpzv74q5wqrgs8rwfpf74wg6s9z" {};
+ libplatform = applePackage "libplatform" "osx-10.12.6" "0rh1f5ybvwz8s0nwfar8s0fh7jbgwqcy903cv2x8m15iq1x599yn" {};
+ libpthread = applePackage "libpthread" "osx-10.12.6" "1j6541rcgjpas1fc77ip5krjgw4bvz6jq7bq7h9q7axb0jv2ns6c" {};
+ libresolv = applePackage "libresolv" "osx-10.12.6" "077j6ljfh7amqpk2146rr7dsz5vasvr3als830mgv5jzl7l6vz88" {};
+ Libsystem = applePackage "Libsystem" "osx-10.12.6" "1082ircc1ggaq3wha218vmfa75jqdaqidsy1bmrc4ckfkbr3bwx2" {
+ libutil = pkgs.darwin.libutil.override { headersOnly = true; };
+ hfs = pkgs.darwin.hfs.override { headersOnly = true; };
+ };
+ libutil = applePackage "libutil" "osx-10.12.6" "0lqdxaj82h8yjbjm856jjz9k2d96k0viimi881akfng08xk1246y" {};
+ libunwind = applePackage "libunwind" "osx-10.12.6" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {};
+ mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "02ms1p8zlgmprzn65jzr7yaqxykh3zxjcrw0c06aayim6h0dsqfy" {};
+ objc4 = applePackage "objc4" "osx-10.12.6" "1cj1vhbcs9pkmag2ms8wslagicnq9bxi2qjkszmp3ys7z7ccrbwz" {};
+ ppp = applePackage "ppp" "osx-10.12.6" "1kcc2nc4x1kf8sz0a23i6nfpvxg381kipi0qdisrp8x9z2gbkxb8" {};
+ removefile = applePackage "removefile" "osx-10.12.6" "0jzjxbmxgjzhssqd50z7kq9dlwrv5fsdshh57c0f8mdwcs19bsyx" {};
+ xnu = applePackage "xnu" "osx-10.12.6" "1sjb0i7qzz840v2h4z3s4jyjisad4r5yyi6sg8pakv3wd81i5fg5" {};
+ hfs = applePackage "hfs" "osx-10.12.6" "1mj3xvqpq1mgd80b6kl1s04knqnap7hccr0gz8rjphalq14rbl5g" {};
+ Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {};
+ adv_cmds = applePackage "adv_cmds" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {};
+ basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {};
+ developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "1r9c2b6dcl22diqf90x58psvz797d3lxh4r2wppr7lldgbgn24di" {};
+ diskdev_cmds = applePackage "diskdev_cmds" "osx-10.11.6" "1ssdyiaq5m1zfy96yy38yyknp682ki6bvabdqd5z18fa0rv3m2ar" {};
+ network_cmds = applePackage "network_cmds" "osx-10.11.6" "0lhi9wz84qr1r2ab3fb4nvmdg9gxn817n5ldg7zw9gnf3wwn42kw" {};
+ file_cmds = applePackage "file_cmds" "osx-10.11.6" "1zfxbmasps529pnfdjvc13p7ws2cfx8pidkplypkswyff0nff4wp" {};
+ shell_cmds = applePackage "shell_cmds" "osx-10.11.6" "0084k271v66h4jqp7q7rmjvv7w4mvhx3aq860qs8jbd30canm86n" {};
+ system_cmds = applePackage "system_cmds" "osx-10.11.6" "1h46j2c5v02pkv5d9fyv6cpgyg0lczvwicrx6r9s210cl03l77jl" {};
+ text_cmds = applePackage "text_cmds" "osx-10.11.6" "1f93m7dd0ghqb2hwh905mjhzblyfr7dwffw98xhgmv1mfdnigxg0" {};
+ top = applePackage "top" "osx-10.11.6" "0i9120rfwapgwdvjbfg0ya143i29s1m8zbddsxh39pdc59xnsg5l" {};
+ PowerManagement = applePackage "PowerManagement" "osx-10.11.6" "1llimhvp0gjffd47322lnjq7cqwinx0c5z7ikli04ad5srpa68mh" {};
+
+ # TODO(matthewbauer):
+ # To be removed, once I figure out how to build a newer Security version.
+ Security = applePackage "Security/boot.nix" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {};
+ };
+in packages
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix
new file mode 100644
index 000000000000..cfd13b1b0498
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, appleDerivation, xcbuildHook, llvmPackages }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+
+ patches = [
+ # The following copied from
+ # https://github.com/Homebrew/homebrew-core/commit/712ed3e948868e17f96b7e59972b5f45d4faf688
+ # is needed to build libvirt.
+ ./rpcgen-support-hyper-and-quad-types.patch
+ ];
+
+ postPatch = ''
+ substituteInPlace rpcgen/rpc_main.c \
+ --replace "/usr/bin/cpp" "${llvmPackages.clang-unwrapped}/bin/clang-cpp"
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+
+ for n in 1; do
+ mkdir -p $out/share/man/man$n
+ install */*.$n $out/share/man/man$n
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/rpcgen-support-hyper-and-quad-types.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/rpcgen-support-hyper-and-quad-types.patch
new file mode 100644
index 000000000000..481cf0f3e055
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/rpcgen-support-hyper-and-quad-types.patch
@@ -0,0 +1,66 @@
+diff --git a/rpcgen/rpc_parse.c b/rpcgen/rpc_parse.c
+index 52edc9f..db0c1f1 100644
+--- a/rpcgen/rpc_parse.c
++++ b/rpcgen/rpc_parse.c
+@@ -580,6 +580,10 @@ get_type(prefixp, typep, dkind)
+ *typep = "long";
+ (void) peekscan(TOK_INT, &tok);
+ break;
++ case TOK_HYPER:
++ *typep = "int64_t";
++ (void) peekscan(TOK_INT, &tok);
++ break;
+ case TOK_VOID:
+ if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
+ error("voids allowed only inside union and program definitions with one argument");
+@@ -592,6 +596,7 @@ get_type(prefixp, typep, dkind)
+ case TOK_INT:
+ case TOK_FLOAT:
+ case TOK_DOUBLE:
++ case TOK_QUAD:
+ case TOK_BOOL:
+ *typep = tok.str;
+ break;
+@@ -622,6 +627,11 @@ unsigned_dec(typep)
+ *typep = "u_long";
+ (void) peekscan(TOK_INT, &tok);
+ break;
++ case TOK_HYPER:
++ get_token(&tok);
++ *typep = "u_int64_t";
++ (void) peekscan(TOK_INT, &tok);
++ break;
+ case TOK_INT:
+ get_token(&tok);
+ *typep = "u_int";
+diff --git a/rpcgen/rpc_scan.c b/rpcgen/rpc_scan.c
+index a8df441..4130107 100644
+--- a/rpcgen/rpc_scan.c
++++ b/rpcgen/rpc_scan.c
+@@ -419,8 +419,10 @@ static token symbols[] = {
+ {TOK_UNSIGNED, "unsigned"},
+ {TOK_SHORT, "short"},
+ {TOK_LONG, "long"},
++ {TOK_HYPER, "hyper"},
+ {TOK_FLOAT, "float"},
+ {TOK_DOUBLE, "double"},
++ {TOK_QUAD, "quadruple"},
+ {TOK_STRING, "string"},
+ {TOK_PROGRAM, "program"},
+ {TOK_VERSION, "version"},
+diff --git a/rpcgen/rpc_scan.h b/rpcgen/rpc_scan.h
+index bac2be4..e4c57c8 100644
+--- a/rpcgen/rpc_scan.h
++++ b/rpcgen/rpc_scan.h
+@@ -66,9 +66,11 @@ enum tok_kind {
+ TOK_INT,
+ TOK_SHORT,
+ TOK_LONG,
++ TOK_HYPER,
+ TOK_UNSIGNED,
+ TOK_FLOAT,
+ TOK_DOUBLE,
++ TOK_QUAD,
+ TOK_OPAQUE,
+ TOK_CHAR,
+ TOK_STRING, \ No newline at end of file
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix
new file mode 100644
index 000000000000..6d3bd103811d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/diskdev_cmds/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, appleDerivation, xcbuildHook
+, Libc, xnu, libutil }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ libutil ];
+
+ NIX_CFLAGS_COMPILE = "-I.";
+ NIX_LDFLAGS = "-lutil";
+ patchPhase = ''
+ # ugly hacks for missing headers
+ # most are bsd related - probably should make this a drv
+ unpackFile ${Libc.src}
+ unpackFile ${xnu.src}
+ mkdir System sys machine i386
+ cp xnu-*/bsd/sys/disklabel.h sys
+ cp xnu-*/bsd/machine/disklabel.h machine
+ cp xnu-*/bsd/i386/disklabel.h i386
+ cp -r xnu-*/bsd/sys System
+ cp -r Libc-*/uuid System
+ substituteInPlace diskdev_cmds.xcodeproj/project.pbxproj \
+ --replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' ""
+ '';
+ installPhase = ''
+ install -D Products/Release/libdisk.a $out/lib/libdisk.a
+ rm Products/Release/libdisk.a
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dtrace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dtrace/default.nix
new file mode 100644
index 000000000000..3e7e89642c26
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dtrace/default.nix
@@ -0,0 +1,53 @@
+{ appleDerivation, xcbuildHook, CoreSymbolication
+, xnu, bison, flex, darling, stdenv, fixDarwinDylibNames }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook flex bison fixDarwinDylibNames ];
+ buildInputs = [ CoreSymbolication darling xnu ];
+ NIX_CFLAGS_COMPILE = "-DCTF_OLD_VERSIONS -DPRIVATE -DYYDEBUG=1 -I${xnu}/Library/Frameworks/System.framework/Headers -Wno-error=implicit-function-declaration";
+ NIX_LDFLAGS = "-L./Products/Release";
+ xcbuildFlags = [ "-target" "dtrace_frameworks" "-target" "dtrace" ];
+
+ doCheck = false;
+ checkPhase = "xcodebuild -target dtrace_tests";
+
+ postPatch = ''
+ substituteInPlace dtrace.xcodeproj/project.pbxproj \
+ --replace "/usr/sbin" ""
+ substituteInPlace libdtrace/dt_open.c \
+ --replace /usr/bin/clang ${stdenv.cc.cc}/bin/clang \
+ --replace /usr/bin/ld ${stdenv.cc.bintools.bintools}/bin/ld \
+ --replace /usr/lib/dtrace/dt_cpp.h $out/include/dt_cpp.h \
+ --replace /usr/lib/dtrace $out/lib/dtrace
+ '';
+
+ # hack to handle xcbuild's broken lex handling
+ preBuild = ''
+ pushd libdtrace
+ yacc -d dt_grammar.y
+ flex -l -d dt_lex.l
+ popd
+
+ substituteInPlace dtrace.xcodeproj/project.pbxproj \
+ --replace '6EBC9800099BFBBF0001019C /* dt_grammar.y */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.yacc; name = dt_grammar.y; path = libdtrace/dt_grammar.y; sourceTree = "<group>"; };' '6EBC9800099BFBBF0001019C /* y.tab.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = y.tab.c; path = libdtrace/y.tab.c; sourceTree = "<group>"; };' \
+ --replace '6EBC9808099BFBBF0001019C /* dt_lex.l */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.lex; name = dt_lex.l; path = libdtrace/dt_lex.l; sourceTree = "<group>"; };' '6EBC9808099BFBBF0001019C /* lex.yy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lex.yy.c; path = libdtrace/lex.yy.c; sourceTree = "<group>"; };'
+ '';
+
+ # xcbuild doesn't support install
+ installPhase = ''
+ mkdir -p $out
+
+ cp -r Products/Release/usr/include $out/include
+ cp scripts/dt_cpp.h $out/include/dt_cpp.h
+
+ mkdir $out/lib
+ cp Products/Release/*.dylib $out/lib
+
+ mkdir $out/bin
+ cp Products/Release/dtrace $out/bin
+
+ mkdir -p $out/lib/dtrace
+
+ install_name_tool -change $PWD/Products/Release/libdtrace.dylib $out/lib/libdtrace.dylib $out/bin/dtrace
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix
new file mode 100644
index 000000000000..ddadf1f3940b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/dyld/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/lib $out/include
+ ln -s /usr/lib/dyld $out/lib/dyld
+ cp -r include $out/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Impure primitive symlinks to the Mac OS native dyld, along with headers";
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix
new file mode 100644
index 000000000000..b24d94b9d70d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/eap8021x/default.nix
@@ -0,0 +1,10 @@
+{ appleDerivation }:
+
+appleDerivation {
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p $out/Library/Frameworks/EAP8021X.framework/Headers
+
+ cp EAP8021X.fproj/EAPClientProperties.h $out/Library/Frameworks/EAP8021X.framework/Headers
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/file_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/file_cmds/default.nix
new file mode 100644
index 000000000000..5de84d2a6e5d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/file_cmds/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, appleDerivation, xcbuildHook, zlib, bzip2, lzma, ncurses, libutil }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ zlib bzip2 lzma ncurses libutil ];
+
+ # some commands not working:
+ # mtree: _simple.h not found
+ # ipcs: sys/ipcs.h not found
+ # so remove their targets from the project
+ patchPhase = ''
+ substituteInPlace file_cmds.xcodeproj/project.pbxproj \
+ --replace "FC8A8CAA14B655FD001B97AD /* PBXTargetDependency */," "" \
+ --replace "FC8A8C9C14B655FD001B97AD /* PBXTargetDependency */," "" \
+ --replace "productName = file_cmds;" "" \
+ --replace '/usr/lib/libcurses.dylib' 'libncurses.dylib'
+ sed -i -re "s/name = ([a-zA-Z]+);/name = \1; productName = \1;/" file_cmds.xcodeproj/project.pbxproj
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+
+ for n in 1; do
+ mkdir -p $out/share/man/man$n
+ install */*.$n $out/share/man/man$n
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix
new file mode 100644
index 000000000000..ab294b143d39
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/hfs/default.nix
@@ -0,0 +1,8 @@
+{ appleDerivation, lib, headersOnly ? false }:
+
+appleDerivation {
+ installPhase = lib.optionalString headersOnly ''
+ mkdir -p $out/include/hfs
+ cp core/*.h $out/include/hfs
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix
new file mode 100644
index 000000000000..eed7982e9d8c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/launchd/default.nix
@@ -0,0 +1,12 @@
+{ appleDerivation }:
+
+appleDerivation {
+ # No clue why the same file has two different names. Ask Apple!
+ installPhase = ''
+ mkdir -p $out/include/ $out/include/servers
+ cp liblaunch/*.h $out/include
+
+ cp liblaunch/bootstrap.h $out/include/servers
+ cp liblaunch/bootstrap.h $out/include/servers/bootstrap_defs.h
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/auto_dtrace.h b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/auto_dtrace.h
new file mode 100644
index 000000000000..bf367a3cabb3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/auto_dtrace.h
@@ -0,0 +1,129 @@
+/*
+ * Generated by dtrace(1M).
+ */
+
+#ifndef _AUTO_DTRACE_H
+#define _AUTO_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GARBAGE_COLLECTION_STABILITY "___dtrace_stability$garbage_collection$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
+
+#define GARBAGE_COLLECTION_TYPEDEFS "___dtrace_typedefs$garbage_collection$v2$6175746f5f636f6c6c656374696f6e5f70686173655f74$6175746f5f636f6c6c656374696f6e5f747970655f74$6d616c6c6f635f7a6f6e655f74"
+
+#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
+
+#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY(arg0, arg1) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$auto_block_lost_thread_locality$v1$766f6964202a$75696e7436345f74(arg0, arg1); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$auto_block_lost_thread_locality$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION(arg0) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$auto_refcount_one_allocation$v1$75696e7436345f74(arg0); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$auto_refcount_one_allocation$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define GARBAGE_COLLECTION_COLLECTION_BEGIN(arg0, arg1) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$collection_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f747970655f74(arg0, arg1); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_COLLECTION_BEGIN_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$collection_begin$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define GARBAGE_COLLECTION_COLLECTION_END(arg0, arg1, arg2, arg3, arg4) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$collection_end$v1$6d616c6c6f635f7a6f6e655f74202a$75696e7436345f74$75696e7436345f74$75696e7436345f74$75696e7436345f74(arg0, arg1, arg2, arg3, arg4); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_COLLECTION_END_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$collection_end$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN(arg0, arg1) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$collection_phase_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74(arg0, arg1); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$collection_phase_begin$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_END(arg0, arg1, arg2, arg3) \
+do { \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_TYPEDEFS); \
+ __dtrace_probe$garbage_collection$collection_phase_end$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74$75696e7436345f74$75696e7436345f74(arg0, arg1, arg2, arg3); \
+ __asm__ volatile(".reference " GARBAGE_COLLECTION_STABILITY); \
+} while (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_END_ENABLED() \
+ ({ int _r = __dtrace_isenabled$garbage_collection$collection_phase_end$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+
+
+extern void __dtrace_probe$garbage_collection$auto_block_lost_thread_locality$v1$766f6964202a$75696e7436345f74(const void *, uint64_t);
+extern int __dtrace_isenabled$garbage_collection$auto_block_lost_thread_locality$v1(void);
+extern void __dtrace_probe$garbage_collection$auto_refcount_one_allocation$v1$75696e7436345f74(uint64_t);
+extern int __dtrace_isenabled$garbage_collection$auto_refcount_one_allocation$v1(void);
+extern void __dtrace_probe$garbage_collection$collection_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f747970655f74(const malloc_zone_t *, auto_collection_type_t);
+extern int __dtrace_isenabled$garbage_collection$collection_begin$v1(void);
+extern void __dtrace_probe$garbage_collection$collection_end$v1$6d616c6c6f635f7a6f6e655f74202a$75696e7436345f74$75696e7436345f74$75696e7436345f74$75696e7436345f74(const malloc_zone_t *, uint64_t, uint64_t, uint64_t, uint64_t);
+extern int __dtrace_isenabled$garbage_collection$collection_end$v1(void);
+extern void __dtrace_probe$garbage_collection$collection_phase_begin$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74(const malloc_zone_t *, auto_collection_phase_t);
+extern int __dtrace_isenabled$garbage_collection$collection_phase_begin$v1(void);
+extern void __dtrace_probe$garbage_collection$collection_phase_end$v1$6d616c6c6f635f7a6f6e655f74202a$6175746f5f636f6c6c656374696f6e5f70686173655f74$75696e7436345f74$75696e7436345f74(const malloc_zone_t *, auto_collection_phase_t, uint64_t, uint64_t);
+extern int __dtrace_isenabled$garbage_collection$collection_phase_end$v1(void);
+
+#else
+
+#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY(arg0, arg1) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_AUTO_BLOCK_LOST_THREAD_LOCALITY_ENABLED() (0)
+#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION(arg0) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_AUTO_REFCOUNT_ONE_ALLOCATION_ENABLED() (0)
+#define GARBAGE_COLLECTION_COLLECTION_BEGIN(arg0, arg1) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_COLLECTION_BEGIN_ENABLED() (0)
+#define GARBAGE_COLLECTION_COLLECTION_END(arg0, arg1, arg2, arg3, arg4) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_COLLECTION_END_ENABLED() (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN(arg0, arg1) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_BEGIN_ENABLED() (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_END(arg0, arg1, arg2, arg3) \
+do { \
+ } while (0)
+#define GARBAGE_COLLECTION_COLLECTION_PHASE_END_ENABLED() (0)
+
+#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _AUTO_DTRACE_H */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/default.nix
new file mode 100644
index 000000000000..b2ef3374ca27
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libauto/default.nix
@@ -0,0 +1,84 @@
+{ stdenv, appleDerivation, libdispatch, Libsystem }:
+
+appleDerivation {
+ # these are included in the pure libc
+ buildInputs = stdenv.lib.optionals stdenv.cc.nativeLibc [ libdispatch Libsystem ];
+
+ buildPhase = ''
+ cp ${./auto_dtrace.h} ./auto_dtrace.h
+
+ substituteInPlace ThreadLocalCollector.h --replace SubZone.h Subzone.h
+
+ substituteInPlace auto_zone.cpp \
+ --replace "#include <msgtracer_client.h>" ''$'#include <asl.h>\nstatic void msgtracer_log_with_keys(...) { };'
+
+ substituteInPlace Definitions.h \
+ --replace "#include <System/pthread_machdep.h>" "" \
+ --replace 'void * const, void * const' 'void * const, void *'
+
+ # getspecific_direct is more efficient, but this should be equivalent...
+ substituteInPlace Zone.h \
+ --replace "_pthread_getspecific_direct" "pthread_getspecific" \
+ --replace "_pthread_has_direct_tsd()" "0" \
+ --replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
+ --replace "__PTK_FRAMEWORK_GC_KEY1" "111" \
+ --replace "__PTK_FRAMEWORK_GC_KEY2" "112" \
+ --replace "__PTK_FRAMEWORK_GC_KEY3" "113" \
+ --replace "__PTK_FRAMEWORK_GC_KEY4" "114" \
+ --replace "__PTK_FRAMEWORK_GC_KEY5" "115" \
+ --replace "__PTK_FRAMEWORK_GC_KEY6" "116" \
+ --replace "__PTK_FRAMEWORK_GC_KEY7" "117" \
+ --replace "__PTK_FRAMEWORK_GC_KEY8" "118" \
+ --replace "__PTK_FRAMEWORK_GC_KEY9" "119"
+
+ substituteInPlace auto_zone.cpp \
+ --replace "__PTK_FRAMEWORK_GC_KEY9" "119" \
+ --replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
+
+ substituteInPlace Zone.cpp \
+ --replace "_pthread_getspecific_direct" "pthread_getspecific" \
+ --replace "__PTK_FRAMEWORK_GC_KEY9" "119" \
+ --replace "__PTK_FRAMEWORK_GC_KEY0" "110" \
+ --replace "__PTK_LIBDISPATCH_KEY0" "20" \
+ --replace "struct auto_zone_cursor {" ''$'extern "C" int pthread_key_init_np(int, void (*)(void *));\nstruct auto_zone_cursor {'
+
+ substituteInPlace auto_impl_utilities.c \
+ --replace "# include <CrashReporterClient.h>" "void CRSetCrashLogMessage(void *msg) { };"
+
+ c++ -I. -O3 -c -Wno-c++11-extensions auto_zone.cpp
+ cc -I. -O3 -Iauto_tester -c auto_impl_utilities.c
+ c++ -I. -O3 -c auto_weak.cpp
+ c++ -I. -O3 -c Admin.cpp
+ c++ -I. -O3 -c Bitmap.cpp
+ c++ -I. -O3 -c Definitions.cpp
+ c++ -I. -O3 -c Environment.cpp
+ c++ -I. -O3 -c Large.cpp
+ c++ -I. -O3 -c Region.cpp
+ c++ -I. -O3 -c Subzone.cpp
+ c++ -I. -O3 -c WriteBarrier.cpp
+ c++ -I. -O3 -c Zone.cpp
+ c++ -I. -O3 -c Thread.cpp
+ c++ -I. -O3 -c InUseEnumerator.cpp
+ c++ -I. -O3 -c auto_gdb_interface.cpp
+ c++ -I. -O3 -c PointerHash.cpp
+ c++ -I. -O3 -c ThreadLocalCollector.cpp
+ c++ -I. -O3 -c ZoneDump.cpp
+ c++ -I. -O3 -c ZoneCollectors.cpp
+ c++ -I. -O3 -c SubzonePartition.cpp
+ c++ -I. -O3 -c ZoneCollectionChecking.cpp
+ c++ -I. -O3 -c ZoneCompaction.cpp
+ c++ -I. -O3 -c BlockRef.cpp
+
+ c++ -Wl,-no_dtrace_dof --stdlib=libc++ -dynamiclib -install_name $out/lib/libauto.dylib -o libauto.dylib *.o
+ '';
+
+ installPhase = ''
+ mkdir -p $out/lib $out/include
+ cp auto_zone.h auto_weak.h auto_tester/auto_tester.h auto_gdb_interface.h $out/include
+ cp libauto.dylib $out/lib
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix
new file mode 100644
index 000000000000..ac33a24a8b4e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libclosure/default.nix
@@ -0,0 +1,8 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/include
+ cp *.h $out/include/
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix
new file mode 100644
index 000000000000..e7aa47bdb6b1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libdispatch/default.nix
@@ -0,0 +1,25 @@
+{ appleDerivation }:
+
+appleDerivation {
+ dontConfigure = true;
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p $out/include/dispatch $out/include/os
+
+ # Move these headers so CF can find <os/voucher_private.h>
+ mv private/voucher*.h $out/include/os
+ cp -r private/*.h $out/include/dispatch
+
+ cp -r dispatch/*.h $out/include/dispatch
+ cp -r os/object*.h $out/include/os
+
+ # gcc compatability. Source: https://stackoverflow.com/a/28014302/3714556
+ substituteInPlace $out/include/dispatch/object.h \
+ --replace 'typedef void (^dispatch_block_t)(void);' \
+ '#ifdef __clang__
+ typedef void (^dispatch_block_t)(void);
+ #else
+ typedef void* dispatch_block_t;
+ #endif'
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
new file mode 100644
index 000000000000..0532c88b66b9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, appleDerivation, lib
+, enableStatic ? stdenv.targetPlatform.isiOS
+, enableShared ? !stdenv.targetPlatform.isiOS
+}:
+
+appleDerivation {
+ postUnpack = "sourceRoot=$sourceRoot/libiconv";
+
+ preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
+ sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
+ '';
+
+ configureFlags = [
+ (lib.enableFeature enableStatic "static")
+ (lib.enableFeature enableShared "shared")
+ ];
+
+ postInstall = lib.optionalString enableShared ''
+ mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
+ ${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
+
+ # re-export one useless symbol; ld will reject a dylib that only reexports other dylibs
+ echo 'void dont_use_this(){}' | ${stdenv.cc.bintools.targetPrefix}clang -dynamiclib -x c - -current_version 2.4.0 \
+ -compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \
+ -Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \
+ -Wl,-reexport_library -Wl,$out/lib/libcharset.dylib
+ '';
+
+ setupHooks = [
+ ../../../../build-support/setup-hooks/role.bash
+ ../../../../development/libraries/libiconv/setup-hook.sh
+ ];
+
+ meta = {
+ platforms = lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix
new file mode 100644
index 000000000000..4fd0ab8a7fb2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libplatform/default.nix
@@ -0,0 +1,8 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir $out
+ cp -r include $out/include
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix
new file mode 100644
index 000000000000..650c6415defc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libpthread/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, appleDerivation, libdispatch, xnu }:
+
+appleDerivation {
+ propagatedBuildInputs = [ libdispatch xnu ];
+
+ installPhase = ''
+ mkdir -p $out/include/pthread/
+ mkdir -p $out/include/sys/_types
+ cp pthread/*.h $out/include/pthread/
+
+ # This overwrites qos.h, and is probably not necessary, but I'll leave it here for now
+ # cp private/*.h $out/include/pthread/
+
+ cp -r sys $out/include
+ cp -r sys/_pthread/*.h $out/include/sys/_types/
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix
new file mode 100644
index 000000000000..f3c7558cfc62
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix
@@ -0,0 +1,49 @@
+{ appleDerivation, Libinfo, configd, mDNSResponder }:
+
+appleDerivation {
+ buildInputs = [ Libinfo configd mDNSResponder ];
+
+ buildPhase = ''
+ cc -I. -c dns_util.c
+ cc -I. -c dns.c
+ cc -I. -c dns_async.c
+ cc -I. -c base64.c
+ cc -I. -c dst_api.c
+ cc -I. -c dst_hmac_link.c
+ cc -I. -c dst_support.c
+ cc -I. -c ns_date.c
+ cc -I. -c ns_name.c
+ cc -I. -c ns_netint.c
+ cc -I. -c ns_parse.c
+ cc -I. -c ns_print.c
+ cc -I. -c ns_samedomain.c
+ cc -I. -c ns_sign.c
+ cc -I. -c ns_ttl.c
+ cc -I. -c ns_verify.c
+ cc -I. -c res_comp.c
+ cc -I. -c res_data.c
+ cc -I. -c res_debug.c
+ cc -I. -c res_findzonecut.c
+ cc -I. -c res_init.c
+ cc -I. -c res_mkquery.c
+ cc -I. -c res_mkupdate.c
+ cc -I. -c res_query.c
+ cc -I. -c res_send.c
+ cc -I. -c res_sendsigned.c
+ cc -I. -c res_update.c
+ cc -dynamiclib -install_name $out/lib/libresolv.9.dylib -current_version 1.0.0 -compatibility_version 1.0.0 -o libresolv.9.dylib *.o
+ '';
+
+ installPhase = ''
+ mkdir -p $out/include $out/include/arpa $out/lib
+
+ cp dns.h $out/include/
+ cp dns_util.h $out/include
+ cp nameser.h $out/include
+ ln -s ../nameser.h $out/include/arpa
+ cp resolv.h $out/include
+
+ cp libresolv.9.dylib $out/lib
+ ln -s libresolv.9.dylib $out/lib/libresolv.dylib
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix
new file mode 100644
index 000000000000..bd219ae434c0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libunwind/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, appleDerivation }:
+
+appleDerivation {
+ buildPhase = ":";
+
+ # install headers only
+ installPhase = ''
+ mkdir -p $out/lib
+ cp -R include $out/include
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = with maintainers; [ copumpkin lnl7 ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix
new file mode 100644
index 000000000000..2b196e46ef45
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix
@@ -0,0 +1,35 @@
+{ lib, appleDerivation, xcbuildHook
+
+# headersOnly is true when building for libSystem
+, headersOnly ? false }:
+
+appleDerivation {
+ nativeBuildInputs = lib.optional (!headersOnly) xcbuildHook;
+
+ prePatch = ''
+ substituteInPlace tzlink.c \
+ --replace '#include <xpc/xpc.h>' ""
+ '';
+
+ xcbuildFlags = [ "-target" "util" ];
+
+ installPhase = ''
+ mkdir -p $out/include
+ '' + lib.optionalString headersOnly ''
+ cp *.h $out/include
+ '' + lib.optionalString (!headersOnly)''
+ mkdir -p $out/lib $out/include
+
+ cp Products/Release/*.dylib $out/lib
+ cp Products/Release/*.h $out/include
+
+ # TODO: figure out how to get this to be right the first time around
+ install_name_tool -id $out/lib/libutil.dylib $out/lib/libutil.dylib
+ '';
+
+ meta = with lib; {
+ maintainers = with maintainers; [ copumpkin ];
+ platforms = platforms.darwin;
+ license = licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix
new file mode 100644
index 000000000000..f17ed785360d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/mDNSResponder/default.nix
@@ -0,0 +1,10 @@
+{ appleDerivation }:
+
+appleDerivation {
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/include
+ cp mDNSShared/dns_sd.h $out/include
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix
new file mode 100644
index 000000000000..82be7dc860ec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, appleDerivation, xcbuildHook
+, openssl_1_0_2, Librpcsvc, xnu, libpcap, developer_cmds }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ openssl_1_0_2 xnu Librpcsvc libpcap developer_cmds ];
+
+ NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/";
+
+ # "spray" requires some files that aren't compiling correctly in xcbuild.
+ # "rtadvd" seems to fail with some missing constants.
+ # "traceroute6" and "ping6" require ipsec which doesn't build correctly
+ patchPhase = ''
+ substituteInPlace network_cmds.xcodeproj/project.pbxproj \
+ --replace "7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */," "" \
+ --replace "7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */," "" \
+ --replace "72CD1D9C0EE8C47C005F825D /* PBXTargetDependency */," "" \
+ --replace "7216D2C20EE89ADF00AE70E4 /* PBXTargetDependency */," ""
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+
+ for n in 1 5; do
+ mkdir -p $out/share/man/man$n
+ install */*.$n $out/share/man/man$n
+ done
+
+ # TODO: patch files to load from $out/ instead of /usr/
+
+ # mkdir -p $out/etc/
+ # install rtadvd.tproj/rtadvd.conf ip6addrctl.tproj/ip6addrctl.conf $out/etc/
+
+ # mkdir -p $out/local/OpenSourceVersions/
+ # install network_cmds.plist $out/local/OpenSourceVersions/
+
+ # mkdir -p $out/System/Library/LaunchDaemons
+ # install kdumpd.tproj/com.apple.kdumpd.plist $out/System/Library/LaunchDaemons
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix
new file mode 100644
index 000000000000..a7cedaaea114
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/default.nix
@@ -0,0 +1,36 @@
+{ appleDerivation }:
+
+appleDerivation {
+ phases = [ "unpackPhase" "installPhase" ];
+
+ # Not strictly necessary, since libSystem depends on it, but it's nice to be explicit so we
+ # can easily find out what's impure.
+ __propagatedImpureHostDeps = [
+ "/usr/lib/libauto.dylib"
+ "/usr/lib/libc++abi.dylib"
+ "/usr/lib/libc++.1.dylib"
+ "/usr/lib/libSystem.B.dylib"
+ ];
+
+ installPhase = ''
+ mkdir -p $out/include/objc $out/lib
+ ln -s /usr/lib/libobjc.dylib $out/lib/libobjc.dylib
+ cp runtime/OldClasses.subproj/List.h $out/include/objc/List.h
+ cp runtime/NSObjCRuntime.h $out/include/objc/NSObjCRuntime.h
+ cp runtime/NSObject.h $out/include/objc/NSObject.h
+ cp runtime/Object.h $out/include/objc/Object.h
+ cp runtime/Protocol.h $out/include/objc/Protocol.h
+ cp runtime/hashtable.h $out/include/objc/hashtable.h
+ cp runtime/hashtable2.h $out/include/objc/hashtable2.h
+ cp runtime/message.h $out/include/objc/message.h
+ cp runtime/objc-api.h $out/include/objc/objc-api.h
+ cp runtime/objc-auto.h $out/include/objc/objc-auto.h
+ cp runtime/objc-class.h $out/include/objc/objc-class.h
+ cp runtime/objc-exception.h $out/include/objc/objc-exception.h
+ cp runtime/objc-load.h $out/include/objc/objc-load.h
+ cp runtime/objc-runtime.h $out/include/objc/objc-runtime.h
+ cp runtime/objc-sync.h $out/include/objc/objc-sync.h
+ cp runtime/objc.h $out/include/objc/objc.h
+ cp runtime/runtime.h $out/include/objc/runtime.h
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h
new file mode 100644
index 000000000000..4ad9ba9ad104
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/objc-probes.h
@@ -0,0 +1,65 @@
+/*
+ * Generated by dtrace(1M).
+ */
+
+#ifndef _OBJC_PROBES_H
+#define _OBJC_PROBES_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OBJC_RUNTIME_STABILITY "___dtrace_stability$objc_runtime$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
+
+#define OBJC_RUNTIME_TYPEDEFS "___dtrace_typedefs$objc_runtime$v2"
+
+#if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
+
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
+do { \
+ __asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
+ __dtrace_probe$objc_runtime$objc_exception_rethrow$v1(); \
+ __asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
+} while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() \
+ ({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
+do { \
+ __asm__ volatile(".reference " OBJC_RUNTIME_TYPEDEFS); \
+ __dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(arg0); \
+ __asm__ volatile(".reference " OBJC_RUNTIME_STABILITY); \
+} while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() \
+ ({ int _r = __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(); \
+ __asm__ volatile(""); \
+ _r; })
+
+
+extern void __dtrace_probe$objc_runtime$objc_exception_rethrow$v1(void);
+extern int __dtrace_isenabled$objc_runtime$objc_exception_rethrow$v1(void);
+extern void __dtrace_probe$objc_runtime$objc_exception_throw$v1$766f6964202a(const void *);
+extern int __dtrace_isenabled$objc_runtime$objc_exception_throw$v1(void);
+
+#else
+
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW() \
+do { \
+ } while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_RETHROW_ENABLED() (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW(arg0) \
+do { \
+ } while (0)
+#define OBJC_RUNTIME_OBJC_EXCEPTION_THROW_ENABLED() (0)
+
+#endif /* !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OBJC_PROBES_H */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix
new file mode 100644
index 000000000000..6a0c819a0a31
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/pure.nix
@@ -0,0 +1,118 @@
+{ stdenv, fetchapplesource, libauto, launchd, libc_old, libunwind }:
+
+stdenv.mkDerivation rec {
+ version = "551.1";
+ pname = "objc4";
+
+ src = fetchapplesource {
+ inherit version;
+ name = "objc4";
+ sha256 = "1jrdb6yyb5jwwj27c1r0nr2y2ihqjln8ynj61mpkvp144c1cm5bg";
+ };
+
+ patches = [ ./spinlocks.patch ];
+
+ buildInputs = [ libauto launchd libc_old libunwind ];
+
+ buildPhase = ''
+ cp ${./objc-probes.h} runtime/objc-probes.h
+
+ mkdir -p build/include/objc
+
+ cp runtime/hashtable.h build/include/objc/hashtable.h
+ cp runtime/OldClasses.subproj/List.h build/include/objc/List.h
+ cp runtime/hashtable2.h build/include/objc/hashtable2.h
+ cp runtime/message.h build/include/objc/message.h
+ cp runtime/objc-api.h build/include/objc/objc-api.h
+ cp runtime/objc-auto.h build/include/objc/objc-auto.h
+ cp runtime/objc-class.h build/include/objc/objc-class.h
+ cp runtime/objc-exception.h build/include/objc/objc-exception.h
+ cp runtime/objc-load.h build/include/objc/objc-load.h
+ cp runtime/objc-sync.h build/include/objc/objc-sync.h
+ cp runtime/objc.h build/include/objc/objc.h
+ cp runtime/objc-runtime.h build/include/objc/objc-runtime.h
+ cp runtime/Object.h build/include/objc/Object.h
+ cp runtime/Protocol.h build/include/objc/Protocol.h
+ cp runtime/runtime.h build/include/objc/runtime.h
+ cp runtime/NSObject.h build/include/objc/NSObject.h
+ cp runtime/NSObjCRuntime.h build/include/objc/NSObjCRuntime.h
+
+ # These would normally be in local/include but we don't do local, so they're
+ # going in with the others
+ cp runtime/maptable.h build/include/objc/maptable.h
+ cp runtime/objc-abi.h build/include/objc/objc-abi.h
+ cp runtime/objc-auto-dump.h build/include/objc/objc-auto-dump.h
+ cp runtime/objc-gdb.h build/include/objc/objc-gdb.h
+ cp runtime/objc-internal.h build/include/objc/objc-internal.h
+
+ cc -o markgc markgc.c
+
+ FLAGS="-Wno-deprecated-register -Wno-unknown-pragmas -Wno-deprecated-objc-isa-usage -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-cast-of-sel-type -Iruntime -Ibuild/include -Iruntime/Accessors.subproj -D_LIBCPP_VISIBLE= -DOS_OBJECT_USE_OBJC=0 -DNDEBUG=1"
+
+ cc -std=gnu++11 $FLAGS -c runtime/hashtable2.mm
+ cc -std=gnu++11 $FLAGS -c runtime/maptable.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-auto.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-cache.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-class-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-class.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-errors.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-exception.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-file.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-initialize.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-layout.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-load.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-loadmethod.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-lockdebug.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-new.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-runtime.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel-set.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sync.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-typeencoding.mm
+ cc -std=gnu++11 $FLAGS -c runtime/Object.mm
+ cc -std=gnu++11 $FLAGS -c runtime/Protocol.mm
+
+ cc -std=gnu++11 $FLAGS -c runtime/objc-references.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-os.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-auto-dump.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-file-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-block-trampolines.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-externalref.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-weak.mm
+ cc -std=gnu++11 $FLAGS -c runtime/NSObject.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-opt.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-cache-old.mm
+ cc -std=gnu++11 $FLAGS -c runtime/objc-sel-old.mm
+
+ cc -std=gnu++11 $FLAGS -c runtime/Accessors.subproj/objc-accessors.mm
+
+ cc $FLAGS -c runtime/objc-sel-table.s
+
+ cc $FLAGS -c runtime/OldClasses.subproj/List.m
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-arm.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-i386.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-x86_64.s
+ cc $FLAGS -c runtime/Messengers.subproj/objc-msg-simulator-i386.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-i386.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-i386.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-x86_64.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-x86_64.s
+
+ cc $FLAGS -c runtime/a1a2-blocktramps-arm.s
+ cc $FLAGS -c runtime/a2a3-blocktramps-arm.s
+
+ c++ -Wl,-no_dtrace_dof --stdlib=libc++ -dynamiclib -lauto -install_name $out/lib/libobjc.dylib -o libobjc.dylib *.o
+
+ ./markgc -p libobjc.dylib
+ '';
+
+ installPhase = ''
+ mkdir -p $out/include $out/lib
+
+ mv build/include/objc $out/include
+ mv libobjc.dylib $out/lib
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch
new file mode 100644
index 000000000000..50c6a983fe4d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/objc4/spinlocks.patch
@@ -0,0 +1,107 @@
+--- objc4-551.1/runtime/objc-os.h 2013-06-10 21:16:15.000000000 -0400
++++ ../objc4-551.1/runtime/objc-os.h 2015-01-19 01:01:36.000000000 -0500
+@@ -77,27 +77,72 @@
+ # include <mach-o/getsect.h>
+ # include <mach-o/dyld_priv.h>
+ # include <malloc/malloc.h>
+-# include <os/lock_private.h>
+ # include <libkern/OSAtomic.h>
+ # include <libkern/OSCacheControl.h>
+-# include <System/pthread_machdep.h>
+ # include "objc-probes.h" // generated dtrace probe definitions.
+
++#define __PTK_FRAMEWORK_OBJC_KEY5 45
++#define __PTK_FRAMEWORK_OBJC_KEY6 46
++#define __PTK_FRAMEWORK_OBJC_KEY7 47
++#define __PTK_FRAMEWORK_OBJC_KEY8 48
++#define __PTK_FRAMEWORK_OBJC_KEY9 49
++
++extern "C" int pthread_key_init_np(int, void (*)(void *));
++
+ // Some libc functions call objc_msgSend()
+ // so we can't use them without deadlocks.
+ void syslog(int, const char *, ...) UNAVAILABLE_ATTRIBUTE;
+ void vsyslog(int, const char *, va_list) UNAVAILABLE_ATTRIBUTE;
+
++#if defined(__i386__) || defined(__x86_64__)
++
++// Inlined spinlock.
++// Not for arm on iOS because it hurts uniprocessor performance.
++
++#define ARR_SPINLOCK_INIT 0
++// XXX -- Careful: OSSpinLock isn't volatile, but should be
++typedef volatile int ARRSpinLock;
++__attribute__((always_inline))
++static inline void ARRSpinLockLock(ARRSpinLock *l)
++{
++ unsigned y;
++again:
++ if (__builtin_expect(__sync_lock_test_and_set(l, 1), 0) == 0) {
++ return;
++ }
++ for (y = 1000; y; y--) {
++#if defined(__i386__) || defined(__x86_64__)
++ asm("pause");
++#endif
++ if (*l == 0) goto again;
++ }
++ thread_switch(THREAD_NULL, SWITCH_OPTION_DEPRESS, 1);
++ goto again;
++}
++__attribute__((always_inline))
++static inline void ARRSpinLockUnlock(ARRSpinLock *l)
++{
++ __sync_lock_release(l);
++}
++__attribute__((always_inline))
++static inline int ARRSpinLockTry(ARRSpinLock *l)
++{
++ return __sync_bool_compare_and_swap(l, 0, 1);
++}
++
++#define spinlock_t ARRSpinLock
++#define spinlock_trylock(l) ARRSpinLockTry(l)
++#define spinlock_lock(l) ARRSpinLockLock(l)
++#define spinlock_unlock(l) ARRSpinLockUnlock(l)
++#define SPINLOCK_INITIALIZER ARR_SPINLOCK_INIT
+
+-#define spinlock_t os_lock_handoff_s
+-#define spinlock_trylock(l) os_lock_trylock(l)
+-#define spinlock_lock(l) os_lock_lock(l)
+-#define spinlock_unlock(l) os_lock_unlock(l)
+-#define SPINLOCK_INITIALIZER OS_LOCK_HANDOFF_INIT
++#endif
+
+
+ #if !TARGET_OS_IPHONE
+-# include <CrashReporterClient.h>
++#define CRSetCrashLogMessage(msg)
++#define CRGetCrashLogMessage() 0
++#define CRSetCrashLogMessage2(msg)
+ #else
+ // CrashReporterClient not yet available on iOS
+ __BEGIN_DECLS
+@@ -594,21 +639,13 @@
+ {
+ assert(is_valid_direct_key(k));
+
+- if (_pthread_has_direct_tsd()) {
+- return _pthread_getspecific_direct(k);
+- } else {
+- return pthread_getspecific(k);
+- }
++ return pthread_getspecific(k);
+ }
+ static inline void tls_set_direct(tls_key_t k, void *value)
+ {
+ assert(is_valid_direct_key(k));
+
+- if (_pthread_has_direct_tsd()) {
+- _pthread_setspecific_direct(k, value);
+- } else {
+- pthread_setspecific(k, value);
+- }
++ pthread_setspecific(k, value);
+ }
+
+ // not arm
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix
new file mode 100644
index 000000000000..5668c376130e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/ppp/default.nix
@@ -0,0 +1,15 @@
+{ appleDerivation }:
+
+appleDerivation {
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p $out/include/ppp
+
+ cp Controller/ppp_msg.h $out/include/ppp
+ cp Controller/pppcontroller_types.h $out/include/ppp
+ cp Controller/pppcontroller_types.h $out/include
+ cp Controller/pppcontroller.defs $out/include/ppp
+ cp Controller/pppcontroller_mach_defines.h $out/include
+ cp Controller/PPPControllerPriv.h $out/include/ppp
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix
new file mode 100644
index 000000000000..2b45fbdb45e2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/removefile/default.nix
@@ -0,0 +1,8 @@
+{ appleDerivation }:
+
+appleDerivation {
+ installPhase = ''
+ mkdir -p $out/include/
+ cp removefile.h checkint.h $out/include/
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/default.nix
new file mode 100644
index 000000000000..b87dadd391d2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/shell_cmds/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, appleDerivation, xcbuildHook }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+
+ patchPhase = ''
+ # NOTE: these hashes must be recalculated for each version change
+
+ # disables:
+ # - su ('security/pam_appl.h' file not found)
+ # - find (Undefined symbol '_get_date')
+ # - w (Undefined symbol '_res_9_init')
+ # - expr
+ substituteInPlace shell_cmds.xcodeproj/project.pbxproj \
+ --replace "FCBA168714A146D000AA698B /* PBXTargetDependency */," "" \
+ --replace "FCBA165914A146D000AA698B /* PBXTargetDependency */," "" \
+ --replace "FCBA169514A146D000AA698B /* PBXTargetDependency */," "" \
+ --replace "FCBA165514A146D000AA698B /* PBXTargetDependency */," ""
+
+ # disable w, test install
+ # get rid of permission stuff
+ substituteInPlace xcodescripts/install-files.sh \
+ --replace 'ln -f "$BINDIR/w" "$BINDIR/uptime"' "" \
+ --replace 'ln -f "$DSTROOT/bin/test" "$DSTROOT/bin/["' "" \
+ --replace "-o root -g wheel -m 0755" "" \
+ --replace "-o root -g wheel -m 0644" ""
+ '';
+
+ # temporary install phase until xcodebuild has "install" support
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/usr/bin/$(basename $f)
+ fi
+ done
+
+ export DSTROOT=$out
+ export SRCROOT=$PWD
+ . xcodescripts/install-files.sh
+
+ mv $out/usr/* $out
+ mv $out/private/etc $out
+ rmdir $out/usr $out/private
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix
new file mode 100644
index 000000000000..16454cbc1a5f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix
@@ -0,0 +1,104 @@
+{ stdenv, appleDerivation, lib
+, Librpcsvc, apple_sdk, pam, CF, openbsm }:
+
+appleDerivation {
+ # xcbuild fails with:
+ # /nix/store/fc0rz62dh8vr648qi7hnqyik6zi5sqx8-xcbuild-wrapper/nix-support/setup-hook: line 1: 9083 Segmentation fault: 11 xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build
+ # see issue facebook/xcbuild#188
+ # buildInputs = [ xcbuild ];
+
+ buildInputs = [ Librpcsvc apple_sdk.frameworks.OpenDirectory pam CF
+ apple_sdk.frameworks.IOKit openbsm ];
+ # NIX_CFLAGS_COMPILE = lib.optionalString hostPlatform.isi686 "-D__i386__"
+ # + lib.optionalString hostPlatform.isx86_64 "-D__x86_64__"
+ # + lib.optionalString hostPlatform.isAarch32 "-D__arm__";
+ NIX_CFLAGS_COMPILE = [ "-DDAEMON_UID=1"
+ "-DDAEMON_GID=1"
+ "-DDEFAULT_AT_QUEUE='a'"
+ "-DDEFAULT_BATCH_QUEUE='b'"
+ "-DPERM_PATH=\"/usr/lib/cron/\""
+ "-DOPEN_DIRECTORY"
+ "-DNO_DIRECT_RPC"
+ "-DAPPLE_GETCONF_UNDERSCORE"
+ "-DAPPLE_GETCONF_SPEC"
+ "-DUSE_PAM"
+ "-DUSE_BSM_AUDIT"
+ "-D_PW_NAME_LEN=MAXLOGNAME"
+ "-D_PW_YPTOKEN=\"__YP!\""
+ "-DAHZV1=64 "
+ "-DAU_SESSION_FLAG_HAS_TTY=0x4000"
+ "-DAU_SESSION_FLAG_HAS_AUTHENTICATED=0x4000"
+ ] ++ lib.optional (!stdenv.isLinux) " -D__FreeBSD__ ";
+
+ patchPhase = ''
+ substituteInPlace login.tproj/login.c \
+ --replace bsm/audit_session.h bsm/audit.h
+ substituteInPlace login.tproj/login_audit.c \
+ --replace bsm/audit_session.h bsm/audit.h
+ '';
+
+ buildPhase = ''
+ for dir in *.tproj; do
+ name=$(basename $dir)
+ name=''${name%.tproj}
+
+ CFLAGS=""
+ case $name in
+ arch) CFLAGS="-framework CoreFoundation";;
+ atrun) CFLAGS="-Iat.tproj";;
+ chkpasswd)
+ CFLAGS="-framework OpenDirectory -framework CoreFoundation -lpam";;
+ getconf)
+ for f in getconf.tproj/*.gperf; do
+ cfile=''${f%.gperf}.c
+ LC_ALL=C awk -f getconf.tproj/fake-gperf.awk $f > $cfile
+ done
+ ;;
+ iostat) CFLAGS="-framework IOKit -framework CoreFoundation";;
+ login) CFLAGS="-lbsm -lpam";;
+ nvram) CFLAGS="-framework CoreFoundation -framework IOKit";;
+ sadc) CFLAGS="-framework IOKit -framework CoreFoundation";;
+ sar) CFLAGS="-Isadc.tproj";;
+ esac
+
+ echo "Building $name"
+
+ case $name in
+
+ # These are all broken currently.
+ arch) continue;;
+ chpass) continue;;
+ dirhelper) continue;;
+ dynamic_pager) continue;;
+ fs_usage) continue;;
+ latency) continue;;
+ pagesize) continue;;
+ passwd) continue;;
+ reboot) continue;;
+ sc_usage) continue;;
+ shutdown) continue;;
+ trace) continue;;
+
+ *) cc $dir/*.c -I''${dir} $CFLAGS -o $name ;;
+ esac
+ done
+ '';
+
+ installPhase = ''
+ for dir in *.tproj; do
+ name=$(basename $dir)
+ name=''${name%.tproj}
+ [ -x $name ] && install -D $name $out/bin/$name
+ for n in 1 2 3 4 5 6 7 8 9; do
+ for f in $dir/*.$n; do
+ install -D $f $out/share/man/man$n/$(basename $f)
+ done
+ done
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ shlevy matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/text_cmds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/text_cmds/default.nix
new file mode 100644
index 000000000000..14d7a5e3b32d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/text_cmds/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, appleDerivation, xcbuildHook, ncurses, bzip2, zlib, lzma }:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ ncurses bzip2 zlib lzma ];
+
+ # patches to use ncursees
+ # disables md5
+ patchPhase = ''
+ substituteInPlace text_cmds.xcodeproj/project.pbxproj \
+ --replace 'FC6C98FB149A94EB00DDCC47 /* libcurses.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurses.dylib; path = /usr/lib/libcurses.dylib; sourceTree = "<absolute>"; };' 'FC6C98FB149A94EB00DDCC47 /* libncurses.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libncurses.dylib; path = /usr/lib/libncurses.dylib; sourceTree = "<absolute>"; };' \
+ --replace 'FC7A7EB5149875E00086576A /* PBXTargetDependency */,' ""
+ '';
+
+ installPhase = ''
+ for f in Products/Release/*; do
+ if [ -f $f ]; then
+ install -D $f $out/bin/$(basename $f)
+ fi
+ done
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.darwin;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/top/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/top/default.nix
new file mode 100644
index 000000000000..a2f912ca5782
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/top/default.nix
@@ -0,0 +1,16 @@
+{xcbuildHook, appleDerivation, apple_sdk, ncurses, libutil, lib}:
+
+appleDerivation {
+ nativeBuildInputs = [ xcbuildHook ];
+ buildInputs = [ apple_sdk.frameworks.IOKit ncurses libutil ];
+ NIX_LDFLAGS = "-lutil";
+ installPhase = ''
+ install -D Products/Release/libtop.a $out/lib/libtop.a
+ install -D Products/Release/libtop.h $out/include/libtop.h
+ install -D Products/Release/top $out/bin/top
+ '';
+ meta = {
+ platforms = lib.platforms.darwin;
+ maintainers = with lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
new file mode 100644
index 000000000000..da2d0c5dc7bf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
@@ -0,0 +1,139 @@
+{ appleDerivation, lib, bootstrap_cmds, bison, flex
+, gnum4, unifdef, perl, python3
+, headersOnly ? true }:
+
+appleDerivation ({
+ nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ];
+
+ patches = [ ./python3.patch ];
+
+ postPatch = ''
+ substituteInPlace Makefile \
+ --replace "/bin/" "" \
+ --replace "MAKEJOBS := " '# MAKEJOBS := '
+
+ substituteInPlace makedefs/MakeInc.cmd \
+ --replace "/usr/bin/" "" \
+ --replace "/bin/" "" \
+ --replace "-Werror " ""
+
+ substituteInPlace makedefs/MakeInc.def \
+ --replace "-c -S -m" "-c -m"
+
+ substituteInPlace makedefs/MakeInc.top \
+ --replace "MEMORY_SIZE := " 'MEMORY_SIZE := 1073741824 # '
+
+ substituteInPlace libkern/kxld/Makefile \
+ --replace "-Werror " ""
+
+ substituteInPlace SETUP/kextsymboltool/Makefile \
+ --replace "-lstdc++" "-lc++"
+
+ substituteInPlace libsyscall/xcodescripts/mach_install_mig.sh \
+ --replace "/usr/include" "/include" \
+ --replace "/usr/local/include" "/include" \
+ --replace 'MIG=`' "# " \
+ --replace 'MIGCC=`' "# " \
+ --replace " -o 0" "" \
+ --replace '$SRC/$mig' '-I$DSTROOT/include $SRC/$mig' \
+ --replace '$SRC/servers/netname.defs' '-I$DSTROOT/include $SRC/servers/netname.defs' \
+ --replace '$BUILT_PRODUCTS_DIR/mig_hdr' '$BUILT_PRODUCTS_DIR'
+
+ patchShebangs .
+ '';
+
+ PLATFORM = "MacOSX";
+ SDKVERSION = "10.11";
+ CC = "cc";
+ CXX = "c++";
+ MIG = "mig";
+ MIGCOM = "migcom";
+ STRIP = "strip";
+ NM = "nm";
+ UNIFDEF = "unifdef";
+ DSYMUTIL = "dsymutil";
+ HOST_OS_VERSION = "10.10";
+ HOST_CC = "cc";
+ HOST_FLEX = "flex";
+ HOST_BISON = "bison";
+ HOST_GM4 = "m4";
+ MIGCC = "cc";
+ ARCHS = "x86_64";
+
+ NIX_CFLAGS_COMPILE = "-Wno-error";
+
+ preBuild = ''
+ # This is a bit of a hack...
+ mkdir -p sdk/usr/local/libexec
+
+ cat > sdk/usr/local/libexec/availability.pl <<EOF
+ #!$SHELL
+ if [ "\$1" == "--macosx" ]; then
+ echo 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11
+ elif [ "\$1" == "--ios" ]; then
+ echo 2.0 2.1 2.2 3.0 3.1 3.2 4.0 4.1 4.2 4.3 5.0 5.1 6.0 6.1 7.0 8.0 9.0
+ fi
+ EOF
+ chmod +x sdk/usr/local/libexec/availability.pl
+
+ export SDKROOT_RESOLVED=$PWD/sdk
+ export HOST_SDKROOT_RESOLVED=$PWD/sdk
+
+ export BUILT_PRODUCTS_DIR=.
+ export DSTROOT=$out
+ '';
+
+ buildFlags = lib.optional headersOnly "exporthdrs";
+ installTargets = lib.optional headersOnly "installhdrs";
+
+ postInstall = lib.optionalString headersOnly ''
+ mv $out/usr/include $out
+
+ (cd BUILD/obj/EXPORT_HDRS && find -type f -exec install -D \{} $out/include/\{} \;)
+
+ # TODO: figure out why I need to do this
+ cp libsyscall/wrappers/*.h $out/include
+ install -D libsyscall/os/tsd.h $out/include/os/tsd.h
+ cp EXTERNAL_HEADERS/AssertMacros.h $out/include
+ cp EXTERNAL_HEADERS/Availability*.h $out/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/
+ cp -r EXTERNAL_HEADERS/corecrypto $out/include
+
+ # Build the mach headers we crave
+ export SRCROOT=$PWD/libsyscall
+ export DERIVED_SOURCES_DIR=$out/include
+ export SDKROOT=$out
+ export OBJROOT=$PWD
+ export BUILT_PRODUCTS_DIR=$out
+ libsyscall/xcodescripts/mach_install_mig.sh
+
+ # Get rid of the System prefix
+ mv $out/System/* $out/
+ rmdir $out/System
+
+ # TODO: do I need this?
+ mv $out/internal_hdr/include/mach/*.h $out/include/mach
+
+ # Get rid of some junk lying around
+ rm -rf $out/internal_hdr $out/usr $out/local
+
+ # Add some symlinks
+ ln -s $out/Library/Frameworks/System.framework/Versions/B \
+ $out/Library/Frameworks/System.framework/Versions/Current
+ ln -s $out/Library/Frameworks/System.framework/Versions/Current/PrivateHeaders \
+ $out/Library/Frameworks/System.framework/Headers
+
+ # IOKit (and possibly the others) is incomplete,
+ # so let's not make it visible from here...
+ mkdir $out/Library/PrivateFrameworks
+ mv $out/Library/Frameworks/IOKit.framework $out/Library/PrivateFrameworks
+ '';
+} // lib.optionalAttrs headersOnly {
+ HOST_CODESIGN = "echo";
+ HOST_CODESIGN_ALLOCATE = "echo";
+ LIPO = "echo";
+ LIBTOOL = "echo";
+ CTFCONVERT = "echo";
+ CTFMERGE = "echo";
+ CTFINSERT = "echo";
+ NMEDIT = "echo";
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch
new file mode 100644
index 000000000000..10778406c8e0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/xnu/python3.patch
@@ -0,0 +1,41 @@
+diff --git a/bsd/kern/makekdebugevents.py b/bsd/kern/makekdebugevents.py
+index 73b2db4..d354ba0 100755
+--- a/bsd/kern/makekdebugevents.py
++++ b/bsd/kern/makekdebugevents.py
+@@ -5,7 +5,7 @@
+ # named kd_events[] or these mappings.
+ # Required to generate a header file used by DEVELOPMENT and DEBUG kernels.
+ #
+-
++
+ import sys
+ import re
+
+@@ -21,18 +21,18 @@ code_table = []
+ # scan file to generate internal table
+ with open(trace_code_file, 'rt') as codes:
+ for line in codes:
+- m = id_name_pattern.match(line)
+- if m:
++ m = id_name_pattern.match(line)
++ if m:
+ code_table += [(int(m.group(1),base=16), m.group(2))]
+
+ # emit typedef:
+-print "typedef struct {"
+-print " uint32_t id;"
+-print " const char *name;"
+-print "} kd_event_t;"
++print("typedef struct {")
++print(" uint32_t id;")
++print(" const char *name;")
++print("} kd_event_t;")
+ # emit structure declaration and sorted initialization:
+-print "kd_event_t kd_events[] = {"
++print("kd_event_t kd_events[] = {")
+ for mapping in sorted(code_table, key=lambda x: x[0]):
+- print " {0x%x, \"%s\"}," % mapping
+-print "};"
++ print(" {0x%x, \"%s\"}," % mapping)
++print("};")
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/binutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/binutils/default.nix
new file mode 100644
index 000000000000..fad33b21d046
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/binutils/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, binutils-unwrapped, cctools, llvm }:
+
+# Make sure both underlying packages claim to have prepended their binaries
+# with the same targetPrefix.
+assert binutils-unwrapped.targetPrefix == cctools.targetPrefix;
+
+let
+ inherit (binutils-unwrapped) targetPrefix;
+ cmds = [
+ "ar" "ranlib" "as" "install_name_tool"
+ "ld" "strip" "otool" "lipo" "nm" "strings" "size"
+ ];
+in
+
+# TODO: loop over targetPrefixed binaries too
+stdenv.mkDerivation {
+ pname = "${targetPrefix}cctools-binutils-darwin";
+ inherit (cctools) version;
+ outputs = [ "out" "man" ];
+ buildCommand = ''
+ mkdir -p $out/bin $out/include
+
+ ln -s ${binutils-unwrapped.out}/bin/${targetPrefix}c++filt $out/bin/${targetPrefix}c++filt
+
+ # We specifically need:
+ # - ld: binutils doesn't provide it on darwin
+ # - as: as above
+ # - ar: the binutils one produces .a files that the cctools ld doesn't like
+ # - ranlib: for compatibility with ar
+ # - otool: we use it for some of our name mangling
+ # - install_name_tool: we use it to rewrite stuff in our bootstrap tools
+ # - strip: the binutils one seems to break mach-o files
+ # - lipo: gcc build assumes it exists
+ # - nm: the gnu one doesn't understand many new load commands
+ for i in ${stdenv.lib.concatStringsSep " " (builtins.map (e: targetPrefix + e) cmds)}; do
+ ln -sf "${cctools}/bin/$i" "$out/bin/$i"
+ done
+
+ ln -s ${llvm}/bin/dsymutil $out/bin/dsymutil
+
+ ln -s ${binutils-unwrapped.out}/share $out/share
+
+ ln -s ${cctools}/libexec $out/libexec
+
+ mkdir -p "$man"/share/man/man{1,5}
+ for i in ${builtins.concatStringsSep " " cmds}; do
+ for path in "${cctools.man}"/share/man/man?/$i.*; do
+ dest_path="$man''${path#${cctools.man}}"
+ ln -sv "$path" "$dest_path"
+ done
+ done
+ '';
+
+ passthru = {
+ inherit targetPrefix;
+ };
+
+ meta = {
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ priority = 10;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch
new file mode 100644
index 000000000000..fc87f69ac32d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch
@@ -0,0 +1,16 @@
+diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
+index 2565518..9250016 100644
+--- a/cctools/ld64/src/ld/Options.cpp
++++ b/cctools/ld64/src/ld/Options.cpp
+@@ -2522,6 +2522,11 @@ void Options::parse(int argc, const char* argv[])
+ throw "missing argument to -rpath";
+ fRPaths.push_back(path);
+ }
++ else if ( strcmp(arg, "-rpath-link") == 0 ) {
++ const char* path = argv[++i];
++ if ( path == NULL )
++ throw "missing argument to -rpath-link";
++ }
+ else if ( strcmp(arg, "-read_only_stubs") == 0 ) {
+ fReadOnlyx86Stubs = true;
+ }
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch
new file mode 100644
index 000000000000..17ad9053f3bd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch
@@ -0,0 +1,29 @@
+diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
+index e4b37ec..4189ebc 100644
+--- a/cctools/ld64/src/ld/Options.cpp
++++ b/cctools/ld64/src/ld/Options.cpp
+@@ -5800,24 +5800,6 @@ void Options::checkIllegalOptionCombinations()
+ if ( fDeadStrip && (fOutputKind == Options::kObjectFile) )
+ throw "-r and -dead_strip cannot be used together";
+
+- // can't use -rpath unless targeting 10.5 or later
+- if ( fRPaths.size() > 0 ) {
+- if ( !platforms().minOS(ld::version2008) )
+- throw "-rpath can only be used when targeting Mac OS X 10.5 or later";
+- switch ( fOutputKind ) {
+- case Options::kDynamicExecutable:
+- case Options::kDynamicLibrary:
+- case Options::kDynamicBundle:
+- break;
+- case Options::kStaticExecutable:
+- case Options::kObjectFile:
+- case Options::kDyld:
+- case Options::kPreload:
+- case Options::kKextBundle:
+- throw "-rpath can only be used when creating a dynamic final linked image";
+- }
+- }
+-
+ if ( fPositionIndependentExecutable ) {
+ switch ( fOutputKind ) {
+ case Options::kDynamicExecutable:
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/port.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/port.nix
new file mode 100644
index 000000000000..64f1490a7a79
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/cctools/port.nix
@@ -0,0 +1,106 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook
+, installShellFiles
+, libcxxabi, libuuid
+, libobjc ? null, maloader ? null
+, enableTapiSupport ? true, libtapi
+}:
+
+let
+
+ # The targetPrefix prepended to binary names to allow multiple binuntils on the
+ # PATH to both be usable.
+ targetPrefix = stdenv.lib.optionalString
+ (stdenv.targetPlatform != stdenv.hostPlatform)
+ "${stdenv.targetPlatform.config}-";
+in
+
+# Non-Darwin alternatives
+assert (!stdenv.hostPlatform.isDarwin) -> maloader != null;
+
+stdenv.mkDerivation {
+ pname = "${targetPrefix}cctools-port";
+ version = "949.0.1";
+
+ src = fetchFromGitHub {
+ owner = "tpoechtrager";
+ repo = "cctools-port";
+ rev = "43f32a4c61b5ba7fde011e816136c550b1b3146f";
+ sha256 = "10yc5smiczzm62q6ijqccc58bwmfhc897f3bwa5i9j98csqsjj0k";
+ };
+
+ outputs = [ "out" "dev" "man" ];
+
+ nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ];
+ buildInputs = [ libuuid ]
+ ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ]
+ ++ stdenv.lib.optional enableTapiSupport libtapi;
+
+ patches = [ ./ld-ignore-rpath-link.patch ./ld-rpath-nonfinal.patch ];
+
+ __propagatedImpureHostDeps = [
+ # As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them
+ "/usr/lib/libobjc.A.dylib"
+ "/usr/lib/libobjc.dylib"
+ ];
+
+ enableParallelBuilding = true;
+
+ # TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
+ configurePlatforms = [ "build" "host" ]
+ ++ stdenv.lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
+ configureFlags = [ "--disable-clang-as" ]
+ ++ stdenv.lib.optionals enableTapiSupport [
+ "--enable-tapi-support"
+ "--with-libtapi=${libtapi}"
+ ];
+
+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+ substituteInPlace cctools/Makefile.am --replace libobjc2 ""
+ '' + ''
+ sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp
+
+ # FIXME: there are far more absolute path references that I don't want to fix right now
+ substituteInPlace cctools/configure.ac \
+ --replace "-isystem /usr/local/include -isystem /usr/pkg/include" "" \
+ --replace "-L/usr/local/lib" "" \
+
+ substituteInPlace cctools/include/Makefile \
+ --replace "/bin/" ""
+
+ patchShebangs tools
+ sed -i -e 's/which/type -P/' tools/*.sh
+
+ # Workaround for https://www.sourceware.org/bugzilla/show_bug.cgi?id=11157
+ cat > cctools/include/unistd.h <<EOF
+ #ifdef __block
+ # undef __block
+ # include_next "unistd.h"
+ # define __block __attribute__((__blocks__(byref)))
+ #else
+ # include_next "unistd.h"
+ #endif
+ EOF
+
+ cd cctools
+ '';
+
+ preInstall = ''
+ pushd include
+ make DSTROOT=$out/include RC_OS=common install
+ popd
+
+ installManPage ar/ar.{1,5}
+ '';
+
+ passthru = {
+ inherit targetPrefix;
+ };
+
+ meta = {
+ broken = !stdenv.targetPlatform.isDarwin; # Only supports darwin targets
+ homepage = "http://www.opensource.apple.com/source/cctools/";
+ description = "MacOS Compiler Tools (cross-platform port)";
+ license = stdenv.lib.licenses.apsl20;
+ maintainers = with stdenv.lib.maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/chunkwm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/chunkwm/default.nix
new file mode 100644
index 000000000000..d94f66969f46
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/chunkwm/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchzip, Carbon, Cocoa, ScriptingBridge }:
+
+stdenv.mkDerivation rec {
+ pname = "chunkwm";
+ version = "0.4.9";
+ src = fetchzip {
+ url = "http://github.com/koekeishiya/chunkwm/archive/v${version}.tar.gz";
+ sha256 = "0w8q92q97fdvbwc3qb5w44jn4vi3m65ssdvjp5hh6b7llr17vspl";
+ };
+
+ buildInputs = [ Carbon Cocoa ScriptingBridge ];
+ outputs = [ "bin" "out" ];
+
+ buildPhase = ''
+ for d in . src/chunkc src/plugins/*; do
+ pushd $d
+ buildPhase
+ popd
+ done
+ '';
+
+ installPhase = ''
+ mkdir -p $bin/bin $out/bin $out/lib/chunkwm/plugins
+ cp src/chunkc/bin/chunkc $bin/bin/chunkc
+ cp bin/chunkwm $out/bin
+ cp plugins/*.so $out/lib/chunkwm/plugins
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tiling window manager for macOS based on plugin architecture";
+ homepage = "https://github.com/koekeishiya/chunkwm";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ lnl7 ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/darling/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/darling/default.nix
new file mode 100644
index 000000000000..846831d0a879
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/darling/default.nix
@@ -0,0 +1,42 @@
+{stdenv, lib, fetchzip}:
+
+stdenv.mkDerivation rec {
+ pname = "darling";
+ name = pname;
+
+ src = fetchzip {
+ url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
+ sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf";
+ postFetch = ''
+ # Get rid of case conflict
+ mkdir $out
+ cd $out
+ tar -xzf $downloadedFile --strip-components=1
+ rm -r $out/src/libm
+ '';
+ };
+
+ # only packaging sandbox for now
+ buildPhase = ''
+ cc -c src/sandbox/sandbox.c -o src/sandbox/sandbox.o
+ cc -dynamiclib -flat_namespace src/sandbox/sandbox.o -o libsystem_sandbox.dylib
+ '';
+
+ installPhase = ''
+ mkdir -p $out/lib
+ cp -rL src/sandbox/include/ $out/
+ cp libsystem_sandbox.dylib $out/lib/
+
+ mkdir -p $out/include
+ cp src/libaks/include/* $out/include
+ '';
+
+ # buildInputs = [ cmake bison flex ];
+
+ meta = with lib; {
+ maintainers = with maintainers; [ matthewbauer ];
+ license = licenses.gpl3;
+ description = "Darwin/macOS emulation layer for Linux";
+ platforms = platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/discrete-scroll/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/discrete-scroll/default.nix
new file mode 100644
index 000000000000..e72402b77933
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/discrete-scroll/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, lib, fetchFromGitHub, Cocoa }:
+
+## after launching for the first time, grant access for parent application (e.g. Terminal.app)
+## from 'system preferences >> security & privacy >> accessibility'
+## and then launch again
+
+stdenv.mkDerivation rec {
+ pname = "discrete-scroll";
+ version = "0.1.1";
+
+ src = fetchFromGitHub {
+ owner = "emreyolcu";
+ repo = "discrete-scroll";
+ rev = "v${version}";
+ sha256 = "0aqkp4kkwjlkll91xbqwf8asjww8ylsdgqvdk8d06bwdvg2cgvhg";
+ };
+
+ buildInputs = [ Cocoa ];
+
+ buildPhase = ''
+ cc -std=c99 -O3 -Wall -framework Cocoa -o dc DiscreteScroll/main.m
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp ./dc $out/bin/discretescroll
+ '';
+
+ meta = with lib; {
+ description = "Fix for OS X's scroll wheel problem";
+ homepage = "https://github.com/emreyolcu/discrete-scroll";
+ platforms = platforms.darwin;
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/duti/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/duti/default.nix
new file mode 100644
index 000000000000..5c63b8e0dfb3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/duti/default.nix
@@ -0,0 +1,29 @@
+{stdenv, lib, fetchFromGitHub, autoreconfHook, darwin}:
+
+stdenv.mkDerivation rec {
+ pname = "duti";
+ version = "1.5.4pre";
+ src = fetchFromGitHub {
+ owner = "moretension";
+ repo = pname;
+ rev = "7dbcae86f99fedef5a6c4311f032a0f1ca0539cc";
+ sha256 = "1z9sa0yk87vs57d5338y6lvm1v1vvynxb7dy1x5aqzkcr0imhljl";
+ };
+ nativeBuildInputs = [autoreconfHook];
+ buildInputs = [darwin.apple_sdk.frameworks.ApplicationServices];
+ configureFlags = ["--with-macosx-sdk=/homeless-shelter"];
+ meta = with lib; {
+ description = "A command-line tool to select default applications for document types and URL schemes on Mac OS X";
+ longDescription = ''
+ duti is a command-line utility capable of setting default applications for
+ various document types on Mac OS X, using Apple's Uniform Type Identifiers. A
+ UTI is a unique string describing the format of a file's content. For instance,
+ a Microsoft Word document has a UTI of com.microsoft.word.doc. Using duti, the
+ user can change which application acts as the default handler for a given UTI.
+ '';
+ maintainers = with maintainers; [matthewbauer];
+ platforms = platforms.darwin;
+ license = licenses.publicDomain;
+ homepage = "http://duti.org/";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
new file mode 100644
index 000000000000..46ba68281868
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
@@ -0,0 +1,13 @@
+{ runCommand, cctools }:
+{ haskellPackages, src, deps ? p : [], name }: let
+ inherit (haskellPackages) ghc ghcWithPackages;
+ with-env = ghcWithPackages deps;
+ ghcName = "${ghc.targetPrefix}ghc";
+in runCommand name { buildInputs = [ with-env cctools ]; } ''
+ mkdir -p $out/lib
+ mkdir -p $out/include
+ ${ghcName} ${src} -staticlib -outputdir . -o $out/lib/${name}.a -stubdir $out/include
+ for file in ${ghc}/lib/${ghcName}-${ghc.version}/include/*; do
+ ln -sv $file $out/include
+ done
+''
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/goku/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/goku/default.nix
new file mode 100644
index 000000000000..f6834fca7351
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/goku/default.nix
@@ -0,0 +1,27 @@
+{stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "goku";
+ version = "0.1.11";
+
+ src = fetchurl {
+ url = "https://github.com/yqrashawn/GokuRakuJoudo/releases/download/v${version}/goku.tar.gz";
+ sha256 = "49562342be114c2656726c5c697131acd286965ab3903a1a1e157cc689e20b15";
+ };
+
+ sourceRoot = ".";
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp goku $out/bin
+ cp gokuw $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Karabiner configurator";
+ homepage = "https://github.com/yqrashawn/GokuRakuJoudo";
+ license = licenses.gpl3;
+ maintainers = [ maintainers.nikitavoloboev ];
+ platforms = platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/insert_dylib/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/insert_dylib/default.nix
new file mode 100644
index 000000000000..0ab6a4157075
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/insert_dylib/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchFromGitHub, xcbuildHook }:
+
+stdenv.mkDerivation
+ { name = "insert_dylib-2016.08.28";
+ src = fetchFromGitHub
+ { owner = "Tyilo";
+ repo = "insert_dylib";
+ rev = "c8beef66a08688c2feeee2c9b6eaf1061c2e67a9";
+ sha256 = "0az38y06pvvy9jf2wnzdwp9mp98lj6nr0ldv0cs1df5p9x2qvbya";
+ };
+ nativeBuildInputs = [ xcbuildHook ];
+ installPhase =
+ ''
+ mkdir -p $out/bin
+ install -m755 Products/Release/insert_dylib $out/bin
+ '';
+ meta.platforms = stdenv.lib.platforms.darwin;
+ }
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ios-deploy/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ios-deploy/default.nix
new file mode 100644
index 000000000000..6567093700df
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/ios-deploy/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenvNoCC, rsync, fetchFromGitHub }:
+
+# Note this is impure, using system XCode to build ios-deploy. We
+# should have a special flag for users to enable this.
+
+let version = "1.11.0";
+in stdenvNoCC.mkDerivation {
+ pname = "ios-deploy";
+ inherit version;
+ src = fetchFromGitHub {
+ owner = "ios-control";
+ repo = "ios-deploy";
+ rev = version;
+ sha256 = "0hqwikdrcnslx4kkw9b0n7n443gzn2gbrw15pp2fnkcw5s0698sc";
+ };
+ nativeBuildInputs = [ rsync ];
+ buildPhase = ''
+ LD=$CC
+ tmp=$(mktemp -d)
+ ln -s /usr/bin/xcodebuild $tmp
+ export PATH="$PATH:$tmp"
+ xcodebuild -configuration Release SYMROOT=build OBJROOT=$tmp
+ '';
+ checkPhase = ''
+ xcodebuild test -scheme ios-deploy-tests -configuration Release SYMROOT=build
+ '';
+ installPhase = ''
+ install -D build/Release/ios-deploy $out/bin/ios-deploy
+ '';
+ meta = {
+ platforms = lib.platforms.darwin;
+ description = "Install and debug iOS apps from the command line. Designed to work on un-jailbroken devices";
+ license = lib.licenses.gpl3;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/iproute2mac/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/iproute2mac/default.nix
new file mode 100644
index 000000000000..edf1583de9a8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/iproute2mac/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, darwin, python2 }:
+
+stdenv.mkDerivation rec {
+ version = "1.2.1";
+ pname = "iproute2mac";
+
+ src = fetchFromGitHub {
+ owner = "brona";
+ repo = "iproute2mac";
+ rev = "v${version}";
+ sha256 = "1n6la7blbxza2m79cpnywsavhzsdv4gzdxrkly4dppyidjg6jy1h";
+ };
+
+ buildInputs = [ python2 ];
+
+ postPatch = ''
+ substituteInPlace src/ip.py \
+ --replace /usr/bin/python ${python2}/bin/python \
+ --replace /sbin/ifconfig ${darwin.network_cmds}/bin/ifconfig \
+ --replace /sbin/route ${darwin.network_cmds}/bin/route \
+ --replace /usr/sbin/netstat ${darwin.network_cmds}/bin/netstat \
+ --replace /usr/sbin/ndp ${darwin.network_cmds}/bin/ndp \
+ --replace /usr/sbin/arp ${darwin.network_cmds}/bin/arp \
+ --replace /usr/sbin/networksetup ${darwin.network_cmds}/bin/networksetup
+ '';
+ installPhase = ''
+ mkdir -p $out/bin
+ install -D -m 755 src/ip.py $out/bin/ip
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/brona/iproute2mac";
+ description = "CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.";
+ license = licenses.mit;
+ maintainers = with maintainers; [ flokli ];
+ platforms = platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/default.nix
new file mode 100644
index 000000000000..b09b65f33d56
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, fetchpatch, Carbon, Cocoa }:
+
+stdenv.mkDerivation rec {
+ pname = "khd";
+ version = "3.0.0";
+
+ src = fetchFromGitHub {
+ owner = "koekeishiya";
+ repo = "khd";
+ rev = "v${version}";
+ sha256 = "0nzfhknv1s71870w2dk9dy56a3g5zsbjphmfrz0vsvi438g099r4";
+ };
+
+ patches = [
+ # Fixes build issues, remove with >3.0.0
+ (fetchpatch {
+ url = "https://github.com/koekeishiya/khd/commit/4765ae0b4c7d4ca56319dc92ff54393cd9e03fbc.patch";
+ sha256 = "0kvf5hxi5bf6pf125qib7wn7hys0ag66zzpp4srj1qa87lxyf7np";
+ })
+ ];
+
+ buildInputs = [ Carbon Cocoa ];
+
+ buildPhase = ''
+ make install
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp bin/khd $out/bin/khd
+
+ mkdir -p $out/Library/LaunchDaemons
+ cp ${./org.nixos.khd.plist} $out/Library/LaunchDaemons/org.nixos.khd.plist
+ substituteInPlace $out/Library/LaunchDaemons/org.nixos.khd.plist --subst-var out
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A simple modal hotkey daemon for OSX";
+ homepage = "https://github.com/koekeishiya/khd";
+ downloadPage = "https://github.com/koekeishiya/khd/releases";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ lnl7 ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/org.nixos.khd.plist b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/org.nixos.khd.plist
new file mode 100644
index 000000000000..3c0aaa81eb61
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/khd/org.nixos.khd.plist
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.nixos.khd</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@out@/bin/khd</string>
+ </array>
+ <key>KeepAlive</key>
+ <true/>
+ <key>ProcessType</key>
+ <string>Interactive</string>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>PATH</key>
+ <string>@out@/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
+ </dict>
+ <key>Sockets</key>
+ <dict>
+ <key>Listeners</key>
+ <dict>
+ <key>SockServiceName</key>
+ <string>3021</string>
+ <key>SockType</key>
+ <string>dgram</string>
+ <key>SockFamily</key>
+ <string>IPv4</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/default.nix
new file mode 100644
index 000000000000..8c412aa68ed7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchzip }:
+
+stdenv.mkDerivation rec {
+ pname = "kwm";
+ version = "4.0.5";
+
+ src = fetchzip {
+ stripRoot = false;
+ url = "https://github.com/koekeishiya/kwm/releases/download/v${version}/Kwm-${version}.zip";
+ sha256 = "1ld1vblg3hmc6lpb8p2ljvisbkijjkijf4y87z5y1ia4k8pk7mxb";
+ };
+
+ # TODO: Build this properly once we have swiftc.
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp kwmc $out/bin/kwmc
+ cp kwm overlaylib.dylib $out
+
+ mkdir -p $out/Library/LaunchDaemons
+ cp ${./org.nixos.kwm.plist} $out/Library/LaunchDaemons/org.nixos.kwm.plist
+ substituteInPlace $out/Library/LaunchDaemons/org.nixos.kwm.plist --subst-var out
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tiling window manager with focus follows mouse for OSX";
+ homepage = "https://github.com/koekeishiya/kwm";
+ downloadPage = "https://github.com/koekeishiya/kwm/releases";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ lnl7 ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/org.nixos.kwm.plist b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/org.nixos.kwm.plist
new file mode 100644
index 000000000000..eafce2ab4a46
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/kwm/org.nixos.kwm.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.nixos.kwm</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@out@/kwm</string>
+ </array>
+ <key>KeepAlive</key>
+ <true/>
+ <key>Sockets</key>
+ <dict>
+ <key>Listeners</key>
+ <dict>
+ <key>SockServiceName</key>
+ <string>3020</string>
+ <key>SockType</key>
+ <string>dgram</string>
+ <key>SockFamily</key>
+ <string>IPv4</string>
+ </dict>
+</dict>
+</dict>
+</plist>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/libtapi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/libtapi/default.nix
new file mode 100644
index 000000000000..1f1e00d13f9a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/libtapi/default.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, fetchFromGitHub, cmake, python3, ncurses }:
+
+stdenv.mkDerivation {
+ name = "libtapi-1000.10.8";
+ src = fetchFromGitHub {
+ owner = "tpoechtrager";
+ repo = "apple-libtapi";
+ rev = "3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48";
+ sha256 = "1zb10p6xkls8x7wsdwgy9c0v16z97rfkgidii9ffq5rfczgvrhjh";
+ };
+
+ sourceRoot = "source/src/llvm";
+
+ nativeBuildInputs = [ cmake python3 ];
+
+ # ncurses is required here to avoid a reference to bootstrap-tools, which is
+ # not allowed for the stdenv.
+ buildInputs = [ ncurses ];
+
+ cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ];
+
+ # fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
+ # adapted from upstream
+ # https://github.com/tpoechtrager/apple-libtapi/blob/3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48/build.sh#L58-L60
+ preConfigure = ''
+ INCLUDE_FIX="-I $PWD/projects/clang/include"
+ INCLUDE_FIX+=" -I $PWD/build/projects/clang/include"
+
+ cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="$INCLUDE_FIX")
+ '';
+
+ buildFlags = [ "clangBasic" "libtapi" ];
+
+ installTargets = [ "install-libtapi" "install-tapi-headers" ];
+
+ postInstall = ''
+ install_name_tool -id $out/lib/libtapi.dylib $out/lib/libtapi.dylib
+ '';
+
+ meta = with lib; {
+ license = licenses.apsl20;
+ maintainers = with maintainers; [ matthewbauer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/lsusb/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/lsusb/default.nix
new file mode 100644
index 000000000000..799a4761fbd1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/lsusb/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ version = "1.0";
+ pname = "lsusb";
+
+ src = fetchFromGitHub {
+ owner = "jlhonora";
+ repo = "lsusb";
+ rev = "8a6bd7084a55a58ade6584af5075c1db16afadd1";
+ sha256 = "0p8pkcgvsx44dd56wgipa8pzi3298qk9h4rl9pwsw1939hjx6h0g";
+ };
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man8
+ install -m 0755 lsusb $out/bin
+ install -m 0444 man/lsusb.8 $out/share/man/man8
+ '';
+
+ meta = {
+ homepage = "https://github.com/jlhonora/lsusb";
+ description = "lsusb command for Mac OS X";
+ platforms = stdenv.lib.platforms.darwin;
+ license = stdenv.lib.licenses.mit;
+ maintainers = [ stdenv.lib.maintainers.varunpatro ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/m-cli/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/m-cli/default.nix
new file mode 100644
index 000000000000..2699bb8e1408
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/m-cli/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "m-cli";
+ version = "0.2.5";
+
+ src = fetchFromGitHub {
+ owner = "rgcr";
+ repo = "m-cli";
+ rev = "v${version}";
+ sha512 = "0mkcx7jq91pbfs8327qc8434gj73fvjgdfdsrza0lyd9wns6jhsqsf0585klzl68aqscvksgzi2asdnim4va35cdkp2fdzl0g3sm4kd";
+ };
+
+ dontBuild = true;
+
+ installPhase = ''
+ local MPATH="$out/share/m"
+
+ gawk -i inplace '{
+ gsub(/^\[ -L.*|^\s+\|\| pushd.*|^popd.*/, "");
+ gsub(/MPATH=.*/, "MPATH='$MPATH'");
+ gsub(/(update|uninstall)_mcli \&\&.*/, "echo NOOP \\&\\& exit 0");
+ print
+ }' m
+
+ install -Dt "$MPATH/plugins" -m755 plugins/*
+
+ install -Dm755 m $out/bin/m
+
+ install -Dt "$out/share/bash-completion/completions/" -m444 completion/bash/m
+ install -Dt "$out/share/fish/vendor_completions.d/" -m444 completion/fish/m.fish
+ install -Dt "$out/share/zsh/site-functions/" -m444 completion/zsh/_m
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Swiss Army Knife for macOS";
+ inherit (src.meta) homepage;
+ repositories.git = "git://github.com/rgcr/m-cli.git";
+
+ license = licenses.mit;
+
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ yurrriq ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/maloader/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/maloader/default.nix
new file mode 100644
index 000000000000..0de94c92388d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/maloader/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchgit, opencflite, clang, libcxx }:
+
+stdenv.mkDerivation {
+ name = "maloader-0git";
+
+ src = fetchgit {
+ url = "git://github.com/shinh/maloader.git";
+ rev = "5f220393e0b7b9ad0cf1aba0e89df2b42a1f0442";
+ sha256 = "0dd1pn07x1y8pyn5wz8qcl1c1xwghyya4d060m3y9vx5dhv9xmzw";
+ };
+
+ postPatch = ''
+ sed -i \
+ -e '/if.*loadLibMac.*mypath/s|mypath|"'"$out/lib/"'"|' \
+ -e 's|libCoreFoundation\.so|${opencflite}/lib/&|' \
+ ld-mac.cc
+ '';
+
+ NIX_CFLAGS_COMPILE = "-I${libcxx}/include/c++/v1";
+ buildInputs = [ clang libcxx ];
+ buildFlags = [ "USE_LIBCXX=1" "release" ];
+
+ installPhase = ''
+ install -vD libmac.so "$out/lib/libmac.so"
+
+ for bin in extract macho2elf ld-mac; do
+ install -vD "$bin" "$out/bin/$bin"
+ done
+ '';
+
+ meta = {
+ description = "Mach-O loader for Linux";
+ homepage = "https://github.com/shinh/maloader";
+ license = stdenv.lib.licenses.bsd2;
+ platforms = stdenv.lib.platforms.linux;
+ broken = true; # 2018-09-08, no succesful build since 2017-08-21
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/native-x11-and-opengl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/native-x11-and-opengl/default.nix
new file mode 100644
index 000000000000..fa3d4284e597
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/native-x11-and-opengl/default.nix
@@ -0,0 +1,14 @@
+{ stdenv, writeScript }:
+
+stdenv.mkDerivation rec {
+ name = "darwin-native-x11-and-opengl";
+
+ builder = writeScript "${name}-builder.sh" ''
+ /bin/mkdir -p $out
+ /bin/mkdir $out/lib
+ /bin/ln -sv /usr/X11/lib/{*.dylib,X11,xorg} $out/lib
+ /bin/mkdir $out/lib/pkgconfig
+ /bin/ln -sv /usr/X11/lib/pkgconfig/{x*.pc,gl*.pc} $out/lib/pkgconfig
+ /bin/ln -sv /usr/X11/{bin,include,share} $out/
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/noah/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/noah/default.nix
new file mode 100644
index 000000000000..81f4ab2bd9e9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/noah/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, Hypervisor }:
+
+stdenv.mkDerivation rec {
+ pname = "noah";
+ version = "0.5.1";
+
+ src = fetchFromGitHub {
+ owner = "linux-noah";
+ repo = pname;
+ rev = version;
+ sha256 = "0bivfsgb56kndz61lzjgdcnqlhjikqw89ma0h6f6radyvfzy0vis";
+ };
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = [ Hypervisor ];
+
+ meta = with stdenv.lib; {
+ description = "Bash on Ubuntu on macOS";
+ homepage = "https://github.com/linux-noah/noah";
+ license = [ licenses.mit licenses.gpl2 ];
+ maintainers = [ maintainers.marsam ];
+ platforms = platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/opencflite/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/opencflite/default.nix
new file mode 100644
index 000000000000..26af46a171fd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/opencflite/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, icu, libuuid, tzdata }:
+
+stdenv.mkDerivation rec {
+ pname = "opencflite";
+ version = "476.19.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/opencflite/${pname}-${version}.tar.gz";
+ sha256 = "0jgmzs0ycl930hmzcvx0ykryik56704yw62w394q1q3xw5kkjn9v";
+ };
+
+ configureFlags = [ "--with-uuid=${libuuid.dev}" ];
+ buildInputs = [ icu tzdata.dev ];
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Cross platform port of the macOS CoreFoundation";
+ homepage = "https://sourceforge.net/projects/opencflite/";
+ license = stdenv.lib.licenses.apsl20;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxfuse/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxfuse/default.nix
new file mode 100644
index 000000000000..e13a08420120
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxfuse/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, runCommand, fetchFromGitHub, autoreconfHook }:
+
+let
+ version = "3.8.3";
+
+ headers = runCommand "osxfuse-common-${version}" {
+ src = fetchFromGitHub {
+ owner = "osxfuse";
+ repo = "osxfuse";
+ rev = "osxfuse-${version}";
+ sha256 = "13lmg41zcyiajh8m42w7szkbg2is4551ryx2ia2mmzvvd23pag0z";
+ };
+ } ''
+ mkdir -p $out/include
+ cp --target-directory=$out/include $src/common/*.h
+ '';
+in
+
+stdenv.mkDerivation {
+
+ pname = "osxfuse";
+ inherit version;
+
+ src = fetchFromGitHub {
+ owner = "osxfuse";
+ repo = "fuse";
+ rev = "1a1977a"; # Submodule reference from osxfuse/osxfuse at tag osxfuse-${version}
+ sha256 = "101fw8j40ylfbbrjycnwr5qp422agyf9sfbczyb9w5ivrkds3rfw";
+ };
+
+ postPatch = ''
+ touch config.rpath
+ '';
+
+ postInstall = ''
+ ln -s osxfuse.pc $out/lib/pkgconfig/fuse.pc
+ '';
+
+ nativeBuildInputs = [ autoreconfHook ];
+ buildInputs = [ headers ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://osxfuse.github.io";
+ description = "C-based FUSE for macOS SDK";
+ platforms = platforms.darwin;
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxsnarf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxsnarf/default.nix
new file mode 100644
index 000000000000..e31271ed2b97
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/osxsnarf/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchFromGitHub, plan9port, darwin, ... }:
+
+stdenv.mkDerivation rec {
+ pname = "osxsnarf";
+ version = "0.1.0";
+
+ src = fetchFromGitHub {
+ owner = "eraserhd";
+ repo = "osxsnarf";
+ rev = "v${version}";
+ sha256 = "1vpg39mpc5avnv1j0yfx0x2ncvv38slmm83zv6nmm7alfwfjr2ss";
+ };
+
+ buildInputs = [ plan9port darwin.apple_sdk.frameworks.Carbon ];
+ makeFlags = [ "prefix=${placeholder "out"}" ];
+
+ meta = with lib; {
+ description = "A Plan 9-inspired way to share your OS X clipboard";
+ homepage = "https://github.com/eraserhd/osxsnarf";
+ license = licenses.unlicense;
+ platforms = platforms.darwin;
+ maintainers = [ maintainers.eraserhd ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/qes/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/qes/default.nix
new file mode 100644
index 000000000000..f231ee571677
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/qes/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, Carbon }:
+
+stdenv.mkDerivation {
+ pname = "qes";
+ version = "0.0.2";
+
+ src = fetchFromGitHub {
+ owner = "koekeishiya";
+ repo = "qes";
+ rev = "ddedf008f0c38b134501ad9f328447b671423d34"; # no tag
+ sha256 = "1w9ppid7jg6f4q7pq40lhm0whg7xmnxcmf3pb9xqfkq2zj2f7dxv";
+ };
+
+ buildInputs = [ Carbon ];
+
+ makeFlags = [ "BUILD_PATH=$(out)/bin" ];
+
+ meta = with stdenv.lib; {
+ description = "Quartz Event Synthesizer";
+ homepage = "https://github.com/koekeishiya/qes";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ lnl7 ];
+ license = licenses.mit;
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/reattach-to-user-namespace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/reattach-to-user-namespace/default.nix
new file mode 100644
index 000000000000..768ca6cf9c97
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/reattach-to-user-namespace/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "reattach-to-user-namespace";
+ version = "2.8";
+
+ src = fetchurl {
+ url = "https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/archive/v${version}.tar.gz";
+ sha256 = "0xxxdd26rcplhpvi2vy6crxadk3d1qkq4xry10lwq6dyya2jf6wb";
+ };
+
+ buildFlags = [ "ARCHES=x86_64" ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp reattach-to-user-namespace $out/bin/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A wrapper that provides access to the Mac OS X pasteboard service";
+ license = licenses.bsd2;
+ maintainers = with maintainers; [ lnl7 ];
+ platforms = platforms.darwin;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/default.nix
new file mode 100644
index 000000000000..d145c0d75d09
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, Carbon }:
+
+stdenv.mkDerivation rec {
+ pname = "skhd";
+ version = "0.3.5";
+
+ src = fetchFromGitHub {
+ owner = "koekeishiya";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "0x099979kgpim18r0vi9vd821qnv0rl3rkj0nd1nx3wljxgf7mrg";
+ };
+
+ buildInputs = [ Carbon ];
+
+ makeFlags = [ "BUILD_PATH=$(out)/bin" ];
+
+ postInstall = ''
+ mkdir -p $out/Library/LaunchDaemons
+ cp ${./org.nixos.skhd.plist} $out/Library/LaunchDaemons/org.nixos.skhd.plist
+ substituteInPlace $out/Library/LaunchDaemons/org.nixos.skhd.plist --subst-var out
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Simple hotkey daemon for macOS";
+ homepage = "https://github.com/koekeishiya/skhd";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ cmacrae lnl7 periklis ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/org.nixos.skhd.plist b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/org.nixos.skhd.plist
new file mode 100644
index 000000000000..e6624487740b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/skhd/org.nixos.skhd.plist
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.nixos.skhd</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@out@/bin/skhd</string>
+ </array>
+ <key>ProcessType</key>
+ <string>Interactive</string>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>PATH</key>
+ <string>@out@/bin:/nix/var/nix/profiles/default/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
+ </dict>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <true/>
+</dict>
+</plist>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/smimesign/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/smimesign/default.nix
new file mode 100644
index 000000000000..6b7e38891619
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/smimesign/default.nix
@@ -0,0 +1,25 @@
+{ buildGoModule, fetchFromGitHub, lib }:
+
+buildGoModule rec {
+ pname = "smimesign";
+ version = "0.1.0";
+
+ src = fetchFromGitHub {
+ owner = "github";
+ repo = "smimesign";
+ rev = "v${version}";
+ sha256 = "12f8vprp4v78l9ifrlql0mvpyw5qa8nlrh5ajq5js8wljzpx7wsv";
+ };
+
+ vendorSha256 = "1cldxykm9qj5rvyfafam45y5xj4f19700s2f9w7ndhxgfp9vahvz";
+
+ buildFlagsArray = "-ldflags=-X main.versionString=v${version}";
+
+ meta = with lib; {
+ description = "An S/MIME signing utility for macOS and Windows that is compatible with Git";
+ homepage = "https://github.com/github/smimesign";
+ license = licenses.mit;
+ platforms = platforms.darwin ++ platforms.windows;
+ maintainers = [ maintainers.enorris ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/spacebar/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/spacebar/default.nix
new file mode 100644
index 000000000000..7af7e408223a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/spacebar/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, Carbon, Cocoa, ScriptingBridge }:
+
+stdenv.mkDerivation rec {
+ pname = "spacebar";
+ version = "1.1.1";
+
+ src = fetchFromGitHub {
+ owner = "cmacrae";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1x0wzm380nv81j26jqqg4y4dwanydnpdsca41ndw6xyj9zlv73f7";
+ };
+
+ buildInputs = [ Carbon Cocoa ScriptingBridge ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1/
+ cp ./bin/spacebar $out/bin/spacebar
+ cp ./doc/spacebar.1 $out/share/man/man1/spacebar.1
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A minimal status bar for macOS";
+ homepage = "https://github.com/cmacrae/spacebar";
+ platforms = platforms.darwin;
+ maintainers = [ maintainers.cmacrae ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/stubs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/stubs/default.nix
new file mode 100644
index 000000000000..6fedf0a451e3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/stubs/default.nix
@@ -0,0 +1,15 @@
+{ stdenv, writeScriptBin, runtimeShell }:
+
+let fake = name: stdenv.lib.overrideDerivation (writeScriptBin name ''
+ #!${runtimeShell}
+ echo >&2 "Faking call to ${name} with arguments:"
+ echo >&2 "$@"
+'') (drv: {
+ name = "${name}-stub";
+}); in
+
+{
+ setfile = fake "SetFile";
+ rez = fake "Rez";
+ derez = fake "DeRez";
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
new file mode 100644
index 000000000000..059cb70bfbd5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
@@ -0,0 +1,114 @@
+{ stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU }:
+
+let
+ # 10.12 adds a new sysdir.h that our version of CF in the main derivation depends on, but
+ # isn't available publicly, so instead we grab an older version of the same file that did
+ # not use sysdir.h, but provided the same functionality. Luckily it's simple :) hack hack
+ sysdir-free-system-directories = fetchurl {
+ url = "https://raw.githubusercontent.com/apple/swift-corelibs-foundation/9a5d8420f7793e63a8d5ec1ede516c4ebec939f0/CoreFoundation/Base.subproj/CFSystemDirectories.c";
+ sha256 = "0krfyghj4f096arvvpf884ra5czqlmbrgf8yyc0b3avqmb613pcc";
+ };
+in
+
+stdenv.mkDerivation {
+ name = "swift-corefoundation";
+
+ src = fetchFromGitHub {
+ owner = "apple";
+ repo = "swift-corelibs-foundation";
+ rev = "71aaba20e1450a82c516af1342fe23268e15de0a";
+ sha256 = "17kpql0f27xxz4jjw84vpas5f5sn4vdqwv10g151rc3rswbwln1z";
+ };
+
+ nativeBuildInputs = [ ninja python3 ];
+ buildInputs = [ curl libxml2 objc4 ICU ];
+
+ sourceRoot = "source/CoreFoundation";
+
+ patchPhase = ''
+ cp ${sysdir-free-system-directories} Base.subproj/CFSystemDirectories.c
+
+ # In order, since I can't comment individual lines:
+ # 1. Disable dispatch support for now
+ # 2. For the linker too
+ # 3. Use the legit CoreFoundation.h, not the one telling you not to use it because of Swift
+ substituteInPlace build.py \
+ --replace "cf.CFLAGS += '-DDEPLOYMENT" '#' \
+ --replace "cf.LDFLAGS += '-ldispatch" '#'
+
+ # Fix sandbox impurities.
+ substituteInPlace ../lib/script.py \
+ --replace '/bin/cp' cp
+
+ # Includes xpc for some initialization routine that they don't define anyway, so no harm here
+ substituteInPlace PlugIn.subproj/CFBundlePriv.h \
+ --replace '#if (TARGET_OS_MAC' '#if (0'
+
+ # Why do we define __GNU__? Is that normal?
+ substituteInPlace Base.subproj/CFAsmMacros.h \
+ --replace '#if defined(__GNU__) ||' '#if 0 &&'
+
+ # The MIN macro doesn't seem to be defined sensibly for us. Not sure if our stdenv or their bug
+ substituteInPlace Base.subproj/CoreFoundation_Prefix.h \
+ --replace '#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX' '#if 1'
+
+ # Somehow our ICU doesn't have this, probably because it's too old (we'll update it soon when we update the rest of the SDK)
+ substituteInPlace Locale.subproj/CFLocale.c \
+ --replace '#if U_ICU_VERSION_MAJOR_NUM' '#if 0 //'
+ '';
+
+ BUILD_DIR = "./Build";
+ CFLAGS = "-DINCLUDE_OBJC -I${libxml2.dev}/include/libxml2"; # They seem to assume we include objc in some places and not in others, make a PR; also not sure why but libxml2 include path isn't getting picked up from buildInputs
+
+ # I'm guessing at the version here. https://github.com/apple/swift-corelibs-foundation/commit/df3ec55fe6c162d590a7653d89ad669c2b9716b1 imported "high sierra"
+ # and this version is a version from there. No idea how accurate it is.
+ LDFLAGS = "-current_version 1454.90.0 -compatibility_version 150.0.0 -init ___CFInitialize";
+
+ configurePhase = ''
+ ../configure release --sysroot UNUSED
+ '';
+
+ enableParallelBuilding = true;
+
+ # FIXME: Workaround for intermittent build failures of CFRuntime.c.
+ # Based on testing this issue seems to only occur with clang_7, so
+ # please remove this when updating the default llvm versions to 8 or
+ # later.
+ buildPhase = stdenv.lib.optionalString true ''
+ for i in {1..512}; do
+ if ninja -j $NIX_BUILD_CORES; then
+ break
+ fi
+
+ echo >&2
+ echo "[$i/512] retrying build, workaround for #66811" >&2
+ echo " With clang_7 the build of CFRuntime.c fails intermittently." >&2
+ echo " See https://github.com/NixOS/nixpkgs/issues/66811 for more details." >&2
+ echo >&2
+ continue
+ done
+ '';
+
+ # TODO: their build system sorta kinda can do this, but it doesn't seem to work right now
+ # Also, this includes a bunch of private headers in the framework, which is not what we want
+ installPhase = ''
+ base="$out/Library/Frameworks/CoreFoundation.framework"
+ mkdir -p $base/Versions/A/{Headers,PrivateHeaders,Modules}
+
+ cp ./Build/CoreFoundation/libCoreFoundation.dylib $base/Versions/A/CoreFoundation
+
+ # Note that this could easily live in the ldflags above as `-install_name @rpath/...` but
+ # https://github.com/NixOS/nixpkgs/issues/46434 thwarts that, so for now I'm hacking it up
+ # after the fact.
+ install_name_tool -id '@rpath/CoreFoundation.framework/Versions/A/CoreFoundation' $base/Versions/A/CoreFoundation
+
+ cp ./Build/CoreFoundation/usr/include/CoreFoundation/*.h $base/Versions/A/Headers
+ cp ./Build/CoreFoundation/usr/include/CoreFoundation/module.modulemap $base/Versions/A/Modules
+
+ ln -s A $base/Versions/Current
+
+ for i in CoreFoundation Headers Modules; do
+ ln -s Versions/Current/$i $base/$i
+ done
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/libdispatch.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/libdispatch.nix
new file mode 100644
index 000000000000..bd143b6071ba
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/swift-corelibs/libdispatch.nix
@@ -0,0 +1,12 @@
+{ stdenv, fetchFromGitHub, cmake, apple_sdk_sierra, xnu-new }:
+
+stdenv.mkDerivation rec {
+ name = "swift-corelibs-libdispatch";
+ src = fetchFromGitHub {
+ owner = "apple";
+ repo = name;
+ rev = "f83b5a498bad8e9ff8916183cf6e8ccf677c346b";
+ sha256 = "1czkyyc9llq2mnqfp19mzcfsxzas0y8zrk0gr5hg60acna6jkz2l";
+ };
+ buildInputs = [ cmake apple_sdk_sierra.sdk xnu-new ];
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/default.nix
new file mode 100644
index 000000000000..205391a52dab
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, perl, AppKit, Cocoa, ScriptingBridge }:
+
+stdenv.mkDerivation rec {
+ version = "0.9.2";
+ pname = "trash";
+
+ src = fetchFromGitHub {
+ owner = "ali-rantakari";
+ repo = "trash";
+ rev = "v${version}";
+ sha256 = "1d3rc03vgz32faj7qi18iiggxvxlqrj9lsk5jkpa9r1mcs5d89my";
+ };
+
+ buildInputs = [ perl Cocoa AppKit ScriptingBridge ];
+
+ patches = [ ./trash.diff ];
+
+ buildPhase = ''make all docs'';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1
+ install -m 0755 trash $out/bin
+ install -m 0444 trash.1 $out/share/man/man1
+ '';
+
+ meta = {
+ homepage = "https://github.com/ali-rantakari/trash";
+ description = "Small command-line program for OS X that moves files or
+ folders to the trash.";
+ platforms = stdenv.lib.platforms.darwin;
+ license = stdenv.lib.licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff
new file mode 100644
index 000000000000..fa6edf98b3de
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 5e4306f..9c975fc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,7 +10,7 @@ trash: $(SOURCE_FILES)
+ @echo
+ @echo ---- Compiling:
+ @echo ======================================
+- $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
++ $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
+
+ analyze:
+ @echo
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/usr-include/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/usr-include/default.nix
new file mode 100644
index 000000000000..4fef1388764d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/usr-include/default.nix
@@ -0,0 +1,23 @@
+{stdenv, darwin}:
+
+/*
+ * This is needed to build GCC on Darwin.
+ *
+ * These are the collection of headers that would normally be available under
+ * /usr/include in macOS machines with command line tools installed. They need
+ * to be in one folder for gcc to use them correctly.
+ */
+
+stdenv.mkDerivation {
+ name = "darwin-usr-include";
+ buildInputs = [ darwin.CF stdenv.libc ];
+ buildCommand = ''
+ mkdir -p $out
+ cd $out
+ ln -sf ${stdenv.libc}/include/* .
+ mkdir CoreFoundation
+ ln -sf ${darwin.CF}/Library/Frameworks/CoreFoundation.framework/Headers/* CoreFoundation
+ '';
+
+ meta.platforms = stdenv.lib.platforms.darwin;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/wifi-password/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/wifi-password/default.nix
new file mode 100644
index 000000000000..2dfc97dec1bd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/wifi-password/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ version = "0.1.0";
+ pname = "wifi-password";
+
+ src = fetchFromGitHub {
+ owner = "rauchg";
+ repo = pname;
+ rev = version;
+ sha256 = "0sfvb40h7rz9jzp4l9iji3jg80paklqsbmnk5h7ipsv2xbsplp64";
+ };
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp wifi-password.sh $out/bin/wifi-password
+ '';
+
+ meta = {
+ homepage = "https://github.com/rauchg/wifi-password";
+ description = "Get the password of the wifi you're on";
+ platforms = stdenv.lib.platforms.darwin;
+ license = stdenv.lib.licenses.mit;
+ maintainers = [ stdenv.lib.maintainers.nikitavoloboev ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix
new file mode 100644
index 000000000000..34e3b2dfeeae
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, requireFile, lib }:
+
+let requireXcode = version: sha256:
+ let
+ xip = "Xcode_" + version + ".xip";
+ # TODO(alexfmpe): Find out how to validate the .xip signature in Linux
+ unxip = if stdenv.isDarwin
+ then ''
+ open -W ${xip}
+ rm -rf ${xip}
+ ''
+ else ''
+ xar -xf ${xip}
+ rm -rf ${xip}
+ pbzx -n Content | cpio -i
+ rm Content Metadata
+ '';
+ app = requireFile rec {
+ name = "Xcode.app";
+ url = "https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_${version}/${xip}";
+ hashMode = "recursive";
+ inherit sha256;
+ message = ''
+ Unfortunately, we cannot download ${name} automatically.
+ Please go to ${url}
+ to download it yourself, and add it to the Nix store by running the following commands.
+ Note: download (~ 5GB), extraction and storing of Xcode will take a while
+
+ ${unxip}
+ nix-store --add-fixed --recursive sha256 Xcode.app
+ rm -rf Xcode.app
+ '';
+ };
+ meta = with stdenv.lib; {
+ homepage = "https://developer.apple.com/downloads/";
+ description = "Apple's XCode SDK";
+ license = licenses.unfree;
+ platforms = platforms.darwin ++ platforms.linux;
+ };
+
+ in app.overrideAttrs ( oldAttrs: oldAttrs // { inherit meta; });
+
+in lib.makeExtensible (self: {
+ xcode_8_1 = requireXcode "8.1" "18xjvfipwzia66gm3r9p770xdd4r375vak7chw5vgqnv9yyjiq2n";
+ xcode_8_2 = requireXcode "8.2" "13nd1zsfqcp9hwp15hndr0rsbb8rgprrz7zr2ablj4697qca06m2";
+ xcode_9_1 = requireXcode "9.1" "0ab1403wy84ys3yn26fj78cazhpnslmh3nzzp1wxib3mr1afjvic";
+ xcode_9_2 = requireXcode "9.2" "1bgfgdp266cbbqf2axcflz92frzvhi0qw0jdkcw6r85kdpc8dj4c";
+ xcode_9_3 = requireXcode "9.3" "12m9kb4759s2ky42b1vf7y38qqxn2j99s99adzc6ljnmy26ii12w";
+ xcode_9_4 = requireXcode "9.4" "00az1cf9pm8zmvzs6yq04prdmxp8xi3ymxw94jjh4mh7hlbkhcb7";
+ xcode_9_4_1 = requireXcode "9.4.1" "0y9kphj86c14jl6aibv57sd7ln0w06vdhzm8ysp0s98rfgyq2lbw";
+ xcode_10_1 = requireXcode "10.1" "1ssdbg4v8r11fjf4jl38pwyry2aia1qihbxyxapz0v0n5gfnp05v";
+ xcode_10_2 = requireXcode "10.2" "1xzybl1gvb3q5qwlwchanzpws4sb70i3plf0vrzvlfdp2hsb3pg7";
+ xcode_10_2_1 = requireXcode "10.2.1" "11sdb54nr0x7kp987qq839x6k5gdx7vqdxjiy5xm5279n1n47bmg";
+ xcode_10_3 = requireXcode "10.3" "1i628vfn6zad81fsz3zpc6z15chhskvyp8qnajp2wnpzvrwl6ngb";
+ xcode_11 = requireXcode "11" "1r03j3kkp4blfp2kqpn538w3dx57ms930fj8apjkq6dk7fv3jcqh";
+ xcode_11_3_1 = requireXcode "11.3.1" "1p6nicj91kr6ad3rmycahd1i7z4hj7ccjs93ixsiximjzaahx3q4";
+ xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (stdenv.targetPlatform ? xcodeVer) then stdenv.targetPlatform.xcodeVer else "11.3.1")}";
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
new file mode 100644
index 000000000000..45e1f1eab4fa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
@@ -0,0 +1,77 @@
+{ targetPlatform
+, clang-unwrapped
+, binutils-unwrapped
+, runCommand
+, stdenv
+, wrapBintoolsWith
+, wrapCCWith
+, buildIosSdk, targetIosSdkPkgs
+, xcode
+, lib
+}:
+
+let
+
+minSdkVersion = targetPlatform.minSdkVersion or "9.0";
+
+iosPlatformArch = { parsed, ... }: {
+ armv7a = "armv7";
+ aarch64 = "arm64";
+ x86_64 = "x86_64";
+}.${parsed.cpu.name};
+
+in
+
+rec {
+ sdk = rec {
+ name = "ios-sdk";
+ type = "derivation";
+ outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk";
+
+ platform = targetPlatform.xcodePlatform;
+ version = targetPlatform.sdkVer;
+ };
+
+ binutils = wrapBintoolsWith {
+ libc = targetIosSdkPkgs.libraries;
+ bintools = binutils-unwrapped;
+ extraBuildCommands = ''
+ echo "-arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/libc-ldflags
+ '' + stdenv.lib.optionalString (sdk.platform == "iPhoneSimulator") ''
+ echo "-platform_version ios-sim ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
+ '' + stdenv.lib.optionalString (sdk.platform == "iPhoneOS") ''
+ echo "-platform_version ios ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags
+ '';
+ };
+
+ clang = (wrapCCWith {
+ cc = clang-unwrapped;
+ bintools = binutils;
+ libc = targetIosSdkPkgs.libraries;
+ extraPackages = [ "${sdk}/System" ];
+ extraBuildCommands = ''
+ tr '\n' ' ' < $out/nix-support/cc-cflags > cc-cflags.tmp
+ mv cc-cflags.tmp $out/nix-support/cc-cflags
+ echo "-target ${targetPlatform.config} -arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/cc-cflags
+ echo "-isystem ${sdk}/usr/include${lib.optionalString (lib.versionAtLeast "10" sdk.version) " -isystem ${sdk}/usr/include/c++/4.2.1/ -stdlib=libstdc++"}" >> $out/nix-support/cc-cflags
+ '' + stdenv.lib.optionalString (sdk.platform == "iPhoneSimulator") ''
+ echo "-mios-simulator-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags
+ '' + stdenv.lib.optionalString (sdk.platform == "iPhoneOS") ''
+ echo "-miphoneos-version-min=${minSdkVersion}" >> $out/nix-support/cc-cflags
+ '';
+ }) // {
+ inherit sdk;
+ };
+
+ libraries = let sdk = buildIosSdk; in runCommand "libSystem-prebuilt" {
+ passthru = {
+ inherit sdk;
+ };
+ } ''
+ if ! [ -d ${sdk} ]; then
+ echo "You must have version ${sdk.version} of the ${sdk.platform} sdk installed at ${sdk}" >&2
+ exit 1
+ fi
+ ln -s ${sdk}/usr $out
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/yabai/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/yabai/default.nix
new file mode 100644
index 000000000000..742a3948707e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/darwin/yabai/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, Carbon, Cocoa, ScriptingBridge, xxd }:
+
+stdenv.mkDerivation rec {
+ pname = "yabai";
+ version = "3.3.0";
+
+ src = fetchFromGitHub {
+ owner = "koekeishiya";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "0y4idivqkmi3xsc8yjdzh1b15qzgyqlw7ifs26v3dc91lkjhfc4x";
+ };
+
+ buildInputs = [ Carbon Cocoa ScriptingBridge xxd ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1/
+ cp ./bin/yabai $out/bin/yabai
+ cp ./doc/yabai.1 $out/share/man/man1/yabai.1
+ '';
+
+ meta = with stdenv.lib; {
+ description = ''
+ A tiling window manager for macOS based on binary space partitioning
+ '';
+ homepage = "https://github.com/koekeishiya/yabai";
+ platforms = platforms.darwin;
+ maintainers = with maintainers; [ cmacrae shardy ];
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix
new file mode 100644
index 000000000000..906ea04293fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+ name = "915resolution-0.5.3";
+
+ src = fetchurl {
+ url = "http://915resolution.mango-lang.org/${name}.tar.gz";
+ sha256 = "0hmmy4kkz3x6yigz6hk99416ybznd67dpjaxap50nhay9f1snk5n";
+ };
+
+ patchPhase = "rm *.o";
+ installPhase = "mkdir -p $out/sbin; cp 915resolution $out/sbin/";
+
+ meta = with stdenv.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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi-call/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi-call/default.nix
new file mode 100644
index 000000000000..bb3aef885a7c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi-call/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ pname = "acpi-call";
+ version = "2020-04-07-${kernel.version}";
+
+ src = fetchFromGitHub {
+ owner = "nix-community";
+ repo = "acpi_call";
+ rev = "3d7c9fe5ed3fc5ed5bafd39d54b1fdc7a09ce710";
+ sha256 = "09kp8zl392h99wjwzqrdw2xcfnsc944hzmfwi8n1y7m2slpdybv3";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ 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 stdenv.lib; {
+ maintainers = with maintainers; [ raskin mic92 ];
+ inherit (src.meta) homepage;
+ platforms = platforms.linux;
+ description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi/default.nix
new file mode 100644
index 000000000000..69a36d7bf52b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpi/default.nix
@@ -0,0 +1,25 @@
+{ 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 stdenv.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 = stdenv.lib.licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpid/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpid/default.nix
new file mode 100644
index 000000000000..5ef5e2724b23
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpid/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ name = "acpid-2.0.32";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/acpid2/${name}.tar.xz";
+ sha256 = "0zhmxnhnhg4v1viw82yjr22kram6k5k1ixznhayk8cnw7q5x7lpj";
+ };
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ # remove when https://sourceforge.net/p/acpid2/code/merge-requests/1/ is merged
+ postPatch = ''
+ substituteInPlace configure.ac \
+ --replace "AC_FUNC_MALLOC" "" \
+ --replace "AC_FUNC_REALLOC" "" \
+ --replace "strrchr strtol" "strrchr strtol malloc realloc"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://sourceforge.net/projects/acpid2/";
+ description = "A daemon for delivering ACPI events to userspace programs";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix
new file mode 100644
index 000000000000..9f2ad5b5c03b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix
@@ -0,0 +1,51 @@
+{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 {
+ name = "acpitool-0.5.1";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/acpitool/${name}.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 = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.guibert ];
+ platforms = stdenv.lib.platforms.unix;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/afuse/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/afuse/default.nix
new file mode 100644
index 000000000000..758c57bb9e13
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/afuse/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, fuse }:
+
+stdenv.mkDerivation {
+ name = "afuse-0.4.1";
+
+ src = fetchurl {
+ url = "https://github.com/pcarrier/afuse/archive/v0.4.1.tar.gz";
+ sha256 = "1sfhicmxppkvdd4z9klfn63snb71gr9hff6xij1gzk94xg6m0ycc";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ fuse ];
+
+ meta = {
+ description = "Automounter in userspace";
+ homepage = "https://github.com/pcarrier/afuse";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ stdenv.lib.maintainers.marcweber ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/cross.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/cross.patch
new file mode 100644
index 000000000000..989ccea2b984
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/cross.patch
@@ -0,0 +1,347 @@
+--- a/hdsploader/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/hdsploader/Makefile.am 2019-06-28 00:43:41.557803832 +0800
+@@ -32,5 +32,14 @@
+ tobin.c
+ CLEANFILES = $(dsp_hex_files)
+
+-$(dsp_hex_files): tobin
+- ./tobin
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(tobin_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(tobin_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(tobin_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++tobin$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(dsp_hex_files): tobin$(BUILD_EXEEXT)
++ ./$<
+--- a/m4/ax_prog_cc_for_build.m4 2019-06-27 15:50:02.274134717 +0800
++++ b/m4/ax_prog_cc_for_build.m4 2019-06-28 01:32:45.088117432 +0800
+@@ -0,0 +1,125 @@
++# ===========================================================================
++# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
++# ===========================================================================
++#
++# SYNOPSIS
++#
++# AX_PROG_CC_FOR_BUILD
++#
++# DESCRIPTION
++#
++# This macro searches for a C compiler that generates native executables,
++# that is a C compiler that surely is not a cross-compiler. This can be
++# useful if you have to generate source code at compile-time like for
++# example GCC does.
++#
++# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
++# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
++# The value of these variables can be overridden by the user by specifying
++# a compiler with an environment variable (like you do for standard CC).
++#
++# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
++# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
++# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
++# substituted in the Makefile.
++#
++# LICENSE
++#
++# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
++#
++# Copying and distribution of this file, with or without modification, are
++# permitted in any medium without royalty provided the copyright notice
++# and this notice are preserved. This file is offered as-is, without any
++# warranty.
++
++#serial 9
++
++AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
++AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
++AC_REQUIRE([AC_PROG_CC])dnl
++AC_REQUIRE([AC_PROG_CPP])dnl
++AC_REQUIRE([AC_EXEEXT])dnl
++AC_REQUIRE([AC_CANONICAL_HOST])dnl
++
++dnl Use the standard macros, but make them use other variable names
++dnl
++pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
++pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
++pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
++pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
++pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
++pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
++pushdef([ac_cv_objext], ac_cv_build_objext)dnl
++pushdef([ac_exeext], ac_build_exeext)dnl
++pushdef([ac_objext], ac_build_objext)dnl
++pushdef([CC], CC_FOR_BUILD)dnl
++pushdef([CPP], CPP_FOR_BUILD)dnl
++pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
++pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
++pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
++pushdef([host], build)dnl
++pushdef([host_alias], build_alias)dnl
++pushdef([host_cpu], build_cpu)dnl
++pushdef([host_vendor], build_vendor)dnl
++pushdef([host_os], build_os)dnl
++pushdef([ac_cv_host], ac_cv_build)dnl
++pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
++pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
++pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
++pushdef([ac_cv_host_os], ac_cv_build_os)dnl
++pushdef([ac_cpp], ac_build_cpp)dnl
++pushdef([ac_compile], ac_build_compile)dnl
++pushdef([ac_link], ac_build_link)dnl
++
++save_cross_compiling=$cross_compiling
++save_ac_tool_prefix=$ac_tool_prefix
++cross_compiling=no
++ac_tool_prefix=
++
++AC_PROG_CC
++AC_PROG_CPP
++AC_EXEEXT
++
++ac_tool_prefix=$save_ac_tool_prefix
++cross_compiling=$save_cross_compiling
++
++dnl Restore the old definitions
++dnl
++popdef([ac_link])dnl
++popdef([ac_compile])dnl
++popdef([ac_cpp])dnl
++popdef([ac_cv_host_os])dnl
++popdef([ac_cv_host_vendor])dnl
++popdef([ac_cv_host_cpu])dnl
++popdef([ac_cv_host_alias])dnl
++popdef([ac_cv_host])dnl
++popdef([host_os])dnl
++popdef([host_vendor])dnl
++popdef([host_cpu])dnl
++popdef([host_alias])dnl
++popdef([host])dnl
++popdef([LDFLAGS])dnl
++popdef([CPPFLAGS])dnl
++popdef([CFLAGS])dnl
++popdef([CPP])dnl
++popdef([CC])dnl
++popdef([ac_objext])dnl
++popdef([ac_exeext])dnl
++popdef([ac_cv_objext])dnl
++popdef([ac_cv_exeext])dnl
++popdef([ac_cv_prog_cc_g])dnl
++popdef([ac_cv_prog_cc_cross])dnl
++popdef([ac_cv_prog_cc_works])dnl
++popdef([ac_cv_prog_gcc])dnl
++popdef([ac_cv_prog_CPP])dnl
++
++dnl Finally, set Makefile variables
++dnl
++BUILD_EXEEXT=$ac_build_exeext
++BUILD_OBJEXT=$ac_build_objext
++AC_SUBST(BUILD_EXEEXT)dnl
++AC_SUBST(BUILD_OBJEXT)dnl
++AC_SUBST([CFLAGS_FOR_BUILD])dnl
++AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
++AC_SUBST([LDFLAGS_FOR_BUILD])dnl
++])
+--- a/configure.ac 2019-06-27 23:58:31.045413144 +0800
++++ b/configure.ac 2019-06-28 01:45:36.511771656 +0800
+@@ -1,6 +1,8 @@
+ AC_PREREQ(2.59)
+ AC_INIT(alsa-firmware, 1.0.29)
++AC_CONFIG_MACRO_DIR([m4])
+ AC_PROG_CC
++AC_PROG_CC_FOR_BUILD
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+ AC_HEADER_STDC
+--- a/vxloader/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/vxloader/Makefile.am 2019-06-28 01:55:19.525947146 +0800
+@@ -43,5 +43,14 @@
+ hotplugfw_DATA =
+ endif
+
+-%.xlx: %.rbt toxlx
+- ./toxlx < $< > $@
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(toxlx_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(toxlx_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(toxlx_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++toxlx$(BUILD_EXEEXT): $(toxlx_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++%.xlx: %.rbt toxlx$(BUILD_EXEEXT)
++ ./toxlx$(BUILD_EXEEXT) < $< > $@
+--- a/echoaudio/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/echoaudio/Makefile.am 2019-06-28 02:00:00.579426080 +0800
+@@ -74,33 +74,42 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer DSP/LoaderDSP.c loader_dsp.fw
+- ./fw_writer DSP/Darla20DSP.c darla20_dsp.fw
+- ./fw_writer DSP/Gina20DSP.c gina20_dsp.fw
+- ./fw_writer DSP/Layla20DSP.c layla20_dsp.fw
+- ./fw_writer ASIC/LaylaASIC.c layla20_asic.fw
+- ./fw_writer DSP/Darla24DSP.c darla24_dsp.fw
+- ./fw_writer DSP/Gina24DSP.c gina24_301_dsp.fw
+- ./fw_writer ASIC/Gina24ASIC.c gina24_301_asic.fw
+- ./fw_writer DSP/Gina24_361DSP.c gina24_361_dsp.fw
+- ./fw_writer ASIC/Gina24ASIC_361.c gina24_361_asic.fw
+- ./fw_writer DSP/Layla24DSP.c layla24_dsp.fw
+- ./fw_writer ASIC/Layla24_1ASIC.c layla24_1_asic.fw
+- ./fw_writer ASIC/Layla24_2A_ASIC.c layla24_2A_asic.fw
+- ./fw_writer ASIC/Layla24_2S_ASIC.c layla24_2S_asic.fw
+- ./fw_writer DSP/MonaDSP.c mona_301_dsp.fw
+- ./fw_writer ASIC/Mona1ASIC48.c mona_301_1_asic_48.fw
+- ./fw_writer ASIC/Mona1ASIC96.c mona_301_1_asic_96.fw
+- ./fw_writer DSP/Mona361DSP.c mona_361_dsp.fw
+- ./fw_writer ASIC/Mona1ASIC48_361.c mona_361_1_asic_48.fw
+- ./fw_writer ASIC/Mona1ASIC96_361.c mona_361_1_asic_96.fw
+- ./fw_writer ASIC/Mona2ASIC.c mona_2_asic.fw
+- ./fw_writer DSP/MiaDSP.c mia_dsp.fw
+- ./fw_writer DSP/Echo3gDSP.c echo3g_dsp.fw
+- ./fw_writer ASIC/3G_ASIC.c 3g_asic.fw
+- ./fw_writer DSP/IndigoDSP.c indigo_dsp.fw
+- ./fw_writer DSP/IndigoIODSP.c indigo_io_dsp.fw
+- ./fw_writer DSP/IndigoIOxDSP.c indigo_iox_dsp.fw
+- ./fw_writer DSP/IndigoDJDSP.c indigo_dj_dsp.fw
+- ./fw_writer DSP/IndigoDJxDSP.c indigo_djx_dsp.fw
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT) DSP/LoaderDSP.c loader_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Darla20DSP.c darla20_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Gina20DSP.c gina20_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Layla20DSP.c layla20_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/LaylaASIC.c layla20_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Darla24DSP.c darla24_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Gina24DSP.c gina24_301_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Gina24ASIC.c gina24_301_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Gina24_361DSP.c gina24_361_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Gina24ASIC_361.c gina24_361_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Layla24DSP.c layla24_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Layla24_1ASIC.c layla24_1_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Layla24_2A_ASIC.c layla24_2A_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Layla24_2S_ASIC.c layla24_2S_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/MonaDSP.c mona_301_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Mona1ASIC48.c mona_301_1_asic_48.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Mona1ASIC96.c mona_301_1_asic_96.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Mona361DSP.c mona_361_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Mona1ASIC48_361.c mona_361_1_asic_48.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Mona1ASIC96_361.c mona_361_1_asic_96.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/Mona2ASIC.c mona_2_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/MiaDSP.c mia_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/Echo3gDSP.c echo3g_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) ASIC/3G_ASIC.c 3g_asic.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/IndigoDSP.c indigo_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/IndigoIODSP.c indigo_io_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/IndigoIOxDSP.c indigo_iox_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/IndigoDJDSP.c indigo_dj_dsp.fw
++ ./fw_writer$(BUILD_EXEEXT) DSP/IndigoDJxDSP.c indigo_djx_dsp.fw
+--- a/emu/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/emu/Makefile.am 2019-06-28 02:01:37.856710042 +0800
+@@ -22,5 +22,14 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT)
+--- a/maestro3/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/maestro3/Makefile.am 2019-06-28 02:03:13.704828106 +0800
+@@ -17,5 +17,14 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT)
+--- a/sb16/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/sb16/Makefile.am 2019-06-28 02:04:37.121743871 +0800
+@@ -18,5 +18,14 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT)
+--- a/wavefront/Makefile.am 2019-06-28 02:07:27.003727160 +0800
++++ b/wavefront/Makefile.am 2019-06-28 02:07:46.477947626 +0800
+@@ -17,5 +17,14 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT)
+--- a/ymfpci/Makefile.am 2015-02-26 20:36:03.000000000 +0800
++++ b/ymfpci/Makefile.am 2019-06-28 02:09:02.487797826 +0800
+@@ -17,5 +17,14 @@
+ hotplugfw_DATA =
+ endif
+
+-$(firmware_files): fw_writer
+- ./fw_writer
++LINK_FOR_BUILD.c = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(TARGET_ARCH_FOR_BUILD)
++
++$(fw_writer_OBJECTS) : CC=$(CC_FOR_BUILD)
++$(fw_writer_OBJECTS) : CFLAGS=$(CFLAGS_FOR_BUILD)
++$(fw_writer_OBJECTS) : CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++
++fw_writer$(BUILD_EXEEXT): $(tobin_OBJECTS)
++ $(LINK_FOR_BUILD.c) $^ $(LOADLIBES_FOR_BUILD) $(LDLIBS_FOR_BUILD) -o $@
++
++$(firmware_files): fw_writer$(BUILD_EXEEXT)
++ ./fw_writer$(BUILD_EXEEXT)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/default.nix
new file mode 100644
index 000000000000..01955534bfc7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-firmware/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, buildPackages, autoreconfHook, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ name = "alsa-firmware-1.2.1";
+
+ src = fetchurl {
+ url = "mirror://alsa/firmware/${name}.tar.bz2";
+ sha256 = "1aq8z8ajpjvcx7bwhwp36bh5idzximyn77ygk3ifs0my3mbpr8mf";
+ };
+
+ patches = [ (fetchpatch {
+ url = "https://github.com/alsa-project/alsa-firmware/commit/a8a478485a999ff9e4a8d8098107d3b946b70288.patch";
+ sha256 = "0zd7vrgz00hn02va5bkv7qj2395a1rl6f8jq1mwbryxs7hiysb78";
+ }) ];
+
+ nativeBuildInputs = [ autoreconfHook buildPackages.stdenv.cc ];
+
+ 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 = {
+ homepage = "http://www.alsa-project.org/";
+ description = "Soundcard firmwares from the alsa project";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/alsa-plugin-conf-multilib.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/alsa-plugin-conf-multilib.patch
new file mode 100644
index 000000000000..b17df9a492e5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/alsa-plugin-conf-multilib.patch
@@ -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) {
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/default.nix
new file mode 100644
index 000000000000..3c5427340baf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-lib/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, alsa-ucm-conf, alsa-topology-conf }:
+
+stdenv.mkDerivation rec {
+ name = "alsa-lib-1.2.3";
+
+ src = fetchurl {
+ url = "mirror://alsa/lib/${name}.tar.bz2";
+ sha256 = "13k7dx1g749z74rz71hs5j8z0pqdjgx7l69pn0vsy7jizhi0kw02";
+ };
+
+ patches = [
+ ./alsa-plugin-conf-multilib.patch
+ ];
+
+ enableParallelBuilding = true;
+
+ # Fix pcm.h file in order to prevent some compilation bugs
+ postPatch = ''
+ sed -i -e 's|//int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);|/\*int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);\*/|' include/pcm.h
+ '';
+
+ 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 stdenv.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.gpl3Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-oss/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-oss/default.nix
new file mode 100644
index 000000000000..774dc3d8d676
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-oss/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, alsaLib, 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 = [ alsaLib ncurses libsamplerate ];
+ nativeBuildInputs = [ gettext ];
+
+ configureFlags = [ "--disable-xmlto" ];
+
+ installFlags = [ "ASOUND_STATE_DIR=$(TMPDIR)/dummy" ];
+
+ meta = with stdenv.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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/default.nix
new file mode 100644
index 000000000000..a69d86c5c4d6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, lib, pkgconfig, alsaLib, libogg, libpulseaudio ? null, libjack2 ? null }:
+
+stdenv.mkDerivation rec {
+ pname = "alsa-plugins";
+ version = "1.2.2";
+
+ src = fetchurl {
+ url = "mirror://alsa/plugins/${pname}-${version}.tar.bz2";
+ sha256 = "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+
+ # ToDo: a52, etc.?
+ buildInputs =
+ [ alsaLib 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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/wrapper.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/wrapper.nix
new file mode 100644
index 000000000000..8271088a5016
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-plugins/wrapper.nix
@@ -0,0 +1,4 @@
+{ writeShellScriptBin, stdenv, alsaPlugins }:
+writeShellScriptBin "ap${if stdenv.hostPlatform.system == "i686-linux" then "32" else "64"}" ''
+ ALSA_PLUGIN_DIRS=${alsaPlugins}/lib/alsa-lib "$@"
+''
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-tools/default.nix
new file mode 100644
index 000000000000..2fef5e07c63c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-tools/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, alsaLib, pkgconfig, 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.2";
+
+ src = fetchurl {
+ url = "mirror://alsa/tools/${pname}-${version}.tar.bz2";
+ sha256 = "0jbkjmq038zapj66a7nkppdf644v2mwj581xbmh6k4i8w6mcglxz";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ alsaLib 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 stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-topology-conf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-topology-conf/default.nix
new file mode 100644
index 000000000000..54340d017ade
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-topology-conf/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "alsa-topology-conf-${version}";
+ version = "1.2.3";
+
+ src = fetchurl {
+ url = "mirror://alsa/lib/${name}.tar.bz2";
+ sha256 = "1zwxc9zhfcmyffjjbibzpdvf4kx7wv9g2zl6xz7y0d6srfr9jgw3";
+ };
+
+ dontBuild = true;
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out/share/alsa
+ cp -r topology $out/share/alsa
+
+ runHook postInstall
+ '';
+
+ meta = with stdenv.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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-ucm-conf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-ucm-conf/default.nix
new file mode 100644
index 000000000000..2a9f28c855a5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-ucm-conf/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "alsa-ucm-conf-${version}";
+ version = "1.2.3";
+
+ src = fetchurl {
+ url = "mirror://alsa/lib/${name}.tar.bz2";
+ sha256 = "000db5yla7dljidjbbwbiaxvc1a7wh1zpw694gipaymj9fh4vhhv";
+ };
+
+ dontBuild = true;
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out/share/alsa
+ cp -r ucm ucm2 $out/share/alsa
+
+ runHook postInstall
+ '';
+
+ meta = with stdenv.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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-utils/default.nix
new file mode 100644
index 000000000000..f4670581dea4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/alsa-utils/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchurl, alsaLib, gettext, makeWrapper, ncurses, libsamplerate, pciutils, which, fftw}:
+
+stdenv.mkDerivation rec {
+ pname = "alsa-utils";
+ version = "1.2.3";
+
+ src = fetchurl {
+ url = "mirror://alsa/utils/${pname}-${version}.tar.bz2";
+ sha256 = "1ai1z4kf91b1m3qrpwqkc1af5vm2fkdkknqv95xdwf19q94aw6gz";
+ };
+
+ nativeBuildInputs = [ gettext ];
+ buildInputs = [ makeWrapper alsaLib ncurses libsamplerate fftw ];
+
+ configureFlags = [ "--disable-xmlto" "--with-udev-rules-dir=$(out)/lib/udev/rules.d" ];
+
+ installFlags = [ "ASOUND_STATE_DIR=$(TMPDIR)/dummy" ];
+
+ postFixup = ''
+ wrapProgram $out/bin/alsa-info.sh --prefix PATH : "${stdenv.lib.makeBinPath [ which pciutils ]}"
+ '';
+
+ meta = with stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/default.nix
new file mode 100644
index 000000000000..32763fcded51
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/default.nix
@@ -0,0 +1,183 @@
+{ stdenv, fetchurl, elfutils
+, xorg, patchelf, openssl, libdrm, udev
+, libxcb, libxshmfence, epoxy, perl, zlib
+, ncurses
+, libsOnly ? false, kernel ? null
+}:
+
+assert (!libsOnly) -> kernel != null;
+
+with stdenv.lib;
+
+let
+
+ kernelDir = if libsOnly then null else kernel.dev;
+
+ 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. The build was stopped.";
+
+ libReplaceDir = "/usr/lib/${libArch}";
+
+ ncurses5 = ncurses.override { abiVersion = "5"; };
+
+in stdenv.mkDerivation rec {
+
+ version = "17.40";
+ pname = "amdgpu-pro";
+ build = "${version}-492261";
+
+ libCompatDir = "/run/lib/${libArch}";
+
+ name = pname + "-" + version + (optionalString (!libsOnly) "-${kernelDir.version}");
+
+ src = fetchurl {
+ url =
+ "https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${build}.tar.xz";
+ sha256 = "1c073lp9cq1rc2mddky2r0j2dv9dd167qj02visz37vwaxbm2r5h";
+ curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx";
+ };
+
+ hardeningDisable = [ "pic" "format" ];
+
+ inherit libsOnly;
+
+ postUnpack = ''
+ cd $sourceRoot
+ mkdir root
+ cd root
+ for deb in ../*_all.deb ../*_i386.deb '' + optionalString stdenv.is64bit "../*_amd64.deb" + ''; do echo $deb; ar p $deb data.tar.xz | tar -xJ; done
+ sourceRoot=.
+ '';
+
+ modulePatches = optionals (!libsOnly) ([
+ ./patches/0001-fix-warnings-for-Werror.patch
+ ./patches/0002-fix-sketchy-int-ptr-warning.patch
+ ./patches/0003-disable-firmware-copy.patch
+ ]);
+
+ patchPhase = optionalString (!libsOnly) ''
+ pushd usr/src/amdgpu-${build}
+ for patch in $modulePatches
+ do
+ echo $patch
+ patch -f -p1 < $patch || true
+ done
+ popd
+ '';
+
+ xreallocarray = ./xreallocarray.c;
+
+ preBuild = optionalString (!libsOnly) ''
+ pushd usr/src/amdgpu-${build}
+ makeFlags="$makeFlags M=$(pwd)"
+ patchShebangs pre-build.sh
+ ./pre-build.sh ${kernel.version}
+ popd
+ pushd lib
+ $CC -fPIC -shared -o libhack-xreallocarray.so $xreallocarray
+ strip libhack-xreallocarray.so
+ popd
+ '';
+
+ modules = [
+ "amd/amdgpu/amdgpu.ko"
+ "amd/amdkcl/amdkcl.ko"
+ "ttm/amdttm.ko"
+ ];
+
+ postBuild = optionalString (!libsOnly)
+ (concatMapStrings (m: "xz usr/src/amdgpu-${build}/${m}\n") modules);
+
+ NIX_CFLAGS_COMPILE = "-Werror";
+
+ makeFlags = optionalString (!libsOnly)
+ "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build modules";
+
+ depLibPath = makeLibraryPath [
+ stdenv.cc.cc.lib xorg.libXext xorg.libX11 xorg.libXdamage xorg.libXfixes zlib
+ xorg.libXxf86vm libxcb libxshmfence epoxy openssl libdrm elfutils udev ncurses5
+ ];
+
+ installPhase = ''
+ mkdir -p $out
+
+ cp -r etc $out/etc
+ cp -r lib $out/lib
+
+ pushd usr
+ cp -r lib/${libArch}/* $out/lib
+ '' + optionalString (!libsOnly) ''
+ cp -r src/amdgpu-${build}/firmware $out/lib/firmware
+ '' + ''
+ cp -r share $out/share
+ popd
+
+ pushd opt/amdgpu-pro
+ '' + optionalString (!libsOnly && stdenv.is64bit) ''
+ cp -r bin $out/bin
+ '' + ''
+ cp -r include $out/include
+ cp -r share/* $out/share
+ cp -r lib/${libArch}/* $out/lib
+ '' + optionalString (!libsOnly) ''
+ mv lib/xorg $out/lib/xorg
+ '' + ''
+ popd
+
+ '' + optionalString (!libsOnly)
+ (concatMapStrings (m:
+ "install -Dm444 usr/src/amdgpu-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules)
+ + ''
+ mv $out/etc/vulkan $out/share
+ interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
+ libPath="$out/lib:$out/lib/gbm:$depLibPath"
+ '' + optionalString (!libsOnly && stdenv.is64bit) ''
+ for prog in clinfo modetest vbltest kms-universal-planes kms-steal-crtc modeprint amdgpu_test kmstest proptest; do
+ patchelf --interpreter "$interpreter" --set-rpath "$libPath" "$out/bin/$prog"
+ done
+ '' + ''
+ ln -s ${makeLibraryPath [ncurses5]}/libncursesw.so.5 $out/lib/libtinfo.so.5
+ '';
+
+ # we'll just set the full rpath on everything to avoid having to track down dlopen problems
+ postFixup = assert (stringLength libReplaceDir == stringLength libCompatDir); ''
+ libPath="$out/lib:$out/lib/gbm:$depLibPath"
+ for lib in `find "$out/lib/" -name '*.so*' -type f`; do
+ patchelf --set-rpath "$libPath" "$lib"
+ done
+ for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so libamdocl${bitness}.so; do
+ perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib"
+ done
+ for lib in dri/amdgpu_dri.so libdrm_amdgpu.so.1.0.0 libgbm_amdgpu.so.1.0.0 libkms_amdgpu.so.1.0.0 libamdocl${bitness}.so; do
+ perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' "$out/lib/$lib"
+ done
+ substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/opt/amdgpu-pro/lib/${libArch}" "$out/lib"
+ '' + optionalString (!libsOnly) ''
+ for lib in drivers/modesetting_drv.so libglamoregl.so; do
+ patchelf --add-needed $out/lib/libhack-xreallocarray.so $out/lib/xorg/modules/$lib
+ done
+ '';
+
+ buildInputs = [
+ patchelf
+ perl
+ ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "AMDGPU-PRO drivers";
+ homepage = "http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Beta-Driver-for-Vulkan-Release-Notes.aspx";
+ license = licenses.unfree;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ corngood ];
+ # Copied from the nvidia default.nix to prevent a store collision.
+ priority = 4;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch
new file mode 100644
index 000000000000..ecde6401ac18
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch
@@ -0,0 +1,71 @@
+From 9167d76c435a7c1df7954f0fbe5cc6d083f8ed2f Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Mon, 6 Feb 2017 22:13:49 -0400
+Subject: [PATCH 1/3] fix warnings for Werror
+
+---
+ amd/amdgpu/amdgpu_device.c | 4 ++--
+ amd/amdgpu/amdgpu_sa.c | 2 +-
+ amd/display/dc/bios/bios_parser2.c | 8 ++++----
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/amd/amdgpu/amdgpu_device.c b/amd/amdgpu/amdgpu_device.c
+index fc1c543..186e06d 100644
+--- a/amd/amdgpu/amdgpu_device.c
++++ b/amd/amdgpu/amdgpu_device.c
+@@ -3164,7 +3164,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor)
+ struct drm_info_node *node, *tmp;
+
+ if (!&minor->debugfs_root)
+- return 0;
++ return;
+
+ mutex_lock(&minor->debugfs_lock);
+ list_for_each_entry_safe(node, tmp,
+@@ -3175,7 +3175,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor)
+ }
+ mutex_unlock(&minor->debugfs_lock);
+
+- return 0;
++ return;
+ }
+ #endif
+
+diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c
+index 7206b34..8b7123c 100644
+--- a/amd/amdgpu/amdgpu_sa.c
++++ b/amd/amdgpu/amdgpu_sa.c
+@@ -430,7 +430,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
+ if (i->fence)
+ #if defined(BUILD_AS_DKMS)
+ seq_printf(m, " protected by 0x%08x on context %d",
+- i->fence->seqno, i->fence->context);
++ i->fence->seqno, (int)i->fence->context);
+ #else
+ seq_printf(m, " protected by 0x%08x on context %llu",
+ i->fence->seqno, i->fence->context);
+diff --git a/amd/display/dc/bios/bios_parser2.c b/amd/display/dc/bios/bios_parser2.c
+index 86fce5a..99681c5 100644
+--- a/amd/display/dc/bios/bios_parser2.c
++++ b/amd/display/dc/bios/bios_parser2.c
+@@ -1326,13 +1326,13 @@ static enum bp_result get_embedded_panel_info_v2_1(
+ info->lcd_timing.misc_info.VERTICAL_CUT_OFF = 0;
+
+ info->lcd_timing.misc_info.H_REPLICATION_BY2 =
+- lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2;
++ (lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2) != 0;
+ info->lcd_timing.misc_info.V_REPLICATION_BY2 =
+- lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2;
++ (lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2) != 0;
+ info->lcd_timing.misc_info.COMPOSITE_SYNC =
+- lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC;
++ (lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC) != 0;
+ info->lcd_timing.misc_info.INTERLACE =
+- lvds->lcd_timing.miscinfo & ATOM_INTERLACE;
++ (lvds->lcd_timing.miscinfo & ATOM_INTERLACE) != 0;
+
+ /* not provided by VBIOS*/
+ info->lcd_timing.misc_info.DOUBLE_CLOCK = 0;
+--
+2.15.1
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch
new file mode 100644
index 000000000000..20f429757a51
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch
@@ -0,0 +1,25 @@
+From a07ee5dec35ca24a013a6638543ef5030b2bab40 Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Tue, 9 Jan 2018 21:45:33 -0400
+Subject: [PATCH 2/3] fix sketchy int->ptr warning
+
+---
+ amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+index d0f091b..707815a 100644
+--- a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
++++ b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+@@ -236,7 +236,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
+ pbn = drm_dp_calc_pbn_mode(clock, bpp);
+
+ slots = drm_dp_find_vcpi_slots(mst_mgr, pbn);
+- ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots);
++ ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, &slots);
+
+ if (!ret)
+ return false;
+--
+2.15.1
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch
new file mode 100644
index 000000000000..0091c471680c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch
@@ -0,0 +1,25 @@
+From 7a3062acbbabdb29239bbc8c984e62589a88576e Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Tue, 9 Jan 2018 21:49:55 -0400
+Subject: [PATCH 3/3] disable firmware copy
+
+---
+ pre-build.sh | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/pre-build.sh b/pre-build.sh
+index e7b8a32..bad8f25 100755
+--- a/pre-build.sh
++++ b/pre-build.sh
+@@ -38,8 +38,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
+ | sort -u \
+ | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\
+ >> include/rename_symbol.h
+-
+-FW_DIR="/lib/firmware/$KERNELVER"
+-mkdir -p $FW_DIR
+-cp -ar /usr/src/amdgpu-17.40-492261/firmware/radeon $FW_DIR
+-cp -ar /usr/src/amdgpu-17.40-492261/firmware/amdgpu $FW_DIR
+--
+2.15.1
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c
new file mode 100644
index 000000000000..ab47bacb8228
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c
@@ -0,0 +1,5 @@
+#include <malloc.h>
+
+void *xreallocarray(void *ptr, size_t nmemb, size_t size) {
+ return reallocarray(ptr, nmemb, size);
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/default.nix
new file mode 100644
index 000000000000..5f8ca7ac46fa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/default.nix
@@ -0,0 +1,140 @@
+{ stdenv, fetchFromGitHub, fetchurl
+, cmake, pkgconfig, dbus, makeWrapper
+, gtest
+, boost
+, libcap
+, systemd
+, mesa
+, libGL
+, libglvnd
+, glib
+, git
+, SDL2
+, SDL2_image
+, properties-cpp
+, protobuf
+, protobufc
+, python
+, lxc
+, writeText
+, writeScript
+, runtimeShell
+}:
+
+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-2019-11-15";
+
+ src = fetchFromGitHub {
+ owner = pname;
+ repo = pname;
+ rev = "0a49ae08f76de7f886a3dbed4422711c2fa39d10";
+ sha256 = "09l56nv9cnyhykclfmvam6bkcxlamwbql6nrz9n022553w92hkjf";
+ };
+
+ nativeBuildInputs = [
+ makeWrapper
+ ];
+
+ buildInputs = [
+ cmake pkgconfig dbus boost libcap gtest systemd mesa glib
+ SDL2 SDL2_image protobuf protobufc properties-cpp lxc python
+ libGL
+ ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error=missing-field-initializers";
+
+ 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 : ${stdenv.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 stdenv.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" ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/kmod.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/kmod.nix
new file mode 100644
index 000000000000..6eb74ca25f6b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/anbox/kmod.nix
@@ -0,0 +1,43 @@
+{ stdenv, kernel, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ pname = "anbox-modules";
+ version = "2019-11-15-" + kernel.version;
+
+ src = fetchFromGitHub {
+ owner = "anbox";
+ repo = "anbox-modules";
+ rev = "e0a237e571989987806b32881044c539db25e3e1";
+ sha256 = "1km1nslp4f5znwskh4bb1b61r1inw1dlbwiyyq3rrh0f0agf8d0v";
+ };
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ KERNEL_SRC="${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
+
+ buildPhase = ''
+ for d in ashmem binder;do
+ cd $d
+ make
+ cd -
+ done
+ '';
+
+ installPhase = ''
+ modDir=$out/lib/modules/${kernel.modDirVersion}/kernel/updates/
+ mkdir -p $modDir
+ for d in ashmem binder;do
+ mv $d/$d*.ko $modDir/.
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Anbox ashmem and binder drivers.";
+ homepage = "https://github.com/anbox/anbox-modules";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ broken = (versionOlder kernel.version "4.4") || (kernel.features.grsecurity);
+ maintainers = with maintainers; [ edwtjo ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/android-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/android-udev-rules/default.nix
new file mode 100644
index 000000000000..1cfa6b5856fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/android-udev-rules/default.nix
@@ -0,0 +1,29 @@
+{ 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 = "20200410";
+
+ src = fetchFromGitHub {
+ owner = "M0Rf30";
+ repo = "android-udev-rules";
+ rev = version;
+ sha256 = "1ik9a0k9gkaw5a80m25pxx5yfiwq34ffb7iqhwicz4lwz5wsw8d3";
+ };
+
+ installPhase = ''
+ install -D 51-android.rules $out/lib/udev/rules.d/51-android.rules
+ '';
+
+ meta = with stdenv.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.gpl3;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix
new file mode 100644
index 000000000000..0e10add55613
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix
@@ -0,0 +1,272 @@
+{ stdenv, lib, fetchurl, fetchpatch, makeWrapper, autoreconfHook
+, pkgconfig, which
+, flex, bison
+, linuxHeaders ? stdenv.cc.libc.linuxHeaders
+, gawk
+, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && lib.any (lib.meta.platformMatch stdenv.hostPlatform) perl.meta.platforms, perl
+, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && lib.any (lib.meta.platformMatch stdenv.hostPlatform) python.meta.platforms, python
+, swig
+, ncurses
+, pam
+, libnotify
+, buildPackages
+}:
+
+let
+ apparmor-series = "2.13";
+ apparmor-patchver = "4";
+ apparmor-version = apparmor-series + "." + apparmor-patchver;
+
+ apparmor-meta = component: with stdenv.lib; {
+ homepage = "https://apparmor.net/";
+ description = "A mandatory access control system - ${component}";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ phreedom thoughtpolice joachifm ];
+ platforms = platforms.linux;
+ };
+
+ apparmor-sources = fetchurl {
+ url = "https://launchpad.net/apparmor/${apparmor-series}/${apparmor-version}/+download/apparmor-${apparmor-version}.tar.gz";
+ sha256 = "03nislxccnbxld89giak2s8xa4mdbwscfxbdwhmw5qpvgz08dgwh";
+ };
+
+ # See <https://gitlab.com/apparmor/apparmor/-/issues/74> This and the
+ # accompanying application in prePatchCommon should be removed in 2.13.5
+ gnumake43Patch = fetchpatch {
+ url = "https://gitlab.com/apparmor/apparmor/-/merge_requests/465.patch";
+ name = "2-23-fix-build-with-make-4.3.patch";
+ sha256 = "0xw028iqp69j9mxv0kbwraplgkj5i5djdlgf0anpkc5cdbsf96r9";
+ };
+
+ prePatchCommon = ''
+ patch -p1 < ${gnumake43Patch}
+ 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"
+ substituteInPlace ./common/Make.rules --replace "/usr/bin/pod2html" "${buildPackages.perl}/bin/pod2html"
+ substituteInPlace ./common/Make.rules --replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h"
+ substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
+ '';
+
+ patches = stdenv.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";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/aports/plain/testing/apparmor/0007-Do-not-build-install-vim-file-with-utils-package.patch?id=74b8427cc21f04e32030d047ae92caa618105b53";
+ name = "0007-Do-not-build-install-vim-file-with-utils-package.patch";
+ sha256 = "1m4dx901biqgnr4w4wz8a2z9r9dxyw7wv6m6mqglqwf2lxinqmp4";
+ })
+ # (alpine patches {1,4,5,6,8} are needed for apparmor 2.11, but not 2.12)
+ ];
+
+ # 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 {
+ name = "libapparmor-${apparmor-version}";
+ src = apparmor-sources;
+
+ nativeBuildInputs = [
+ autoreconfHook
+ bison
+ flex
+ pkgconfig
+ swig
+ ncurses
+ which
+ perl
+ ];
+
+ buildInputs = []
+ ++ stdenv.lib.optional withPerl perl
+ ++ stdenv.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
+ substituteInPlace ./libraries/libapparmor/swig/perl/Makefile.in --replace install_vendor install_site
+ substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${stdenv.lib.getDev stdenv.cc.libc}/include/netinet/in.h"
+ substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${stdenv.lib.getDev stdenv.cc.libc}/include/netinet/in.h"
+ '';
+ inherit patches;
+
+ postPatch = "cd ./libraries/libapparmor";
+ # https://gitlab.com/apparmor/apparmor/issues/1
+ configureFlags = [
+ (stdenv.lib.withFeature withPerl "perl")
+ (stdenv.lib.withFeature withPython "python")
+ ];
+
+ outputs = [ "out" ] ++ stdenv.lib.optional withPython "python";
+
+ postInstall = stdenv.lib.optionalString withPython ''
+ mkdir -p $python/lib
+ mv $out/lib/python* $python/lib/
+ '';
+
+ inherit doCheck;
+
+ meta = apparmor-meta "library";
+ };
+
+ apparmor-utils = stdenv.mkDerivation {
+ name = "apparmor-utils-${apparmor-version}";
+ src = apparmor-sources;
+
+ nativeBuildInputs = [ makeWrapper which ];
+
+ buildInputs = [
+ perl
+ python
+ libapparmor
+ libapparmor.python
+ ];
+
+ prePatch = prePatchCommon + ''
+ substituteInPlace ./utils/apparmor/easyprof.py --replace "/sbin/apparmor_parser" "${apparmor-parser}/bin/apparmor_parser"
+ substituteInPlace ./utils/apparmor/aa.py --replace "/sbin/apparmor_parser" "${apparmor-parser}/bin/apparmor_parser"
+ substituteInPlace ./utils/logprof.conf --replace "/sbin/apparmor_parser" "${apparmor-parser}/bin/apparmor_parser"
+ '';
+ inherit patches;
+ postPatch = "cd ./utils";
+ makeFlags = [ "LANGS=" ];
+ installFlags = [ "DESTDIR=$(out)" "BINDIR=$(out)/bin" "VIM_INSTALL_PATH=$(out)/share" "PYPREFIX=" ];
+
+ postInstall = ''
+ for prog in aa-audit aa-autodep aa-cleanprof aa-complain aa-disable aa-enforce aa-genprof aa-logprof aa-mergeprof aa-status aa-unconfined ; do
+ wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
+ done
+
+ substituteInPlace $out/bin/aa-notify --replace /usr/bin/notify-send ${libnotify}/bin/notify-send
+ # aa-notify checks its name and does not work named ".aa-notify-wrapped"
+ mv $out/bin/aa-notify $out/bin/aa-notify-wrapped
+ makeWrapper ${perl}/bin/perl $out/bin/aa-notify --set PERL5LIB ${libapparmor}/${perl.libPrefix} --add-flags $out/bin/aa-notify-wrapped
+ '';
+
+ inherit doCheck;
+
+ meta = apparmor-meta "user-land utilities" // {
+ broken = !(withPython && withPerl);
+ };
+ };
+
+ apparmor-bin-utils = stdenv.mkDerivation {
+ name = "apparmor-bin-utils-${apparmor-version}";
+ src = apparmor-sources;
+
+ nativeBuildInputs = [
+ pkgconfig
+ libapparmor
+ gawk
+ which
+ ];
+
+ buildInputs = [
+ libapparmor
+ ];
+
+ prePatch = prePatchCommon;
+ postPatch = "cd ./binutils";
+ makeFlags = [ "LANGS=" "USE_SYSTEM=1" ];
+ installFlags = [ "DESTDIR=$(out)" "BINDIR=$(out)/bin" ];
+
+ inherit doCheck;
+
+ meta = apparmor-meta "binary user-land utilities";
+ };
+
+ apparmor-parser = stdenv.mkDerivation {
+ name = "apparmor-parser-${apparmor-version}";
+ src = apparmor-sources;
+
+ nativeBuildInputs = [ bison flex which ];
+
+ buildInputs = [ libapparmor ];
+
+ prePatch = prePatchCommon + ''
+ substituteInPlace ./parser/Makefile --replace "/usr/bin/bison" "${bison}/bin/bison"
+ substituteInPlace ./parser/Makefile --replace "/usr/bin/flex" "${flex}/bin/flex"
+ substituteInPlace ./parser/Makefile --replace "/usr/include/linux/capability.h" "${linuxHeaders}/include/linux/capability.h"
+ ## techdoc.pdf still doesn't build ...
+ substituteInPlace ./parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
+ '';
+ 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 {
+ name = "apparmor-pam-${apparmor-version}";
+ src = apparmor-sources;
+
+ nativeBuildInputs = [ pkgconfig 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 {
+ name = "apparmor-profiles-${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 {
+ name = "apparmor-kernel-patches-${apparmor-version}";
+ src = apparmor-sources;
+
+ phases = ''unpackPhase installPhase'';
+
+ installPhase = ''
+ mkdir "$out"
+ cp -R ./kernel-patches/* "$out"
+ '';
+
+ inherit doCheck;
+
+ meta = apparmor-meta "kernel patches";
+ };
+
+in
+
+{
+ inherit
+ libapparmor
+ apparmor-utils
+ apparmor-bin-utils
+ apparmor-parser
+ apparmor-pam
+ apparmor-profiles
+ apparmor-kernel-patches;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/asus-wmi-sensors/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/asus-wmi-sensors/default.nix
new file mode 100644
index 000000000000..8eb8a7484e15
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/asus-wmi-sensors/default.nix
@@ -0,0 +1,37 @@
+{ 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 stdenv.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";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/builder.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/builder.sh
new file mode 100644
index 000000000000..a9e5aaef3976
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/builder.sh
@@ -0,0 +1,302 @@
+# TODO gentoo removes some tools because there are xorg sources (?)
+
+source $stdenv/setup
+set -x
+
+die(){ echo $@; exit 1; }
+
+unzip $src
+run_file=fglrx-$build/amd-driver-installer-$build-x86.x86_64.run
+sh $run_file --extract .
+
+for patch in $patches;do
+ patch -p1 < $patch
+done
+
+case "$system" in
+ x86_64-linux)
+ arch=x86_64
+ lib_arch=lib64
+ DIR_DEPENDING_ON_XORG_VERSION=xpic_64a
+ ;;
+ i686-linux)
+ arch=x86
+ lib_arch=lib
+ DIR_DEPENDING_ON_XORG_VERSION=xpic
+ ;;
+ *) exit 1;;
+esac
+
+# Handle/Build the kernel module.
+
+if test -z "$libsOnly"; then
+
+ kernelVersion=$(cd ${kernelDir}/lib/modules && ls)
+ kernelBuild=$(echo ${kernelDir}/lib/modules/$kernelVersion/build)
+ linuxsources=$(echo ${kernelDir}/lib/modules/$kernelVersion/source)
+
+ # note: maybe the .config file should be used to determine this ?
+ # current kbuild infrastructure allows using CONFIG_* defines
+ # but ati sources don't use them yet..
+ # copy paste from make.sh
+
+ setSMP(){
+
+ linuxincludes=$kernelBuild/include
+
+ # copied and stripped. source: make.sh:
+ # 3
+ # linux/autoconf.h may contain this: #define CONFIG_SMP 1
+
+ # Before 2.6.33 autoconf.h is under linux/.
+ # For 2.6.33 and later autoconf.h is under generated/.
+ if [ -f $linuxincludes/generated/autoconf.h ]; then
+ autoconf_h=$linuxincludes/generated/autoconf.h
+ else
+ autoconf_h=$linuxincludes/linux/autoconf.h
+ fi
+ src_file=$autoconf_h
+
+ [ -e $src_file ] || die "$src_file not found"
+
+ if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then
+ SMP=`cat $src_file | grep CONFIG_SMP | cut -d' ' -f3`
+ echo "file $src_file says: SMP=$SMP"
+ fi
+
+ if [ "$SMP" = 0 ]; then
+ echo "assuming default: SMP=$SMP"
+ fi
+ # act on final result
+ if [ ! "$SMP" = 0 ]; then
+ smp="-SMP"
+ def_smp=-D__SMP__
+ fi
+
+ }
+
+ setModVersions(){
+ ! grep CONFIG_MODVERSIONS=y $kernelBuild/.config ||
+ def_modversions="-DMODVERSIONS"
+ # make.sh contains much more code to determine this whether its enabled
+ }
+
+ # ==============================================================
+ # resolve if we are building for a kernel with a fix for CVE-2010-3081
+ # On kernels with the fix, use arch_compat_alloc_user_space instead
+ # of compat_alloc_user_space since the latter is GPL-only
+
+ COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
+
+ for src_file in \
+ $kernelBuild/arch/x86/include/asm/compat.h \
+ $linuxsources/arch/x86/include/asm/compat.h \
+ $kernelBuild/include/asm-x86_64/compat.h \
+ $linuxsources/include/asm-x86_64/compat.h \
+ $kernelBuild/include/asm/compat.h;
+ do
+ if [ -e $src_file ];
+ then
+ break
+ fi
+ done
+ if [ ! -e $src_file ];
+ then
+ echo "Warning: x86 compat.h not found in kernel headers"
+ echo "neither arch/x86/include/asm/compat.h nor include/asm-x86_64/compat.h"
+ echo "could be found in $kernelBuild or $linuxsources"
+ echo ""
+ else
+ if [ `cat $src_file | grep -c arch_compat_alloc_user_space` -gt 0 ]
+ then
+ COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space
+ fi
+ echo "file $src_file says: COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE"
+ fi
+
+ # make.sh contains some code figuring out whether to use these or not..
+ PAGE_ATTR_FIX=0
+ setSMP
+ setModVersions
+ CC=gcc
+ MODULE=fglrx
+ LIBIP_PREFIX=$TMP/arch/$arch/lib/modules/fglrx/build_mod
+ [ -d $LIBIP_PREFIX ]
+ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`"
+
+ { # build .ko module
+ cd ./common/lib/modules/fglrx/build_mod/2.6.x
+ echo .lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
+ echo 'This is a dummy file created to suppress this warning: could not find /lib/modules/fglrx/build_mod/2.6.x/.libfglrx_ip.a.GCC4.cmd for /lib/modules/fglrx/build_mod/2.6.x/libfglrx_ip.a.GCC4' > lib${MODULE}_ip.a.GCC${GCC_MAJOR}.cmd
+
+ sed -i -e "s@COMPAT_ALLOC_USER_SPACE@$COMPAT_ALLOC_USER_SPACE@" ../kcl_ioctl.c
+
+ make CC=${CC} \
+ LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \
+ MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
+ KVER=$kernelVersion \
+ KDIR=$kernelBuild \
+ PAGE_ATTR_FIX=$PAGE_ATTR_FIX \
+ -j4
+
+ cd $TMP
+ }
+
+fi
+
+{ # install
+ mkdir -p $out/lib/xorg
+ cp -r common/usr/include $out
+ cp -r common/usr/sbin $out
+ cp -r common/usr/share $out
+ mkdir $out/bin/
+ cp -f common/usr/X11R6/bin/* $out/bin/
+ # cp -r arch/$arch/lib $out/lib
+ # what are those files used for?
+ cp -r common/etc $out
+ cp -r $DIR_DEPENDING_ON_XORG_VERSION/usr/X11R6/$lib_arch/* $out/lib/xorg
+
+ # install kernel module
+ if test -z "$libsOnly"; then
+ t=$out/lib/modules/${kernelVersion}/kernel/drivers/misc
+ mkdir -p $t
+
+ cp ./common/lib/modules/fglrx/build_mod/2.6.x/fglrx.ko $t
+ fi
+
+ # should this be installed at all?
+ # its used by the example fglrx_gamma only
+ # don't use $out/lib/modules/dri because this will cause the kernel module
+ # aggregator code to see both: kernel version and the dri direcotry. It'll
+ # fail saying different kernel versions
+ cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/modules/dri $out/lib
+ cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/modules/dri/* $out/lib
+ cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/*.so* $out/lib
+ cp -r $TMP/arch/$arch/usr/X11R6/$lib_arch/fglrx/fglrx-libGL.so.1.2 $out/lib/fglrx-libGL.so.1.2
+ cp -r $TMP/arch/$arch/usr/$lib_arch/* $out/lib
+ ln -s libatiuki.so.1.0 $out/lib/libatiuki.so.1
+ ln -s fglrx-libGL.so.1.2 $out/lib/libGL.so.1
+ ln -s fglrx-libGL.so.1.2 $out/lib/libGL.so
+ # FIXME : This file is missing or has changed versions
+ #ln -s libfglrx_gamma.so.1.0 $out/lib/libfglrx_gamma.so.1
+ # make xorg use the ati version
+ ln -s $out/lib/xorg/modules/extensions/{fglrx/fglrx-libglx.so,libglx.so}
+ # Correct some paths that are hardcoded into binary libs.
+ if [ "$arch" == "x86_64" ]; then
+ for lib in \
+ xorg/modules/extensions/fglrx/fglrx-libglx.so \
+ xorg/modules/glesx.so \
+ dri/fglrx_dri.so \
+ fglrx_dri.so \
+ fglrx-libGL.so.1.2
+ do
+ oldPaths="/usr/X11R6/lib/modules/dri"
+ newPaths="/run/opengl-driver/lib/dri"
+ sed -i -e "s|$oldPaths|$newPaths|" $out/lib/$lib
+ done
+ else
+ oldPaths="/usr/X11R6/lib32/modules/dri\x00/usr/lib32/dri"
+ newPaths="/run/opengl-driver-32/lib/dri\x00/dev/null/dri"
+ sed -i -e "s|$oldPaths|$newPaths|" \
+ $out/lib/xorg/modules/extensions/fglrx/fglrx-libglx.so
+
+ for lib in \
+ dri/fglrx_dri.so \
+ fglrx_dri.so \
+ xorg/modules/glesx.so
+ do
+ oldPaths="/usr/X11R6/lib32/modules/dri/"
+ newPaths="/run/opengl-driver-32/lib/dri"
+ sed -i -e "s|$oldPaths|$newPaths|" $out/lib/$lib
+ done
+
+ oldPaths="/usr/X11R6/lib32/modules/dri\x00"
+ newPaths="/run/opengl-driver-32/lib/dri"
+ sed -i -e "s|$oldPaths|$newPaths|" $out/lib/fglrx-libGL.so.1.2
+ fi
+ # libstdc++ and gcc are needed by some libs
+ for pelib1 in \
+ fglrx_dri.so \
+ dri/fglrx_dri.so
+ do
+ patchelf --remove-needed libX11.so.6 $out/lib/$pelib1
+ done
+
+ for pelib2 in \
+ libatiadlxx.so \
+ xorg/modules/glesx.so \
+ dri/fglrx_dri.so \
+ fglrx_dri.so \
+ libaticaldd.so
+ do
+ patchelf --set-rpath $glibcDir/lib/:$libStdCxx/lib/ $out/lib/$pelib2
+ done
+}
+
+if test -z "$libsOnly"; then
+
+{ # build samples
+ mkdir -p $out/bin
+ mkdir -p samples
+ cd samples
+ tar xfz ../common/usr/src/ati/fglrx_sample_source.tgz
+ eval "$patchPhaseSamples"
+
+
+ ( # build and install fgl_glxgears
+ cd fgl_glxgears;
+ gcc -DGL_ARB_texture_multisample=1 -g \
+ -I$libGL/include -I$libGLU/include \
+ -I$out/include \
+ -L$libGL/lib -L$libGLU/lib -lGL -lGLU -lX11 -lm \
+ -o $out/bin/fgl_glxgears -Wall fgl_glxgears.c
+ )
+
+ true || ( # build and install
+
+ ###
+ ## FIXME ?
+ # doesn't build undefined reference to `FGLRX_X11SetGamma'
+ # which should be contained in -lfglrx_gamma
+ # This should create $out/lib/libfglrx_gamma.so.1.0 ? because there is
+ # a symlink named libfglrx_gamma.so.1 linking to libfglrx_gamma.so.1.0 in $out/lib/
+
+ cd programs/fglrx_gamma
+ gcc -fPIC -I${libXxf86vm.dev}/include \
+ -I${xorgproto}/include \
+ -I$out/X11R6/include \
+ -L$out/lib \
+ -Wall -lm -lfglrx_gamma -lX11 -lXext -o $out/bin/fglrx_xgamma fglrx_xgamma.c
+ )
+
+ {
+ # patch and copy statically linked qt libs used by amdcccle
+ patchelf --set-interpreter $(echo $glibcDir/lib/ld-linux*.so.2) $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 &&
+ patchelf --set-rpath $gcc/$lib_arch/ $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 &&
+ patchelf --set-rpath $gcc/$lib_arch/:$out/share/ati/:$libXrender/lib/:$libSM/lib/:$libICE/lib/:$libfontconfig/lib/:$libfreetype/lib/ $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtGui.so.4 &&
+ mkdir -p $out/share/ati
+ cp -r $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtCore.so.4 $out/share/ati/
+ cp -r $TMP/arch/$arch/usr/share/ati/$lib_arch/libQtGui.so.4 $out/share/ati/
+ # copy binaries and wrap them:
+ BIN=$TMP/arch/$arch/usr/X11R6/bin
+ patchelf --set-rpath $gcc/$lib_arch/:$out/share/ati/:$libXinerama/lib/:$libXrandr/lib/ $TMP/arch/$arch/usr/X11R6/bin/amdcccle
+ patchelf --set-rpath $libXrender/lib/:$libXrandr/lib/ $TMP/arch/$arch/usr/X11R6/bin/aticonfig
+ patchelf --shrink-rpath $BIN/amdcccle
+ for prog in $BIN/*; do
+ cp -f $prog $out/bin &&
+ patchelf --set-interpreter $(echo $glibcDir/lib/ld-linux*.so.2) $out/bin/$(basename $prog) &&
+ wrapProgram $out/bin/$(basename $prog) --prefix LD_LIBRARY_PATH : $out/lib/:$gcc/lib/:$out/share/ati/:$libXinerama/lib/:$libXrandr/lib/:$libfontconfig/lib/:$libfreetype/lib/${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
+ done
+ }
+
+ rm -f $out/lib/fglrx/switchlibglx && rm -f $out/lib/fglrx/switchlibGL
+
+}
+
+fi
+
+for p in $extraDRIlibs; do
+ for lib in $p/lib/*.so*; do
+ ln -s $lib $out/lib/
+ done
+done
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/default.nix
new file mode 100644
index 000000000000..63f9b5399da9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/default.nix
@@ -0,0 +1,140 @@
+{ stdenv, lib, fetchurl, kernel ? null, which
+, xorg, makeWrapper, glibc, patchelf, unzip
+, fontconfig, freetype, libGLU, libGL # for fgl_glxgears
+, # Whether to build the libraries only (i.e. not the kernel module or
+ # driver utils). Used to support 32-bit binaries on 64-bit
+ # Linux.
+ libsOnly ? false
+}:
+
+assert (!libsOnly) -> kernel != null;
+
+with stdenv.lib;
+
+# This derivation requires a maximum of gcc49, Linux kernel 4.1 and xorg.xserver 1.17
+# and will not build or run using versions newer
+
+# If you want to use a different Xorg version probably
+# DIR_DEPENDING_ON_XORG_VERSION in builder.sh has to be adopted (?)
+# make sure libglx.so of ati is used. xorg.xorgserver does provide it as well
+# which is a problem because it doesn't contain the xorgserver patch supporting
+# the XORG_DRI_DRIVER_PATH env var.
+# See https://marc.info/?l=nix-dev&m=139641585515351 for a
+# workaround (TODO)
+
+# The gentoo ebuild contains much more "magic" and is usually a great resource to
+# find patches XD
+
+# http://wiki.cchtml.com/index.php/Main_Page
+
+# /usr/lib/dri/fglrx_dri.so must point to /run/opengl-driver/lib/fglrx_dri.so
+# This is done in the builder script.
+
+stdenv.mkDerivation rec {
+
+ version = "15.12";
+ pname = "ati-drivers";
+ build = "15.302";
+
+ linuxonly =
+ if stdenv.hostPlatform.system == "i686-linux" then
+ true
+ else if stdenv.hostPlatform.system == "x86_64-linux" then
+ true
+ else throw "ati-drivers are Linux only. Sorry. The build was stopped.";
+
+ name = pname + "-" + version + (optionalString (!libsOnly) "-${kernelDir.version}");
+
+ builder = ./builder.sh;
+ gcc = stdenv.cc.cc;
+ libXinerama = xorg.libXinerama;
+ libXrandr = xorg.libXrandr;
+ libXrender = xorg.libXrender;
+ libXxf86vm = xorg.libXxf86vm;
+ xorgproto = xorg.xorgproto;
+ libSM = xorg.libSM;
+ libICE = xorg.libICE;
+ libfreetype = freetype;
+ libfontconfig = fontconfig;
+ libStdCxx = stdenv.cc.cc.lib;
+
+ src = fetchurl {
+ url =
+ "https://www2.ati.com/drivers/linux/radeon-crimson-15.12-15.302-151217a-297685e.zip";
+ sha256 = "704f2dfc14681f76dae3b4120c87b1ded33cf43d5a1d800b6de5ca292bb61e58";
+ curlOpts = "--referer https://www.amd.com/en/support";
+ };
+
+ hardeningDisable = [ "pic" "format" ];
+
+ patchPhaseSamples = "patch -p2 < ${./patches/patch-samples.patch}";
+ patches = [
+ ./patches/15.12-xstate-fp.patch
+ ./patches/15.9-kcl_str.patch
+ ./patches/15.9-mtrr.patch
+ ./patches/15.9-preempt.patch
+ ./patches/15.9-sep_printf.patch ]
+ ++ optionals ( kernel != null &&
+ (lib.versionAtLeast kernel.version "4.6") )
+ [ ./patches/kernel-4.6-get_user_pages.patch
+ ./patches/kernel-4.6-page_cache_release-put_page.patch ]
+ ++ optionals ( kernel != null &&
+ (lib.versionAtLeast kernel.version "4.7") )
+ [ ./patches/4.7-arch-cpu_has_pge-v2.patch ]
+ ++ optionals ( kernel != null &&
+ (lib.versionAtLeast kernel.version "4.9") )
+ [ ./patches/4.9-get_user_pages.patch ];
+
+ buildInputs =
+ [ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM
+ xorg.libXrandr xorg.libXxf86vm xorg.xorgproto xorg.imake xorg.libICE
+ patchelf
+ unzip
+ libGLU libGL
+ fontconfig
+ freetype
+ makeWrapper
+ which
+ ];
+
+ inherit libsOnly;
+
+ kernelDir = if libsOnly then null else kernel.dev;
+
+ # glibc only used for setting the binaries interpreter
+ glibcDir = glibc.out;
+
+ # outputs TODO: probably many fixes are needed;
+ LD_LIBRARY_PATH = makeLibraryPath
+ [ xorg.libXrender xorg.libXext xorg.libX11 xorg.libXinerama xorg.libSM
+ xorg.libXrandr xorg.libXxf86vm xorg.xorgproto xorg.imake xorg.libICE
+ libGLU libGL
+ fontconfig
+ freetype
+ stdenv.cc.cc
+ ];
+
+ # without this some applications like blender don't start, but they start
+ # with nvidia. This causes them to be symlinked to $out/lib so that they
+ # appear in /run/opengl-driver/lib which get's added to LD_LIBRARY_PATH
+
+ extraDRIlibs = [ xorg.libXrandr.out xorg.libXrender.out xorg.libXext.out
+ xorg.libX11.out xorg.libXinerama.out xorg.libSM.out
+ xorg.libICE.out ];
+
+ inherit libGLU libGL; # only required to build the examples
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "ATI Catalyst display drivers";
+ homepage = "http://support.amd.com/us/gpudownload/Pages/index.aspx";
+ license = licenses.unfree;
+ maintainers = with maintainers; [ marcweber offline jerith666 ];
+ platforms = platforms.linux;
+ hydraPlatforms = [];
+ # Copied from the nvidia default.nix to prevent a store collision.
+ priority = 4;
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.12-xstate-fp.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.12-xstate-fp.patch
new file mode 100644
index 000000000000..22e43fc0c7b6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.12-xstate-fp.patch
@@ -0,0 +1,26 @@
+From: Krzysztof Kolasa <kkolasa@winsoft.pl>
+Date: Thu, 26 Nov 2015 14:28:46 +0100
+Subject: [PATCH] Patch for kernel 4.4.0-rc2
+
+constant change of name XSTATE_XP to name XFEATURE_MASK_FP
+---
+ firegl_public.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
+index 3626c7b..f071d42 100644
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod//firegl_public.c
+@@ -6463,7 +6463,11 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
+ if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
+ #else
+ copy_xregs_to_kernel(&fpu->state.xsave);
+- if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
++ if (!(fpu->state.xsave.header.xfeatures & XFEATURE_MASK_FP))
++#else
++ if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
++#endif
+ #endif
+ return 1;
+ } else if (static_cpu_has(X86_FEATURE_FXSR)) {
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-kcl_str.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-kcl_str.patch
new file mode 100644
index 000000000000..20c3bc8a169b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-kcl_str.patch
@@ -0,0 +1,14 @@
+--- a/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-09-13 13:47:30.000000000 -0400
++++ b/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-09-13 13:49:42.000000000 -0400
+@@ -169,7 +169,11 @@ int ATI_API_CALL KCL_STR_Strnicmp(const
+ const char* s2,
+ KCL_TYPE_SizeSigned count)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
+ return strnicmp(s1, s2, count);
++#else
++ return strncasecmp(s1, s2, count);
++#endif
+ }
+
+ /** \brief Locate character in string
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-mtrr.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-mtrr.patch
new file mode 100644
index 000000000000..bdf70b4ccdc4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-mtrr.patch
@@ -0,0 +1,27 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-19 23:43:22.000000000 -0400
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-19 23:52:07.000000000 -0400
+@@ -3442,7 +3442,11 @@ int ATI_API_CALL KCL_MEM_MTRR_Support(vo
+ int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ return arch_phys_wc_add(base, size);
++#else
+ return mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
+@@ -3451,7 +3455,12 @@ int ATI_API_CALL KCL_MEM_MTRR_AddRegionW
+ int ATI_API_CALL KCL_MEM_MTRR_DeleteRegion(int reg, unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ arch_phys_wc_del(reg);
++ return reg;
++#else
+ return mtrr_del(reg, base, size);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-preempt.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-preempt.patch
new file mode 100644
index 000000000000..c6598835133e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-preempt.patch
@@ -0,0 +1,103 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-08-30 17:36:02.000000000 -0400
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-08-30 17:39:36.000000000 -0400
+@@ -21,6 +21,8 @@
+ !!! since it requires changes to linux/init/main.c.
+ #endif /* !MODULE */
+
++#include <linux/preempt.h>
++
+ // ============================================================
+ #include <linux/version.h>
+
+@@ -4997,7 +4999,9 @@ static unsigned int kas_spin_unlock(kas_
+ unsigned long ATI_API_CALL KAS_GetExecutionLevel(void)
+ {
+ unsigned long ret;
++ preempt_disable();
+ ret = kas_GetExecutionLevel();
++ preempt_enable();
+ return ret;
+ }
+
+@@ -5022,8 +5026,10 @@ unsigned int ATI_API_CALL KAS_Ih_Execute
+ KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X, 0x%08X\n", ih_routine, ih_context);
+
+ //Prevent simultaneous entry on some SMP systems.
++ preempt_disable();
+ if (test_and_set_bit(0, (void *)&(kasContext.in_interrupts[smp_processor_id()])))
+ {
++ preempt_enable();
+ KCL_DEBUG1(FN_FIREGL_KAS, "The processor is handling the interrupt\n");
+ return IRQ_NONE;
+ }
+@@ -5036,9 +5042,9 @@ unsigned int ATI_API_CALL KAS_Ih_Execute
+
+ kasSetExecutionLevel(orig_level);
+ spin_unlock(&kasContext.lock_ih);
+-
+ clear_bit(0, (void *)&(kasContext.in_interrupts[smp_processor_id()]));
+ KCL_DEBUG5(FN_FIREGL_KAS,"%d\n", ret);
++ preempt_enable();
+
+ return ret;
+ }
+@@ -5256,6 +5262,7 @@ unsigned int ATI_API_CALL KAS_Spinlock_A
+
+ KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X\n", hSpinLock);
+
++ preempt_disable();
+ spin_lock_info.routine_type = spinlock_obj->routine_type;
+ spin_lock_info.plock = &(spinlock_obj->lock);
+
+@@ -5263,6 +5270,7 @@ unsigned int ATI_API_CALL KAS_Spinlock_A
+
+ spinlock_obj->acquire_type = spin_lock_info.acquire_type;
+ spinlock_obj->flags = spin_lock_info.flags;
++ preempt_enable();
+
+ KCL_DEBUG5(FN_FIREGL_KAS,"%d\n", ret);
+ return ret;
+@@ -6034,6 +6042,8 @@ unsigned int ATI_API_CALL KAS_Interlocke
+
+ KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X, 0x%08X, 0x%08X\n", hListHead, hListEntry, phPrevEntry);
+
++ preempt_disable();
++
+ /* Protect the operation with spinlock */
+ spin_lock_info.routine_type = listhead_obj->routine_type;
+ spin_lock_info.plock = &(listhead_obj->lock);
+@@ -6041,6 +6051,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
+ if (!kas_spin_lock(&spin_lock_info))
+ {
+ KCL_DEBUG_ERROR("Unable to grab list spinlock\n");
++ preempt_enable();
+ return 0; /* No spinlock - no operation */
+ }
+
+@@ -6065,6 +6076,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
+ spin_unlock_info.flags = spin_lock_info.flags;
+
+ ret = kas_spin_unlock(&spin_unlock_info);
++ preempt_enable();
+ KCL_DEBUG5(FN_FIREGL_KAS,"%d", ret);
+ return ret;
+ }
+@@ -6153,8 +6165,10 @@ unsigned int ATI_API_CALL KAS_Interlocke
+ spin_lock_info.routine_type = listhead_obj->routine_type;
+ spin_lock_info.plock = &(listhead_obj->lock);
+
++ preempt_disable();
+ if (!kas_spin_lock(&spin_lock_info))
+ {
++ preempt_enable();
+ KCL_DEBUG_ERROR("Unable to grab list spinlock");
+ return 0; /* No spinlock - no operation */
+ }
+@@ -6178,6 +6192,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
+ spin_unlock_info.flags = spin_lock_info.flags;
+
+ ret = kas_spin_unlock(&spin_unlock_info);
++ preempt_enable();
+ KCL_DEBUG5(FN_FIREGL_KAS,"%d", ret);
+ return ret;
+ }
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-sep_printf.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-sep_printf.patch
new file mode 100644
index 000000000000..3e4e8d6499a0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-sep_printf.patch
@@ -0,0 +1,11 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-14 15:14:36.000000000 -0400
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-14 16:18:58.000000000 -0400
+@@ -649,6 +649,8 @@ static int firegl_major_proc_read(struct
+ *eof = 1;
+
+ len = snprintf(buf, request, "%d\n", major);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ seq_printf(m, "%d\n", major);
+ #else
+ len = seq_printf(m, "%d\n", major);
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch
new file mode 100644
index 000000000000..cb86f5aff276
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.7-arch-cpu_has_pge-v2.patch
@@ -0,0 +1,70 @@
+diff -uNr 16.8/common/lib/modules/fglrx/build_mod/firegl_public.c 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.c
+--- 16.8/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-12-18 19:47:41.000000000 +0100
++++ 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.c 2016-08-15 15:09:37.228538907 +0200
+@@ -4518,7 +4518,11 @@
+ write_cr0(cr0);
+ wbinvd();
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++ if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+ if (cpu_has_pge)
++#endif
+ {
+ cr4 = READ_CR4();
+ WRITE_CR4(cr4 & ~X86_CR4_PGE);
+@@ -4532,7 +4536,11 @@
+ wbinvd();
+ __flush_tlb();
+ write_cr0(cr0 & 0xbfffffff);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++ if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+ if (cpu_has_pge)
++#endif
+ {
+ WRITE_CR4(cr4);
+ }
+@@ -4559,7 +4567,11 @@
+ write_cr0(cr0);
+ wbinvd();
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++ if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+ if (cpu_has_pge)
++#endif
+ {
+ cr4 = READ_CR4();
+ WRITE_CR4(cr4 & ~X86_CR4_PGE);
+@@ -4572,7 +4584,11 @@
+ wbinvd();
+ __flush_tlb();
+ write_cr0(cr0 & 0xbfffffff);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++ if (boot_cpu_has(X86_FEATURE_PGE))
++#else
+ if (cpu_has_pge)
++#endif
+ {
+ WRITE_CR4(cr4);
+ }
+diff -uNr 16.8/common/lib/modules/fglrx/build_mod/firegl_public.h 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.h
+--- 16.8/common/lib/modules/fglrx/build_mod/firegl_public.h 2015-12-18 19:47:41.000000000 +0100
++++ 16.8b/common/lib/modules/fglrx/build_mod/firegl_public.h 2016-08-15 15:09:05.815141238 +0200
+@@ -650,9 +650,15 @@
+ #define cpu_has_pat test_bit(X86_FEATURE_PAT, (void *) &boot_cpu_data.x86_capability)
+ #endif
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
++#ifndef boot_cpu_has(X86_FEATURE_PGE)
++#define boot_cpu_has(X86_FEATURE_PGE) test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability)
++#endif
++#else
+ #ifndef cpu_has_pge
+ #define cpu_has_pge test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability)
+ #endif
++#endif
+
+ /* 2.6.29 defines pgprot_writecombine as a macro which resolves to a
+ * GPL-only function with the same name. So we always use our own
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.9-get_user_pages.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.9-get_user_pages.patch
new file mode 100644
index 000000000000..8a6c42cdb1fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/4.9-get_user_pages.patch
@@ -0,0 +1,28 @@
+commit b3e4353fc68a6a024dcb95e2d61aa0afd7370233
+Author: Matt McHenry <matt@mchenryfamily.org>
+Date: Fri Feb 3 20:19:41 2017
+
+ patch for 4.9 only
+
+diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
+index 4ce095f..3b591e1 100755
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -3224,7 +3224,7 @@ int ATI_API_CALL KCL_LockUserPages(unsigned long vaddr, unsigned long* page_list
+ int ret;
+
+ down_read(&current->mm->mmap_sem);
+- ret = get_user_pages(vaddr, page_cnt, 1, 0, (struct page **)page_list, NULL);
++ ret = get_user_pages(vaddr, page_cnt, 1, (struct page **)page_list, NULL);
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
+@@ -3242,7 +3242,7 @@ int ATI_API_CALL KCL_LockReadOnlyUserPages(unsigned long vaddr, unsigned long* p
+ int ret;
+
+ down_read(&current->mm->mmap_sem);
+- ret = get_user_pages(vaddr, page_cnt, 0, 0, (struct page **)page_list, NULL);
++ ret = get_user_pages(vaddr, page_cnt, 0, (struct page **)page_list, NULL);
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-get_user_pages.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-get_user_pages.patch
new file mode 100644
index 000000000000..1e7209ed5ed1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-get_user_pages.patch
@@ -0,0 +1,25 @@
+diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
+index 9c70211..b2242af 100755
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -3220,7 +3220,7 @@ int ATI_API_CALL KCL_LockUserPages(unsigned long vaddr, unsigned long* page_list
+ int ret;
+
+ down_read(&current->mm->mmap_sem);
+- ret = get_user_pages(current, current->mm, vaddr, page_cnt, 1, 0, (struct page **)page_list, NULL);
++ ret = get_user_pages(vaddr, page_cnt, 1, 0, (struct page **)page_list, NULL);
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
+@@ -3238,7 +3238,7 @@ int ATI_API_CALL KCL_LockReadOnlyUserPages(unsigned long vaddr, unsigned long* p
+ int ret;
+
+ down_read(&current->mm->mmap_sem);
+- ret = get_user_pages(current, current->mm, vaddr, page_cnt, 0, 0, (struct page **)page_list, NULL);
++ ret = get_user_pages(vaddr, page_cnt, 0, 0, (struct page **)page_list, NULL);
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
+--
+2.9.2
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-page_cache_release-put_page.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-page_cache_release-put_page.patch
new file mode 100644
index 000000000000..28820790e492
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/kernel-4.6-page_cache_release-put_page.patch
@@ -0,0 +1,16 @@
+diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
+index b2242af..586129c 100755
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -3249,7 +3249,7 @@ void ATI_API_CALL KCL_UnlockUserPages(unsigned long* page_list, unsigned int pag
+ unsigned int i;
+ for (i=0; i<page_cnt; i++)
+ {
+- page_cache_release((struct page*)page_list[i]);
++ put_page((struct page*)page_list[i]);
+ }
+ }
+
+--
+2.9.2
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/patch-samples.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/patch-samples.patch
new file mode 100644
index 000000000000..8bd24b1d022b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/patch-samples.patch
@@ -0,0 +1,26 @@
+diff --git a/samples/fgl_glxgears/fgl_glxgears.c b/samples/fgl_glxgears/fgl_glxgears.c
+index 6c8e313..2b8d035 100644
+--- a/samples/fgl_glxgears/fgl_glxgears.c
++++ b/samples/fgl_glxgears/fgl_glxgears.c
+@@ -1096,8 +1096,6 @@ static void event_loop(void)
+ view_rotx -= 5.0;
+ }
+ else {
+- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
+- NULL, NULL);
+ if (buffer[0] == 27) {
+ /* escape */
+ return;
+
+
+diff -Nur a/samples/fgl_glxgears/fgl_glxgears.c b/samples/fgl_glxgears/fgl_glxgears.c
+--- a/samples/fgl_glxgears/fgl_glxgears.c 2012-08-29 09:59:03.000000000 +0300
++++ b/samples/fgl_glxgears/fgl_glxgears.c 2013-09-07 09:26:11.034723135 +0300
+@@ -78,7 +78,6 @@
+ #endif // _WIN32
+
+ #define INT_PTR ptrdiff_t
+-#include <GL/glATI.h>
+
+ #ifdef _WIN32
+ #include <GL/wglATI.h>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.nix
new file mode 100644
index 000000000000..0d8392cbcd8a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.nix
@@ -0,0 +1,48 @@
+{stdenv, fetchurl, zlib, ncurses}:
+
+stdenv.mkDerivation rec {
+ version = "2.4.0";
+ pname = "atop";
+
+ src = fetchurl {
+ url = "https://www.atoptool.nl/download/atop-${version}.tar.gz";
+ sha256 = "0s9xlxlzz688a80zxld840zkrmzw998rdkkg6yc7ssq8fw50275y";
+ };
+
+ buildInputs = [zlib ncurses];
+
+ makeFlags = [
+ ''SCRPATH=$out/etc/atop''
+ ''LOGPATH=/var/log/atop''
+ ''INIPATH=$out/etc/rc.d/init.d''
+ ''CRNPATH=$out/etc/cron.d''
+ ''ROTPATH=$out/etc/logrotate.d''
+ ];
+
+ preConfigure = ''
+ sed -e "s@/usr/@$out/@g" -i $(find . -type f )
+ sed -e "/mkdir.*LOGPATH/s@mkdir@echo missing dir @" -i Makefile
+ sed -e "/touch.*LOGPATH/s@touch@echo should have created @" -i Makefile
+ sed -e 's/chown/true/g' -i Makefile
+ sed -e '/chkconfig/d' -i Makefile
+ sed -e 's/chmod 04711/chmod 0711/g' -i Makefile
+ '';
+
+ preInstall = ''
+ mkdir -p "$out"/{bin,sbin}
+ make systemdinstall $makeFlags
+ '';
+
+ meta = with stdenv.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.
+ '';
+ inherit version;
+ license = licenses.gpl2;
+ downloadPage = "http://atoptool.nl/downloadatop.php";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.upstream b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.upstream
new file mode 100644
index 000000000000..46099d9c9595
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/atop/default.upstream
@@ -0,0 +1,4 @@
+url http://atoptool.nl/downloadatop.php
+version_link '[.]tar[.]'
+version '[^0-9]*[-.]([0-9]([-0-9.]*[0-9])?)[.].*' '\1'
+minimize_overwrite
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/audit/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/audit/default.nix
new file mode 100644
index 000000000000..f77d71c823b8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/audit/default.nix
@@ -0,0 +1,66 @@
+{
+ stdenv, buildPackages, fetchurl, fetchpatch,
+ runCommand,
+ autoconf, automake, libtool,
+ enablePython ? false, python ? null,
+}:
+
+assert enablePython -> python != null;
+
+stdenv.mkDerivation rec {
+ name = "audit-2.8.5"; # at the next release, remove the patches below!
+
+ src = fetchurl {
+ url = "https://people.redhat.com/sgrubb/audit/${name}.tar.gz";
+ sha256 = "1dzcwb2q78q7x41shcachn7f4aksxbxd470yk38zh03fch1l2p8f";
+ };
+
+ outputs = [ "bin" "dev" "out" "man" ];
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = stdenv.lib.optionals stdenv.hostPlatform.isMusl
+ [ autoconf automake libtool ];
+ buildInputs = stdenv.lib.optional enablePython python;
+
+ 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 = stdenv.lib.optional stdenv.hostPlatform.isMusl [
+ (
+ 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.'
+ ''
+ )
+ ];
+
+ prePatch = ''
+ sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
+ '';
+ meta = {
+ description = "Audit Library";
+ homepage = "https://people.redhat.com/sgrubb/audit/";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/autofs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/autofs/default.nix
new file mode 100644
index 000000000000..baf3cc6ad55e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/autofs/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, flex, bison, linuxHeaders, libtirpc, mount, umount, nfs-utils, e2fsprogs
+, libxml2, kerberos, kmod, openldap, sssd, cyrus_sasl, openssl }:
+
+let
+ version = "5.1.6";
+ name = "autofs-${version}";
+in stdenv.mkDerivation {
+ inherit name;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/daemons/autofs/v5/${name}.tar.xz";
+ sha256 = "1vya21mb4izj3khcr3flibv7xc15vvx2v0rjfk5yd31qnzcy7pnx";
+ };
+
+ 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.
+ '';
+
+ installPhase = ''
+ make install SUBDIRS="lib daemon modules man" # all but samples
+ #make install SUBDIRS="samples" # impure!
+ '';
+
+ buildInputs = [ linuxHeaders libtirpc libxml2 kerberos kmod openldap sssd
+ openssl cyrus_sasl ];
+
+ nativeBuildInputs = [ flex bison ];
+
+ meta = {
+ description = "Kernel-based automounter";
+ homepage = "https://www.kernel.org/pub/linux/daemons/autofs/";
+ license = stdenv.lib.licenses.gpl2Plus;
+ executables = [ "automount" ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/alfred.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/alfred.nix
new file mode 100644
index 000000000000..04217b8989bc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/alfred.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, 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 = [ pkgconfig ];
+ buildInputs = [ gpsd libcap libnl ];
+
+ preBuild = ''
+ makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.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 = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [ fpletz ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/batctl.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/batctl.nix
new file mode 100644
index 000000000000..3b1cf183e08e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/batctl.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, 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 = [ pkgconfig ];
+ buildInputs = [ libnl ];
+
+ preBuild = ''
+ makeFlags="PREFIX=$out PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.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 = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [ fpletz ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/default.nix
new file mode 100644
index 000000000000..8985949a0123
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, 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;
+
+ hardeningDisable = [ "pic" ];
+
+ preBuild = ''
+ makeFlags="KERNELPATH=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ 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 = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [ fpletz ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/version.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/version.nix
new file mode 100644
index 000000000000..e617881a570c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/batman-adv/version.nix
@@ -0,0 +1,9 @@
+{
+ version = "2020.3";
+
+ sha256 = {
+ batman-adv = "0wrzh0k44zzjx2s5zj65hjkh4jm9y38qpis1s5cbx9cyj756slb5";
+ alfred = "13bvccz90pkjl09jyw68gj23pbrw9b05w1vhds9sjggwf3jkj5w2";
+ batctl = "0r2w2v4sy6wgr7mp9lc7yj9k4ldsbsm3425rjil7p0b17zmzf4rm";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix
new file mode 100644
index 000000000000..67cbc6e5c5e6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchurl, fetchpatch, kernel, runtimeShell }:
+
+let
+ baseName = "bbswitch";
+ version = "0.8";
+ name = "${baseName}-${version}-${kernel.version}";
+
+in
+
+stdenv.mkDerivation {
+ inherit name;
+
+ src = fetchurl {
+ url = "https://github.com/Bumblebee-Project/${baseName}/archive/v${version}.tar.gz";
+ sha256 = "0xql1nv8dafnrcg54f3jsi3ny3cd2ca9iv73pxpgxd2gfczvvjkn";
+ };
+
+ 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"
+ '';
+
+ 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 stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/default.nix
new file mode 100644
index 000000000000..a90b2fce34d5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/default.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, fetchpatch
+, makeWrapper, cmake, llvmPackages, kernel
+, flex, bison, elfutils, python, luajit, netperf, iperf, libelf
+, systemtap, bash
+}:
+
+python.pkgs.buildPythonApplication rec {
+ pname = "bcc";
+ version = "0.16.0";
+
+ disabled = !stdenv.isLinux;
+
+ src = fetchurl {
+ url = "https://github.com/iovisor/bcc/releases/download/v${version}/bcc-src-with-submodule.tar.gz";
+ sha256 = "sha256-ekVRyugpZOU1nr0N9kWCSoJTmtD2qGsn/DmWgK7XZ/c=";
+ };
+ format = "other";
+
+ buildInputs = with llvmPackages; [
+ llvm clang-unwrapped kernel
+ elfutils luajit netperf iperf
+ systemtap.stapBuild flex bash
+ ];
+
+ patches = [
+ # This is needed until we fix
+ # https://github.com/NixOS/nixpkgs/issues/40427
+ ./fix-deadlock-detector-import.patch
+
+ # This is already upstream; remove it on the next release
+ (fetchpatch {
+ url = "https://github.com/iovisor/bcc/commit/60de17161fe7f44b534a8da343edbad2427220e3.patch";
+ sha256 = "0pd5b4vgpdxbsrjwrw2kmn4l9hpj0rwdm3hvwvk7dsr3raz7w4b3";
+ })
+ ];
+
+ propagatedBuildInputs = [ python.pkgs.netaddr ];
+ nativeBuildInputs = [ makeWrapper cmake flex bison ]
+ # libelf is incompatible with elfutils-libelf
+ ++ stdenv.lib.filter (x: x != libelf) kernel.moduleBuildDependencies;
+
+ cmakeFlags = [
+ "-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules"
+ "-DREVISION=${version}"
+ "-DENABLE_USDT=ON"
+ "-DENABLE_CPP_API=ON"
+ ];
+
+ postPatch = ''
+ substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
+ patch -p1 < libbcc-path.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"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Dynamic Tracing Tools for Linux";
+ homepage = "https://iovisor.github.io/bcc/";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ ragge mic92 thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch
new file mode 100644
index 000000000000..1c422635f4fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/fix-deadlock-detector-import.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/libbcc-path.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/libbcc-path.patch
new file mode 100644
index 000000000000..187bb3aadd00
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bcc/libbcc-path.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/blktrace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/blktrace/default.nix
new file mode 100644
index 000000000000..4ae449c19aa8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/blktrace/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libaio }:
+
+stdenv.mkDerivation {
+ name = "blktrace-1.2.0";
+
+ # Official source
+ # "git://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git"
+ src = fetchurl {
+ url = "http://brick.kernel.dk/snaps/blktrace-1.2.0.tar.bz2";
+ sha256 = "0i9z7ayh9qx4wi0ihyz15bhr1c9aknjl8v5i8c9mx3rhyy41i5i6";
+ };
+
+ buildInputs = [ libaio ];
+
+ preConfigure = ''
+ sed s,/usr/local,$out, -i Makefile
+ '';
+
+ meta = {
+ description = "Block layer IO tracing mechanism";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bluez/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bluez/default.nix
new file mode 100644
index 000000000000..401ab39bca36
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bluez/default.nix
@@ -0,0 +1,122 @@
+{ stdenv
+, lib
+, fetchurl
+, alsaLib
+, dbus
+, glib
+, json_c
+, libical
+, pkgconfig
+, python3
+, readline
+, systemd
+, udev
+}: let
+ pythonPath = with python3.pkgs; [
+ dbus-python
+ pygobject3
+ recursivePthLoader
+ ];
+in stdenv.mkDerivation rec {
+ pname = "bluez";
+ version = "5.54";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/bluetooth/${pname}-${version}.tar.xz";
+ sha256 = "1p2ncvjz6alr9n3l5wvq2arqgc7xjs6dqyar1l9jp0z8cfgapkb8";
+ };
+
+ buildInputs = [
+ alsaLib
+ dbus
+ glib
+ json_c
+ libical
+ python3
+ readline
+ udev
+ ];
+
+ nativeBuildInputs = [
+ pkgconfig
+ python3.pkgs.wrapPython
+ ];
+
+ outputs = [ "out" "dev" ] ++ lib.optional doCheck "test";
+
+ postPatch = ''
+ substituteInPlace tools/hid2hci.rules \
+ --replace /sbin/udevadm ${systemd}/bin/udevadm \
+ --replace "hid2hci " "$out/lib/udev/hid2hci "
+ '';
+
+ configureFlags = [
+ "--localstatedir=/var"
+ "--enable-library"
+ "--enable-cups"
+ "--enable-pie"
+ "--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-wiimote"
+ ];
+
+ # 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
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Bluetooth support for Linux";
+ homepage = "http://www.bluez.org/";
+ license = with licenses; [ gpl2 lgpl21 ];
+ platforms = platforms.linux;
+ repositories.git = "https://git.kernel.org/pub/scm/bluetooth/bluez.git";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch
new file mode 100644
index 000000000000..0853bcea9167
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch
@@ -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}"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/default.nix
new file mode 100644
index 000000000000..114a90129ac2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bolt/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, meson, ninja, pkgconfig, fetchFromGitLab,
+ python3, umockdev, gobject-introspection, dbus,
+ asciidoc, libxml2, libxslt, docbook_xml_dtd_45, docbook_xsl,
+ glib, systemd, polkit
+}:
+
+stdenv.mkDerivation rec {
+ pname = "bolt";
+ version = "0.8";
+
+ src = fetchFromGitLab {
+ domain = "gitlab.freedesktop.org";
+ owner = "bolt";
+ repo = "bolt";
+ rev = version;
+ sha256 = "1qamls0fll0qc27lqavf56hv1yj6v6n4ry90g7bcnwpvccmd82yd";
+ };
+
+ nativeBuildInputs = [
+ meson ninja pkgconfig
+ asciidoc libxml2 libxslt docbook_xml_dtd_45 docbook_xsl
+ ] ++ stdenv.lib.optional (!doCheck) python3;
+
+ buildInputs = [
+ glib systemd polkit
+ ];
+
+ doCheck = true;
+
+ preCheck = ''
+ export LD_LIBRARY_PATH=${umockdev.out}/lib/
+ '';
+
+ checkInputs = [
+ dbus umockdev gobject-introspection
+ (python3.withPackages
+ (p: [ p.pygobject3 p.dbus-python p.python-dbusmock ]))
+ ];
+
+ # meson install tries to create /var/lib/boltd
+ patches = [ ./0001-skip-mkdir.patch ];
+
+ 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 stdenv.lib; {
+ description = "Thunderbolt 3 device management daemon";
+ homepage = "https://gitlab.freedesktop.org/bolt/bolt";
+ license = licenses.lgpl21Plus;
+ maintainers = [ maintainers.callahad ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftool/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftool/default.nix
new file mode 100644
index 000000000000..34ddcc3a213f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftool/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, libopcodes, libbfd, libelf
+, linuxPackages_latest, zlib
+, python3
+}:
+
+stdenv.mkDerivation {
+ pname = "bpftool";
+ inherit (linuxPackages_latest.kernel) version src;
+
+ nativeBuildInputs = [ python3 ];
+ buildInputs = [ libopcodes libbfd libelf zlib ];
+
+ preConfigure = ''
+ patchShebangs scripts/bpf_helpers_doc.py
+
+ cd tools/bpf/bpftool
+ substituteInPlace ./Makefile \
+ --replace '/usr/local' "$out" \
+ --replace '/usr' "$out" \
+ --replace '/sbin' '/bin'
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Debugging/program analysis tool for the eBPF subsystem";
+ license = [ licenses.gpl2 licenses.bsd2 ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/default.nix
new file mode 100644
index 000000000000..fc7c8ecba2da
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchFromGitHub
+, cmake, pkgconfig, flex, bison
+, llvmPackages, kernel, elfutils
+, libelf, libbfd, libbpf, libopcodes, bcc
+}:
+
+stdenv.mkDerivation rec {
+ pname = "bpftrace";
+ version = "0.11.0";
+
+ src = fetchFromGitHub {
+ owner = "iovisor";
+ repo = "bpftrace";
+ rev = "refs/tags/v${version}";
+ sha256 = "02f2r731yj3fdc8341id1ksk4dma9rwm2765n2xgx2ldrrz5823y";
+ };
+
+ enableParallelBuilding = true;
+
+ buildInputs = with llvmPackages;
+ [ llvm clang-unwrapped
+ kernel elfutils libelf bcc
+ libbpf libbfd libopcodes
+ ];
+
+ nativeBuildInputs = [ cmake pkgconfig flex bison ]
+ # libelf is incompatible with elfutils-libelf
+ ++ stdenv.lib.filter (x: x != libelf) kernel.moduleBuildDependencies;
+
+ # patch the source, *then* substitute on @NIX_KERNEL_SRC@ in the result. we could
+ # also in theory make this an environment variable around bpftrace, but this works
+ # nicely without wrappers.
+ patchPhase = ''
+ patch -p1 < ${./fix-kernel-include-dir.patch}
+ substituteInPlace ./src/utils.cpp \
+ --subst-var-by NIX_KERNEL_SRC '${kernel.dev}/lib/modules/${kernel.modDirVersion}'
+ '';
+
+ # 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" ];
+
+ meta = with stdenv.lib; {
+ description = "High-level tracing language for Linux eBPF";
+ homepage = "https://github.com/iovisor/bpftrace";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ rvl thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/fix-kernel-include-dir.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/fix-kernel-include-dir.patch
new file mode 100644
index 000000000000..bff370d51e27
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bpftrace/fix-kernel-include-dir.patch
@@ -0,0 +1,22 @@
+commit b6172952c0150d84912fa6f09bab782dd0549f1e
+Author: Austin Seipp <aseipp@pobox.com>
+Date: Fri May 3 00:47:12 2019 -0500
+
+ src: special case nix build directories for clang
+
+ Signed-off-by: Austin Seipp <aseipp@pobox.com>
+
+diff --git a/src/clang_parser.cpp b/src/clang_parser.cpp
+index b1db8ff..0cfb01f 100644
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -140,6 +140,9 @@ static bool is_dir(const std::string& path)
+ // Both ksrc and kobj are guaranteed to be != "", if at least some trace of kernel sources was found.
+ std::tuple<std::string, std::string> get_kernel_dirs(const struct utsname& utsname)
+ {
++ // NB (aseipp): special case the kernel directory for nix
++ return { "@NIX_KERNEL_SRC@/source", "@NIX_KERNEL_SRC@/build" };
++
+ #ifdef KERNEL_HEADERS_DIR
+ return {KERNEL_HEADERS_DIR, KERNEL_HEADERS_DIR};
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/add-ip6-header.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/add-ip6-header.patch
new file mode 100644
index 000000000000..c9149bfec386
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/add-ip6-header.patch
@@ -0,0 +1,11 @@
+diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h
+index 39964f2..dd14bae 100644
+--- a/libbridge/libbridge.h
++++ b/libbridge/libbridge.h
+@@ -20,6 +20,7 @@
+ #define _LIBBRIDGE_H
+
+ #include <sys/socket.h>
++#include <netinet/in.h>
+ #include <linux/if.h>
+ #include <linux/if_bridge.h>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/autoconf-ar.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/autoconf-ar.patch
new file mode 100644
index 000000000000..efa41075644d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/autoconf-ar.patch
@@ -0,0 +1,25 @@
+diff --git a/configure.in b/configure.in
+index 5e3f89b..19be6d9 100644
+--- a/configure.in
++++ b/configure.in
+@@ -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
+diff --git a/libbridge/Makefile.in b/libbridge/Makefile.in
+index 20512c4..83c802b 100644
+--- 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@
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix
new file mode 100644
index 000000000000..1aeb4a907fbf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ name = "bridge-utils-1.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/bridge/${name}.tar.gz";
+ sha256 = "42f9e5fb8f6c52e63a98a43b81bd281c227c529f194913e1c51ec48a393b6688";
+ };
+
+ patches = [
+ ./autoconf-ar.patch
+ ./add-ip6-header.patch # Remove patch once the kernel headers are updated
+ ];
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ postInstall = ''
+ # The bridge utils build does not fail even if the brctl binary
+ # is not build. This test ensures that we fail if we don't produce a brctl
+ # binary.
+ test -f $out/sbin/brctl
+ '';
+
+ meta = {
+ description = "https://sourceforge.net/projects/bridge/";
+ homepage = "https://wiki.linuxfoundation.org/networking/bridge";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/default.nix
new file mode 100644
index 000000000000..5baaa0752aa6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitLab , go-md2man, coreutils, substituteAll }:
+
+stdenv.mkDerivation rec {
+ pname = "brillo";
+ version = "1.4.9";
+
+ src = fetchFromGitLab {
+ owner= "cameronnemo";
+ repo= "brillo";
+ rev= "v${version}";
+ sha256 = "0ab7s60zcgl6hvm0a9rlwq35p25n3jnw6r9256pwl4cdwyjyybsb";
+ };
+
+ patches = [
+ (substituteAll {
+ src = ./udev-rule.patch;
+ inherit coreutils;
+ })
+ ];
+
+ nativeBuildInputs = [ go-md2man ];
+
+ makeFlags = [ "PREFIX=$(out)" "AADIR=$(out)/etc/apparmor.d" ];
+
+ installTargets = [ "install-dist" ];
+
+ meta = with stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/udev-rule.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/udev-rule.patch
new file mode 100644
index 000000000000..7b1cf4840675
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/brillo/udev-rule.patch
@@ -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"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/default.nix
new file mode 100644
index 000000000000..ecaa3896044d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl, kernel }:
+
+let
+ version = "6.30.223.271";
+ hashes = {
+ i686-linux = "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg";
+ x86_64-linux = "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz";
+ };
+
+ arch = stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "_64";
+ tarballVersion = stdenv.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
+ ./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 = stdenv.lib.licenses.unfreeRedistributable;
+ maintainers = with stdenv.lib.maintainers; [ phreedom ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/gcc.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/gcc.patch
new file mode 100644
index 000000000000..f93e3f1d3a3f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/gcc.patch
@@ -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`
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/i686-build-failure.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/i686-build-failure.patch
new file mode 100644
index 000000000000..cfa16075409b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/i686-build-failure.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/license.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/license.patch
new file mode 100644
index 000000000000..aebb46365195
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/license.patch
@@ -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);
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.11.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.11.patch
new file mode 100644
index 000000000000..a779f8c84cfd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.11.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.12.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.12.patch
new file mode 100644
index 000000000000..8abc73db4db1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.12.patch
@@ -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);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.15.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.15.patch
new file mode 100644
index 000000000000..523fa291d525
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.15.patch
@@ -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;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.7.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.7.patch
new file mode 100644
index 000000000000..566680a09140
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.7.patch
@@ -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;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.8.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.8.patch
new file mode 100644
index 000000000000..20e8a9ae49d2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-4.8.patch
@@ -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
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.1.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.1.patch
new file mode 100644
index 000000000000..8f04a737cab8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.1.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.6.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.6.patch
new file mode 100644
index 000000000000..df5af79f77c6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/linux-5.6.patch
@@ -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)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/null-pointer-fix.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/null-pointer-fix.patch
new file mode 100644
index 000000000000..763797294307
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/broadcom-sta/null-pointer-fix.patch
@@ -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);
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/btfs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/btfs/default.nix
new file mode 100644
index 000000000000..b4107e8ba001
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/btfs/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
+, python3, boost, fuse, libtorrentRasterbar, curl }:
+
+stdenv.mkDerivation rec {
+ pname = "btfs";
+ version = "2.22";
+
+ src = fetchFromGitHub {
+ owner = "johang";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1z88bk1z4sns3jdn56x83mvh06snxg0lr5h4v0c24lzlf5wbdifz";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [
+ boost fuse libtorrentRasterbar curl python3
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A bittorrent filesystem based on FUSE";
+ homepage = "https://github.com/johang/btfs";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ rnhmjoj ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-Fix-build-with-glibc-2.31.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-Fix-build-with-glibc-2.31.patch
new file mode 100644
index 000000000000..029333b57e4d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-Fix-build-with-glibc-2.31.patch
@@ -0,0 +1,71 @@
+From c29b637b55c93214993f40b1a223233d40b8a7d6 Mon Sep 17 00:00:00 2001
+From: Maximilian Bosch <maximilian@mbosch.me>
+Date: Wed, 19 Feb 2020 22:32:28 +0100
+Subject: [PATCH] Fix build with glibc 2.31
+
+This is derived from the corresponding upstream patch[1], however this
+one doesn't apply cleanly on busybox-1.31.1, so I rebased the patch
+locally and added it directly to nixpkgs.
+
+[1] https://git.busybox.net/busybox/patch/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9
+---
+ coreutils/date.c | 2 +-
+ libbb/missing_syscalls.c | 8 --------
+ util-linux/rdate.c | 8 ++++++--
+ 3 files changed, 7 insertions(+), 11 deletions(-)
+
+diff --git a/coreutils/date.c b/coreutils/date.c
+index 3414d38..931b7f9 100644
+--- a/coreutils/date.c
++++ b/coreutils/date.c
+@@ -303,7 +303,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
+ ts.tv_sec = validate_tm_time(date_str, &tm_time);
+
+ /* if setting time, set it */
+- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
++ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
+ bb_perror_msg("can't set date");
+ }
+ }
+diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
+index 87cf59b..dc40d91 100644
+--- a/libbb/missing_syscalls.c
++++ b/libbb/missing_syscalls.c
+@@ -15,14 +15,6 @@ pid_t getsid(pid_t pid)
+ return syscall(__NR_getsid, pid);
+ }
+
+-int stime(const time_t *t)
+-{
+- struct timeval tv;
+- tv.tv_sec = *t;
+- tv.tv_usec = 0;
+- return settimeofday(&tv, NULL);
+-}
+-
+ int sethostname(const char *name, size_t len)
+ {
+ return syscall(__NR_sethostname, name, len);
+diff --git a/util-linux/rdate.c b/util-linux/rdate.c
+index 70f829e..878375d 100644
+--- a/util-linux/rdate.c
++++ b/util-linux/rdate.c
+@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
+ if (!(flags & 2)) { /* no -p (-s may be present) */
+ if (time(NULL) == remote_time)
+ bb_error_msg("current time matches remote time");
+- else
+- if (stime(&remote_time) < 0)
++ else {
++ struct timespec ts;
++ ts.tv_sec = remote_time;
++ ts.tv_nsec = 0;
++ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
+ bb_perror_msg_and_die("can't set time of day");
++ }
+ }
+
+ if (flags != 1) /* not lone -s */
+--
+2.25.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-wget-implement-TLS-verification-with-ENABLE_FEATURE_.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-wget-implement-TLS-verification-with-ENABLE_FEATURE_.patch
new file mode 100644
index 000000000000..d11cd670d5e8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/0001-wget-implement-TLS-verification-with-ENABLE_FEATURE_.patch
@@ -0,0 +1,94 @@
+From 45fa3f18adf57ef9d743038743d9c90573aeeb91 Mon Sep 17 00:00:00 2001
+From: Dimitri John Ledkov <xnox@ubuntu.com>
+Date: Tue, 19 May 2020 18:20:39 +0100
+Subject: [PATCH] wget: implement TLS verification with
+ ENABLE_FEATURE_WGET_OPENSSL
+
+When ENABLE_FEATURE_WGET_OPENSSL is enabled, correctly implement TLS
+verification by default. And only ignore verification errors, if
+--no-check-certificate was passed.
+
+Also note, that previously OPENSSL implementation did not implement
+TLS verification, nor printed any warning messages that verification
+was not performed.
+
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1879533
+
+CVE-2018-1000500
+
+Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ networking/wget.c | 20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/networking/wget.c b/networking/wget.c
+index f2fc9e215..6a8c08324 100644
+--- a/networking/wget.c
++++ b/networking/wget.c
+@@ -91,6 +91,9 @@
+ //config: patches, but do want to waste bandwidth expaining how wrong
+ //config: it is, you will be ignored.
+ //config:
++//config: FEATURE_WGET_OPENSSL does implement TLS verification
++//config: using the certificates available to OpenSSL.
++//config:
+ //config:config FEATURE_WGET_OPENSSL
+ //config: bool "Try to connect to HTTPS using openssl"
+ //config: default y
+@@ -115,6 +118,9 @@
+ //config: If openssl can't be executed, internal TLS code will be used
+ //config: (if you enabled it); if openssl can be executed but fails later,
+ //config: wget can't detect this, and download will fail.
++//config:
++//config: By default TLS verification is performed, unless
++//config: --no-check-certificate option is passed.
+
+ //applet:IF_WGET(APPLET(wget, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+@@ -124,8 +130,11 @@
+ //usage: IF_FEATURE_WGET_LONG_OPTIONS(
+ //usage: "[-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]\n"
+ //usage: " [-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off]\n"
++//usage: IF_FEATURE_WGET_OPENSSL(
++//usage: " [--no-check-certificate]\n"
++//usage: )
+ /* Since we ignore these opts, we don't show them in --help */
+-/* //usage: " [--no-check-certificate] [--no-cache] [--passive-ftp] [-t TRIES]" */
++/* //usage: " [--no-cache] [--passive-ftp] [-t TRIES]" */
+ /* //usage: " [-nv] [-nc] [-nH] [-np]" */
+ //usage: " [-P DIR] [-S|--server-response] [-U|--user-agent AGENT]" IF_FEATURE_WGET_TIMEOUT(" [-T SEC]") " URL..."
+ //usage: )
+@@ -137,7 +146,9 @@
+ //usage: "Retrieve files via HTTP or FTP\n"
+ //usage: IF_FEATURE_WGET_LONG_OPTIONS(
+ //usage: "\n --spider Only check URL existence: $? is 0 if exists"
+-///////: "\n --no-check-certificate Don't validate the server's certificate"
++//usage: IF_FEATURE_WGET_OPENSSL(
++//usage: "\n --no-check-certificate Don't validate the server's certificate"
++//usage: )
+ //usage: )
+ //usage: "\n -c Continue retrieval of aborted transfer"
+ //usage: "\n -q Quiet"
+@@ -662,7 +673,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
+ pid = xvfork();
+ if (pid == 0) {
+ /* Child */
+- char *argv[8];
++ char *argv[9];
+
+ close(sp[0]);
+ xmove_fd(sp[1], 0);
+@@ -689,6 +700,9 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
+ argv[5] = (char*)"-servername";
+ argv[6] = (char*)servername;
+ }
++ if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
++ argv[7] = (char*)"-verify_return_error";
++ }
+
+ BB_EXECVP(argv[0], argv);
+ xmove_fd(3, 2);
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/busybox-in-store.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/busybox-in-store.patch
new file mode 100644
index 000000000000..2d356b66b3ae
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/busybox-in-store.patch
@@ -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];
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/clang-cross.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/clang-cross.patch
new file mode 100644
index 000000000000..b2d696bfd73f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/clang-cross.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/default.nix
new file mode 100644
index 000000000000..599754129b43
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/default.nix
@@ -0,0 +1,144 @@
+{ stdenv, lib, buildPackages, fetchurl, fetchFromGitLab
+, enableStatic ? false
+, enableMinimal ? false
+# 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 lacks 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 {
+ # TODO: When bumping this version, please validate whether the wget patch is present upstream
+ # and remove the patch if it is. The patch should be present upstream for all versions 1.32.0+.
+ # See NixOs/nixpkgs#94722 for context.
+ name = "busybox-1.31.1";
+
+ # 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/${name}.tar.bz2";
+ sha256 = "1659aabzp8w4hayr4z8kcpbk2z1q2wqhw7i1yb0l72b45ykl1yfh";
+ };
+
+ hardeningDisable = [ "format" "pie" ]
+ ++ lib.optionals enableStatic [ "fortify" ];
+
+ patches = [
+ ./busybox-in-store.patch
+ ./0001-Fix-build-with-glibc-2.31.patch
+ ./0001-wget-implement-TLS-verification-with-ENABLE_FEATURE_.patch
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./clang-cross.patch;
+
+ 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
+
+ ${lib.optionalString enableStatic ''
+ CONFIG_STATIC y
+ ''}
+
+ # 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")
+ '';
+
+ postInstall = ''
+ sed -e '
+ 1 a busybox() { '$out'/bin/busybox "$@"; }\
+ logger() { '$out'/bin/logger "$@"; }\
+ ' ${debianDispatcherScript} > ${outDispatchPath}
+ chmod 555 ${outDispatchPath}
+ PATH=$out/bin patchShebangs ${outDispatchPath}
+ '';
+
+ 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 stdenv.lib; {
+ description = "Tiny versions of common UNIX utilities in a single small executable";
+ homepage = "https://busybox.net/";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ TethysSvensson ];
+ platforms = platforms.linux;
+ priority = 10;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/sandbox-shell.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/sandbox-shell.nix
new file mode 100644
index 000000000000..036ea0a0f486
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/busybox/sandbox-shell.nix
@@ -0,0 +1,25 @@
+{ busybox, stdenv}:
+
+# 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_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
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cachefilesd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cachefilesd/default.nix
new file mode 100644
index 000000000000..27fd8c9613ac
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cachefilesd/default.nix
@@ -0,0 +1,25 @@
+{ 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 stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-isotp/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-isotp/default.nix
new file mode 100644
index 000000000000..cccc7550fba8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-isotp/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, kernel, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ pname = "can-isotp";
+ version = "20200910";
+
+ hardeningDisable = [ "pic" ];
+
+ src = fetchFromGitHub {
+ owner = "hartkopp";
+ repo = "can-isotp";
+ rev = "21a3a59e2bfad246782896841e7af042382fcae7";
+ sha256 = "1laax93czalclg7cy9iq1r7hfh9jigh7igj06y9lski75ap2vhfq";
+ };
+
+ KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
+ INSTALL_MOD_PATH = "\${out}";
+
+ buildPhase = ''
+ make modules
+ '';
+
+ installPhase = ''
+ make modules_install
+ '';
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ meta = with stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-utils/default.nix
new file mode 100644
index 000000000000..2b6b82591b59
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/can-utils/default.nix
@@ -0,0 +1,31 @@
+{ 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 stdenv.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 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checkpolicy/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checkpolicy/default.nix
new file mode 100644
index 000000000000..fc2faa5b8f57
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checkpolicy/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, bison, flex, libsepol }:
+
+stdenv.mkDerivation rec {
+ pname = "checkpolicy";
+ version = "2.9";
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/checkpolicy-${version}.tar.gz";
+ sha256 = "13jz6f8zdrijvn5w1j102b36fs41z0q8ii74axw48cj550mw6im9";
+ };
+
+ nativeBuildInputs = [ bison flex ];
+ buildInputs = [ libsepol ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a"
+ ];
+
+ meta = removeAttrs libsepol.meta ["outputsToInstall"] // {
+ description = "SELinux policy compiler";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/0001-attempt-to-modprobe-config-before-checking-kernel.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/0001-attempt-to-modprobe-config-before-checking-kernel.patch
new file mode 100644
index 000000000000..9beeab0f9543
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/0001-attempt-to-modprobe-config-before-checking-kernel.patch
@@ -0,0 +1,28 @@
+From 6503848d9e0eb009e5f462116a963beacb208930 Mon Sep 17 00:00:00 2001
+From: Austin Seipp <aseipp@pobox.com>
+Date: Thu, 20 Feb 2014 00:11:44 -0600
+Subject: [PATCH] attempt to 'modprobe config' before checking kernel
+
+Signed-off-by: Austin Seipp <aseipp@pobox.com>
+---
+ checksec.sh | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/checksec b/checksec
+index dd1f72e..63acc29 100644
+--- a/checksec
++++ b/checksec
+@@ -676,7 +676,8 @@ kernelcheck() {
+ echo_message " userspace processes, this option lists the status of kernel configuration\n" '' '' ''
+ 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}\","
+ # update the architecture based on the config rather than the system
+--
+1.8.3.2
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/default.nix
new file mode 100644
index 000000000000..5a66e536956f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/checksec/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, makeWrapper, file, findutils
+, binutils-unwrapped, glibc, coreutils, sysctl, openssl
+}:
+
+stdenv.mkDerivation rec {
+ pname = "checksec";
+ version = "2.2.3";
+
+ src = fetchFromGitHub {
+ owner = "slimm609";
+ repo = "checksec.sh";
+ rev = version;
+ sha256 = "0hw8bd7dj71m1ml9zvfab2j87jacs542z7a89nziapckmg6kmh6f";
+ };
+
+ patches = [ ./0001-attempt-to-modprobe-config-before-checking-kernel.patch ];
+ nativeBuildInputs = [ makeWrapper ];
+
+ installPhase = let
+ path = stdenv.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 stdenv.lib; {
+ description = "A tool for checking security bits on executables";
+ homepage = "http://www.trapkit.de/tools/checksec.html";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ thoughtpolice globin ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/chromium-xorg-conf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/chromium-xorg-conf/default.nix
new file mode 100644
index 000000000000..d9608650ed9d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/chromium-xorg-conf/default.nix
@@ -0,0 +1,8 @@
+{ fetchFromGitiles }:
+
+fetchFromGitiles {
+ name = "chromium-xorg-conf";
+ url = "https://chromium.googlesource.com/chromiumos/platform/xorg-conf";
+ rev = "26fb9d57e195c7e467616b35b17e2b5d279c1514";
+ sha256 = "0643y3l3hjk4mv4lm3h9z56h990q6k11hcr10lcqppgsii0d3zcf";
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cifs-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cifs-utils/default.nix
new file mode 100644
index 000000000000..ad136b811df8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cifs-utils/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, autoreconfHook, docutils, pkgconfig
+, kerberos, keyutils, pam, talloc }:
+
+stdenv.mkDerivation rec {
+ pname = "cifs-utils";
+ version = "6.9";
+
+ src = fetchurl {
+ url = "mirror://samba/pub/linux-cifs/cifs-utils/${pname}-${version}.tar.bz2";
+ sha256 = "175cp509wn1zv8p8mv37hkf6sxiskrsxdnq22mhlsg61jazz3n0q";
+ };
+
+ nativeBuildInputs = [ autoreconfHook docutils pkgconfig ];
+
+ buildInputs = [ kerberos keyutils pam talloc ];
+
+ makeFlags = [ "root_sbindir=$(out)/sbin" ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.samba.org/linux-cifs/cifs-utils/";
+ description = "Tools for managing Linux CIFS client filesystems";
+ platforms = platforms.linux;
+ license = licenses.lgpl3;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/compsize/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/compsize/default.nix
new file mode 100644
index 000000000000..dd54df77c348
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/compsize/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, btrfs-progs }:
+
+stdenv.mkDerivation rec {
+ pname = "compsize";
+ version = "1.3";
+
+ src = fetchFromGitHub {
+ owner = "kilobyte";
+ repo = "compsize";
+ rev = "v${version}";
+ sha256 = "1c69whla844nwis30jxbj00zkpiw3ccndhkmzjii8av5358mjn43";
+ };
+
+ buildInputs = [ btrfs-progs ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man8
+ install -m 0755 compsize $out/bin
+ install -m 0444 compsize.8 $out/share/man/man8
+ '';
+
+ meta = with stdenv.lib; {
+ description = "btrfs: Find compression type/ratio on a file or set of files";
+ homepage = "https://github.com/kilobyte/compsize";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ CrazedProgrammer ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conky/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conky/default.nix
new file mode 100644
index 000000000000..ee67140cd861
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conky/default.nix
@@ -0,0 +1,143 @@
+{ config, stdenv, fetchFromGitHub, pkgconfig, cmake
+
+# dependencies
+, glib, libXinerama
+
+# 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 stdenv.lib;
+
+stdenv.mkDerivation rec {
+ pname = "conky";
+ version = "1.11.6";
+
+ src = fetchFromGitHub {
+ owner = "brndnmtthws";
+ repo = "conky";
+ rev = "v${version}";
+ sha256 = "0y2g66fjqp2hdk0y1h4ijxhnv34j16gizvxpmbigwh4n6zijcm6v";
+ };
+
+ 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)"
+ '';
+
+ NIX_LDFLAGS = "-lgcc_s";
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+ 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;
+
+ meta = with stdenv.lib; {
+ homepage = "http://conky.sourceforge.net/";
+ description = "Advanced, highly configurable system monitor based on torsmo";
+ maintainers = [ maintainers.guibert ];
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conntrack-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conntrack-tools/default.nix
new file mode 100644
index 000000000000..43306e51166b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conntrack-tools/default.nix
@@ -0,0 +1,29 @@
+{ fetchurl, stdenv, flex, bison, pkgconfig, 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 pkgconfig ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://conntrack-tools.netfilter.org/";
+ description = "Connection tracking userspace tools";
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/consoletools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/consoletools/default.nix
new file mode 100644
index 000000000000..83de8f5ae1a5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/consoletools/default.nix
@@ -0,0 +1,37 @@
+{ 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 stdenv.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
+ '';
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.nix
new file mode 100644
index 000000000000..a52b87385706
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.nix
@@ -0,0 +1,37 @@
+{stdenv, fetchurl, autoconf, automake, ncurses}:
+let
+ s = # Generated upstream information
+ rec {
+ baseName="conspy";
+ version="1.16";
+ name="${baseName}-${version}";
+ hash="02andak806vd04bgjlr0y0d2ddx7cazyf8nvca80vlh8x94gcppf";
+ url="mirror://sourceforge/project/conspy/conspy-1.16-1/conspy-1.16.tar.gz";
+ sha256="02andak806vd04bgjlr0y0d2ddx7cazyf8nvca80vlh8x94gcppf";
+ };
+ buildInputs = [
+ autoconf automake ncurses
+ ];
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ inherit buildInputs;
+ src = fetchurl {
+ inherit (s) url sha256;
+ curlOpts = " -A application/octet-stream ";
+ };
+ preConfigure = ''
+ touch NEWS
+ echo "EPL 1.0" > COPYING
+ aclocal
+ automake --add-missing
+ autoconf
+ '';
+ meta = {
+ inherit (s) version;
+ description = "Linux text console viewer";
+ license = stdenv.lib.licenses.epl10 ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.upstream b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.upstream
new file mode 100644
index 000000000000..3f9ff3e4a820
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/conspy/default.upstream
@@ -0,0 +1,5 @@
+url https://sourceforge.net/projects/conspy/files/
+version_link 'conspy-[-0-9.]+/$'
+version_link '[-0-9.]+[.]tar[.][a-z0-9]+/download$'
+SF_redirect
+version '.*-([-0-9.]+)[.]tar[.].*' '\1'
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix
new file mode 100644
index 000000000000..4c0515e94b3b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, libtool, gettext }:
+
+stdenv.mkDerivation rec {
+ name = "cpufrequtils-008";
+
+ src = fetchurl {
+ url = "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/${name}.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 stdenv.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.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/remove-pot-creation-date.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/remove-pot-creation-date.patch
new file mode 100644
index 000000000000..0116ed9eab0c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpufrequtils/remove-pot-creation-date.patch
@@ -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
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuid/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuid/default.nix
new file mode 100644
index 000000000000..df0017eadc1f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuid/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, perl }:
+
+stdenv.mkDerivation rec {
+ pname = "cpuid";
+ version = "20200427";
+
+ src = fetchurl {
+ name = "${pname}-${version}.src.tar.gz";
+ url = "http://etallen.com/cpuid/${pname}-${version}.src.tar.gz";
+ sha256 = "1m31238z2ya8f8pzpyklwp0ksf5xicqrw1z941hhhx913wzldaf1";
+ };
+
+ # 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 = {
+ 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.
+ '';
+
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ license = stdenv.lib.licenses.gpl2;
+ homepage = "http://etallen.com/cpuid.html";
+ maintainers = with stdenv.lib.maintainers; [ blitz ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpupower/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpupower/default.nix
new file mode 100644
index 000000000000..b6ecaa11de28
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpupower/default.nix
@@ -0,0 +1,44 @@
+{ 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 = stdenv.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 stdenv.lib; {
+ description = "Tool to examine and tune power saving features";
+ homepage = "https://www.kernel.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuset/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuset/default.nix
new file mode 100644
index 000000000000..57cffe5f9e08
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpuset/default.nix
@@ -0,0 +1,27 @@
+{ stdenv
+, fetchFromGitHub
+, python2Packages
+}:
+
+python2Packages.buildPythonApplication rec {
+ pname = "cpuset";
+ version = "1.5.8";
+
+ propagatedBuildInputs = [ ];
+
+ makeFlags = [ "prefix=$(out)" ];
+
+ src = fetchFromGitHub {
+ owner = "wykurz";
+ repo = "cpuset";
+ rev = "v${version}";
+ sha256 = "19fl2sn470yrnm2q508giggjwy5b6r2gd94gvwfbdlhf0r9dsbbm";
+ };
+
+ meta = with stdenv.lib; {
+ description = "Cpuset is a 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/wykurz/cpuset";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ wykurz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpustat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpustat/default.nix
new file mode 100644
index 000000000000..23ed2b07c966
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cpustat/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "cpustat";
+ version = "0.02.09";
+
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/${pname}/${pname}-${version}.tar.xz";
+ sha256 = "12xahv65yrhs5r830clkl1qnwg3dnrk5qn3zsznzbv1iy2f3cj7y";
+ };
+
+ buildInputs = [ ncurses ];
+
+ installFlags = [
+ "BINDIR=${placeholder "out"}/bin"
+ "MANDIR=${placeholder "out"}/share/man/man8"
+ ];
+
+ meta = with lib; {
+ description = "CPU usage monitoring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/cpustat/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ dtzWill ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/default.nix
new file mode 100644
index 000000000000..8633823ab5c5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/default.nix
@@ -0,0 +1,32 @@
+{ 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 ];
+
+ installPhase = ''
+ install --target $out/bin -D cramfsck mkcramfs
+ '';
+
+ buildInputs = [ zlib ];
+
+ meta = with stdenv.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;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/include-sysmacros.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/include-sysmacros.patch
new file mode 100644
index 000000000000..7c115a66ac90
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsprogs/include-sysmacros.patch
@@ -0,0 +1,12 @@
+diff --git a/mkcramfs.c b/mkcramfs.c
+index a2ef018959d..bec83c112d1 100644
+--- a/mkcramfs.c
++++ b/mkcramfs.c
+@@ -22,6 +22,7 @@
+ * If you change the disk format of cramfs, please update fs/cramfs/README.
+ */
+
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <sys/stat.h>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsswap/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsswap/default.nix
new file mode 100644
index 000000000000..afb38364c4e6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cramfsswap/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl, zlib}:
+
+stdenv.mkDerivation rec {
+ pname = "cramfsswap";
+ version = "1.4.1";
+
+ src = fetchurl {
+ url = "mirror://debian/pool/main/c/cramfsswap/${pname}_${version}.tar.gz";
+ sha256 = "0c6lbx1inkbcvvhh3y6fvfaq3w7d1zv7psgpjs5f3zjk1jysi9qd";
+ };
+
+ buildInputs = [zlib];
+
+ installPhase = ''
+ install --target $out/bin -D cramfsswap
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Swap endianess of a cram filesystem (cramfs)";
+ homepage = "https://packages.debian.org/sid/utils/cramfsswap";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/crda/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/crda/default.nix
new file mode 100644
index 000000000000..979b7cf1deb3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/crda/default.nix
@@ -0,0 +1,78 @@
+{ stdenv, fetchurl, fetchpatch, libgcrypt, libnl, pkgconfig, python3Packages, wireless-regdb }:
+
+stdenv.mkDerivation rec {
+ pname = "crda";
+ version = "3.18";
+
+ src = fetchurl {
+ sha256 = "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23";
+ url = "http://kernel.org/pub/software/network/crda/crda-${version}.tar.xz";
+ };
+
+ patches = [
+ # Switch to Python 3
+ # https://lore.kernel.org/linux-wireless/1437542484-23409-1-git-send-email-ahmed.taahir@gmail.com/
+ (fetchpatch {
+ url = "https://lore.kernel.org/linux-wireless/1437542484-23409-2-git-send-email-ahmed.taahir@gmail.com/raw";
+ sha256 = "0s2n340cgaasvg1k8g9v8xjrbh4y2mcgrhdmv97ja2fs8xjcjbf1";
+ })
+ (fetchpatch {
+ url = "https://lore.kernel.org/linux-wireless/1437542484-23409-3-git-send-email-ahmed.taahir@gmail.com/raw";
+ sha256 = "01dlfw7kqhyx025jxq2l75950b181p9r7i9zkflcwvbzzdmx59md";
+ })
+ ];
+
+ buildInputs = [ libgcrypt libnl ];
+ nativeBuildInputs = [
+ pkgconfig
+ python3Packages.pycrypto
+ ];
+
+ postPatch = ''
+ patchShebangs utils/
+ substituteInPlace Makefile \
+ --replace ldconfig true \
+ --replace pkg-config $PKG_CONFIG
+ sed -i crda.c \
+ -e "/\/usr\/.*\/regulatory.bin/d" \
+ -e "s|/lib/crda|${wireless-regdb}/lib/crda|g"
+ '';
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "SBINDIR=$(out)/bin/"
+ "UDEV_RULE_DIR=$(out)/lib/udev/rules.d/"
+ "REG_BIN=${wireless-regdb}/lib/crda/regulatory.bin"
+ ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error=unused-const-variable";
+
+ buildFlags = [ "all_noverify" ];
+ enableParallelBuilding = true;
+
+ doCheck = true;
+ checkTarget = "verify";
+
+ postInstall = ''
+ # The patch installs build header
+ rm $out/include/reglib/keys-gcrypt.h
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Linux wireless Central Regulatory Domain Agent";
+ longDescription = ''
+ CRDA acts as the udev helper for communication between the kernel and
+ userspace for regulatory compliance. It relies on nl80211 for communication.
+
+ CRDA is intended to be run only through udev communication from the kernel.
+ To use it under NixOS, add
+
+ services.udev.packages = [ pkgs.crda ];
+
+ to the system configuration.
+ '';
+ homepage = "http://drvbp1.linux-foundation.org/~mcgrof/rel-html/crda/";
+ license = licenses.free; # "copyleft-next 0.3.0", as yet without a web site
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/criu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/criu/default.nix
new file mode 100644
index 000000000000..462658396c8a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/criu/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, lib, fetchurl, protobuf, protobufc, asciidoc, iptables
+, xmlto, docbook_xsl, libpaper, libnl, libcap, libnet, pkgconfig
+, which, python, makeWrapper, docbook_xml_dtd_45 }:
+
+stdenv.mkDerivation rec {
+ pname = "criu";
+ version = "3.14";
+
+ src = fetchurl {
+ url = "https://download.openvz.org/criu/${pname}-${version}.tar.bz2";
+ sha256 = "1jrr3v99g18gc0hriz0avq6ccdvyya0j6wwz888sdsc4icc30gzn";
+ };
+
+ enableParallelBuilding = true;
+ nativeBuildInputs = [ pkgconfig docbook_xsl which makeWrapper docbook_xml_dtd_45 ];
+ buildInputs = [ protobuf protobufc asciidoc xmlto libpaper libnl libcap libnet python iptables ];
+
+ postPatch = ''
+ substituteInPlace ./Documentation/Makefile --replace "2>/dev/null" ""
+ substituteInPlace ./Documentation/Makefile --replace "-m custom.xsl" "-m custom.xsl --skip-validation -x ${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl"
+ substituteInPlace ./criu/Makefile --replace "-I/usr/include/libnl3" "-I${libnl.dev}/include/libnl3"
+ substituteInPlace ./Makefile --replace "head-name := \$(shell git tag -l v\$(CRIU_VERSION))" "head-name = ${version}.0"
+ ln -sf ${protobuf}/include/google/protobuf/descriptor.proto ./images/google/protobuf/descriptor.proto
+ '';
+
+ makeFlags = [ "PREFIX=$(out)" "ASCIIDOC=${asciidoc}/bin/asciidoc" "XMLTO=${xmlto}/bin/xmlto" ];
+
+ outputs = [ "out" "dev" "man" ];
+
+ preBuild = ''
+ # No idea why but configure scripts break otherwise.
+ export SHELL=""
+ '';
+
+ hardeningDisable = [ "stackprotector" "fortify" ];
+ # dropping fortify here as well as package uses it by default:
+ # command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
+
+ postFixup = ''
+ wrapProgram $out/bin/criu \
+ --prefix PATH : ${lib.makeBinPath [ iptables ]}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Userspace checkpoint/restore for Linux";
+ homepage = "https://criu.org";
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ maintainers.thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptodev/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptodev/default.nix
new file mode 100644
index 000000000000..79132852d239
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptodev/default.nix
@@ -0,0 +1,26 @@
+{ fetchFromGitHub, stdenv, kernel ? false }:
+
+stdenv.mkDerivation rec {
+ pname = "cryptodev-linux-1.11";
+ name = "${pname}-${kernel.version}";
+
+ src = fetchFromGitHub {
+ owner = "cryptodev-linux";
+ repo = "cryptodev-linux";
+ rev = pname;
+ sha256 = "1ky850qiyacq8p3lng7n3w6h3x2clqrz4lkv2cv3psy92mg9pvc9";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ KERNEL_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
+ INSTALL_MOD_PATH = "\${out}";
+ prefix = "\${out}";
+
+ meta = {
+ description = "Device that allows access to Linux kernel cryptographic drivers";
+ homepage = "http://cryptodev-linux.org/";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix
new file mode 100644
index 000000000000..aa5c124ea600
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, lvm2, json_c
+, openssl, libuuid, pkgconfig, popt }:
+
+stdenv.mkDerivation rec {
+ pname = "cryptsetup";
+ version = "2.3.4";
+
+ outputs = [ "out" "dev" "man" ];
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/cryptsetup/v2.3/${pname}-${version}.tar.xz";
+ sha256 = "0wrpz2fzbsszmsgxxbssxjgylpyiindh24z8g13m2fxmjsxyw5lx";
+ };
+
+ # Disable 4 test cases that fail in a sandbox
+ patches = [ ./disable-failing-tests.patch ];
+
+ postPatch = ''
+ patchShebangs tests
+
+ # O_DIRECT is filesystem dependent and fails in a sandbox (on tmpfs)
+ # and on several filesystem types (btrfs, zfs) without sandboxing.
+ # Remove it, see discussion in #46151
+ substituteInPlace tests/unit-utils-io.c --replace "| O_DIRECT" ""
+ '';
+
+ NIX_LDFLAGS = "-lgcc_s";
+
+ configureFlags = [
+ "--enable-cryptsetup-reencrypt"
+ "--with-crypto_backend=openssl"
+ ];
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ lvm2 json_c openssl libuuid popt ];
+
+ doCheck = true;
+
+ meta = {
+ homepage = "https://gitlab.com/cryptsetup/cryptsetup/";
+ description = "LUKS for dm-crypt";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [ ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/disable-failing-tests.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/disable-failing-tests.patch
new file mode 100644
index 000000000000..1504bf3e1511
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/cryptsetup/disable-failing-tests.patch
@@ -0,0 +1,19 @@
+diff -ur a/tests/blockwise-compat b/tests/blockwise-compat
+--- a/tests/blockwise-compat 2018-09-08 12:23:11.706555098 +0200
++++ b/tests/blockwise-compat 2018-09-08 12:24:24.444393460 +0200
+@@ -148,15 +148,11 @@
+ # device/file fn_name length
+ RUN "P" $1 read_buffer $BSIZE
+ RUN "P" $1 read_buffer $((2*BSIZE))
+- RUN "F" $1 read_buffer $((BSIZE-1))
+- RUN "F" $1 read_buffer $((BSIZE+1))
+ RUN "P" $1 read_buffer 0
+
+ RUN "P" $1 write_buffer $BSIZE
+ RUN "P" $1 write_buffer $((2*BSIZE))
+
+- RUN "F" $1 write_buffer $((BSIZE-1))
+- RUN "F" $1 write_buffer $((BSIZE+1))
+ RUN "F" $1 write_buffer 0
+
+ # basic blockwise functions
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dbus-broker/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dbus-broker/default.nix
new file mode 100644
index 000000000000..d84676bcda6f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dbus-broker/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, docutils, meson, ninja, pkgconfig
+, dbus, linuxHeaders, systemd }:
+
+stdenv.mkDerivation rec {
+ pname = "dbus-broker";
+ version = "22";
+
+ src = fetchFromGitHub {
+ owner = "bus1";
+ repo = "dbus-broker";
+ rev = "v${version}";
+ sha256 = "0vxr73afix5wjxy8g4cckwhl242rrlazm52673iwmdyfz5nskj2x";
+ fetchSubmodules = true;
+ };
+
+ nativeBuildInputs = [ docutils meson ninja pkgconfig ];
+
+ buildInputs = [ dbus linuxHeaders systemd ];
+
+ PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
+ PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
+ PKG_CONFIG_SYSTEMD_CATALOGDIR = "${placeholder "out"}/lib/systemd/catalog";
+
+ postInstall = ''
+ install -Dm644 $src/README.md $out/share/doc/dbus-broker/README
+
+ sed -i $out/lib/systemd/{system,user}/dbus-broker.service \
+ -e 's,^ExecReload.*busctl,ExecReload=${systemd}/bin/busctl,'
+ '';
+
+ doCheck = true;
+
+ meta = with stdenv.lib; {
+ description = "Linux D-Bus Message Broker";
+ homepage = "https://github.com/bus1/dbus-broker/wiki";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ peterhoeg ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ddcci/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ddcci/default.nix
new file mode 100644
index 000000000000..c977db64ee8a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ddcci/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchFromGitLab, kernel }:
+
+stdenv.mkDerivation rec {
+ pname = "ddcci-driver";
+ version = "0.3.3";
+ name = "${pname}-${kernel.version}-${version}";
+
+ src = fetchFromGitLab {
+ owner = "${pname}-linux";
+ repo = "${pname}-linux";
+ rev = "v${version}";
+ sha256 = "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ prePatch = ''
+ substituteInPlace ./ddcci/Makefile \
+ --replace '"$(src)"' '$(PWD)' \
+ --replace depmod \#
+ substituteInPlace ./ddcci-backlight/Makefile \
+ --replace '"$(src)"' '$(PWD)' \
+ --replace depmod \#
+ '';
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "KVER=${kernel.modDirVersion}"
+ "KERNEL_MODLIB=$(out)/lib/modules/${kernel.modDirVersion}"
+ "INCLUDEDIR=$(out)/include"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Kernel module driver for DDC/CI monitors";
+ homepage = "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ bricewge ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/default.nix
new file mode 100644
index 000000000000..0599289ab726
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/default.nix
@@ -0,0 +1,32 @@
+{ stdenvNoCC, dtc, findutils }:
+
+with stdenvNoCC.lib; {
+ applyOverlays = (base: overlays': stdenvNoCC.mkDerivation {
+ name = "device-tree-overlays";
+ nativeBuildInputs = [ dtc findutils ];
+ buildCommand = let
+ overlays = toList overlays';
+ in ''
+ mkdir -p $out
+ cd ${base}
+ find . -type f -name '*.dtb' -print0 \
+ | xargs -0 cp -v --no-preserve=mode --target-directory $out --parents
+
+ for dtb in $(find $out -type f -name '*.dtb'); do
+ dtbCompat="$( fdtget -t s $dtb / compatible )"
+
+ ${flip (concatMapStringsSep "\n") overlays (o: ''
+ overlayCompat="$( fdtget -t s ${o.dtboFile} / compatible )"
+ # overlayCompat in dtbCompat
+ if [[ "$dtbCompat" =~ "$overlayCompat" ]]; then
+ echo "Applying overlay ${o.name} to $( basename $dtb )"
+ mv $dtb{,.in}
+ fdtoverlay -o "$dtb" -i "$dtb.in" ${o.dtboFile};
+ rm $dtb.in
+ fi
+ '')}
+
+ done
+ '';
+ });
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/raspberrypi.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/raspberrypi.nix
new file mode 100644
index 000000000000..93dad5ef3271
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/device-tree/raspberrypi.nix
@@ -0,0 +1,37 @@
+{ stdenvNoCC, raspberrypifw }:
+
+stdenvNoCC.mkDerivation {
+ name = "raspberrypi-dtbs-${raspberrypifw.version}";
+ nativeBuildInputs = [ raspberrypifw ];
+
+ # Rename DTBs so u-boot finds them, like linux-rpi.nix
+ buildCommand = ''
+ mkdir -p $out/broadcom/
+ cd $out/broadcom/
+
+ cp ${raspberrypifw}/share/raspberrypi/boot/bcm*.dtb .
+
+ cp bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb
+ cp bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
+ cp bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
+ cp bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
+ cp bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus
+ cp bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus
+ cp bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
+ cp bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
+ cp bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
+ cp bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
+ cp bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
+ cp bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
+ cp bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb
+ '';
+
+ passthru = {
+ # Compatible overlays that may be used
+ overlays = "${raspberrypifw}/share/raspberrypi/boot/overlays";
+ };
+ meta = with stdenvNoCC.lib; {
+ inherit (raspberrypifw.meta) homepage license;
+ description = "DTBs for the Raspberry Pi";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix
new file mode 100644
index 000000000000..9115601e3573
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "devmem2-2004-08-05";
+
+ src = fetchurl {
+ urls = [
+ "http://lartmaker.nl/lartware/port/devmem2.c"
+ "https://raw.githubusercontent.com/hackndev/tools/7ed212230f8fbb1da3424a15ee88de3279bf96ec/devmem2.c"
+ ];
+ sha256 = "14f1k7v6i1yaxg4xcaaf5i4aqn0yabba857zjnbg9wiymy82qf7c";
+ };
+
+ hardeningDisable = [ "format" ]; # fix compile error
+
+ buildCommand = ''
+ $CC "$src" -o devmem2
+ install -D devmem2 "$out/bin/devmem2"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Simple program to read/write from/to any location in memory";
+ homepage = "http://lartmaker.nl/lartware/port/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ bjornfor ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/digimend/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/digimend/default.nix
new file mode 100644
index 000000000000..94f32d2c4329
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/digimend/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, fetchpatch, kernel }:
+
+assert stdenv.lib.versionAtLeast kernel.version "3.5";
+
+stdenv.mkDerivation rec {
+ pname = "digimend";
+ version = "unstable-2019-06-18";
+
+ src = fetchFromGitHub {
+ owner = "digimend";
+ repo = "digimend-kernel-drivers";
+ rev = "8b228a755e44106c11f9baaadb30ce668eede5d4";
+ sha256 = "1l54j85540386a8aypqka7p5hy1b63cwmpsscv9rmmf10f78v8mm";
+ };
+
+ INSTALL_MOD_PATH = "\${out}";
+
+ postPatch = ''
+ sed 's/udevadm /true /' -i Makefile
+ sed 's/depmod /true /' -i Makefile
+ '';
+
+ patches = [
+ # Fix build on Linux kernel >= 5.4
+ # https://github.com/DIGImend/digimend-kernel-drivers/pull/331
+ (fetchpatch {
+ url = "https://github.com/DIGImend/digimend-kernel-drivers/commit/fb8a2eb6a9198bb35aaccb81e22dd5ebe36124d1.patch";
+ sha256 = "1j7l5hsk59gccydpf7n6xx1ki4rm6aka7k879a7ah5jn8p1ylgw9";
+ })
+ ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ postInstall = ''
+ # Remove module reload hack.
+ # The hid-rebind unloads and then reloads the hid-* module to ensure that
+ # the extra/ module is loaded.
+ rm -r $out/lib/udev
+ '';
+
+ makeFlags = [
+ "KVERSION=${kernel.modDirVersion}"
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "DESTDIR=${placeholder "out"}"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "DIGImend graphics tablet drivers for the Linux kernel";
+ homepage = "https://digimend.github.io/";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ gebner ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/directvnc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/directvnc/default.nix
new file mode 100644
index 000000000000..c79371909152
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/directvnc/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, directfb, zlib, libjpeg, xorgproto }:
+
+stdenv.mkDerivation {
+ pname = "directvnc";
+ version = "0.7.7.2015-04-16";
+
+ src = fetchFromGitHub {
+ owner = "drinkmilk";
+ repo = "directvnc";
+ rev = "d336f586c5865da68873960092b7b5fbc9f8617a";
+ sha256 = "16x7mr7x728qw7nbi6rqhrwsy73zsbpiz8pbgfzfl2aqhfdiz88b";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+ buildInputs = [ directfb zlib libjpeg xorgproto ];
+
+ meta = with stdenv.lib; {
+ description = "DirectFB VNC client";
+ homepage = "http://drinkmilk.github.io/directvnc/";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.raskin ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix
new file mode 100644
index 000000000000..b2ae930f193c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchgit, libX11 }:
+
+stdenv.mkDerivation {
+ name = "disk-indicator-2014-05-19";
+
+ src = fetchgit {
+ url = "git://github.com/MeanEYE/Disk-Indicator.git";
+ rev = "51ef4afd8141b8d0659cbc7dc62189c56ae9c2da";
+ sha256 = "10jx6mx9qarn21p2l2jayxkn1gmqhvck1wymgsr4jmbwxl8ra5kd";
+ };
+
+ buildInputs = [ libX11 ];
+
+ patchPhase = ''
+ substituteInPlace ./makefile --replace "COMPILER=c99" "COMPILER=gcc -std=c99"
+ substituteInPlace ./makefile --replace "COMPILE_FLAGS=" "COMPILE_FLAGS=-O2 "
+ '';
+
+ buildPhase = "make -f makefile";
+
+ NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
+ hardeningDisable = [ "fortify" ];
+
+ installPhase = ''
+ mkdir -p "$out/bin"
+ cp ./disk_indicator "$out/bin/"
+ '';
+
+ meta = {
+ homepage = "https://github.com/MeanEYE/Disk-Indicator";
+ description = "A program that will turn a LED into a hard disk indicator";
+ longDescription = ''
+ Small program for Linux that will turn your Scroll, Caps or Num Lock LED
+ or LED on your ThinkPad laptop into a hard disk activity indicator.
+ '';
+ license = stdenv.lib.licenses.gpl3;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix
new file mode 100644
index 000000000000..3db9a7d3005c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, lib, unzip, utillinux,
+ libusb1, evdi, systemd, makeWrapper, requireFile, substituteAll }:
+
+let
+ arch =
+ if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
+ else if stdenv.hostPlatform.system == "i686-linux" then "x86"
+ else throw "Unsupported architecture";
+ bins = "${arch}-ubuntu-1604";
+ libPath = lib.makeLibraryPath [ stdenv.cc.cc utillinux libusb1 evdi ];
+
+in stdenv.mkDerivation rec {
+ pname = "displaylink";
+ version = "5.3.1.34";
+
+ src = requireFile rec {
+ name = "displaylink.zip";
+ sha256 = "1c1kbjgpb71f73qnyl44rvwi6l4ivddq789rwvvh0ahw2jm324hy";
+ message = ''
+ In order to install the DisplayLink drivers, you must first
+ comply with DisplayLink's EULA and download the binaries and
+ sources from here:
+
+ https://www.displaylink.com/downloads/file?id=1576
+
+ Once you have downloaded the file, please use the following
+ commands and re-run the installation:
+
+ mv \$PWD/"DisplayLink USB Graphics Software for Ubuntu ${lib.versions.majorMinor version}.zip" \$PWD/${name}
+ nix-prefetch-url file://\$PWD/${name}
+ '';
+ };
+
+ nativeBuildInputs = [ unzip makeWrapper ];
+
+ unpackPhase = ''
+ unzip $src
+ chmod +x displaylink-driver-${version}.run
+ ./displaylink-driver-${version}.run --target . --noexec --nodiskspace
+ '';
+
+ patches = [ (substituteAll {
+ src = ./udev-installer.patch;
+ inherit systemd;
+ })];
+
+ installPhase = ''
+ sed -i "s,/opt/displaylink/udev.sh,$out/lib/udev/displaylink.sh,g" udev-installer.sh
+ ( source udev-installer.sh
+ mkdir -p $out/lib/udev/rules.d
+ main systemd "$out/lib/udev/rules.d/99-displaylink.rules" "$out/lib/udev/displaylink.sh"
+ )
+
+ install -Dt $out/lib/displaylink *.spkg
+ install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
+ patchelf \
+ --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
+ --set-rpath ${libPath} \
+ $out/bin/DisplayLinkManager
+ wrapProgram $out/bin/DisplayLinkManager \
+ --run "cd $out/lib/displaylink"
+ '';
+
+ dontStrip = true;
+ dontPatchELF = true;
+
+
+ meta = with stdenv.lib; {
+ description = "DisplayLink DL-5xxx, DL-41xx and DL-3x00 Driver for Linux";
+ maintainers = with maintainers; [ nshalman abbradar peterhoeg eyjhb ];
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ license = licenses.unfree;
+ homepage = "https://www.displaylink.com/";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch
new file mode 100644
index 000000000000..880c073fbcf6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch
@@ -0,0 +1,18 @@
+--- a/udev-installer.sh 2018-12-09 12:05:53.772318942 +0100
++++ b/udev-installer.sh 2018-12-09 12:06:19.939947629 +0100
+@@ -21,12 +21,12 @@
+ cat <<'EOF'
+ start_service()
+ {
+- systemctl start displaylink-driver
++ /run/current-system/systemd/bin/systemctl start --no-block dlm
+ }
+
+ stop_service()
+ {
+- systemctl stop displaylink-driver
++ /run/current-system/systemd/bin/systemctl stop dlm
+ }
+
+ EOF
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix
new file mode 100644
index 000000000000..7d0990d9f81a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ name = "dmidecode-3.2";
+
+ src = fetchurl {
+ url = "mirror://savannah/dmidecode/${name}.tar.xz";
+ sha256 = "1pcfhcgs2ifdjwp7amnsr3lq95pgxpr150bjhdinvl505px0cw07";
+ };
+
+ patches = [
+ # suggested patches for 3.2 according to https://www.nongnu.org/dmidecode/
+ (fetchpatch {
+ name = "0001-fix_redfish_hostname_print_length.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=fde47bb227b8fa817c88d7e10a8eb771c46de1df";
+ sha256 = "133nd0c72p68hnqs5m714167761r1pp6bd3kgbsrsrwdx40jlc3m";
+ })
+ (fetchpatch {
+ name = "0002-add_logical_non-volatile_device_to_memory_device_types.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=74dfb854b8199ddb0a27e89296fa565f4706cb9d";
+ sha256 = "0wdpmlcwmqdyyrsmyis8jb7cx3q6fnqpdpc5xly663dj841jcvwh";
+ })
+ (fetchpatch {
+ name = "0003-only-scan-devmem-for-entry-point-on-x86.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=e12ec26e19e02281d3e7258c3aabb88a5cf5ec1d";
+ sha256 = "1y2858n98bfa49syjinx911vza6mm7aa6xalvzjgdlyirhccs30i";
+ })
+ (fetchpatch {
+ name = "0004-fix_formatting_of_tpm_table_output.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=1d0db85949a5bdd96375f6131d393a11204302a6";
+ sha256 = "11s8jciw7xf2668v79qcq2c9w2gwvm3dkcik8dl9v74p654y1nr8";
+ })
+ (fetchpatch {
+ name = "0005-fix_system-slot_information_for_pcie_ssd.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=fd08479625b5845e4d725ab628628f7ebfccc407";
+ sha256 = "07l61wvsw1d8g14zzf6zm7l0ri9kkqz8j5n4h116qwhg1p2k49y4";
+ })
+ (fetchpatch {
+ name = "0006-print_type_33_name_unconditionally.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=65438a7ec0f4cddccf810136da6f280bd148af71";
+ sha256 = "0gqz576ccxys0c8217spf1qmw9lxi9xalw85jjqwsi2bj1k6vy4n";
+ })
+ (fetchpatch {
+ name = "0007-dont_choke_on_invalid_processor_voltage.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=5bb7eb173b72256f70c6b3f3916d7a444be93340";
+ sha256 = "1dkg4lq9kn2g1w5raz1gssn6zqk078zjqbnh9i32f822f727syhp";
+ })
+ (fetchpatch {
+ name = "0008-fix_the_alignment_of_type_25_name.patch";
+ url = "https://git.savannah.gnu.org/cgit/dmidecode.git/patch/?id=557c3c373a9992d45d4358a6a2ccf53b03276f39";
+ sha256 = "18hc91pk7civyqrlilg3kn2nmp2warhh49xlbzrwqi7hgipyf12z";
+ })
+ ];
+
+ makeFlags = [ "prefix=$(out)" ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.nongnu.org/dmidecode/";
+ description = "A tool that reads information about your system's hardware from the BIOS according to the SMBIOS/DMI standard";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
new file mode 100644
index 000000000000..129ccb304564
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, fetchpatch, lvm2 }:
+
+stdenv.mkDerivation rec {
+ name = "dmraid-1.0.0.rc16";
+
+ src = fetchurl {
+ url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/${name}.tar.bz2";
+ sha256 = "0m92971gyqp61darxbiri6a48jz3wq3gkp8r2k39320z0i6w8jgq";
+ };
+
+ patches = [ ./hardening-format.patch ]
+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/void-linux/void-packages/fceed4b8e96b3c1da07babf6f67b6ed1588a28b2/srcpkgs/dmraid/patches/006-musl-libc.patch";
+ sha256 = "1j8xda0fpz8lxjxnqdidy7qb866qrzwpbca56yjdg6vf4x21hx6w";
+ stripLen = 2;
+ extraPrefix = "1.0.0.rc16/";
+ })
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/void-linux/void-packages/fceed4b8e96b3c1da07babf6f67b6ed1588a28b2/srcpkgs/dmraid/patches/007-fix-loff_t-musl.patch";
+ sha256 = "0msnq39qnzg3b1pdksnz1dgqwa3ak03g41pqh0lw3h7w5rjc016k";
+ stripLen = 2;
+ extraPrefix = "1.0.0.rc16/";
+ })
+ ];
+
+ postPatch = ''
+ sed -i 's/\[\[[^]]*\]\]/[ "''$''${n##*.}" = "so" ]/' */lib/Makefile.in
+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE"
+ '';
+
+ preConfigure = "cd */";
+
+ buildInputs = [ lvm2 ];
+
+ meta = {
+ description = "Old-style RAID configuration utility";
+ longDescription = ''
+ Old RAID configuration utility (still under development, though).
+ It is fully compatible with modern kernels and mdadm recognizes
+ its volumes. May be needed for rescuing an older system or nuking
+ the metadata when reformatting.
+ '';
+ maintainers = [ stdenv.lib.maintainers.raskin ];
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/hardening-format.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/hardening-format.patch
new file mode 100644
index 000000000000..f91a7fb18aa0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmraid/hardening-format.patch
@@ -0,0 +1,18 @@
+--- a/1.0.0.rc16/lib/events/libdmraid-events-isw.c 2016-01-29 05:16:57.455425454 +0000
++++ b/1.0.0.rc16/lib/events/libdmraid-events-isw.c 2016-01-29 05:17:55.520564013 +0000
+@@ -838,13 +838,13 @@
+
+ sz = _log_all_devs(log_type, rs, NULL, 0);
+ if (!sz) {
+- syslog(LOG_ERR, msg[0]);
++ syslog(LOG_ERR, "%s", msg[0]);
+ return;
+ }
+
+ str = dm_malloc(++sz);
+ if (!str) {
+- syslog(LOG_ERR, msg[1]);
++ syslog(LOG_ERR, "%s", msg[1]);
+ return;
+ }
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/default.nix
new file mode 100644
index 000000000000..0f7f2f9817a5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, bash, perl, python }:
+
+stdenv.mkDerivation rec {
+ pname = "dmtcp";
+ version = "2.6.0";
+
+ src = fetchFromGitHub {
+ owner = pname;
+ repo = pname;
+ rev = version;
+ sha256 = "01skyhr573w1dygvkwz66lvir2jsq443fjwkysglwxvmrdfz9kwd";
+ };
+
+ dontDisableStatic = true;
+
+ patches = [ ./ld-linux-so-buffer-size.patch ];
+
+ postPatch = ''
+ patchShebangs .
+
+ substituteInPlace configure \
+ --replace '#define ELF_INTERPRETER "$interp"' \
+ "#define ELF_INTERPRETER \"$(cat $NIX_CC/nix-support/dynamic-linker)\""
+ substituteInPlace src/dmtcp_coordinator.cpp \
+ --replace /bin/bash ${stdenv.shell}
+ substituteInPlace util/gdb-add-symbol-file \
+ --replace /bin/bash ${stdenv.shell}
+ substituteInPlace test/autotest.py \
+ --replace /bin/bash ${bash}/bin/bash \
+ --replace /usr/bin/perl ${perl}/bin/perl \
+ --replace /usr/bin/python ${python}/bin/python \
+ --replace "os.environ['USER']" "\"nixbld1\"" \
+ --replace "os.getenv('USER')" "\"nixbld1\""
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Distributed MultiThreaded Checkpointing";
+ longDescription = ''
+ DMTCP (Distributed MultiThreaded Checkpointing) is a tool to
+ transparently checkpointing the state of an arbitrary group of
+ programs spread across many machines and connected by sockets. It does
+ not modify the user's program or the operating system.
+ '';
+ homepage = "http://dmtcp.sourceforge.net/";
+ license = licenses.lgpl3Plus; # most files seem this or LGPL-2.1+
+ platforms = intersectLists platforms.linux platforms.x86; # broken on ARM and Darwin
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/ld-linux-so-buffer-size.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/ld-linux-so-buffer-size.patch
new file mode 100644
index 000000000000..5a81dad0cc90
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dmtcp/ld-linux-so-buffer-size.patch
@@ -0,0 +1,11 @@
+--- dmtcp-2.5.1-src/src/util_exec.cpp 2017-09-19 13:36:22.947587034 +0200
++++ dmtcp-2.5.1-src/src/util_exec.cpp 2017-09-19 13:36:32.221313460 +0200
+@@ -178,7 +178,7 @@
+
+ static string ld_linux_so_path(int version, bool is32bitElf = false)
+ {
+- char buf[80];
++ char buf[128];
+ #if (defined(__x86_64__) || defined(__aarch64__)) && !defined(CONFIG_M32)
+ if (is32bitElf) {
+ sprintf(buf, "/lib/ld-linux.so.%d", version);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dpdk/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dpdk/default.nix
new file mode 100644
index 000000000000..aacbc3cdfbe2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dpdk/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, lib
+, kernel
+, fetchurl
+, pkgconfig, meson, ninja
+, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap
+, doxygen, python3
+, shared ? false }:
+
+let
+ mod = kernel != null;
+
+in stdenv.mkDerivation rec {
+ name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
+ version = "20.05";
+
+ src = fetchurl {
+ url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
+ sha256 = "0h0xv2zwb91b9n29afg5ihn06a8q28in64hag2f112kc19f79jj8";
+ };
+
+ nativeBuildInputs = [
+ doxygen
+ meson
+ ninja
+ pkgconfig
+ python3
+ python3.pkgs.sphinx
+ ];
+ buildInputs = [
+ jansson
+ libbpf
+ libbsd
+ libelf
+ libpcap
+ numactl
+ openssl.dev
+ zlib
+ ] ++ lib.optionals mod kernel.moduleBuildDependencies;
+
+ postPatch = ''
+ patchShebangs config/arm buildtools
+ '';
+
+ mesonFlags = [
+ "-Denable_docs=true"
+ "-Denable_kmods=${if mod then "true" else "false"}"
+ ]
+ ++ lib.optional (!shared) "-Ddefault_library=static"
+ ++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
+ ++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}";
+
+ # dpdk meson script does not support separate kernel source and installion
+ # dirs (except via destdir), so we temporarily link the former into the latter.
+ preConfigure = lib.optionalString mod ''
+ mkdir -p $kmod/lib/modules/${kernel.modDirVersion}
+ ln -sf ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build \
+ $kmod/lib/modules/${kernel.modDirVersion}
+ '';
+
+ postBuild = lib.optionalString mod ''
+ rm -f $kmod/lib/modules/${kernel.modDirVersion}/build
+ '';
+
+ outputs = [ "out" ] ++ lib.optional mod "kmod";
+
+ enableParallelBuilding = true;
+
+ meta = with lib; {
+ description = "Set of libraries and drivers for fast packet processing";
+ homepage = "http://dpdk.org/";
+ license = with licenses; [ lgpl21 gpl2 bsd2 ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ domenkozar magenbluten orivej ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/default.nix
new file mode 100644
index 000000000000..bbf2535ce3d6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, flex, systemd, perl }:
+
+stdenv.mkDerivation rec {
+ name = "drbd-8.4.4";
+
+ src = fetchurl {
+ url = "http://oss.linbit.com/drbd/8.4/${name}.tar.gz";
+ sha256 = "1w4889h1ak7gy9w33kd4fgjlfpgmp6hzfya16p1pkc13bjf22mm0";
+ };
+
+ patches = [ ./pass-force.patch ./fix-glibc-compilation.patch ];
+
+ nativeBuildInputs = [ flex ];
+ buildInputs = [ perl ];
+
+ configureFlags = [
+ "--without-distro"
+ "--without-pacemaker"
+ "--localstatedir=/var"
+ "--sysconfdir=/etc"
+ ];
+
+ preConfigure =
+ ''
+ export PATH=${systemd}/sbin:$PATH
+ substituteInPlace user/Makefile.in \
+ --replace /sbin '$(sbindir)'
+ substituteInPlace user/legacy/Makefile.in \
+ --replace '$(DESTDIR)/lib/drbd' '$(DESTDIR)$(LIBDIR)'
+ substituteInPlace user/drbdadm_usage_cnt.c --replace /lib/drbd $out/lib/drbd
+ substituteInPlace scripts/drbd.rules --replace /usr/sbin/drbdadm $out/sbin/drbdadm
+ '';
+
+ makeFlags = [ "SHELL=${stdenv.shell}" ];
+
+ installFlags = [
+ "localstatedir=$(TMPDIR)/var"
+ "sysconfdir=$(out)/etc"
+ "INITDIR=$(out)/etc/init.d"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.drbd.org/";
+ description = "Distributed Replicated Block Device, a distributed storage system for Linux";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/fix-glibc-compilation.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/fix-glibc-compilation.patch
new file mode 100644
index 000000000000..621a2dd995db
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/fix-glibc-compilation.patch
@@ -0,0 +1,24 @@
+diff --git a/user/drbdadm_adjust.c b/user/drbdadm_adjust.c
+index cb23270..3a751ca 100644
+--- a/user/drbdadm_adjust.c
++++ b/user/drbdadm_adjust.c
+@@ -29,6 +29,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+
+diff --git a/user/legacy/drbdadm_adjust.c b/user/legacy/drbdadm_adjust.c
+index c79163c..6990ffb 100644
+--- a/user/legacy/drbdadm_adjust.c
++++ b/user/legacy/drbdadm_adjust.c
+@@ -27,6 +27,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch
new file mode 100644
index 000000000000..8f0201100f72
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/drbd/pass-force.patch
@@ -0,0 +1,15 @@
+Propagate the --force flag in the legacy drbdadm to drbdsetup.
+Otherwise "drbdadm primary --force" won't work as expected (the kernel
+will say "State change failed: Need access to UpToDate data").
+
+diff -ru -x '*~' drbd-8.4.0-orig/user/legacy/drbdadm_main.c drbd-8.4.0/user/legacy/drbdadm_main.c
+--- drbd-8.4.0-orig/user/legacy/drbdadm_main.c 2011-07-07 06:55:39.000000000 -0400
++++ drbd-8.4.0/user/legacy/drbdadm_main.c 2011-11-02 14:51:04.000000000 -0400
+@@ -1547,6 +1547,7 @@
+ for (i = 0; i < soi; i++) {
+ argv[NA(argc)] = setup_opts[i];
+ }
++ if (force) argv[NA(argc)] = "--force";
+ argv[NA(argc)] = 0;
+
+ setenv("DRBD_RESOURCE", res->name, 1);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dropwatch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dropwatch/default.nix
new file mode 100644
index 000000000000..69acfa9682b6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dropwatch/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
+, libnl, readline, libbfd, ncurses, zlib }:
+
+stdenv.mkDerivation rec {
+ pname = "dropwatch";
+ version = "1.5.1";
+
+ src = fetchFromGitHub {
+ owner = "nhorman";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1qmax0l7z1qik42c949fnvjh5r6awk4gpgzdsny8iwnmwzjyp8b8";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ libbfd libnl ncurses readline zlib ];
+
+ # To avoid running into https://sourceware.org/bugzilla/show_bug.cgi?id=14243 we need to define:
+ NIX_CFLAGS_COMPILE = "-DPACKAGE=${pname} -DPACKAGE_VERSION=${version}";
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Linux kernel dropped packet monitor";
+ homepage = "https://github.com/nhorman/dropwatch";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.c0bw3b ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dstat/default.nix
new file mode 100644
index 000000000000..2e235e27f364
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/dstat/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, python2Packages }:
+
+python2Packages.buildPythonApplication rec {
+ pname = "dstat";
+ format = "other";
+ version = "0.7.3";
+
+ src = fetchurl {
+ url = "https://github.com/dagwieers/dstat/archive/${version}.tar.gz";
+ sha256 = "16286z3y2lc9nsq8njzjkv6k2vyxrj9xiixj1k3gnsbvhlhkirj6";
+ };
+
+ propagatedBuildInputs = with python2Packages; [ python-wifi ];
+
+ makeFlags = [ "prefix=$(out)" ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://dag.wieers.com/home-made/dstat/";
+ description = "Versatile resource statistics tool";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/e1000e/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/e1000e/default.nix
new file mode 100644
index 000000000000..d5d6697a01e3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/e1000e/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, kernel }:
+
+assert stdenv.lib.versionOlder kernel.version "4.10";
+
+stdenv.mkDerivation rec {
+ name = "e1000e-${version}-${kernel.version}";
+ version = "3.8.4";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/e1000/e1000e-${version}.tar.gz";
+ sha256 = "1q8dbqh14c7r15q6k6iv5k0d6xpi74i71d5r54py60gr099m2ha4";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ configurePhase = ''
+ cd src
+ kernel_version=${kernel.modDirVersion}
+ substituteInPlace common.mk \
+ --replace "/lib/modules" "${kernel.dev}/lib/modules"
+ export makeFlags="BUILD_KERNEL=$kernel_version"
+ '';
+
+ installPhase = ''
+ install -v -D -m 644 e1000e.ko "$out/lib/modules/$kernel_version/kernel/drivers/net/e1000e/e1000e.ko"
+ '';
+
+ dontStrip = true;
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Linux kernel drivers for Intel Ethernet adapters and LOMs (LAN On Motherboard)";
+ homepage = "http://e1000.sf.net/";
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/default.nix
new file mode 100644
index 000000000000..575da8aca732
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, pandoc, installShellFiles, withManpage ? false }:
+
+stdenv.mkDerivation rec {
+ pname = "earlyoom";
+ version = "1.6.1";
+
+ src = fetchFromGitHub {
+ owner = "rfjakob";
+ repo = "earlyoom";
+ rev = "v${version}";
+ sha256 = "1cn0bgbgiq69i8mk8zxly1f7j01afm82g672qzccz6swsi2637j4";
+ };
+
+ nativeBuildInputs = stdenv.lib.optionals withManpage [ pandoc installShellFiles ];
+
+ patches = [ ./fix-dbus-path.patch ];
+
+ makeFlags = [ "VERSION=${version}" ];
+
+ installPhase = ''
+ install -D earlyoom $out/bin/earlyoom
+ '' + stdenv.lib.optionalString withManpage ''
+ installManPage earlyoom.1
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Early OOM Daemon for Linux";
+ homepage = "https://github.com/rfjakob/earlyoom";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/fix-dbus-path.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/fix-dbus-path.patch
new file mode 100644
index 000000000000..e1c10cf82f96
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/earlyoom/fix-dbus-path.patch
@@ -0,0 +1,11 @@
+--- a/kill.c
++++ b/kill.c
+@@ -55,7 +55,7 @@ static void notify(const char* summary, const char* body)
+ }
+ // Complete command line looks like this:
+ // dbus-send --system / net.nuetzlich.SystemNotifications.Notify 'string:summary text' 'string:and body text'
+- execl("/usr/bin/dbus-send", "dbus-send", "--system", "/", "net.nuetzlich.SystemNotifications.Notify",
++ execlp("dbus-send", "dbus-send", "--system", "/", "net.nuetzlich.SystemNotifications.Notify",
+ summary2, body2, NULL);
+ warn("notify: exec failed: %s\n", strerror(errno));
+ exit(1);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ebtables/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ebtables/default.nix
new file mode 100644
index 000000000000..d3705195f599
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ebtables/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "ebtables";
+ version = "2.0.11";
+
+ src = fetchurl {
+ url = "http://ftp.netfilter.org/pub/${pname}/${pname}-${version}.tar.gz";
+ sha256 = "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp";
+ };
+
+ makeFlags =
+ [ "LIBDIR=$(out)/lib" "BINDIR=$(out)/sbin" "MANDIR=$(out)/share/man"
+ "ETCDIR=$(out)/etc" "INITDIR=$(TMPDIR)" "SYSCONFIGDIR=$(out)/etc/sysconfig"
+ "LOCALSTATEDIR=/var"
+ ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error";
+
+ preInstall = "mkdir -p $out/etc/sysconfig";
+
+ meta = with stdenv.lib; {
+ description = "A filtering tool for Linux-based bridging firewalls";
+ homepage = "http://ebtables.sourceforge.net/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix
new file mode 100644
index 000000000000..fb0a6dbf62ec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, perl, makeWrapper
+, sysfsutils, dmidecode, kmod }:
+
+stdenv.mkDerivation {
+ name = "edac-utils-2015-01-07";
+
+ src = fetchFromGitHub {
+ owner = "grondo";
+ repo = "edac-utils";
+ rev = "f9aa96205f610de39a79ff43c7478b7ef02e3138";
+ sha256 = "1dmfqb15ffldl5zirbmwiqzpxbcc2ny9rpfvxcfvpmh5b69knvdg";
+ };
+
+ nativeBuildInputs = [ perl makeWrapper ];
+ buildInputs = [ sysfsutils ];
+
+ configureFlags = [
+ "--sysconfdir=/etc"
+ "--localstatedir=/var"
+ ];
+
+ installFlags = [
+ "sysconfdir=\${out}/etc"
+ ];
+
+ postInstall = ''
+ wrapProgram "$out/sbin/edac-ctl" \
+ --set PATH ${stdenv.lib.makeBinPath [ dmidecode kmod ]}
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/grondo/edac-utils";
+ description = "Handles the reporting of hardware-related memory errors";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/default.nix
new file mode 100644
index 000000000000..9faeb831b4b2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, fetchgit
+, autoreconfHook
+, pkgconfig
+, dbus
+}:
+
+stdenv.mkDerivation rec {
+ pname = "ell";
+ version = "0.33";
+
+ outputs = [ "out" "dev" ];
+
+ src = fetchgit {
+ url = "https://git.kernel.org/pub/scm/libs/${pname}/${pname}.git";
+ rev = version;
+ sha256 = "0li788l57m2ic1i33fag4nnblqghbwqjyqkgppi8s2sifcvswfbw";
+ };
+
+ patches = [
+ ./fix-dbus-tests.patch
+ ];
+
+ nativeBuildInputs = [
+ pkgconfig
+ autoreconfHook
+ ];
+
+ checkInputs = [
+ dbus
+ ];
+
+ enableParallelBuilding = true;
+
+ doCheck = true;
+
+ meta = with stdenv.lib; {
+ homepage = "https://01.org/ell";
+ description = "Embedded Linux Library";
+ longDescription = ''
+ The Embedded Linux* Library (ELL) provides core, low-level functionality for system daemons. It typically has no dependencies other than the Linux kernel, C standard library, and libdl (for dynamic linking). While ELL is designed to be efficient and compact enough for use on embedded Linux platforms, it is not limited to resource-constrained systems.
+ '';
+ license = licenses.lgpl21Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ mic92 dtzWill ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/fix-dbus-tests.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/fix-dbus-tests.patch
new file mode 100644
index 000000000000..b494ba8b43c9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ell/fix-dbus-tests.patch
@@ -0,0 +1,65 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -140,6 +140,7 @@
+ ell_libell_private_la_SOURCES = $(ell_libell_la_SOURCES)
+
+ AM_CFLAGS = -fvisibility=hidden -DUNITDIR=\""$(top_srcdir)/unit/"\" \
++ -DDBUS_DAEMON=\""$(DBUS_DAEMONDIR)/dbus-daemon"\" \
+ -DCERTDIR=\""$(top_builddir)/unit/"\"
+
+ pkgconfigdir = $(libdir)/pkgconfig
+--- a/configure.ac
++++ b/configure.ac
+@@ -14,6 +14,8 @@
+
+ AC_PREFIX_DEFAULT(/usr/local)
+
++PKG_PROG_PKG_CONFIG
++
+ COMPILER_FLAGS
+
+ AC_LANG_C
+@@ -131,6 +133,10 @@
+ AC_CHECK_PROG(have_xxd, [xxd], [yes], [no])
+ fi
+
++PKG_CHECK_MODULES(DBUS, dbus-1, dummy=yes,
++ AC_MSG_ERROR(D-Bus is required for running tests))
++PKG_CHECK_VAR(DBUS_DAEMONDIR, dbus-1, daemondir)
++
+ AM_CONDITIONAL(DBUS_TESTS, test "${little_endian}" = "yes")
+ AM_CONDITIONAL(CERT_TESTS, test "${have_openssl}" = "yes")
+
+--- a/unit/test-dbus-message-fds.c
++++ b/unit/test-dbus-message-fds.c
+@@ -51,7 +51,7 @@
+ char *prg_envp[1];
+ pid_t pid;
+
+- prg_argv[0] = "/usr/bin/dbus-daemon";
++ prg_argv[0] = DBUS_DAEMON;
+ prg_argv[1] = "--nopidfile";
+ prg_argv[2] = "--nofork";
+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
+--- a/unit/test-dbus-properties.c
++++ b/unit/test-dbus-properties.c
+@@ -48,7 +48,7 @@
+ char *prg_envp[1];
+ pid_t pid;
+
+- prg_argv[0] = "/usr/bin/dbus-daemon";
++ prg_argv[0] = DBUS_DAEMON;
+ prg_argv[1] = "--nopidfile";
+ prg_argv[2] = "--nofork";
+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
+--- a/unit/test-dbus.c
++++ b/unit/test-dbus.c
+@@ -45,7 +45,7 @@
+ char *prg_envp[1];
+ pid_t pid;
+
+- prg_argv[0] = "/usr/bin/dbus-daemon";
++ prg_argv[0] = DBUS_DAEMON;
+ prg_argv[1] = "--nopidfile";
+ prg_argv[2] = "--nofork";
+ prg_argv[3] = "--config-file=" UNITDIR "dbus.conf";
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ena/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ena/default.nix
new file mode 100644
index 000000000000..b672dd170122
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ena/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ version = "2.2.11";
+ name = "ena-${version}-${kernel.version}";
+
+ src = fetchFromGitHub {
+ owner = "amzn";
+ repo = "amzn-drivers";
+ rev = "ena_linux_${version}";
+ sha256 = "06ajhs6byw3pj0skix6ppmdjsg1a3zan8yamnjqdgkxwliiszhrc";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ # linux 3.12
+ NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
+
+ configurePhase = ''
+ cd kernel/linux/ena
+ substituteInPlace Makefile --replace '/lib/modules/$(BUILD_KERNEL)' ${kernel.dev}/lib/modules/${kernel.modDirVersion}
+ '';
+
+ installPhase = ''
+ strip -S ena.ko
+ dest=$out/lib/modules/${kernel.modDirVersion}/misc
+ mkdir -p $dest
+ cp ena.ko $dest/
+ xz $dest/ena.ko
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Amazon Elastic Network Adapter (ENA) driver for Linux";
+ homepage = "https://github.com/amzn/amzn-drivers";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.eelco ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eudev/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eudev/default.nix
new file mode 100644
index 000000000000..d087a9e2e26d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eudev/default.nix
@@ -0,0 +1,60 @@
+{stdenv, fetchurl, pkgconfig, glib, gperf, utillinux, kmod}:
+let
+ s = # Generated upstream information
+ rec {
+ baseName="eudev";
+ version = "3.2.9";
+ name="${baseName}-${version}";
+ url="http://dev.gentoo.org/~blueness/eudev/eudev-${version}.tar.gz";
+ sha256 = "1z6lfhhbjs6j7pbp6ybn17ywjsdl87ql6g1p3m2y26aa10cqcqc9";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [
+ glib gperf utillinux kmod
+ ];
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ inherit nativeBuildInputs buildInputs;
+ src = fetchurl {
+ inherit (s) url sha256;
+ };
+ patches = [
+ ];
+
+ configureFlags = [
+ "--localstatedir=/var"
+ "--sysconfdir=/etc"
+ ];
+ makeFlags = [
+ "hwdb_bin=/var/lib/udev/hwdb.bin"
+ "udevrulesdir=/etc/udev/rules.d"
+ ];
+
+ preInstall = ''
+ # Disable install-exec-hook target as it conflicts with our move-sbin setup-hook
+ sed -i 's;$(MAKE) $(AM_MAKEFLAGS) install-exec-hook;$(MAKE) $(AM_MAKEFLAGS);g' src/udev/Makefile
+ '';
+
+ installFlags =
+ [
+ "localstatedir=$(TMPDIR)/var"
+ "sysconfdir=$(out)/etc"
+ "udevconfdir=$(out)/etc/udev"
+ "udevhwdbbin=$(out)/var/lib/udev/hwdb.bin"
+ "udevhwdbdir=$(out)/var/lib/udev/hwdb.d"
+ "udevrulesdir=$(out)/var/lib/udev/rules.d"
+ ];
+ enableParallelBuilding = true;
+ meta = {
+ inherit (s) version;
+ description = ''An udev fork by Gentoo'';
+ license = stdenv.lib.licenses.gpl2Plus ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ homepage = ''https://www.gentoo.org/proj/en/eudev/'';
+ downloadPage = ''http://dev.gentoo.org/~blueness/eudev/'';
+ updateWalker = true;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/evdi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/evdi/default.nix
new file mode 100644
index 000000000000..119ba22ca264
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/evdi/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, fetchpatch, kernel, libdrm }:
+
+stdenv.mkDerivation rec {
+ pname = "evdi";
+ version = "unstable-20200416";
+
+ src = fetchFromGitHub {
+ owner = "DisplayLink";
+ repo = pname;
+ rev = "dc595db636845aef39490496bc075f6bf067106c";
+ sha256 = "1yrny6jj9403z0rxbd3nxf49xc4w0rfpl7xsq03pq32pb3vlbqw7";
+ };
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildInputs = [ kernel libdrm ];
+
+ makeFlags = [
+ "KVER=${kernel.modDirVersion}"
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ hardeningDisable = [ "format" "pic" "fortify" ];
+
+ installPhase = ''
+ install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
+ install -Dm755 library/libevdi.so $out/lib/libevdi.so
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Extensible Virtual Display Interface";
+ maintainers = with maintainers; [ eyjhb ];
+ platforms = platforms.linux;
+ license = with licenses; [ lgpl21 gpl2 ];
+ homepage = "https://www.displaylink.com/";
+ broken = versionOlder kernel.version "4.9" || stdenv.isAarch64;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eventstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eventstat/default.nix
new file mode 100644
index 000000000000..ca4984257212
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/eventstat/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, lib, fetchzip, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "eventstat";
+ version = "0.04.10";
+ src = fetchzip {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/eventstat/eventstat-${version}.tar.gz";
+ sha256 = "0rmg49m56qxji7gwci03pkk4f4hnaq1n2x1348dqkaf5zs5nhi6b";
+ };
+ buildInputs = [ ncurses ];
+ installFlags = [ "DESTDIR=$(out)" ];
+ postInstall = ''
+ mv $out/usr/* $out
+ rm -r $out/usr
+ '';
+ meta = with lib; {
+ description = "Simple monitoring of system events";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cstrahan ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/exfat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/exfat/default.nix
new file mode 100644
index 000000000000..5e212825bab3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/exfat/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, kernel }:
+
+
+# Upstream build for kernel 4.1 is broken, 3.12 and below seems to be working
+assert lib.versionAtLeast kernel.version "4.2" || lib.versionOlder kernel.version "4.0";
+
+stdenv.mkDerivation rec {
+ # linux kernel above 5.7 comes with its own exfat implementation https://github.com/arter97/exfat-linux/issues/27
+ # Assertion moved here due to some tests unintenionally triggering it,
+ # e.g. nixosTests.kernel-latest; it's unclear how/why so far.
+ assertion = assert lib.versionOlder kernel.version "5.8"; null;
+
+ name = "exfat-nofuse-${version}-${kernel.version}";
+ version = "2020-04-15";
+
+ src = fetchFromGitHub {
+ owner = "barrybingo";
+ repo = "exfat-nofuse";
+ rev = "297a5739cd4a942a1d814d05a9cd9b542e7b8fc8";
+ sha256 = "14jahy7n6pr482fjfrlf9ck3f2rkr5ds0n5r85xdfsla37ria26d";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+ ];
+
+ installPhase = ''
+ install -m644 -b -D exfat.ko $out/lib/modules/${kernel.modDirVersion}/kernel/fs/exfat/exfat.ko
+ '';
+
+ meta = {
+ description = "exfat kernel module";
+ inherit (src.meta) homepage;
+ license = lib.licenses.gpl2;
+ maintainers = with lib.maintainers; [ makefu ];
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/extrace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/extrace/default.nix
new file mode 100644
index 000000000000..23a9c68b5d5b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/extrace/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "extrace";
+ version = "0.7";
+
+ src = fetchFromGitHub {
+ owner = "leahneukirchen";
+ repo = "extrace";
+ rev = "v${version}";
+ sha256 = "0acspj3djspfvgr3ng5b61qws6v2md6b0lc5qkby10mqnfpkvq85";
+ };
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ postInstall = ''
+ install -dm755 "$out/share/licenses/extrace/"
+ install -m644 LICENSE "$out/share/licenses/extrace/LICENSE"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/leahneukirchen/extrace";
+ description = "Trace exec() calls system-wide";
+ license = with licenses; [ gpl2 bsd2 ];
+ platforms = platforms.linux;
+ maintainers = [ maintainers.leahneukirchen ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/facetimehd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/facetimehd/default.nix
new file mode 100644
index 000000000000..941e71c3bfc7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/facetimehd/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+# facetimehd is not supported for kernels older than 3.19";
+assert stdenv.lib.versionAtLeast kernel.version "3.19";
+
+let
+ # Note: When updating this revision:
+ # 1. Also update pkgs/os-specific/linux/firmware/facetimehd-firmware/
+ # 2. Test the module and firmware change via:
+ # a. Give some applications a try (Skype, Hangouts, Cheese, etc.)
+ # b. Run: journalctl -f
+ # c. Then close the lid
+ # d. Then open the lid (and maybe press a key to wake it up)
+ # e. see if the module loads back (apps using the camera won't
+ # recover and will have to be restarted) and the camera
+ # still works.
+ srcParams = if (stdenv.lib.versionAtLeast kernel.version "4.8") then
+ { # Use mainline branch
+ version = "unstable-2020-04-16";
+ rev = "82626d4892eeb9eb704538bf0dc49a00725ff451";
+ sha256 = "118z6vjvhhcwvs4n3sgwwdagys9w718b8nkh6l9ic93732vv7cqx";
+ }
+ else
+ { # Use master branch (broken on 4.8)
+ version = "unstable-2016-05-02";
+ rev = "5a7083bd98b38ef3bd223f7ee531d58f4fb0fe7c";
+ sha256 = "0d455kajvn5xav9iilqy7s1qvsy4yb8vzjjxx7bvcgp7aj9ljvdp";
+ }
+ ;
+in
+
+stdenv.mkDerivation rec {
+ name = "facetimehd-${version}-${kernel.version}";
+ version = srcParams.version;
+
+ src = fetchFromGitHub {
+ owner = "patjak";
+ repo = "bcwc_pcie";
+ inherit (srcParams) rev sha256;
+ };
+
+ preConfigure = ''
+ export INSTALL_MOD_PATH="$out"
+ '';
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/patjak/bcwc_pcie";
+ description = "Linux driver for the Facetime HD (Broadcom 1570) PCIe webcam";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ womfoo grahamc kraem ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fatrace/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fatrace/default.nix
new file mode 100644
index 000000000000..69d1afad8a68
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fatrace/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, python3, which }:
+
+stdenv.mkDerivation rec {
+ pname = "fatrace";
+ version = "0.13";
+
+ src = fetchurl {
+ url = "https://launchpad.net/fatrace/trunk/${version}/+download/${pname}-${version}.tar.bz2";
+ sha256 = "0hrh45bpzncw0jkxw3x2smh748r65k2yxvfai466043bi5q0d2vx";
+ };
+
+ buildInputs = [ python3 which ];
+
+ postPatch = ''
+ substituteInPlace power-usage-report \
+ --replace "'which'" "'${which}/bin/which'"
+
+ # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror.
+ sed 1i'#include <sys/sysmacros.h>' -i fatrace.c
+ '';
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "Report system-wide file access events";
+ homepage = "https://launchpad.net/fatrace/";
+ license = licenses.gpl3Plus;
+ longDescription = ''
+ fatrace reports file access events from all running processes.
+ Its main purpose is to find processes which keep waking up the disk
+ unnecessarily and thus prevent some power saving.
+ Requires a Linux kernel with the FANOTIFY configuration option enabled.
+ Enabling X86_MSR is also recommended for power-usage-report on x86.
+ '';
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/default.nix
new file mode 100644
index 000000000000..2b049bc6df5d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/default.nix
@@ -0,0 +1,62 @@
+{stdenv, lib, fetchurl, gpm, freetype, fontconfig, pkgconfig, ncurses, libx86}:
+let
+ s = # Generated upstream information
+ {
+ baseName="fbterm";
+ version="1.7.0";
+ name="fbterm-1.7.0";
+ hash="0pciv5by989vzvjxsv1jsv4bdp4m8j0nfbl29jm5fwi12w4603vj";
+ url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/fbterm/fbterm-1.7.0.tar.gz";
+ sha256="0pciv5by989vzvjxsv1jsv4bdp4m8j0nfbl29jm5fwi12w4603vj";
+ };
+ buildInputs = [gpm freetype fontconfig ncurses]
+ ++ lib.optional (stdenv.isi686 || stdenv.isx86_64) libx86;
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ src = fetchurl {
+ inherit (s) url sha256;
+ };
+
+ nativeBuildInputs = [ pkgconfig ncurses ];
+ inherit buildInputs;
+
+ preConfigure = ''
+ sed -e '/ifdef SYS_signalfd/atypedef long long loff_t;' -i src/fbterm.cpp
+ sed -e '/install-exec-hook:/,/^[^\t]/{d}; /.NOEXPORT/iinstall-exec-hook:\
+ ' -i src/Makefile.in
+ export HOME=$PWD;
+ export NIX_LDFLAGS="$NIX_LDFLAGS -lfreetype"
+ '';
+ preBuild = ''
+ mkdir -p "$out/share/terminfo"
+ tic -a -v2 -o"$out/share/terminfo" terminfo/fbterm
+ makeFlagsArray+=("AR=$AR")
+ '';
+
+ patches = [
+ # fixes from Arch Linux package
+ (fetchurl {
+ url = "https://raw.githubusercontent.com/glitsj16/fbterm-patched/d1fe03313be4654dd0a1c0bb5f51530732345134/gcc-6-build-fixes.patch";
+ sha256 = "1kl9fjnrri6pamjdl4jpkqxk5wxcf6jcchv5801xz8vxp4542m40";
+ })
+ (fetchurl {
+ url = "https://raw.githubusercontent.com/glitsj16/fbterm-patched/d1fe03313be4654dd0a1c0bb5f51530732345134/insertmode-fix.patch";
+ sha256 = "1bad9mqcfpqb94lpx23lsamlhplil73ahzin2xjva0gl3gr1038l";
+ })
+ (fetchurl {
+ url = "https://raw.githubusercontent.com/glitsj16/fbterm-patched/d1fe03313be4654dd0a1c0bb5f51530732345134/miscoloring-fix.patch";
+ sha256 = "1mjszji0jgs2jsagjp671fv0d1983wmxv009ff1jfhi9pbay6jd0";
+ })
+ ./select.patch
+ ];
+
+ meta = with stdenv.lib; {
+ inherit (s) version;
+ description = "Framebuffer terminal emulator";
+ homepage = "https://code.google.com/archive/p/fbterm/";
+ maintainers = [ maintainers.raskin ];
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/select.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/select.patch
new file mode 100644
index 000000000000..549674047a93
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fbterm/select.patch
@@ -0,0 +1,12 @@
+diff --git a/src/fbio.cpp b/src/fbio.cpp
+index e5afc44..2485227 100644
+--- a/src/fbio.cpp
++++ b/src/fbio.cpp
+@@ -18,6 +18,7 @@
+ *
+ */
+
++#include <sys/select.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include "config.h"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/default.nix
new file mode 100644
index 000000000000..b93caccc7574
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/default.nix
@@ -0,0 +1,108 @@
+{ stdenv
+, mkDerivation
+, dbus
+, dbus_cplusplus
+, desktop-file-utils
+, fetchurl
+, glibmm
+, kernel
+, libavc1394
+, libconfig
+, libiec61883
+, libraw1394
+, libxmlxx3
+, pkgconfig
+, python3
+, sconsPackages
+, which
+, wrapQtAppsHook
+}:
+
+let
+ inherit (python3.pkgs) pyqt5 dbus-python;
+ python = python3.withPackages (pkgs: with pkgs; [ pyqt5 dbus-python ]);
+in
+mkDerivation rec {
+ pname = "ffado";
+ version = "2.4.3";
+
+ src = fetchurl {
+ url = "http://www.ffado.org/files/libffado-${version}.tgz";
+ sha256 = "08bygzv1k6ai0572gv66h7gfir5zxd9klfy74z2pxqp6s5hms58r";
+ };
+
+ prePatch = ''
+ substituteInPlace ./support/tools/ffado-diag.in \
+ --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"
+ '';
+
+ patches = [
+ # fix installing metainfo file
+ ./fix-build.patch
+ ];
+
+ outputs = [ "out" "bin" "dev" ];
+
+ nativeBuildInputs = [
+ desktop-file-utils
+ sconsPackages.scons_3_1_2
+ pkgconfig
+ which
+ python
+ pyqt5
+ wrapQtAppsHook
+ ];
+
+ prefixKey = "PREFIX=";
+ sconsFlags = [
+ "DEBUG=False"
+ "ENABLE_ALL=True"
+ "BUILD_TESTS=True"
+ "WILL_DEAL_WITH_XDG_MYSELF=True"
+ "BUILD_MIXER=True"
+ "UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
+ "PYPKGDIR=${placeholder "out"}/${python3.sitePackages}"
+ "BINDIR=${placeholder "bin"}/bin"
+ "INCLUDEDIR=${placeholder "dev"}/include"
+ "PYTHON_INTERPRETER=${python.interpreter}"
+ ];
+
+ buildInputs = [
+ dbus
+ dbus_cplusplus
+ glibmm
+ libavc1394
+ libconfig
+ libiec61883
+ libraw1394
+ libxmlxx3
+ python
+ ];
+
+ enableParallelBuilding = true;
+ dontWrapQtApps = true;
+
+ postInstall = ''
+ desktop="$bin/share/applications/ffado-mixer.desktop"
+ install -DT -m 444 support/xdg/ffado.org-ffadomixer.desktop $desktop
+ substituteInPlace "$desktop" \
+ --replace Exec=ffado-mixer "Exec=$bin/bin/ffado-mixer" \
+ --replace hi64-apps-ffado ffado-mixer
+ install -DT -m 444 support/xdg/hi64-apps-ffado.png "$bin/share/icons/hicolor/64x64/apps/ffado-mixer.png"
+
+ # prevent build tools from leaking into closure
+ echo 'See `nix-store --query --tree ${placeholder "out"}`.' > $out/lib/libffado/static_info.txt
+ '';
+
+ preFixup = ''
+ wrapQtApp $bin/bin/ffado-mixer
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.ffado.org";
+ description = "FireWire audio drivers";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ goibhniu michojel ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/fix-build.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/fix-build.patch
new file mode 100644
index 000000000000..7e360932613f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ffado/fix-build.patch
@@ -0,0 +1,26 @@
+From b0f2b20b23780dd2e67a01c15462070dd86c4ac1 Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Sun, 3 Mar 2019 11:50:27 +0100
+Subject: [PATCH] Fix build on Nix
+
+We do not have global /usr.
+---
+ SConstruct | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/SConstruct b/SConstruct
+index 05755e4b..3fbdc1d8 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -537,7 +537,7 @@ env['mandir'] = Template( env.destdir + env['MANDIR'] ).safe_substitute( env )
+ env['pypkgdir'] = Template( env.destdir + env['PYPKGDIR'] ).safe_substitute( env )
+ env['udevdir'] = Template( env.destdir + env['UDEVDIR'] ).safe_substitute( env )
+ env['PYPKGDIR'] = Template( env['PYPKGDIR'] ).safe_substitute( env )
+-env['metainfodir'] = Template( env.destdir + "/usr/share/metainfo" ).safe_substitute( env )
++env['metainfodir'] = Template( env.destdir + env['SHAREDIR'] + "/metainfo" ).safe_substitute( env )
+
+ env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) )
+
+--
+2.19.2
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.nix
new file mode 100644
index 000000000000..272b8612d7a7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.nix
@@ -0,0 +1,90 @@
+{stdenv, fetchurl, fetchpatch, which, nixosTests}:
+let
+ s = # Generated upstream information
+ rec {
+ baseName="firejail";
+ version="0.9.62";
+ name="${baseName}-${version}";
+ url="mirror://sourceforge/firejail/firejail/firejail-${version}.tar.xz";
+ sha256="1q2silgy882fl61p5qa9f9jqkxcqnwa71jig3c729iahx4f0hs05";
+ };
+ buildInputs = [
+ which
+ ];
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ inherit buildInputs;
+ src = fetchurl {
+ inherit (s) url sha256;
+ name = "${s.name}.tar.bz2";
+ };
+
+ patches = [
+ (fetchpatch {
+ name = "CVE-2020-17367.patch";
+ url = "https://github.com/netblue30/firejail/commit/2c734d6350ad321fccbefc5ef0382199ac331b37.patch";
+ sha256 = "1gxz4jxp80gxnn46195qxcpmikwqab9d0ylj9zkm62lycp84ij6n";
+ })
+ (fetchpatch {
+ name = "CVE-2020-17368.patch";
+ url = "https://github.com/netblue30/firejail/commit/34193604fed04cad2b7b6b0f1a3a0428afd9ed5b.patch";
+ sha256 = "0n4ch3qykxx870201l8lz81f7h84vk93pzz77f5cjbd30cxnbddl";
+ })
+ ];
+
+ prePatch = ''
+ # Allow whitelisting ~/.nix-profile
+ substituteInPlace etc/firejail.config --replace \
+ '# follow-symlink-as-user yes' \
+ 'follow-symlink-as-user no'
+ '';
+
+ preConfigure = ''
+ sed -e 's@/bin/bash@${stdenv.shell}@g' -i $( grep -lr /bin/bash .)
+ sed -e "s@/bin/cp@$(which cp)@g" -i $( grep -lr /bin/cp .)
+ '';
+
+ preBuild = ''
+ sed -e "s@/etc/@$out/etc/@g" -e "/chmod u+s/d" -i Makefile
+ '';
+
+ # The profile files provided with the firejail distribution include `.local`
+ # profile files using relative paths. The way firejail works when it comes to
+ # handling includes is by looking target files up in `~/.config/firejail`
+ # first, and then trying `SYSCONFDIR`. The latter normally points to
+ # `/etc/filejail`, but in the case of nixos points to the nix store. This
+ # makes it effectively impossible to place any profile files in
+ # `/etc/firejail`.
+ #
+ # The workaround applied below is by creating a set of `.local` files which
+ # only contain respective includes to `/etc/firejail`. This way
+ # `~/.config/firejail` still takes precedence, but `/etc/firejail` will also
+ # be searched in second order. This replicates the behaviour from
+ # non-nixos platforms.
+ #
+ # See https://github.com/netblue30/firejail/blob/e4cb6b42743ad18bd11d07fd32b51e8576239318/src/firejail/profile.c#L68-L83
+ # for the profile file lookup implementation.
+ postInstall = ''
+ for local in $(grep -Eh '^include.*local$' $out/etc/firejail/*.profile | awk '{print $2}' | sort | uniq)
+ do
+ echo "include /etc/firejail/$local" >$out/etc/firejail/$local
+ done
+ '';
+
+ # At high parallelism, the build sometimes fails with:
+ # bash: src/fsec-optimize/fsec-optimize: No such file or directory
+ enableParallelBuilding = false;
+
+ passthru.tests = nixosTests.firejail;
+
+ meta = {
+ inherit (s) version;
+ description = ''Namespace-based sandboxing tool for Linux'';
+ license = stdenv.lib.licenses.gpl2Plus ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ homepage = "https://firejail.wordpress.com/";
+ downloadPage = "https://sourceforge.net/projects/firejail/files/firejail/";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.upstream b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.upstream
new file mode 100644
index 000000000000..0e6576c44a80
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firejail/default.upstream
@@ -0,0 +1,3 @@
+url https://sourceforge.net/projects/firejail/files/firejail/
+version_link '[-][0-9.]+[.]tar[.][a-z0-9]+/download$'
+SF_redirect
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix
new file mode 100644
index 000000000000..7cb5d2a9a408
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "b43-fwcutter-019";
+
+ src = fetchurl {
+ url = "https://bues.ch/b43/fwcutter/${name}.tar.bz2";
+ sha256 = "1ki1f5fy3yrw843r697f8mqqdz0pbsbqnvg4yzkhibpn1lqqbsnn";
+ };
+
+ patches = [ ./no-root-install.patch ];
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ meta = {
+ description = "Firmware extractor for cards supported by the b43 kernel module";
+ homepage = "http://wireless.kernel.org/en/users/Drivers/b43";
+ license = stdenv.lib.licenses.free;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/no-root-install.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/no-root-install.patch
new file mode 100644
index 000000000000..578812e0ad0b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/no-root-install.patch
@@ -0,0 +1,18 @@
+diff -Naur b43-fwcutter-015-orig/Makefile b43-fwcutter-015/Makefile
+--- b43-fwcutter-015-orig/Makefile 2011-08-21 08:17:01.000000000 -0400
++++ b43-fwcutter-015/Makefile 2012-07-13 17:57:53.002154557 -0400
+@@ -51,10 +51,10 @@
+ $(QUIET_CC) $(CFLAGS) -o $(BIN) $(call OBJS,$(SRCS)) $(LDFLAGS)
+
+ install: all
+- install -d -o 0 -g 0 -m 755 $(PREFIX)/bin/
+- install -o 0 -g 0 -m 755 $(BIN) $(PREFIX)/bin/
+- install -d -o 0 -g 0 -m 755 $(PREFIX)/man/man1/
+- install -o 0 -g 0 -m 644 $(BIN).1 $(PREFIX)/man/man1/
++ install -d -m 755 $(PREFIX)/bin/
++ install -m 755 $(BIN) $(PREFIX)/bin/
++ install -d -m 755 $(PREFIX)/man/man1/
++ install -m 644 $(BIN).1 $(PREFIX)/man/man1/
+
+ clean:
+ -rm -Rf obj dep *.orig *.rej *~
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/5.1.138.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/5.1.138.nix
new file mode 100644
index 000000000000..4f03f58b11fb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/5.1.138.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, b43FirmwareCutter }:
+
+let version = "5.100.138"; in
+
+stdenv.mkDerivation {
+ pname = "b43-firmware";
+ inherit version;
+
+ src = fetchurl {
+ url = "http://www.lwfinger.com/b43-firmware/broadcom-wl-${version}.tar.bz2";
+ sha256 = "0vz4ka8gycf72gmnaq61k8rh8y17j1wm2k3fidxvcqjvmix0drzi";
+ };
+
+ buildInputs = [ b43FirmwareCutter ];
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/lib/firmware
+ b43-fwcutter -w $out/lib/firmware linux/wl_apsta.o
+ '';
+
+ meta = {
+ description = "Firmware for cards supported by the b43 kernel module";
+ homepage = "http://wireless.kernel.org/en/users/Drivers/b43";
+ license = stdenv.lib.licenses.unfree;
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/6.30.163.46.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/6.30.163.46.nix
new file mode 100644
index 000000000000..3972e52977f6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware/6.30.163.46.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, b43FirmwareCutter }:
+
+stdenv.mkDerivation rec {
+ pname = "b43-firmware";
+ version = "6.30.163.46";
+
+ src = fetchurl {
+ url = "http://www.lwfinger.com/b43-firmware/broadcom-wl-${version}.tar.bz2";
+ sha256 = "0baw6gcnrhxbb447msv34xg6rmlcj0gm3ahxwvdwfcvq4xmknz50";
+ };
+
+ buildInputs = [ b43FirmwareCutter ];
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ sourceRoot = ".";
+
+ installPhase = ''
+ mkdir $out
+ b43-fwcutter -w $out *.wl_apsta.o
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Firmware for cards supported by the b43 kernel module";
+ homepage = "http://wireless.kernel.org/en/users/Drivers/b43";
+ downloadPage = "http://www.lwfinger.com/b43-firmware";
+ license = licenses.unfree;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/broadcom-bt-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/broadcom-bt-firmware/default.nix
new file mode 100644
index 000000000000..314a6b7521b8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/broadcom-bt-firmware/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, cabextract, bt-fw-converter }:
+
+# Kernels between 4.2 and 4.7 will not work with
+# this packages as they expect the firmware to be named "BCM.hcd"
+# see: https://github.com/NixOS/nixpkgs/pull/25478#issuecomment-299034865
+stdenv.mkDerivation rec {
+ pname = "broadcom-bt-firmware";
+ version = "12.0.1.1012";
+
+ src = fetchurl {
+ url = "http://download.windowsupdate.com/c/msdownload/update/driver/drvs/2017/04/852bb503-de7b-4810-a7dd-cbab62742f09_7cf83a4c194116648d17707ae37d564f9c70bec2.cab";
+ sha256 = "1b1qjwxjk4y91l3iz157kms8601n0mmiik32cs6w9b1q4sl4pxx9";
+ };
+
+ nativeBuildInputs = [ cabextract bt-fw-converter ];
+
+ unpackCmd = ''
+ mkdir -p ${pname}-${version}
+ cabextract $src --directory ${pname}-${version}
+ '';
+
+ installPhase = ''
+ mkdir -p $out/lib/firmware/brcm
+ bt-fw-converter -f bcbtums.inf -o $out/lib/firmware/brcm
+ for filename in $out/lib/firmware/brcm/*.hcd
+ do
+ linkname=$(basename $filename | awk 'match($0,/^(BCM)[0-9A-Z]+(-[0-9a-z]{4}-[0-9a-z]{4}\.hcd)$/,c) { print c[1]c[2] }')
+ if ! [ -z $linkname ]
+ then
+ ln -s --relative -T $filename $out/lib/firmware/brcm/$linkname
+ fi
+ done
+ '';
+
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ outputHash = "042frb2dmrqfj8q83h5p769q6hg2b3i8fgnyvs9r9a71z7pbsagq";
+
+ meta = with stdenv.lib; {
+ description = "Firmware for Broadcom WIDCOMM® Bluetooth devices";
+ homepage = "http://www.catalog.update.microsoft.com/Search.aspx?q=Broadcom+bluetooth";
+ license = licenses.unfree;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ zraexy ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/bt-fw-converter/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/bt-fw-converter/default.nix
new file mode 100644
index 000000000000..5b4506a10eae
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/bt-fw-converter/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, makeWrapper, perl, perlPackages, bluez }:
+
+stdenv.mkDerivation rec {
+ pname = "bt-fw-converter";
+ version = "2017-02-19";
+ rev = "2d8b34402df01c6f7f4b8622de9e8b82fadf4153";
+
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/winterheart/broadcom-bt-firmware/${rev}/tools/bt-fw-converter.pl";
+ sha256 = "c259b414a4a273c89a0fa7159b3ef73d1ea62b6de91c3a7c2fcc832868e39f4b";
+ };
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ buildInputs = [ perl perlPackages.RegexpGrammars bluez ];
+
+ unpackCmd = ''
+ mkdir -p ${pname}-${version}
+ cp $src ${pname}-${version}/bt-fw-converter.pl
+ '';
+
+ installPhase = ''
+ install -D -m755 bt-fw-converter.pl $out/bin/bt-fw-converter
+ substituteInPlace $out/bin/bt-fw-converter --replace /usr/bin/hex2hcd ${bluez}/bin/hex2hcd
+ wrapProgram $out/bin/bt-fw-converter --set PERL5LIB $PERL5LIB
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/winterheart/broadcom-bt-firmware/";
+ description = "A tool that converts hex to hcd based on inf file";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ zraexy ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix
new file mode 100644
index 000000000000..7d735e69f568
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchurl, cpio, xz, pkgs }:
+
+let
+
+ version = "1.43_5";
+
+
+ # Updated according to https://github.com/patjak/bcwc_pcie/pull/81/files
+ # and https://github.com/patjak/bcwc_pcie/blob/5a7083bd98b38ef3bd223f7ee531d58f4fb0fe7c/firmware/Makefile#L3-L9
+ # and https://github.com/patjak/bcwc_pcie/blob/5a7083bd98b38ef3bd223f7ee531d58f4fb0fe7c/firmware/extract-firmware.sh
+
+ # From the Makefile:
+ dmgUrl = "https://updates.cdn-apple.com/2019/cert/041-88431-20191011-e7ee7d98-2878-4cd9-bc0a-d98b3a1e24b1/OSXUpd10.11.5.dmg";
+ dmgRange = "204909802-207733123"; # the whole download is 1.3GB, this cuts it down to 2MB
+ # Notes:
+ # 1. Be sure to update the sha256 below in the fetch_url
+ # 2. Be sure to update the homepage in the meta
+
+ # Also from the Makefile (OS_DRV, OS_DRV_DIR), but seems to not change:
+ firmwareIn = "./System/Library/Extensions/AppleCameraInterface.kext/Contents/MacOS/AppleCameraInterface";
+ firmwareOut = "firmware.bin";
+
+ # The following are from the extract-firmware.sh
+ firmwareOffset = "81920"; # Variable: firmw_offsets
+ firmwareSize = "603715"; # Variable: firmw_sizes
+
+
+ # separated this here as the script will fail without the 'exit 0'
+ unpack = pkgs.writeScriptBin "unpack" ''
+ xzcat -Q $src | cpio --format odc -i -d ${firmwareIn}
+ exit 0
+ '';
+
+in
+
+stdenv.mkDerivation {
+
+ pname = "facetimehd-firmware";
+ inherit version;
+ src = fetchurl {
+ url = dmgUrl;
+ sha256 = "0s8crlh8rvpanzk1w4z3hich0a3mw0m5xhpcg07bxy02calhpdk1";
+ curlOpts = "-r ${dmgRange}";
+ };
+
+ phases = [ "buildPhase" ];
+
+ buildInputs = [ cpio xz ];
+
+ buildPhase = ''
+ ${unpack}/bin/unpack
+ dd bs=1 skip=${firmwareOffset} count=${firmwareSize} if=${firmwareIn} of=${firmwareOut}.gz &> /dev/null
+ mkdir -p $out/lib/firmware/facetimehd
+ gunzip -c ${firmwareOut}.gz > $out/lib/firmware/facetimehd/${firmwareOut}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "facetimehd firmware";
+ homepage = "https://support.apple.com/kb/DL1877";
+ license = licenses.unfree;
+ maintainers = with maintainers; [ womfoo grahamc ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
new file mode 100644
index 000000000000..76ea5230becc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchgit, lib }:
+
+stdenv.mkDerivation rec {
+ pname = "firmware-linux-nonfree";
+ version = "2020-09-18";
+
+ src = fetchgit {
+ url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
+ rev = lib.replaceStrings ["-"] [""] version;
+ sha256 = "06k2x6y9dhzs6nnbs1ws7rxbz0xijzmyn24sa223n0bmbb96n4f0";
+ };
+
+ installFlags = [ "DESTDIR=$(out)" ];
+
+ # Firmware blobs do not need fixing and should not be modified
+ dontFixup = true;
+
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ outputHash = "1avpf2x1g7dlpva76pcnldxngkjabsyaknkkjbrhg1mj6z9g1mx7";
+
+ meta = with stdenv.lib; {
+ description = "Binary firmware collection packaged by kernel.org";
+ homepage = "http://packages.debian.org/sid/firmware-linux-nonfree";
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ fpletz ];
+ priority = 6; # give precedence to kernel firmware
+ };
+
+ passthru = { inherit version; };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-manager/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-manager/default.nix
new file mode 100644
index 000000000000..e98de6bbe9e8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/firmware-manager/default.nix
@@ -0,0 +1,38 @@
+{ rustPlatform, lib, fetchFromGitHub, lzma, pkgconfig, openssl, dbus, glib, udev, cairo, pango, atk, gdk-pixbuf, gtk3, wrapGAppsHook }:
+rustPlatform.buildRustPackage rec {
+ pname = "firmware-manager";
+ version = "0.1.1";
+
+ src = fetchFromGitHub {
+ owner = "pop-os";
+ repo = pname;
+ rev = version;
+ sha256 = "0x9604jsflqxvbkfp139mzjicpyx8v21139jj8bp88c14ngvmdlw";
+ };
+
+ nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
+
+ buildInputs = [ lzma openssl dbus glib udev cairo pango atk gdk-pixbuf gtk3 ];
+
+ depsExtraArgs.postPatch = "make prefix='$(out)' toml-gen";
+
+ postPatch = ''
+ sed -i 's|etc|$(prefix)/etc|' Makefile
+ '';
+
+ buildPhase = "make prefix='$(out)'";
+
+ installPhase = "make prefix='$(out)' install";
+
+ cargoSha256 = "0byc0pqa1w2qnfrx3psrzdq1c8qjslbmzxg872b9v6fr5d4c9cvg";
+
+ doCheck = false;
+
+ meta = {
+ description = "Graphical frontend for firmware management";
+ homepage = "https://github.com/pop-os/firmware-manager";
+ license = lib.licenses.gpl3;
+ maintainers = [ lib.maintainers.shlevy ];
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch
new file mode 100644
index 000000000000..a727e5f4a85b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/add-option-for-installation-sysconfdir.patch
@@ -0,0 +1,177 @@
+diff --git a/data/meson.build b/data/meson.build
+index bb749fd4..b611875b 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -17,7 +17,7 @@ endif
+
+ if build_standalone
+ install_data(['daemon.conf'],
+- install_dir : join_paths(sysconfdir, 'fwupd')
++ install_dir : join_paths(sysconfdir_install, 'fwupd')
+ )
+ endif
+
+diff --git a/data/pki/meson.build b/data/pki/meson.build
+index 94bb0b6f..1ea6a9ac 100644
+--- a/data/pki/meson.build
++++ b/data/pki/meson.build
+@@ -3,24 +3,23 @@ install_data([
+ 'GPG-KEY-Linux-Foundation-Firmware',
+ 'GPG-KEY-Linux-Vendor-Firmware-Service',
+ ],
+- install_dir : join_paths(sysconfdir, 'pki', 'fwupd')
++ install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd')
+ )
+
+ install_data([
+ 'GPG-KEY-Linux-Foundation-Metadata',
+ 'GPG-KEY-Linux-Vendor-Firmware-Service',
+ ],
+- install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata')
++ install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd-metadata')
+ )
+
+ install_data([
+ 'LVFS-CA.pem',
+ ],
+- install_dir : join_paths(sysconfdir, 'pki', 'fwupd')
++ install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd')
+ )
+ install_data([
+ 'LVFS-CA.pem',
+ ],
+- install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata')
++ install_dir : join_paths(sysconfdir_install, 'pki', 'fwupd-metadata')
+ )
+-
+diff --git a/data/remotes.d/meson.build b/data/remotes.d/meson.build
+index 826a3c1d..b78db663 100644
+--- a/data/remotes.d/meson.build
++++ b/data/remotes.d/meson.build
+@@ -3,7 +3,7 @@ if build_daemon and get_option('lvfs')
+ 'lvfs.conf',
+ 'lvfs-testing.conf',
+ ],
+- install_dir : join_paths(sysconfdir, 'fwupd', 'remotes.d')
++ install_dir : join_paths(sysconfdir_install, 'fwupd', 'remotes.d')
+ )
+ i18n.merge_file(
+ input: 'lvfs.metainfo.xml',
+@@ -37,12 +37,12 @@ configure_file(
+ output : 'vendor.conf',
+ configuration : con2,
+ install: true,
+- install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
++ install_dir: join_paths(sysconfdir_install, 'fwupd', 'remotes.d'),
+ )
+ configure_file(
+ input : 'vendor-directory.conf',
+ output : 'vendor-directory.conf',
+ configuration : con2,
+ install: true,
+- install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
++ install_dir: join_paths(sysconfdir_install, 'fwupd', 'remotes.d'),
+ )
+diff --git a/meson.build b/meson.build
+index 87ea67e5..3a4374db 100644
+--- a/meson.build
++++ b/meson.build
+@@ -175,6 +175,12 @@ endif
+ mandir = join_paths(prefix, get_option('mandir'))
+ localedir = join_paths(prefix, get_option('localedir'))
+
++if get_option('sysconfdir_install') != ''
++ sysconfdir_install = join_paths(prefix, get_option('sysconfdir_install'))
++else
++ sysconfdir_install = sysconfdir
++endif
++
+ diffcmd = find_program('diff')
+ gio = dependency('gio-2.0', version : '>= 2.45.8')
+ giounix = dependency('gio-unix-2.0', version : '>= 2.45.8', required: false)
+diff --git a/meson_options.txt b/meson_options.txt
+index 3da9b6c4..6c80275b 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -24,6 +24,7 @@ option('plugin_coreboot', type : 'boolean', value : true, description : 'enable
+ option('systemd', type : 'boolean', value : true, description : 'enable systemd support')
+ option('systemdunitdir', type: 'string', value: '', description: 'Directory for systemd units')
+ option('elogind', type : 'boolean', value : false, description : 'enable elogind support')
++option('sysconfdir_install', type: 'string', value: '', description: 'sysconfdir to use during installation')
+ option('tests', type : 'boolean', value : true, description : 'enable tests')
+ option('udevdir', type: 'string', value: '', description: 'Directory for udev rules')
+ option('efi-cc', type : 'string', value : 'gcc', description : 'the compiler to use for EFI modules')
+diff --git a/plugins/ata/meson.build b/plugins/ata/meson.build
+index 8444bb8a..fa4a8ad1 100644
+--- a/plugins/ata/meson.build
++++ b/plugins/ata/meson.build
+@@ -7,7 +7,7 @@ install_data([
+ )
+
+ install_data(['ata.conf'],
+- install_dir: join_paths(sysconfdir, 'fwupd')
++ install_dir: join_paths(sysconfdir_install, 'fwupd')
+ )
+
+ shared_module('fu_plugin_ata',
+diff --git a/plugins/dell-esrt/meson.build b/plugins/dell-esrt/meson.build
+index ed4eee70..76dbdb1d 100644
+--- a/plugins/dell-esrt/meson.build
++++ b/plugins/dell-esrt/meson.build
+@@ -37,5 +37,5 @@ configure_file(
+ output : 'dell-esrt.conf',
+ configuration : con2,
+ install: true,
+- install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
++ install_dir: join_paths(sysconfdir_install, 'fwupd', 'remotes.d'),
+ )
+diff --git a/plugins/redfish/meson.build b/plugins/redfish/meson.build
+index 25fc5c7d..77eb9a83 100644
+--- a/plugins/redfish/meson.build
++++ b/plugins/redfish/meson.build
+@@ -27,7 +27,7 @@ shared_module('fu_plugin_redfish',
+ )
+
+ install_data(['redfish.conf'],
+- install_dir: join_paths(sysconfdir, 'fwupd')
++ install_dir: join_paths(sysconfdir_install, 'fwupd')
+ )
+
+ if get_option('tests')
+diff --git a/plugins/thunderbolt/meson.build b/plugins/thunderbolt/meson.build
+index 06ab34ee..297a9182 100644
+--- a/plugins/thunderbolt/meson.build
++++ b/plugins/thunderbolt/meson.build
+@@ -46,7 +46,7 @@ executable('tbtfwucli',
+ )
+
+ install_data(['thunderbolt.conf'],
+- install_dir: join_paths(sysconfdir, 'fwupd')
++ install_dir: join_paths(sysconfdir_install, 'fwupd')
+ )
+ # we use functions from 2.52 in the tests
+ if get_option('tests') and umockdev.found() and gio.version().version_compare('>= 2.52')
+diff --git a/plugins/uefi/meson.build b/plugins/uefi/meson.build
+index 5838cecc..9ba3d5cd 100644
+--- a/plugins/uefi/meson.build
++++ b/plugins/uefi/meson.build
+@@ -101,7 +101,7 @@ if get_option('man')
+ endif
+
+ install_data(['uefi.conf'],
+- install_dir: join_paths(sysconfdir, 'fwupd')
++ install_dir: join_paths(sysconfdir_install, 'fwupd')
+ )
+
+ if get_option('tests')
+diff --git a/plugins/upower/meson.build b/plugins/upower/meson.build
+index 290a3eb6..9ab2f452 100644
+--- a/plugins/upower/meson.build
++++ b/plugins/upower/meson.build
+@@ -23,5 +23,5 @@ shared_module('fu_plugin_upower',
+ )
+
+ install_data(['upower.conf'],
+- install_dir: join_paths(sysconfdir, 'fwupd')
++ install_dir: join_paths(sysconfdir_install, 'fwupd')
+ )
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/default.nix
new file mode 100644
index 000000000000..d502d049ace4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/default.nix
@@ -0,0 +1,322 @@
+# Updating? Keep $out/etc synchronized with passthru keys
+
+{ stdenv
+, fetchurl
+, fetchpatch
+, substituteAll
+, gtk-doc
+, pkg-config
+, gobject-introspection
+, gettext
+, libgudev
+, polkit
+, libxmlb
+, gusb
+, sqlite
+, libarchive
+, glib-networking
+, libsoup
+, help2man
+, libjcat
+, libxslt
+, elfutils
+, libsmbios
+, efivar
+, gnu-efi
+, valgrind
+, meson
+, libuuid
+, colord
+, docbook_xml_dtd_43
+, docbook-xsl-nons
+, ninja
+, gcab
+, python3
+, wrapGAppsHook
+, json-glib
+, bash-completion
+, shared-mime-info
+, umockdev
+, vala
+, makeFontsConf
+, freefont_ttf
+, cairo
+, freetype
+, fontconfig
+, pango
+, tpm2-tss
+, bubblewrap
+, efibootmgr
+, flashrom
+, tpm2-tools
+, nixosTests
+, runCommand
+}:
+
+let
+ python = python3.withPackages (p: with p; [
+ pygobject3
+ pycairo
+ pillow
+ setuptools
+ ]);
+
+ installedTestsPython = python3.withPackages (p: with p; [
+ pygobject3
+ requests
+ ]);
+
+ isx86 = stdenv.isx86_64 || stdenv.isi686;
+
+ # Dell isn't supported on Aarch64
+ haveDell = isx86;
+
+ # only redfish for x86_64
+ haveRedfish = stdenv.isx86_64;
+
+ # # Currently broken on Aarch64
+ # haveFlashrom = isx86;
+ # Experimental
+ haveFlashrom = false;
+
+ runPythonCommand = name: buildCommandPython: runCommand name {
+ nativeBuildInputs = [ python3 ];
+ inherit buildCommandPython;
+ } ''
+ exec python3 -c "$buildCommandPython"
+ '';
+
+ self = stdenv.mkDerivation rec {
+ pname = "fwupd";
+ version = "1.4.6";
+
+ # libfwupd goes to lib
+ # daemon, plug-ins and libfwupdplugin go to out
+ # CLI programs go to out
+ outputs = [ "out" "lib" "dev" "devdoc" "man" "installedTests" ];
+
+ src = fetchurl {
+ url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz";
+ sha256 = "AKG5stioIveQc7ooYb/2UoOaBzbPUFzYk8tZK0rzvK0=";
+ };
+
+ patches = [
+ # Do not try to create useless paths in /var.
+ ./fix-paths.patch
+
+ # Allow installing
+ ./add-option-for-installation-sysconfdir.patch
+
+ # Install plug-ins and libfwupdplugin to out,
+ # they are not really part of the library.
+ ./install-fwupdplugin-to-out.patch
+
+ # Installed tests are installed to different output
+ # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle.
+ (substituteAll {
+ src = ./installed-tests-path.patch;
+ # Needs a different set of modules than po/make-images.
+ inherit installedTestsPython;
+ })
+ ];
+
+ nativeBuildInputs = [
+ meson
+ ninja
+ gtk-doc
+ pkg-config
+ gobject-introspection
+ gettext
+ shared-mime-info
+ valgrind
+ gcab
+ docbook_xml_dtd_43
+ docbook-xsl-nons
+ help2man
+ libxslt
+ python
+ wrapGAppsHook
+ vala
+ ];
+
+ buildInputs = [
+ polkit
+ libxmlb
+ gusb
+ sqlite
+ libarchive
+ libsoup
+ elfutils
+ gnu-efi
+ libgudev
+ colord
+ libjcat
+ libuuid
+ glib-networking
+ json-glib
+ umockdev
+ bash-completion
+ cairo
+ freetype
+ fontconfig
+ pango
+ tpm2-tss
+ efivar
+ ] ++ stdenv.lib.optionals haveDell [
+ libsmbios
+ ];
+
+ mesonFlags = [
+ "-Dgtkdoc=true"
+ "-Dplugin_dummy=true"
+ "-Dudevdir=lib/udev"
+ "-Dsystemd_root_prefix=${placeholder "out"}"
+ "-Dinstalled_test_prefix=${placeholder "installedTests"}"
+ "-Defi-libdir=${gnu-efi}/lib"
+ "-Defi-ldsdir=${gnu-efi}/lib"
+ "-Defi-includedir=${gnu-efi}/include/efi"
+ "--localstatedir=/var"
+ "--sysconfdir=/etc"
+ "-Dsysconfdir_install=${placeholder "out"}/etc"
+
+ # We do not want to place the daemon into lib (cyclic reference)
+ "--libexecdir=${placeholder "out"}/libexec"
+ # Our builder only adds $lib/lib to rpath but some things link
+ # against libfwupdplugin which is in $out/lib.
+ "-Dc_link_args=-Wl,-rpath,${placeholder "out"}/lib"
+ ] ++ stdenv.lib.optionals (!haveDell) [
+ "-Dplugin_dell=false"
+ "-Dplugin_synaptics=false"
+ ] ++ stdenv.lib.optionals (!haveRedfish) [
+ "-Dplugin_redfish=false"
+ ] ++ stdenv.lib.optionals haveFlashrom [
+ "-Dplugin_flashrom=true"
+ ];
+
+ # TODO: wrapGAppsHook wraps efi capsule even though it is not ELF
+ dontWrapGApps = true;
+
+ # /etc/os-release not available in sandbox
+ # doCheck = true;
+
+ # Environment variables
+
+ # Fontconfig error: Cannot load default config file
+ FONTCONFIG_FILE =
+ let
+ fontsConf = makeFontsConf {
+ fontDirectories = [ freefont_ttf ];
+ };
+ in fontsConf;
+
+ # error: “PolicyKit files are missing”
+ # https://github.com/NixOS/nixpkgs/pull/67625#issuecomment-525788428
+ PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions";
+
+ # Phase hooks
+
+ postPatch = ''
+ patchShebangs \
+ contrib/get-version.py \
+ contrib/generate-version-script.py \
+ meson_post_install.sh \
+ po/make-images \
+ po/make-images.sh \
+ po/test-deps
+ '';
+
+ preCheck = ''
+ addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share"
+ '';
+
+ preFixup = let
+ binPath = [
+ efibootmgr
+ bubblewrap
+ tpm2-tools
+ ] ++ stdenv.lib.optional haveFlashrom flashrom;
+ in ''
+ gappsWrapperArgs+=(
+ --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
+ # See programs reached with fu_common_find_program_in_path in source
+ --prefix PATH : "${stdenv.lib.makeBinPath binPath}"
+ )
+ '';
+
+ # Since we had to disable wrapGAppsHook, we need to wrap the executables manually.
+ postFixup = ''
+ find -L "$out/bin" "$out/libexec" -type f -executable -print0 \
+ | while IFS= read -r -d ''' file; do
+ if [[ "$file" != *.efi ]]; then
+ echo "Wrapping program $file"
+ wrapGApp "$file"
+ fi
+ done
+ '';
+
+ passthru = {
+ filesInstalledToEtc = [
+ "fwupd/ata.conf"
+ "fwupd/daemon.conf"
+ "fwupd/redfish.conf"
+ "fwupd/remotes.d/lvfs-testing.conf"
+ "fwupd/remotes.d/lvfs.conf"
+ "fwupd/remotes.d/vendor.conf"
+ "fwupd/remotes.d/vendor-directory.conf"
+ "fwupd/thunderbolt.conf"
+ "fwupd/upower.conf"
+ "fwupd/uefi.conf"
+ "pki/fwupd/GPG-KEY-Hughski-Limited"
+ "pki/fwupd/GPG-KEY-Linux-Foundation-Firmware"
+ "pki/fwupd/GPG-KEY-Linux-Vendor-Firmware-Service"
+ "pki/fwupd/LVFS-CA.pem"
+ "pki/fwupd-metadata/GPG-KEY-Linux-Foundation-Metadata"
+ "pki/fwupd-metadata/GPG-KEY-Linux-Vendor-Firmware-Service"
+ "pki/fwupd-metadata/LVFS-CA.pem"
+ ] ++ stdenv.lib.optionals haveDell [
+ "fwupd/remotes.d/dell-esrt.conf"
+ ];
+
+ # BlacklistPlugins key in fwupd/daemon.conf
+ defaultBlacklistedPlugins = [
+ "test"
+ "invalid"
+ ];
+
+ tests = let
+ listToPy = list: "[${stdenv.lib.concatMapStringsSep ", " (f: "'${f}'") list}]";
+ in {
+ installedTests = nixosTests.installed-tests.fwupd;
+
+ passthruMatches = runPythonCommand "fwupd-test-passthru-matches" ''
+ import itertools
+ import configparser
+ import os
+ import pathlib
+
+ etc = '${self}/etc'
+ package_etc = set(itertools.chain.from_iterable([[os.path.relpath(os.path.join(prefix, file), etc) for file in files] for (prefix, dirs, files) in os.walk(etc)]))
+ passthru_etc = set(${listToPy passthru.filesInstalledToEtc})
+ assert len(package_etc - passthru_etc) == 0, f'fwupd package contains the following paths in /etc that are not listed in passthru.filesInstalledToEtc: {package_etc - passthru_etc}'
+ assert len(passthru_etc - package_etc) == 0, f'fwupd package lists the following paths in passthru.filesInstalledToEtc that are not contained in /etc: {passthru_etc - package_etc}'
+
+ config = configparser.RawConfigParser()
+ config.read('${self}/etc/fwupd/daemon.conf')
+ package_blacklisted_plugins = config.get('fwupd', 'BlacklistPlugins').rstrip(';').split(';')
+ passthru_blacklisted_plugins = ${listToPy passthru.defaultBlacklistedPlugins}
+ assert package_blacklisted_plugins == passthru_blacklisted_plugins, f'Default blacklisted plug-ins in the package {package_blacklisted_plugins} do not match those listed in passthru.defaultBlacklistedPlugins {passthru_blacklisted_plugins}'
+
+ pathlib.Path(os.getenv('out')).touch()
+ '';
+ };
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://fwupd.org/";
+ maintainers = with maintainers; [ jtojnar ];
+ license = licenses.lgpl21Plus;
+ platforms = platforms.linux;
+ };
+ };
+
+in self
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch
new file mode 100644
index 000000000000..474b250097d0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch
@@ -0,0 +1,8 @@
+diff --git a/data/builder/meson.build b/data/builder/meson.build
+index c7a430c0..e69de29b 100644
+--- a/data/builder/meson.build
++++ b/data/builder/meson.build
+@@ -1,3 +0,0 @@
+-install_data('README.md',
+- install_dir : join_paths(localstatedir, 'lib', 'fwupd', 'builder')
+-)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/install-fwupdplugin-to-out.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/install-fwupdplugin-to-out.patch
new file mode 100644
index 000000000000..347b6862146d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/install-fwupdplugin-to-out.patch
@@ -0,0 +1,37 @@
+diff --git a/libfwupdplugin/meson.build b/libfwupdplugin/meson.build
+index 0abcd45c..51cbc912 100644
+--- a/libfwupdplugin/meson.build
++++ b/libfwupdplugin/meson.build
+@@ -114,7 +114,8 @@
+ ],
+ link_args : vflag,
+ link_depends : fwupdplugin_mapfile,
+- install : true
++ install : true,
++ install_dir : bindir / '..' / 'lib',
+ )
+
+ fwupdplugin_pkgg = import('pkgconfig')
+@@ -167,7 +168,8 @@
+ 'GUsb-1.0',
+ fwupd_gir[0],
+ ],
+- install : true
++ install : true,
++ install_dir_typelib : bindir / '..' / 'lib' / 'girepository-1.0',
+ )
+ gnome.generate_vapi('fwupdplugin',
+ sources : fwupd_gir[0],
+diff --git a/meson.build b/meson.build
+index b1a523d2..00125997 100644
+--- a/meson.build
++++ b/meson.build
+@@ -389,7 +389,7 @@
+ if host_machine.system() == 'windows'
+ plugin_dir = 'fwupd-plugins-3'
+ else
+- plugin_dir = join_paths(libdir, 'fwupd-plugins-3')
++ plugin_dir = join_paths(bindir, '..', 'lib', 'fwupd-plugins-3')
+ endif
+ conf.set_quoted('FWUPD_PLUGINDIR', plugin_dir)
+ endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch
new file mode 100644
index 000000000000..432056cbe7fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/fwupd/installed-tests-path.patch
@@ -0,0 +1,30 @@
+--- a/data/device-tests/hardware.py
++++ b/data/device-tests/hardware.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!@installedTestsPython@/bin/python3
+ # pylint: disable=wrong-import-position,too-many-locals,unused-argument,wrong-import-order
+ #
+ # Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
+--- a/data/installed-tests/meson.build
++++ b/data/installed-tests/meson.build
+@@ -1,4 +1,4 @@
+-installed_test_datadir = join_paths(datadir, 'installed-tests', 'fwupd')
++installed_test_datadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', 'fwupd')
+
+ con2 = configuration_data()
+ con2.set('installedtestsdir', installed_test_datadir)
+@@ -52,5 +52,5 @@ configure_file(
+ output : 'fwupd-tests.conf',
+ configuration : con2,
+ install: true,
+- install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
++ install_dir: join_paths(get_option('installed_test_prefix'), 'etc', 'fwupd', 'remotes.d'),
+ )
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,3 +1,4 @@
++option('installed_test_prefix', type: 'string', value: '', description: 'Prefix for installed tests')
+ option('build', type : 'combo', choices : ['all', 'standalone', 'library'], value : 'all', description : 'build type')
+ option('agent', type : 'boolean', value : true, description : 'enable the fwupd agent')
+ option('consolekit', type : 'boolean', value : true, description : 'enable ConsoleKit support')
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/intel2200BGFirmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/intel2200BGFirmware/default.nix
new file mode 100644
index 000000000000..c9b1d7c5f0a5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/intel2200BGFirmware/default.nix
@@ -0,0 +1,25 @@
+{ lib, fetchzip }:
+
+let version = "3.1"; in
+
+fetchzip {
+ name = "intel2200BGFirmware-${version}";
+ url = "https://src.fedoraproject.org/repo/pkgs/ipw2200-firmware/ipw2200-fw-${version}.tgz/eaba788643c7cc7483dd67ace70f6e99/ipw2200-fw-${version}.tgz";
+ sha256 = "0zjyjndyc401pn5x5lgypxdal21n82ymi3vbb2ja1b89yszj432b";
+
+ postFetch = ''
+ tar -xzvf $downloadedFile --strip-components=1
+ install -D -m644 ipw2200-bss.fw $out/lib/firmware/ipw2200-bss.fw
+ install -D -m644 ipw2200-ibss.fw $out/lib/firmware/ipw2200-ibss.fw
+ install -D -m644 ipw2200-sniffer.fw $out/lib/firmware/ipw2200-sniffer.fw
+ install -D -m644 LICENSE.ipw2200-fw $out/share/doc/intel2200BGFirmware/LICENSE
+ '';
+
+ meta = with lib; {
+ description = "Firmware for Intel 2200BG cards";
+ homepage = "http://ipw2200.sourceforge.net/firmware.php";
+ license = licenses.unfreeRedistributableFirmware;
+ maintainers = with maintainers; [ sternenseemann ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/openelec-dvb-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/openelec-dvb-firmware/default.nix
new file mode 100644
index 000000000000..ff0081a71e17
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/openelec-dvb-firmware/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "openelec-dvb-firmware";
+ version = "0.0.51";
+
+ src = fetchurl {
+ url = "https://github.com/OpenELEC/dvb-firmware/archive/${version}.tar.gz";
+ sha256 = "cef3ce537d213e020af794cecf9de207e2882c375ceda39102eb6fa2580bad8d";
+ };
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ DESTDIR="$out" ./install
+ find $out \( -name 'README.*' -or -name 'LICEN[SC]E.*' -or -name '*.txt' \) | xargs rm
+ '';
+
+ meta = with stdenv.lib; {
+ description = "DVB firmware from OpenELEC";
+ homepage = "https://github.com/OpenELEC/dvb-firmware";
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = platforms.linux;
+ priority = 7;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
new file mode 100644
index 000000000000..233386847649
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ pname = "raspberrypi-wireless-firmware";
+ version = "2019-08-16";
+
+ srcs = [
+ (fetchFromGitHub {
+ name = "bluez-firmware";
+ owner = "RPi-Distro";
+ repo = "bluez-firmware";
+ rev = "96eefffcccc725425fd83be5e0704a5c32b79e54";
+ sha256 = "05h57gcxhb2c84h99cyxxx4mzi6kd5fm8pjqkz3nq5vs3nv8cqhr";
+ })
+ (fetchFromGitHub {
+ name = "firmware-nonfree";
+ owner = "RPi-Distro";
+ repo = "firmware-nonfree";
+ rev = "130cb86fa30cafbd575d38865fa546350d4c5f9c";
+ sha256 = "0jmhgbpldzz8n8lncpzwfl5ym8zgss05y952rfpwcf9v5c7vgabx";
+ })
+ ];
+
+ sourceRoot = ".";
+
+ dontBuild = true;
+ # Firmware blobs do not need fixing and should not be modified
+ dontFixup = true;
+
+ installPhase = ''
+ mkdir -p "$out/lib/firmware/brcm"
+
+ # Wifi firmware
+ for filename in firmware-nonfree/brcm/brcmfmac434??-sdio.*; do
+ cp "$filename" "$out/lib/firmware/brcm"
+ done
+
+ # Bluetooth firmware
+ cp bluez-firmware/broadcom/*.hcd "$out/lib/firmware/brcm"
+ '';
+
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ outputHash = "1r4alf1fbj6vkkf54d0anm47ymb6gn2ykl4a2hhd34b0hnf1dnhn";
+
+ meta = with stdenv.lib; {
+ description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W";
+ homepage = "https://github.com/RPi-Distro/firmware-nonfree";
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ lopsided98 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/default.nix
new file mode 100644
index 000000000000..6036eff2d984
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "raspberrypi-firmware";
+ version = "1.20200902";
+
+ src = fetchFromGitHub {
+ owner = "raspberrypi";
+ repo = "firmware";
+ rev = version;
+ sha256 = "1dj5vyhz2ljka7hwhl6s14hd017fspix1xp7zbm7lzdyys9jb9ni";
+ };
+
+ installPhase = ''
+ mkdir -p $out/share/raspberrypi/boot
+ cp -R boot/* $out/share/raspberrypi/boot
+ '';
+
+ dontFixup = true;
+
+ meta = with stdenv.lib; {
+ description = "Firmware for the Raspberry Pi board";
+ homepage = "https://github.com/raspberrypi/firmware";
+ license = licenses.unfreeRedistributableFirmware; # See https://github.com/raspberrypi/firmware/blob/master/boot/LICENCE.broadcom
+ maintainers = with maintainers; [ dezgeg tavyc ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/tools.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/tools.nix
new file mode 100644
index 000000000000..6c4d49e4e240
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/raspberrypi/tools.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig }:
+
+stdenv.mkDerivation {
+ pname = "raspberrypi-tools";
+ version = "2020-05-28";
+
+ src = fetchFromGitHub {
+ owner = "raspberrypi";
+ repo = "userland";
+ rev = "f97b1af1b3e653f9da2c1a3643479bfd469e3b74";
+ sha256 = "1r7n05rv96hqjq0rn0qzchmfqs0j7vh3p8jalgh66s6l0vms5mwy";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+
+ preConfigure = ''
+ cmakeFlagsArray+=("-DVMCS_INSTALL_PREFIX=$out")
+ '' + stdenv.lib.optionalString stdenv.isAarch64 ''
+ cmakeFlagsArray+=("-DARM64=1")
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Userland tools for the Raspberry Pi board";
+ homepage = "https://github.com/raspberrypi/userland";
+ license = licenses.bsd3;
+ platforms = [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+ maintainers = with maintainers; [ dezgeg tavyc ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rt5677/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rt5677/default.nix
new file mode 100644
index 000000000000..af0c07d10596
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rt5677/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation {
+ name = "rt5677-firmware";
+
+ src = fetchgit {
+ url = "https://github.com/raphael/linux-samus";
+ rev = "995de6c2093797905fbcd79f1a3625dd3f50be37";
+ sha256 = "0a6lz9wadm47cmva136q6wd0lw03bmymf9ispnzb091a7skwacry";
+ };
+
+
+ installPhase = ''
+ mkdir -p $out/lib/firmware
+ cp ./firmware/rt5677_elf_vad $out/lib/firmware
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Firmware for Realtek rt5677 device";
+ license = licenses.unfreeRedistributableFirmware;
+ maintainers = [ maintainers.zohl ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix
new file mode 100644
index 000000000000..9b68a49266f5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub }:
+with stdenv.lib;
+stdenv.mkDerivation {
+ name = "rtl8192su-unstable-2016-10-05";
+
+ src = fetchFromGitHub {
+ owner = "chunkeey";
+ repo = "rtl8192su";
+ rev = "c00112c9a14133290fe30bd3b44e45196994cb1c";
+ sha256 = "0j3c35paapq1icmxq0mg7pm2xa2m69q7bkfmwgq99d682yr2cb5l";
+ };
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ for i in rtl8192sfw.bin \
+ rtl8192sufw-ap.bin \
+ rtl8192sufw-apple.bin \
+ rtl8192sufw-windows.bin \
+ rtl8712u-linux-firmware-bad.bin \
+ rtl8712u-most-recent-v2.6.6-bad.bin \
+ rtl8712u-most-recent-v2.6.6-bad.bin \
+ rtl8712u-oldest-but-good.bin;
+ do
+ install -D -pm644 firmwares/$i $out/lib/firmware/rtlwifi/$i
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Firmware for Realtek RTL8188SU/RTL8191SU/RTL8192SU";
+ homepage = "https://github.com/chunkeey/rtl8192su";
+ license = licenses.unfreeRedistributableFirmware;
+ maintainers = with maintainers; [ mic92 ];
+ platforms = with platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8723bs-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8723bs-firmware/default.nix
new file mode 100644
index 000000000000..f95d1efcef77
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtl8723bs-firmware/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, linuxPackages }:
+with stdenv.lib;
+stdenv.mkDerivation {
+ name = "rtl8723bs-firmware-${linuxPackages.rtl8723bs.version}";
+ inherit (linuxPackages.rtl8723bs) src;
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ mkdir -p "$out/lib/firmware/rtlwifi"
+ cp rtl8723bs_nic.bin "$out/lib/firmware/rtlwifi"
+ cp rtl8723bs_wowlan.bin "$out/lib/firmware/rtlwifi"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Firmware for RealTek 8723bs";
+ homepage = "https://github.com/hadess/rtl8723bs";
+ license = licenses.unfreeRedistributableFirmware;
+ maintainers = with maintainers; [ elitak ];
+ platforms = with platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtlwifi_new-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtlwifi_new-firmware/default.nix
new file mode 100644
index 000000000000..673ef686e488
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/rtlwifi_new-firmware/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, linuxPackages }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+ name = "rtlwifi_new-firmware-${linuxPackages.rtlwifi_new.version}";
+ inherit (linuxPackages.rtlwifi_new) src;
+
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir -p "$out/lib/firmware"
+ cp -rf firmware/rtlwifi/ "$out/lib/firmware"
+ '';
+
+ meta = {
+ description = "Firmware for the newest Realtek rtlwifi codes";
+ inherit (src.meta) homepage;
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = with platforms; linux;
+ maintainers = with maintainers; [ tvorog ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/sof-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/sof-firmware/default.nix
new file mode 100644
index 000000000000..a9fc44e48cc8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/sof-firmware/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ pname = "sof-firmware";
+ version = "1.5.1";
+
+ src = fetchFromGitHub {
+ owner = "thesofproject";
+ repo = "sof-bin";
+ rev = "ae61d2778b0a0f47461a52da0d1f191f651e0763";
+ sha256 = "0j6bpwz49skvdvian46valjw4anwlrnkq703n0snkbngmq78prba";
+ };
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/lib/firmware/intel
+
+ sed -i 's/ROOT=.*$/ROOT=$out/g' go.sh
+ sed -i 's/VERSION=.*$/VERSION=v${version}/g' go.sh
+
+ ./go.sh
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Sound Open Firmware";
+ homepage = "https://www.sofproject.org/";
+ license = with licenses; [ bsd3 isc ];
+ maintainers = with maintainers; [ lblasc evenbrenden ];
+ platforms = with platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix
new file mode 100644
index 000000000000..f19af3d10fc9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix
@@ -0,0 +1,39 @@
+{ rustPlatform, lib, fetchFromGitHub, lzma, pkgconfig, openssl, dbus, efibootmgr, makeWrapper }:
+rustPlatform.buildRustPackage rec {
+ pname = "system76-firmware";
+ # Check Makefile when updating, make sure postInstall matches make install
+ version = "1.0.18";
+
+ src = fetchFromGitHub {
+ owner = "pop-os";
+ repo = pname;
+ rev = version;
+ sha256 = "08y65ak3y08xcl1nprwraqv9l65yqnfllbgmxyd2bppjpprwq474";
+ };
+
+ nativeBuildInputs = [ pkgconfig makeWrapper ];
+
+ buildInputs = [ lzma openssl dbus ];
+
+ cargoBuildFlags = [ "--workspace" ];
+
+ cargoSha256 = "00933zkhqd1l29ir2dgp5r1k7g24mlb2k8fmggwzplrwzw1al5h4";
+
+ # Purposefully don't install systemd unit file, that's for NixOS
+ postInstall = ''
+ install -D -m -0644 data/system76-firmware-daemon.conf $out/etc/dbus-1/system.d/system76-firmware-daemon.conf
+
+ for bin in $out/bin/system76-firmware-*
+ do
+ wrapProgram $bin --prefix PATH : "${efibootmgr}/bin"
+ done
+ '';
+
+ meta = {
+ description = "Tools for managing firmware updates for system76 devices";
+ homepage = "https://github.com/pop-os/system76-firmware";
+ license = lib.licenses.gpl3;
+ maintainers = [ lib.maintainers.shlevy ];
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/zd1211/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/zd1211/default.nix
new file mode 100644
index 000000000000..d6963c8eb782
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/firmware/zd1211/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchzip }:
+
+let
+ pname = "zd1211-firmware";
+ version = "1.5";
+in fetchzip rec {
+ name = "${pname}-${version}";
+ url = "mirror://sourceforge/zd1211/${name}.tar.bz2";
+
+ postFetch = ''
+ tar -xjvf $downloadedFile
+ mkdir -p $out/lib/firmware/zd1211
+ cp zd1211-firmware/* $out/lib/firmware/zd1211
+ '';
+
+ sha256 = "0sj2zl3r0549mjz37xy6iilm1hm7ak5ax02gwrn81r5yvphqzd52";
+
+ meta = {
+ description = "Firmware for the ZyDAS ZD1211(b) 802.11a/b/g USB WLAN chip";
+ homepage = "https://sourceforge.net/projects/zd1211/";
+ license = "GPL";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/flashbench/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/flashbench/default.nix
new file mode 100644
index 000000000000..70ad779c239b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/flashbench/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation {
+ pname = "flashbench";
+ version = "2012-06-06";
+
+ src = fetchgit {
+ url = "https://github.com/bradfa/flashbench.git";
+ rev = "2e30b1968a66147412f21002ea844122a0d5e2f0";
+ sha256 = "037rhd2alwfip9qk78cy8fwwnc2kdyzccsyc7v2zpmvl4vvpvnhg";
+ };
+
+ installPhase = ''
+ install -d -m755 $out/bin $out/share/doc/flashbench
+ install -v -m755 flashbench $out/bin
+ install -v -m755 erase $out/bin/flashbench-erase
+ install -v -m644 README $out/share/doc/flashbench
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Testing tool for flash based memory devices";
+ homepage = "https://github.com/bradfa/flashbench";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ maintainers = [ maintainers.rycee ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fnotifystat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fnotifystat/default.nix
new file mode 100644
index 000000000000..f01c96259a80
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fnotifystat/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "fnotifystat";
+ version = "0.02.06";
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/fnotifystat/fnotifystat-${version}.tar.gz";
+ sha256 = "1mr2qzh8r8qq7haz4qgci2k5lcrcy493fm0m3ri40a81vaajfniy";
+ };
+ installFlags = [ "DESTDIR=$(out)" ];
+ postInstall = ''
+ mv $out/usr/* $out
+ rm -r $out/usr
+ '';
+ meta = with lib; {
+ description = "File activity monitoring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/fnotifystat/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ womfoo ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forkstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forkstat/default.nix
new file mode 100644
index 000000000000..d42091085baf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forkstat/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "forkstat";
+ version = "0.02.15";
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/forkstat/forkstat-${version}.tar.xz";
+ sha256 = "11dvg7bbklpfywx6i6vb29vvc28pbfk3mff0g18n5imxvzsd7jxs";
+ };
+ installFlags = [ "DESTDIR=$(out)" ];
+ postInstall = ''
+ mv $out/usr/* $out
+ rm -r $out/usr
+ '';
+ meta = with lib; {
+ description = "Process fork/exec/exit monitoring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/forkstat/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ womfoo ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.nix
new file mode 100644
index 000000000000..66570bac9428
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.nix
@@ -0,0 +1,36 @@
+{stdenv, fetchurl}:
+let
+ s = # Generated upstream information
+ rec {
+ baseName="forktty";
+ version="1.3";
+ name="${baseName}-${version}";
+ hash="0nd55zdqly6nl98k9lc7j751x86cw9hayx1qn0725f22r1x3j5zb";
+ url="http://sunsite.unc.edu/pub/linux/utils/terminal/forktty-1.3.tgz";
+ sha256="0nd55zdqly6nl98k9lc7j751x86cw9hayx1qn0725f22r1x3j5zb";
+ };
+ buildInputs = [
+ ];
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ inherit buildInputs;
+ src = fetchurl {
+ inherit (s) url sha256;
+ };
+ preBuild = ''
+ sed -e s@/usr/bin/ginstall@install@g -i Makefile
+ '';
+ preInstall = ''
+ mkdir -p "$out/bin"
+ mkdir -p "$out/share/man/man8"
+ '';
+ makeFlags = [ "prefix=$(out)" "manprefix=$(out)/share/" ];
+ meta = {
+ inherit (s) version;
+ description = ''Tool to detach from controlling TTY and attach to another'';
+ license = stdenv.lib.licenses.gpl2 ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.upstream b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.upstream
new file mode 100644
index 000000000000..45cb775a0ae3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/forktty/default.upstream
@@ -0,0 +1,2 @@
+url http://sunsite.unc.edu/pub/linux/utils/terminal/
+version_link 'forktty.*tgz'
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/freefall/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/freefall/default.nix
new file mode 100644
index 000000000000..a6c5a6593d1c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/freefall/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, kernel }:
+
+stdenv.mkDerivation {
+ inherit (kernel) version src;
+
+ pname = "freefall";
+
+ postPatch = ''
+ cd tools/laptop/freefall
+
+ # Default time-out is a little low, probably because the AC/lid status
+ # functions were never implemented. Because no-one still uses HDDs, right?
+ substituteInPlace freefall.c --replace "alarm(2)" "alarm(5)"
+ '';
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ meta = with stdenv.lib; {
+ inherit (kernel.meta) homepage license;
+
+ description = "Free-fall protection for spinning HP/Dell laptop hard drives";
+ longDescription = ''
+ Provides a shock protection facility in modern laptops with spinning hard
+ drives, by stopping all input/output operations on the internal hard drive
+ and parking its heads on the ramp when critical situations are anticipated.
+ Requires support for the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
+ feature, which should cause the drive to switch to idle mode and unload the
+ disk heads, and an accelerometer device. It has no effect on SSD devices!
+ '';
+
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscrypt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscrypt/default.nix
new file mode 100644
index 000000000000..000400e4cdf9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscrypt/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, buildGoModule, fetchFromGitHub, gnum4, pam, fscrypt-experimental }:
+
+# Don't use this for anything important yet!
+
+buildGoModule rec {
+ pname = "fscrypt";
+ version = "0.2.9";
+
+ src = fetchFromGitHub {
+ owner = "google";
+ repo = "fscrypt";
+ rev = "v${version}";
+ sha256 = "020hhdarbn3bwlc2j2g89868v8nfx8562z1a778ihpvvsa4ykr31";
+ };
+
+ postPatch = ''
+ substituteInPlace Makefile \
+ --replace 'TAG_VERSION := $(shell git describe --tags)' "" \
+ --replace "/usr/local" "$out"
+ '';
+
+ vendorSha256 = "0yak221mlyfacvlsaq9g3xiyk94n94vqgkbaji8d21pi8hhr38m6";
+
+ doCheck = false;
+
+ nativeBuildInputs = [ gnum4 ];
+ buildInputs = [ pam ];
+
+ buildPhase = ''
+ make
+ '';
+
+ installPhase = ''
+ make install
+ '';
+
+ meta = with stdenv.lib; {
+ description =
+ "A high-level tool for the management of Linux filesystem encryption";
+ longDescription = ''
+ This tool manages metadata, key generation, key wrapping, PAM integration,
+ and provides a uniform interface for creating and modifying encrypted
+ directories.
+ '';
+ inherit (src.meta) homepage;
+ changelog = "https://github.com/google/fscrypt/releases/tag/v${version}";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ primeos ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscryptctl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscryptctl/default.nix
new file mode 100644
index 000000000000..ecab0350d789
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fscryptctl/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub }:
+
+# Don't use this for anything important yet!
+
+stdenv.mkDerivation rec {
+ pname = "fscryptctl-unstable";
+ version = "2017-10-23";
+
+ goPackagePath = "github.com/google/fscrypt";
+
+ src = fetchFromGitHub {
+ owner = "google";
+ repo = "fscryptctl";
+ rev = "142326810eb19d6794793db6d24d0775a15aa8e5";
+ sha256 = "1853hlpklisbqnkb7a921dsf0vp2nr2im26zpmrs592cnpsvk3hb";
+ };
+
+ makeFlags = [ "DESTDIR=$(out)/bin" ];
+
+ meta = with stdenv.lib; {
+ description = ''
+ A low-level tool that handles raw keys and manages policies for Linux
+ filesystem encryption
+ '';
+ inherit (src.meta) homepage;
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ primeos ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix
new file mode 100644
index 000000000000..fc1a25633821
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, libv4l, gd }:
+
+stdenv.mkDerivation rec {
+ name = "fswebcam-20200725";
+
+ src = fetchurl {
+ url = "https://www.sanslogic.co.uk/fswebcam/files/${name}.tar.gz";
+ sha256 = "1dazsrcaw9s30zz3jpxamk9lkff5dkmflp1s0jjjvdbwa0k6k6ii";
+ };
+
+ buildInputs =
+ [ libv4l gd ];
+
+ meta = {
+ description = "Neat and simple webcam app";
+ homepage = "http://www.sanslogic.co.uk/fswebcam";
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/default.nix
new file mode 100644
index 000000000000..d7791cd1a629
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "ftop";
+ version = "1.0";
+
+ src = fetchurl {
+ url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ftop/${pname}-${version}.tar.bz2";
+ sha256 = "3a705f4f291384344cd32c3dd5f5f6a7cd7cea7624c83cb7e923966dbcd47f82";
+ };
+
+ buildInputs = [ ncurses ];
+
+ patches = [
+ ./ftop-fix_buffer_overflow.patch
+ ./ftop-fix_printf_format.patch
+ ];
+ patchFlags = [ "-p0" ];
+
+ postPatch = ''
+ substituteInPlace configure --replace "curses" "ncurses"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Show progress of open files and file systems";
+ homepage = "https://code.google.com/archive/p/ftop/";
+ license = licenses.gpl3Plus;
+ longDescription = ''
+ ftop is to files what top is to processes. The progress of all open files
+ and file systems can be monitored. If run as a regular user, the set of
+ open files will be limited to those in that user's processes (which is
+ generally all that is of interest to the user).
+ As with top, the items are displayed in order from most to least active.
+ '';
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_buffer_overflow.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_buffer_overflow.patch
new file mode 100644
index 000000000000..f10fa6a33b85
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_buffer_overflow.patch
@@ -0,0 +1,11 @@
+--- src/ftop.c.orig 2010-06-15 21:42:15.000000000 +0200
++++ src/ftop.c 2010-06-15 21:45:38.000000000 +0200
+@@ -935,7 +935,7 @@
+ {
+ if (bar_used > 0)
+ {
+- snprintf(rate_buf, bar_used + 1, "%s", tmp_buf);
++ snprintf(rate_buf, bar_used >= sizeof(rate_buf) ? sizeof(rate_buf) : bar_used + 1, "%s", tmp_buf);
+ p_attron(p, A_REVERSE);
+ p_printf(p, "%s", rate_buf);
+ if (bar_used > bytes)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_printf_format.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_printf_format.patch
new file mode 100644
index 000000000000..afb04306428a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ftop/ftop-fix_printf_format.patch
@@ -0,0 +1,20 @@
+--- src/ftop.c.orig 2010-06-15 23:14:50.000000000 +0200
++++ src/ftop.c 2010-06-15 23:15:52.000000000 +0200
+@@ -222,7 +222,7 @@
+ p_eol(p, part);
+
+ cols = snprintf(tmp_buf, sizeof(tmp_buf),
+- "Processes: %u total, %u unreadable",
++ "Processes: %zu total, %zu unreadable",
+ s->num_processes + s->num_unreadable_processes,
+ s->num_unreadable_processes);
+
+@@ -244,7 +244,7 @@
+ p_eol(p, part);
+
+ snprintf(tmp_buf, sizeof(tmp_buf),
+- "Open Files: %u regular, %u dir, %u chr, %u blk, %u pipe, %u sock, %u misc",
++ "Open Files: %zu regular, %zu dir, %zu chr, %zu blk, %zu pipe, %zu sock, %zu misc",
+ s->num_reg, s->num_dir, s->num_chr, s->num_blk, s->num_pipe,
+ s->num_sock, s->num_misc);
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/common.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/common.nix
new file mode 100644
index 000000000000..19c64106701e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/common.nix
@@ -0,0 +1,102 @@
+{ version, sha256Hash }:
+
+{ stdenv, fetchFromGitHub, fetchpatch
+, fusePackages, utillinux, gettext
+, meson, ninja, pkg-config
+, autoreconfHook
+, python3Packages, which
+}:
+
+let
+ isFuse3 = stdenv.lib.hasPrefix "3" version;
+in stdenv.mkDerivation rec {
+ pname = "fuse";
+ inherit version;
+
+ src = fetchFromGitHub {
+ owner = "libfuse";
+ repo = "libfuse";
+ rev = "${pname}-${version}";
+ sha256 = sha256Hash;
+ };
+
+ preAutoreconf = "touch config.rpath";
+
+ patches =
+ stdenv.lib.optional
+ (!isFuse3 && stdenv.isAarch64)
+ (fetchpatch {
+ url = "https://github.com/libfuse/libfuse/commit/914871b20a901e3e1e981c92bc42b1c93b7ab81b.patch";
+ sha256 = "1w4j6f1awjrycycpvmlv0x5v9gprllh4dnbjxl4dyl2jgbkaw6pa";
+ })
+ ++ (if isFuse3
+ then [ ./fuse3-install.patch ./fuse3-Do-not-set-FUSERMOUNT_DIR.patch ]
+ else [ ./fuse2-Do-not-set-FUSERMOUNT_DIR.patch ]);
+
+ nativeBuildInputs = if isFuse3
+ then [ meson ninja pkg-config ]
+ else [ autoreconfHook gettext ];
+
+ outputs = [ "out" ] ++ stdenv.lib.optional isFuse3 "common";
+
+ mesonFlags = stdenv.lib.optionals isFuse3 [
+ "-Dudevrulesdir=/udev/rules.d"
+ "-Duseroot=false"
+ ];
+
+ preConfigure = ''
+ export MOUNT_FUSE_PATH=$out/sbin
+ export INIT_D_PATH=$TMPDIR/etc/init.d
+ export UDEV_RULES_PATH=$out/etc/udev/rules.d
+
+ # Ensure that FUSE calls the setuid wrapper, not
+ # $out/bin/fusermount. It falls back to calling fusermount in
+ # $PATH, so it should also work on non-NixOS systems.
+ export NIX_CFLAGS_COMPILE="-DFUSERMOUNT_DIR=\"/run/wrappers/bin\""
+
+ sed -e 's@/bin/@${utillinux}/bin/@g' -i lib/mount_util.c
+ '' + (if isFuse3 then ''
+ # The configure phase will delete these files (temporary workaround for
+ # ./fuse3-install_man.patch)
+ install -D -m444 doc/fusermount3.1 $out/share/man/man1/fusermount3.1
+ install -D -m444 doc/mount.fuse3.8 $out/share/man/man8/mount.fuse3.8
+ '' else ''
+ sed -e 's@CONFIG_RPATH=/usr/share/gettext/config.rpath@CONFIG_RPATH=${gettext}/share/gettext/config.rpath@' -i makeconf.sh
+ ./makeconf.sh
+ '');
+
+ checkInputs = [ which ] ++ (with python3Packages; [ python pytest ]);
+
+ checkPhase = ''
+ python3 -m pytest test/
+ '';
+
+ doCheck = false; # v2: no tests, v3: all tests get skipped in a sandbox
+
+ postFixup = "cd $out\n" + (if isFuse3 then ''
+ install -D -m444 etc/fuse.conf $common/etc/fuse.conf
+ install -D -m444 etc/udev/rules.d/99-fuse3.rules $common/etc/udev/rules.d/99-fuse.rules
+ '' else ''
+ cp ${fusePackages.fuse_3.common}/etc/fuse.conf etc/fuse.conf
+ cp ${fusePackages.fuse_3.common}/etc/udev/rules.d/99-fuse.rules etc/udev/rules.d/99-fuse.rules
+ '');
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Library that allows filesystems to be implemented in user space";
+ longDescription = ''
+ FUSE (Filesystem in Userspace) is an interface for userspace programs to
+ export a filesystem to the Linux kernel. The FUSE project consists of two
+ components: The fuse kernel module (maintained in the regular kernel
+ repositories) and the libfuse userspace library (this package). libfuse
+ provides the reference implementation for communicating with the FUSE
+ kernel module.
+ '';
+ inherit (src.meta) homepage;
+ changelog = "https://github.com/libfuse/libfuse/releases/tag/fuse-${version}";
+ platforms = platforms.linux;
+ license = with licenses; [ gpl2 lgpl21 ];
+ maintainers = [ maintainers.primeos ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/default.nix
new file mode 100644
index 000000000000..7549f379f8a7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/default.nix
@@ -0,0 +1,17 @@
+{ callPackage, utillinux }:
+
+let
+ mkFuse = args: callPackage (import ./common.nix args) {
+ inherit utillinux;
+ };
+in {
+ fuse_2 = mkFuse {
+ version = "2.9.9";
+ sha256Hash = "1yxxvm58c30pc022nl1wlg8fljqpmwnchkywic3r74zirvlcq23n";
+ };
+
+ fuse_3 = mkFuse {
+ version = "3.10.0";
+ sha256Hash = "05ipzmlk6xci9v4sf0pap542b37aszghlchswl6s76fg6h3w4yms";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse2-Do-not-set-FUSERMOUNT_DIR.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse2-Do-not-set-FUSERMOUNT_DIR.patch
new file mode 100644
index 000000000000..8ff40f34f938
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse2-Do-not-set-FUSERMOUNT_DIR.patch
@@ -0,0 +1,11 @@
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -1,7 +1,7 @@
+ ## Process this file with automake to produce Makefile.in
+
+ AUTOMAKE_OPTIONS = subdir-objects
+-AM_CPPFLAGS = -I$(top_srcdir)/include -DFUSERMOUNT_DIR=\"$(bindir)\" \
++AM_CPPFLAGS = -I$(top_srcdir)/include \
+ -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DFUSE_USE_VERSION=26
+
+ lib_LTLIBRARIES = libfuse.la libulockmgr.la
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-Do-not-set-FUSERMOUNT_DIR.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-Do-not-set-FUSERMOUNT_DIR.patch
new file mode 100644
index 000000000000..903f30325df2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-Do-not-set-FUSERMOUNT_DIR.patch
@@ -0,0 +1,12 @@
+--- a/lib/meson.build
++++ b/lib/meson.build
+@@ -37,8 +37,7 @@ libfuse = library('fuse3', libfuse_sources, version: meson.project_version(),
+ soversion: '3', include_directories: include_dirs,
+ dependencies: deps, install: true,
+ link_depends: 'fuse_versionscript',
+- c_args: [ '-DFUSE_USE_VERSION=35',
+- '-DFUSERMOUNT_DIR="@0@"'.format(fusermount_path) ],
++ c_args: [ '-DFUSE_USE_VERSION=35' ],
+ link_args: ['-Wl,--version-script,' + meson.current_source_dir()
+ + '/fuse_versionscript' ])
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-install.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-install.patch
new file mode 100644
index 000000000000..147bcb439fb8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fuse/fuse3-install.patch
@@ -0,0 +1,25 @@
+--- a/util/install_helper.sh 2019-07-10 12:00:15.984840142 +0200
++++ b/util/install_helper.sh 2019-07-10 12:28:56.343011401 +0200
+@@ -37,10 +37,10 @@
+ fi
+
+ install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
+- "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
++ "${sysconfdir}${udevrulesdir}/99-fuse3.rules"
+
+ install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
+- "${DESTDIR}/etc/init.d/fuse3"
++ "${sysconfdir}/init.d/fuse3"
+
+
+ if test -x /usr/sbin/update-rc.d && test -z "${DESTDIR}"; then
+diff --git a/util/meson.build b/util/meson.build
+index aa0e734..06d4378 100644
+--- a/util/meson.build
++++ b/util/meson.build
+@@ -1,4 +1,4 @@
+-fuseconf_path = join_paths(get_option('prefix'), get_option('sysconfdir'), 'fuse.conf')
++fuseconf_path = join_paths('/', get_option('sysconfdir'), 'fuse.conf')
+
+ executable('fusermount3', ['fusermount.c', '../lib/mount_util.c'],
+ include_directories: include_dirs,
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/default.nix
new file mode 100644
index 000000000000..5de0eea0beac
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchzip, autoreconfHook, pkgconfig, glib, libtool, pcre
+, json_c, flex, bison, dtc, pciutils, dmidecode, iasl, libbsd }:
+
+stdenv.mkDerivation rec {
+ pname = "fwts";
+ version = "20.08.00";
+
+ src = fetchzip {
+ url = "http://fwts.ubuntu.com/release/${pname}-V${version}.tar.gz";
+ sha256 = "098vxj5sd2nm88jmj6cxzcvid8w81m8fxdz881iki0pi7ysixa5q";
+ stripRoot = false;
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig libtool ];
+ buildInputs = [ glib pcre json_c flex bison dtc pciutils dmidecode iasl libbsd ];
+
+ postPatch = ''
+ substituteInPlace src/lib/include/fwts_binpaths.h --replace "/usr/bin/lspci" "${pciutils}/bin/lspci"
+ substituteInPlace src/lib/include/fwts_binpaths.h --replace "/usr/sbin/dmidecode" "${dmidecode}/bin/dmidecode"
+ substituteInPlace src/lib/include/fwts_binpaths.h --replace "/usr/bin/iasl" "${iasl}/bin/iasl"
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ homepage = "https://wiki.ubuntu.com/FirmwareTestSuite";
+ description = "Firmware Test Suite";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ tadfisher ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/module.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/module.nix
new file mode 100644
index 000000000000..ef90e0c303ba
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fwts/module.nix
@@ -0,0 +1,31 @@
+{ stdenv, fwts, kernel }:
+
+stdenv.mkDerivation rec {
+ pname = "fwts-efi-runtime";
+ version = "${fwts.version}-${kernel.version}";
+
+ inherit (fwts) src;
+
+ sourceRoot = "source/efi_runtime";
+
+ postPatch = ''
+ substituteInPlace Makefile --replace \
+ '/lib/modules/$(KVER)/build' \
+ '${kernel.dev}/lib/modules/${kernel.modDirVersion}/build'
+ '';
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ makeFlags = [
+ "INSTALL_MOD_PATH=${placeholder "out"}"
+ ];
+
+ meta = with stdenv.lib; {
+ inherit (fwts.meta) homepage license;
+ description = fwts.meta.description + "(efi-runtime kernel module)";
+ maintainers = with maintainers; [ dtzWill ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fxload/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fxload/default.nix
new file mode 100644
index 000000000000..e77983254e43
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/fxload/default.nix
@@ -0,0 +1,36 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+ name = "fxload-2002_04_11";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/linux-hotplug/fxload-2002_04_11.tar.gz";
+ sha256 = "1hql93bp3dxrv1p67nc63xsbqwljyynm997ysldrc3n9ifi6s48m";
+ };
+
+ patches = [
+ # Will be needed after linux-headers is updated to >= 2.6.21.
+ (fetchurl {
+ url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/sys-apps/fxload/files/fxload-20020411-linux-headers-2.6.21.patch?rev=1.1";
+ sha256 = "0ij0c8nr1rbyl5wmyv1cklhkxglvsqz32h21cjw4bjm151kgmk7p";
+ })
+ ];
+
+ preBuild = ''
+ substituteInPlace Makefile --replace /usr /
+ makeFlagsArray=(INSTALL=install prefix=$out)
+ '';
+
+ preInstall = ''
+ mkdir -p $out/sbin
+ mkdir -p $out/share/man/man8
+ mkdir -p $out/share/usb
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://linux-hotplug.sourceforge.net/?selected=usb";
+ description = "Tool to upload firmware to Cypress EZ-USB microcontrollers";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/default.nix
new file mode 100644
index 000000000000..c670fc86d13b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/default.nix
@@ -0,0 +1,88 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, fetchurl
+, fetchpatch
+, patchelf
+, freetype
+, libusb-compat-0_1
+}:
+let
+ license = lib.licenses.gpl2;
+ maintainers = with lib.maintainers; [ peterhoeg ];
+
+ g15src = { pname, version, sha256 }: fetchurl {
+ url = "mirror://sourceforge/g15tools/${pname}/${version}/${pname}-${version}.tar.bz2";
+ inherit sha256;
+ };
+
+ libg15 = stdenv.mkDerivation rec {
+ pname = "libg15";
+ version = "1.2.7";
+
+ src = g15src {
+ inherit pname version;
+ sha256 = "1mkrf622n0cmz57lj8w9q82a9dcr1lmyyxbnrghrxzb6gvifnbqk";
+ };
+
+ buildInputs = [ libusb-compat-0_1 ];
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Provides low-level access to Logitech G11/G15 keyboards and Z10 speakers";
+ inherit license maintainers;
+ };
+ };
+
+ libg15render = stdenv.mkDerivation rec {
+ pname = "libg15render";
+ version = "1.2";
+
+ src = g15src {
+ inherit pname version;
+ sha256 = "03yjb78j1fnr2fwklxy54sdljwi0imvp29m8kmwl9v0pdapka8yj";
+ };
+
+ buildInputs = [ libg15 ];
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "A small graphics library optimised for drawing on an LCD";
+ inherit license maintainers;
+ };
+ };
+in
+stdenv.mkDerivation rec {
+ pname = "g15daemon";
+ version = "1.9.5.3";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/${pname}/G15Daemon%201.9x/${version}/${pname}-${version}.tar.bz2";
+ sha256 = "1613gsp5dgilwbshqxxhiyw73ksngnam7n1iw6yxdjkp9fyd2a3d";
+ };
+
+ patches = let
+ patch = fname: sha256: fetchurl rec {
+ url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/${pname}-${version}-${fname}.patch?h=packages/${pname}";
+ name = "${fname}.patch";
+ inherit sha256;
+ };
+ in
+ [
+ (patch "uinput" "1misfff7a1vg0qgfk3n25y7drnm86a4gq96iflpcwr5x3lw7q0h7")
+ (patch "config-write" "0jkrbqvzqrvxr14h5qi17cb4d32caq7vw9kzlz3qwpxdgxjrjvy2")
+ (patch "recv-oob-answer" "1f67iqpj5hcgpakagi7gbw1xviwhy5vizs546l9bfjimx8r2d29g")
+ ./pid_location.patch
+ ];
+
+ buildInputs = [ libg15 libg15render ];
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "A daemon that makes it possible to use the Logitech keyboard G-Buttons and draw on various Logitech LCDs";
+ inherit license maintainers;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/pid_location.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/pid_location.patch
new file mode 100644
index 000000000000..f88c4a809626
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/g15daemon/pid_location.patch
@@ -0,0 +1,25 @@
+diff --git a/g15daemon/main.c b/g15daemon/main.c
+index e674475..97b8242 100644
+--- a/g15daemon/main.c
++++ b/g15daemon/main.c
+@@ -574,7 +574,7 @@ exitnow:
+ g15daemon_quit_refresh();
+ uf_conf_write(lcdlist,"/etc/g15daemon.conf");
+ uf_conf_free(lcdlist);
+- unlink("/var/run/g15daemon.pid");
++ unlink("/run/g15daemon/g15daemon.pid");
+ }
+ return 0;
+ }
+diff --git a/g15daemon/utility_funcs.c b/g15daemon/utility_funcs.c
+index c93d164..2e9c679 100644
+--- a/g15daemon/utility_funcs.c
++++ b/g15daemon/utility_funcs.c
+@@ -48,7 +48,7 @@
+
+ extern unsigned int g15daemon_debug;
+ extern volatile int leaving;
+-#define G15DAEMON_PIDFILE "/var/run/g15daemon.pid"
++#define G15DAEMON_PIDFILE "/run/g15daemon/g15daemon.pid"
+
+ pthread_cond_t lcd_refresh = PTHREAD_COND_INITIALIZER;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gfxtablet/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gfxtablet/default.nix
new file mode 100644
index 000000000000..56fa4f1d7d68
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gfxtablet/default.nix
@@ -0,0 +1,33 @@
+{stdenv, fetchFromGitHub, linuxHeaders}:
+
+stdenv.mkDerivation rec {
+ version = "1.4";
+ pname = "gfxtablet-uinput-driver";
+
+ buildInputs = [
+ linuxHeaders
+ ];
+
+ src = fetchFromGitHub {
+ owner = "rfc2822";
+ repo = "GfxTablet";
+ rev = "android-app-${version}";
+ sha256 = "1i2m98yypfa9phshlmvjlgw7axfisxmldzrvnbzm5spvv5s4kvvb";
+ };
+
+ preBuild = ''cd driver-uinput'';
+
+ installPhase = ''
+ mkdir -p "$out/bin"
+ cp networktablet "$out/bin"
+ mkdir -p "$out/share/doc/gfxtablet/"
+ cp ../*.md "$out/share/doc/gfxtablet/"
+ '';
+
+ meta = {
+ description = ''Uinput driver for Android GfxTablet tablet-as-input-device app'';
+ license = stdenv.lib.licenses.mit ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gobi_loader/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gobi_loader/default.nix
new file mode 100644
index 000000000000..b8735354c2c6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gobi_loader/default.nix
@@ -0,0 +1,28 @@
+{ stdenv
+, fetchurl
+}:
+
+stdenv.mkDerivation rec {
+ pname = "gobi_loader";
+ version = "0.7";
+
+ src = fetchurl {
+ url = "https://www.codon.org.uk/~mjg59/gobi_loader/download/${pname}-${version}.tar.gz";
+ sha256 = "0jkmpqkiddpxrzl2s9s3kh64ha48m00nn53f82m1rphw8maw5gbq";
+ };
+
+ postPatch = ''
+ substituteInPlace 60-gobi.rules --replace "gobi_loader" "${placeholder "out"}/lib/udev/gobi_loader"
+ substituteInPlace 60-gobi.rules --replace "/lib/firmware" "/run/current-system/firmware"
+ '';
+
+ makeFlags = "prefix=${placeholder "out"}";
+
+ meta = with stdenv.lib; {
+ description = "Firmware loader for Qualcomm Gobi USB chipsets";
+ homepage = "https://www.codon.org.uk/~mjg59/gobi_loader/";
+ license = with licenses; [ gpl2 ];
+ maintainers = with maintainers; [ _0x4A6F ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/config-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/config-paths.patch
new file mode 100644
index 000000000000..88358038bc7e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/config-paths.patch
@@ -0,0 +1,39 @@
+diff -urN gogoc-1_2-RELEASE/gogoc-tsp/conf/gogoc.conf.in gogoc-1_2-RELEASE-fix/gogoc-tsp/conf/gogoc.conf.in
+--- gogoc-1_2-RELEASE/gogoc-tsp/conf/gogoc.conf.in 2009-11-20 17:53:12.000000000 +0100
++++ gogoc-1_2-RELEASE-fix/gogoc-tsp/conf/gogoc.conf.in 2012-02-25 15:16:12.758849219 +0100
+@@ -224,7 +224,7 @@
+ #
+ # broker_list=<file_name>
+ #
+-broker_list=tsp-broker-list.txt
++broker_list=/var/lib/gogoc/tsp-broker-list.txt
+
+ #
+ # Last Server Used File Name:
+@@ -234,7 +234,7 @@
+ #
+ # last_server=<file_name>
+ #
+-last_server=tsp-last-server.txt
++last_server=/var/lib/gogoc/tsp-last-server.txt
+
+ #
+ # Always Use Last Known Working Server:
+@@ -294,7 +294,7 @@
+ #
+ # log_filename=<file_name>
+ #
+-log_filename=gogoc.log
++log_filename=/var/log/gogoc.log
+
+ #
+ # Log File Rotation:
+@@ -313,7 +313,7 @@
+ #
+ # log_rotation=<yes|no>
+ #
+-log_rotation=yes
++log_rotation=no
+
+ #
+ # Log File Rotation Size:
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/default.nix
new file mode 100644
index 000000000000..d107f18c8da2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/default.nix
@@ -0,0 +1,44 @@
+{stdenv, fetchurl, openssl, nettools, iproute, sysctl}:
+
+let baseName = "gogoclient";
+ version = "1.2";
+in
+
+stdenv.mkDerivation rec {
+ name = "${baseName}-${version}";
+
+ src = fetchurl {
+ #url = "http://gogo6.com/downloads/gogoc-1_2-RELEASE.tar.gz";
+ url = "https://src.fedoraproject.org/repo/pkgs/gogoc/gogoc-1_2-RELEASE.tar.gz/41177ed683cf511cc206c7782c37baa9/gogoc-1_2-RELEASE.tar.gz";
+ sha256 = "a0ef45c0bd1fc9964dc8ac059b7d78c12674bf67ef641740554e166fa99a2f49";
+ };
+ patches = [./gcc46-include-fix.patch ./config-paths.patch ];
+ makeFlags = ["target=linux"];
+ installFlags = ["installdir=$(out)"];
+
+ hardeningDisable = [ "format" ];
+
+ buildInputs = [openssl];
+
+ preFixup = ''
+ mkdir -p $out/share/${name}
+ chmod 444 $out/bin/gogoc.conf
+ mv $out/bin/gogoc.conf $out/share/${name}/gogoc.conf.sample
+ rm $out/bin/gogoc.conf.sample
+
+ substituteInPlace "$out/template/linux.sh" \
+ --replace "/sbin/ifconfig" "${nettools}/bin/ifconfig" \
+ --replace "/sbin/route" "${nettools}/bin/route" \
+ --replace "/sbin/ip" "${iproute}/sbin/ip" \
+ --replace "/sbin/sysctl" "${sysctl}/bin/sysctl"
+ sed -i -e 's/^.*Exec \$route -A.*$/& metric 128/' $out/template/linux.sh
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://ipv6.ernet.in/Tunnel_broker";
+ description = "Client to connect to the Freenet6 IPv6 tunnel broker service";
+ maintainers = [ maintainers.bluescreen303 ];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/gcc46-include-fix.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/gcc46-include-fix.patch
new file mode 100644
index 000000000000..22ecad187d62
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gogoclient/gcc46-include-fix.patch
@@ -0,0 +1,22 @@
+diff -urN gogoc-1_2-RELEASE/gogoc-messaging/src/clientmsgsender.cc gogoc-1_2-RELEASE-fix/gogoc-messaging/src/clientmsgsender.cc
+--- gogoc-1_2-RELEASE/gogoc-messaging/src/clientmsgsender.cc 2009-11-20 17:34:55.000000000 +0100
++++ gogoc-1_2-RELEASE-fix/gogoc-messaging/src/clientmsgsender.cc 2012-02-25 15:06:20.764698284 +0100
+@@ -15,6 +15,7 @@
+ // **************************************************************************
+ #include <gogocmessaging/clientmsgsender.h>
+ #include <assert.h>
++#include <stddef.h>
+
+
+ namespace gogocmessaging
+diff -urN gogoc-1_2-RELEASE/gogoc-messaging/src/servermsgsender.cc gogoc-1_2-RELEASE-fix/gogoc-messaging/src/servermsgsender.cc
+--- gogoc-1_2-RELEASE/gogoc-messaging/src/servermsgsender.cc 2009-11-20 17:34:56.000000000 +0100
++++ gogoc-1_2-RELEASE-fix/gogoc-messaging/src/servermsgsender.cc 2012-02-25 15:06:36.722740288 +0100
+@@ -15,6 +15,7 @@
+ // **************************************************************************
+ #include <gogocmessaging/servermsgsender.h>
+ #include <assert.h>
++#include <stddef.h>
+
+
+ namespace gogocmessaging
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix
new file mode 100644
index 000000000000..ce90a1d432f7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, lib, fetchurl, autoreconfHook, pam, qrencode }:
+
+stdenv.mkDerivation rec {
+ pname = "google-authenticator-libpam";
+ version = "1.09";
+
+ src = fetchurl {
+ url = "https://github.com/google/google-authenticator-libpam/archive/${version}.tar.gz";
+ sha256 = "0dyhgizl2jcrnfn5sxipxawqrbr6qgjh7aggw8fz3hix861pj7db";
+ };
+
+ nativeBuildInputs = [ autoreconfHook ];
+ buildInputs = [ pam ];
+
+ preConfigure = ''
+ sed -i "s|libqrencode.so.4|${qrencode.out}/lib/libqrencode.so.4|" src/google-authenticator.c
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin $out/lib/security
+ cp ./.libs/pam_google_authenticator.so $out/lib/security
+ cp google-authenticator $out/bin
+ '';
+
+ meta = with lib; {
+ homepage = "https://github.com/google/google-authenticator-libpam";
+ description = "Two-step verification, with pam module";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ aneeshusa ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gpu-switch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gpu-switch/default.nix
new file mode 100644
index 000000000000..17452a5e2446
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gpu-switch/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ pname = "gpu-switch-unstable";
+ version = "2017-04-28";
+ src = fetchFromGitHub {
+ owner = "0xbb";
+ repo = "gpu-switch";
+ rev = "a365f56d435c8ef84c4dd2ab935ede4992359e31";
+ sha256 = "1jnh43nijkqd83h7piq7225ixziggyzaalabgissyxdyz6szcn0r";
+ };
+ installPhase = ''
+ mkdir -p $out/bin
+ cp gpu-switch $out/bin/
+ '';
+ meta = with lib; {
+ description = "Application that allows to switch between the graphic cards of dual-GPU MacBook Pro models";
+ homepage = "https://github.com/0xbb/gpu-switch";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.msiedlarek ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gradm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gradm/default.nix
new file mode 100644
index 000000000000..fee183c82599
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/gradm/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl
+, bison, flex
+, pam
+}:
+
+stdenv.mkDerivation rec {
+ pname = "gradm";
+ version = "3.1-201903191516";
+
+ src = fetchurl {
+ url = "http://grsecurity.net/stable/${pname}-${version}.tar.gz";
+ sha256 = "1wszqwaswcf08s9zbvnqzmmfdykyfcy16w8xjia20ypr7wwbd86k";
+ };
+
+ nativeBuildInputs = [ bison flex ];
+ buildInputs = [ pam ];
+
+ enableParallelBuilding = true;
+
+ makeFlags = [
+ "DESTDIR=$(out)"
+ "LEX=${flex}/bin/flex"
+ "MANDIR=/share/man"
+ "MKNOD=true"
+ ];
+
+ preBuild = ''
+ substituteInPlace Makefile \
+ --replace "/usr/bin/" "" \
+ --replace "/usr/include/security/pam_" "${pam}/include/security/pam_"
+
+ substituteInPlace gradm_defs.h \
+ --replace "/sbin/grlearn" "$out/bin/grlearn" \
+ --replace "/sbin/gradm" "$out/bin/gradm" \
+ --replace "/sbin/gradm_pam" "$out/bin/gradm_pam"
+
+ echo 'inherit-learn /nix/store' >>learn_config
+
+ mkdir -p "$out/etc/udev/rules.d"
+ '';
+
+ postInstall = ''rmdir $out/dev'';
+
+ meta = with stdenv.lib; {
+ description = "grsecurity RBAC administration and policy analysis utility";
+ homepage = "https://grsecurity.net";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ thoughtpolice joachifm ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/guvcview/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/guvcview/default.nix
new file mode 100644
index 000000000000..d780cade7865
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/guvcview/default.nix
@@ -0,0 +1,78 @@
+{ config
+, stdenv
+, fetchurl
+, intltool
+, pkgconfig
+, portaudio
+, SDL2
+, ffmpeg
+, udev
+, libusb1
+, libv4l
+, alsaLib
+, gsl
+, libpng
+, sfml
+, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
+, libpulseaudio ? null
+, useQt ? false
+, qtbase ? null
+, wrapQtAppsHook ? null
+# can be turned off if used as a library
+, useGtk ? true
+, gtk3 ? null
+, wrapGAppsHook ? null
+}:
+
+assert pulseaudioSupport -> libpulseaudio != null;
+
+stdenv.mkDerivation rec {
+ version = "2.0.6";
+ pname = "guvcview";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/guvcview/source/guvcview-src-${version}.tar.gz";
+ sha256 = "11byyfpkcik7wvf2qic77zjamfr2rhji97dpj1gy2fg1bvpiqf4m";
+ };
+
+ nativeBuildInputs = [
+ intltool
+ pkgconfig
+ ]
+ ++ stdenv.lib.optionals (useGtk) [ wrapGAppsHook ]
+ ++ stdenv.lib.optionals (useQt) [ wrapQtAppsHook ]
+ ;
+
+ buildInputs = [
+ SDL2
+ alsaLib
+ ffmpeg
+ libusb1
+ libv4l
+ portaudio
+ udev
+ gsl
+ libpng
+ sfml
+ ]
+ ++ stdenv.lib.optionals (pulseaudioSupport) [ libpulseaudio ]
+ ++ stdenv.lib.optionals (useGtk) [ gtk3 ]
+ ++ stdenv.lib.optionals (useQt) [
+ qtbase
+ ]
+ ;
+ configureFlags = [
+ "--enable-sfml"
+ ]
+ ++ stdenv.lib.optionals (useGtk) [ "--enable-gtk3" ]
+ ++ stdenv.lib.optionals (useQt) [ "--enable-qt5" ]
+ ;
+
+ meta = with stdenv.lib; {
+ description = "A simple interface for devices supported by the linux UVC driver";
+ homepage = "http://guvcview.sourceforge.net";
+ maintainers = [ maintainers.coconnor ];
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hal-flash/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hal-flash/default.nix
new file mode 100644
index 000000000000..c3463851fd3e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hal-flash/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, autoconf, automake, dbus, glib, libtool, pkgconfig, udisks2 }:
+
+stdenv.mkDerivation {
+ name = "hal-flash-0.3.3";
+
+ src = fetchurl {
+ url = "https://github.com/cshorler/hal-flash/archive/v0.3.3.tar.gz";
+ sha256 = "0dw9bx190mrh0dycw4rfvfmwwvh2sgypffr99nfnr36b38jrd6y6";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ autoconf automake dbus glib libtool udisks2 ];
+
+ preConfigure = "libtoolize && aclocal && autoconf && automake --add-missing";
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/cshorler/hal-flash";
+ description = "libhal stub library to satisfy the Flash Player DRM requirements";
+ longDescription =
+ ''
+ Stub library based loosely upon libhal.[ch] from the hal-0.5.14
+ package. Provides the minimum necessary functionality to enable
+ libflashplayer.so/libadobecp.so to play back DRM content.
+ '';
+ license = with licenses; [ afl21 gpl2 ];
+ maintainers = with maintainers; [ malyn ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix
new file mode 100644
index 000000000000..5e32e220b2f8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "hd-idle-1.05";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/hd-idle/${name}.tgz";
+ sha256 = "031sm996s0rhy3z91b9xvyimsj2yd2fhsww2al2hxda5s5wzxzjf";
+ };
+
+ prePatch = ''
+ substituteInPlace Makefile \
+ --replace "-g root -o root" ""
+ '';
+
+ installFlags = [ "TARGET_DIR=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "Spins down external disks after a period of idle time";
+ homepage = "http://hd-idle.sourceforge.net/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.rycee ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/default.nix
new file mode 100644
index 000000000000..893eb4fdd999
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+let version = "20141203"; in
+stdenv.mkDerivation {
+ name = "hdapsd-"+version;
+
+ src = fetchurl {
+ url = "https://github.com/evgeni/hdapsd/releases/download/${version}/hdapsd-${version}.tar.gz";
+ sha256 = "0ppgrfabd0ivx9hyny3c3rv4rphjyxcdsd5svx5pgfai49mxnl36";
+ };
+
+ postInstall = builtins.readFile ./postInstall.sh;
+
+ meta = with stdenv.lib;
+ { description = "Hard Drive Active Protection System Daemon";
+ homepage = "http://hdaps.sf.net/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.ehmry ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/postInstall.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/postInstall.sh
new file mode 100644
index 000000000000..37867817bf63
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdapsd/postInstall.sh
@@ -0,0 +1,7 @@
+mkdir -p $out/lib/udev/rules.d $out/lib/systemd/system
+cp misc/hdapsd.rules $out/lib/udev/rules.d
+SBIN_REWRITE="s|@sbindir@|$out/bin|g"
+for i in misc/*.service.in
+do sed $SBIN_REWRITE "$i" > "$out/lib/systemd/system/$(basename ${i%.in})"
+done
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdparm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdparm/default.nix
new file mode 100644
index 000000000000..99464b67db1e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hdparm/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "hdparm-9.58";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/hdparm/${name}.tar.gz";
+ sha256 = "03z1qm8zbgpxagk3994lvp24yqsshjibkwg05v9p3q1w7y48xrws";
+
+ };
+
+ preBuild = ''
+ makeFlagsArray=(sbindir=$out/sbin manprefix=$out)
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A tool to get/set ATA/SATA drive parameters under Linux";
+ homepage = "https://sourceforge.net/projects/hdparm/";
+ platforms = platforms.linux;
+ license = licenses.bsd2;
+ maintainers = [ ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/health-check/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/health-check/default.nix
new file mode 100644
index 000000000000..694d4565d969
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/health-check/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fetchurl, json_c, libbsd }:
+
+stdenv.mkDerivation rec {
+ pname = "health-check";
+ version = "0.03.05";
+
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/${pname}/${pname}-${version}.tar.gz";
+ sha256 = "1qxmkdl4pa043yg4kq5ffapm0c2cmm64h3v2c3xhnx0ad5pbhy5z";
+ };
+
+ buildInputs = [ json_c libbsd ];
+
+ makeFlags = [ "JSON_OUTPUT=y" "FNOTIFY=y" ];
+
+ installFlags = [
+ "BINDIR=${placeholder "out"}/bin"
+ "MANDIR=${placeholder "out"}/share/man/man8"
+ ];
+
+ meta = with lib; {
+ description = "Process monitoring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/health-check/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ dtzWill ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/default.nix
new file mode 100644
index 000000000000..8fc6bfdbdcf3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, gawk }:
+
+let version = "2.0";
+in
+ stdenv.mkDerivation {
+ pname = "hibernate";
+ inherit version;
+ src = fetchurl {
+ url = "http://tuxonice.nigelcunningham.com.au/files/hibernate-script-${version}.tar.gz";
+ sha256 = "0ib5bac3spbcwmhf8f9apjbll8x7fgqj4k1s5q3srijh793rfifh";
+ };
+
+ patches = [ ./install.patch ./gen-manpages.patch ./hibernate.patch ];
+
+ buildInputs = [ gawk ];
+
+ installPhase = ''
+ # FIXME: Storing config files under `$out/etc' is not very useful.
+
+ substituteInPlace "hibernate.sh" --replace \
+ 'SWSUSP_D="/etc/hibernate"' "SWSUSP_D=\"$out/etc/hibernate\""
+
+ # Remove all references to `/bin' and `/sbin'.
+ for i in scriptlets.d/*
+ do
+ substituteInPlace "$i" --replace "/bin/" "" --replace "/sbin/" ""
+ done
+
+ PREFIX="$out" CONFIG_PREFIX="$out" ./install.sh
+
+ ln -s "$out/share/hibernate/scriptlets.d" "$out/etc/hibernate"
+ '';
+
+ meta = {
+ description = "The `hibernate' script for swsusp and Tux-on-Ice";
+ longDescription = ''
+ This package provides the `hibernate' script, a command-line utility
+ that saves the computer's state to disk and switches it off, turning
+ it into "hibernation". It works both with Linux swsusp and Tux-on-Ice.
+ '';
+
+ license = stdenv.lib.licenses.gpl2Plus;
+ homepage = "http://www.tuxonice.net/";
+ platforms = stdenv.lib.platforms.linux;
+ };
+ }
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/gen-manpages.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/gen-manpages.patch
new file mode 100644
index 000000000000..cdbacc86bafa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/gen-manpages.patch
@@ -0,0 +1,11 @@
+--- hibernate-script-1.98.1/gen-manpages.sh 2008-03-31 09:40:29.000000000 +0200
++++ hibernate-script-1.98.1/gen-manpages.sh 2008-04-01 15:58:11.000000000 +0200
+@@ -254,7 +254,7 @@ BEGIN {
+ }
+
+ # Create a copy of hibernate.sh with only the help items
+-TMPF=`mktemp /tmp/tmp.hibernate.XXXXXX`
++TMPF=`mktemp "$TMPDIR/tmp.hibernate.XXXXXX"`
+ awk '{
+ if ((substr($0, 1, 1) != "#") && (match($0, "AddConfigHelp") || match($0, "AddOptionHelp")) && (match($0, "\\(\\)") == 0)) {
+ print $0;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/hibernate.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/hibernate.patch
new file mode 100644
index 000000000000..24de1637d3ce
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/hibernate.patch
@@ -0,0 +1,37 @@
+--- hibernate-script-1.98.1/hibernate.sh 2008-03-31 09:40:29.000000000 +0200
++++ hibernate-script-1.98.1/hibernate.sh 2008-04-01 18:24:23.000000000 +0200
+@@ -224,7 +224,7 @@ FindXServer() {
+
+ xauth="`get_env_var_of_process $xpid XAUTHORITY`"
+ xhome="`get_env_var_of_process $xpid HOME`"
+- xuser=`/bin/ls -ld /proc/$xpid/ | awk '{print $3}'`
++ xuser=`ls -ld /proc/$xpid/ | awk '{print $3}'`
+ [ -z $xauth ] && [ -n $xhome ] && [ -f $xhome/.Xauthority ] && xauth=$xhome/.Xauthority
+
+ [ -z $xauth ] && continue
+@@ -273,14 +273,14 @@ UsingSuspendMethod() {
+ # chain.
+ SortSuspendBits() {
+ # explicit path required to be ash compatible.
+- /bin/echo -ne "$SUSPEND_BITS" | sort -n
++ echo -ne "$SUSPEND_BITS" | sort -n
+ }
+
+ # SortResumeBits: Returns a list of functions registered in the correct order
+ # to call for resuming, prefixed by their position number.
+ SortResumeBits() {
+ # explicit path required to be ash compatible.
+- /bin/echo -ne "$RESUME_BITS" | sort -rn
++ echo -ne "$RESUME_BITS" | sort -rn
+ }
+
+ # WrapHelpText: takes text from stdin, wraps it with an indent of 5 and width
+@@ -557,7 +557,7 @@ LoadScriptlets() {
+ CURRENT_SOURCED_SCRIPTLET=""
+ for scriptlet_dir in $SCRIPTLET_PATH ; do
+ [ -d "$scriptlet_dir" ] || continue
+- [ -z "`/bin/ls -1 $scriptlet_dir`" ] && continue
++ [ -z "`ls -1 $scriptlet_dir`" ] && continue
+ for scriptlet in $scriptlet_dir/* ; do
+ # Avoid editor backup files.
+ case "$scriptlet" in *~|*.bak) continue ;; esac
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/install.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/install.patch
new file mode 100644
index 000000000000..ae296b955ac8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hibernate/install.patch
@@ -0,0 +1,11 @@
+--- hibernate-script-1.98.1/install.sh 2008-03-31 09:40:29.000000000 +0200
++++ hibernate-script-1.98.1/install.sh 2008-04-01 15:50:46.000000000 +0200
+@@ -63,7 +63,7 @@ fi
+ cp -a blacklisted-modules $BLACKLIST
+
+ # Test if they have anything in there, and warn them
+-if /bin/ls $OLD_SCRIPTLET_DIR/* > /dev/null 2>&1 ; then
++if ls $OLD_SCRIPTLET_DIR/* > /dev/null 2>&1 ; then
+ echo " **"
+ echo " ** You have scriptlets already installed in $OLD_SCRIPTLET_DIR"
+ echo " ** Since version 0.95, these have moved to $SCRIPTLET_DIR."
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hostapd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hostapd/default.nix
new file mode 100644
index 000000000000..991dcbe26152
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hostapd/default.nix
@@ -0,0 +1,105 @@
+{ stdenv, fetchurl, pkgconfig, libnl, openssl, sqlite ? null }:
+
+stdenv.mkDerivation rec {
+ pname = "hostapd";
+ version = "2.9";
+
+ src = fetchurl {
+ url = "https://w1.fi/releases/${pname}-${version}.tar.gz";
+ sha256 = "1mrbvg4v7vm7mknf0n29mf88k3s4a4qj6r4d51wq8hmjj1m7s7c8";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ libnl openssl sqlite ];
+
+ patches = [
+ (fetchurl {
+ # Note: fetchurl seems to be unhappy with openwrt git
+ # server's URLs containing semicolons. Using the github mirror instead.
+ url = "https://raw.githubusercontent.com/openwrt/openwrt/master/package/network/services/hostapd/patches/300-noscan.patch";
+ sha256 = "04wg4yjc19wmwk6gia067z99gzzk9jacnwxh5wyia7k5wg71yj5k";
+ })
+ # AP mode PMF disconnection protection bypass (CVE.2019-16275), can be removed >= 2.10
+ # https://w1.fi/security/2019-7/
+ (fetchurl {
+ name = "CVE-2019-16275.patch";
+ url = "https://w1.fi/security/2019-7/0001-AP-Silently-ignore-management-frame-from-unexpected-.patch";
+ sha256 = "15xjyy7crb557wxpx898b5lnyblxghlij0xby5lmj9hpwwss34dz";
+ })
+ # Fixes for UPnP SUBSCRIBE misbehavior in hostapd WPS AP (CVE-2020-12695), can be removed >= 2.10
+ # https://w1.fi/security/2020-1/
+ (fetchurl {
+ name = "CVE-2020-12695_0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch";
+ url = "https://w1.fi/security/2020-1/0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch";
+ sha256 = "1mrbhicqb34jlw1nid5hk2vnjbvfhvp7r5iblaj4l6vgc6fmp6id";
+ })
+ (fetchurl {
+ name = "CVE-2020-12695_0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch";
+ url = "https://w1.fi/security/2020-1/0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch";
+ sha256 = "1pk08b06b24is50bis3rr56xjd3b5kxdcdk8bx39n9vna9db7zj9";
+ })
+ (fetchurl {
+ name = "CVE-2020-12695_0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch";
+ url = "https://w1.fi/security/2020-1/0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch";
+ sha256 = "12npqp2skgrj934wwkqicgqksma0fxz09di29n1b5fm5i4njl8d8";
+ })
+ ];
+
+ outputs = [ "out" "man" ];
+
+ extraConfig = ''
+ CONFIG_DRIVER_WIRED=y
+ CONFIG_LIBNL32=y
+ CONFIG_EAP_SIM=y
+ CONFIG_EAP_AKA=y
+ CONFIG_EAP_AKA_PRIME=y
+ CONFIG_EAP_PAX=y
+ CONFIG_EAP_PWD=y
+ CONFIG_EAP_SAKE=y
+ CONFIG_EAP_GPSK=y
+ CONFIG_EAP_GPSK_SHA256=y
+ CONFIG_EAP_FAST=y
+ CONFIG_EAP_IKEV2=y
+ CONFIG_EAP_TNC=y
+ CONFIG_EAP_EKE=y
+ CONFIG_RADIUS_SERVER=y
+ CONFIG_IEEE80211R=y
+ CONFIG_IEEE80211N=y
+ CONFIG_IEEE80211AC=y
+ CONFIG_FULL_DYNAMIC_VLAN=y
+ CONFIG_VLAN_NETLINK=y
+ CONFIG_TLS=openssl
+ CONFIG_TLSV11=y
+ CONFIG_TLSV12=y
+ CONFIG_INTERNETWORKING=y
+ CONFIG_HS20=y
+ CONFIG_ACS=y
+ CONFIG_GETRANDOM=y
+ '' + stdenv.lib.optionalString (sqlite != null) ''
+ CONFIG_SQLITE=y
+ '';
+
+ configurePhase = ''
+ cd hostapd
+ cp -v defconfig .config
+ echo "$extraConfig" >> .config
+ cat -n .config
+ substituteInPlace Makefile --replace /usr/local $out
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libnl-3.0)"
+ '';
+
+ preInstall = "mkdir -p $out/bin";
+ postInstall = ''
+ install -vD hostapd.8 -t $man/share/man/man8
+ install -vD hostapd_cli.1 -t $man/share/man/man1
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://hostap.epitest.fi";
+ repositories.git = "git://w1.fi/hostap.git";
+ description = "A user space daemon for access point and authentication servers";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ phreedom ninjatrappeur hexa ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hwdata/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hwdata/default.nix
new file mode 100644
index 000000000000..9b54f404f72e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hwdata/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "hwdata";
+ version = "0.335";
+
+ src = fetchFromGitHub {
+ owner = "vcrhonek";
+ repo = "hwdata";
+ rev = "v${version}";
+ sha256 = "0f8ikwfrs6xd5sywypd9rq9cln8a0rf3vj6nm0adwzn1p8mgmrb2";
+ };
+
+ preConfigure = "patchShebangs ./configure";
+
+ configureFlags = [ "--datadir=${placeholder "out"}/share" ];
+
+ doCheck = false; # this does build machine-specific checks (e.g. enumerates PCI bus)
+
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ outputHash = "101lppd1805drwd038b4njr5czzjnqqxf3xlf6v3l22wfwr2cn3l";
+
+ meta = {
+ homepage = "https://github.com/vcrhonek/hwdata";
+ description = "Hardware Database, including Monitors, pci.ids, usb.ids, and video cards";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hyperv-daemons/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hyperv-daemons/default.nix
new file mode 100644
index 000000000000..1a111a295a42
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/hyperv-daemons/default.nix
@@ -0,0 +1,114 @@
+{ stdenv, lib, python, kernel, makeWrapper, writeText
+, gawk, iproute }:
+
+let
+ libexec = "libexec/hypervkvpd";
+
+ daemons = stdenv.mkDerivation rec {
+ pname = "hyperv-daemons-bin";
+ inherit (kernel) src version;
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ # as of 4.9 compilation will fail due to -Werror=format-security
+ hardeningDisable = [ "format" ];
+
+ postPatch = ''
+ cd tools/hv
+ substituteInPlace hv_kvp_daemon.c \
+ --replace /usr/libexec/hypervkvpd/ $out/${libexec}/
+ '';
+
+ # We don't actually need the hv_get_{dhcp,dns}_info scripts on NixOS in
+ # their current incarnation but with them in place, we stop the spam of
+ # errors in the log.
+ installPhase = ''
+ runHook preInstall
+
+ for f in fcopy kvp vss ; do
+ install -Dm755 hv_''${f}_daemon -t $out/bin
+ done
+
+ install -Dm755 lsvmbus $out/bin/lsvmbus
+ install -Dm755 hv_get_dhcp_info.sh $out/${libexec}/hv_get_dhcp_info
+ install -Dm755 hv_get_dns_info.sh $out/${libexec}/hv_get_dns_info
+
+ # I don't know why this isn't being handled automatically by fixupPhase
+ substituteInPlace $out/bin/lsvmbus \
+ --replace '/usr/bin/env python' ${python.interpreter}
+
+ runHook postInstall
+ '';
+
+ postFixup = ''
+ wrapProgram $out/bin/hv_kvp_daemon \
+ --prefix PATH : $out/bin:${lib.makeBinPath [ gawk iproute ]}
+ '';
+ };
+
+ service = bin: title: check:
+ writeText "hv-${bin}.service" ''
+ [Unit]
+ Description=Hyper-V ${title} daemon
+ ConditionVirtualization=microsoft
+ ${lib.optionalString (check != "") ''
+ ConditionPathExists=/dev/vmbus/${check}
+ ''}
+ [Service]
+ ExecStart=@out@/hv_${bin}_daemon -n
+ Restart=on-failure
+ PrivateTmp=true
+ Slice=hyperv.slice
+
+ [Install]
+ WantedBy=hyperv-daemons.target
+ '';
+
+in stdenv.mkDerivation {
+ pname = "hyperv-daemons";
+ inherit (kernel) version;
+
+ # we just stick the bins into out as well as it requires "out"
+ outputs = [ "bin" "lib" "out" ];
+
+ buildInputs = [ daemons ];
+
+ buildCommand = ''
+ system=$lib/lib/systemd/system
+
+ install -Dm444 ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service
+ install -Dm444 ${service "kvp" "key-value pair (KVP)" "" } $system/hv-kvp.service
+ install -Dm444 ${service "vss" "volume shadow copy (VSS)" "" } $system/hv-vss.service
+
+ cat > $system/hyperv-daemons.target <<EOF
+ [Unit]
+ Description=Hyper-V Daemons
+ Wants=hv-fcopy.service hv-kvp.service hv-vss.service
+ EOF
+
+ for f in $lib/lib/systemd/system/* ; do
+ substituteInPlace $f --replace @out@ ${daemons}/bin
+ done
+
+ # we need to do both $out and $bin as $out is required
+ for d in $out/bin $bin/bin ; do
+ # make user binaries available
+ mkdir -p $d
+ ln -s ${daemons}/bin/lsvmbus $d/lsvmbus
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Integration Services for running NixOS under HyperV";
+ longDescription = ''
+ This packages contains the daemons that are used by the Hyper-V hypervisor
+ on the host.
+
+ Microsoft calls their guest agents "Integration Services" which is why
+ we use that name here.
+ '';
+ homepage = "https://kernel.org";
+ maintainers = with maintainers; [ peterhoeg ];
+ platforms = kernel.meta.platforms;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i2c-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i2c-tools/default.nix
new file mode 100644
index 000000000000..3a00dbefa635
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i2c-tools/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, perl, read-edid }:
+
+stdenv.mkDerivation rec {
+ pname = "i2c-tools";
+ version = "4.1";
+
+ src = fetchurl {
+ url = "https://www.kernel.org/pub/software/utils/i2c-tools/${pname}-${version}.tar.xz";
+ sha256 = "1m97hpwqfaqjl9xvr4pvz2vdrsdvxbcn0nnx8pamnyc3s7pikcjp";
+ };
+
+ buildInputs = [ perl ];
+
+ postPatch = ''
+ substituteInPlace eeprom/decode-edid --replace "/usr/sbin/parse-edid" "${read-edid}/bin/parse-edid"
+ substituteInPlace stub/i2c-stub-from-dump --replace "/sbin/" ""
+ '';
+
+ makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+ postInstall = ''
+ rm -rf $out/include # Installs include/linux/i2c-dev.h that conflics with kernel headers
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Set of I2C tools for Linux";
+ homepage = "https://i2c.wiki.kernel.org/index.php/I2C_Tools";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.dezgeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/default.nix
new file mode 100644
index 000000000000..2e00e9eedc3b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, ncurses
+, withGui ? false, qtbase }:
+
+stdenv.mkDerivation rec {
+ pname = "i7z";
+ version = "0.27.3";
+
+ src = fetchFromGitHub {
+ owner = "DimitryAndric";
+ repo = "i7z";
+ rev = "v${version}";
+ sha256 = "0l8wz0ffb27nkwchc606js652spk8masy3kjmzh7ygipwsary5ds";
+ };
+
+ buildInputs = [ ncurses ] ++ lib.optional withGui qtbase;
+
+ patches = [
+ (fetchpatch {
+ url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/fix-insecure-tempfile.patch";
+ sha256 = "0ifg06xjw14y4fnzzgkhqm4sv9mcdzgi8m2wffq9z8b1r0znya3s";
+ })
+ (fetchpatch {
+ url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/nehalem.patch";
+ sha256 = "1ys6sgm01jkqb6d4y7qc3h89dzph8jjjcfya5c5jcm7dkxlzjq8a";
+ })
+ (fetchpatch {
+ url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/hyphen-used-as-minus-sign.patch";
+ sha256 = "1ji2qvdyq0594cpqz0dlsfggvw3rm63sygh0jxvwjgxpnhykhg1p";
+ })
+ ./qt5.patch
+ ];
+
+ enableParallelBuilding = true;
+
+ postBuild = lib.optionalString withGui ''
+ cd GUI
+ qmake
+ make clean
+ make
+ cd ..
+ '';
+
+ makeFlags = [ "prefix=${placeholder "out"}" ];
+
+ postInstall = lib.optionalString withGui ''
+ install -Dm755 GUI/i7z_GUI $out/bin/i7z-gui
+ '';
+
+ meta = with lib; {
+ description = "A better i7 (and now i3, i5) reporting tool for Linux";
+ homepage = "https://github.com/DimitryAndric/i7z";
+ repositories.git = "https://github.com/DimitryAndric/i7z.git";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ bluescreen303 ];
+ # broken on ARM
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/qt5.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/qt5.patch
new file mode 100644
index 000000000000..9e9b162d9e85
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i7z/qt5.patch
@@ -0,0 +1,13 @@
+diff -Naur a/GUI/i7z_GUI.pro b/GUI/i7z_GUI.pro
+--- a/GUI/i7z_GUI.pro 2013-10-12 21:59:19.000000000 +0100
++++ b/GUI/i7z_GUI.pro 2016-11-05 13:54:30.118655672 +0000
+@@ -3,7 +3,8 @@
+ ######################################################################
+
+ TEMPLATE = app
+-TARGET =
++TARGET = i7z_GUI
++QT += widgets
+ DEPENDPATH += .
+ INCLUDEPATH += .
+ CONFIG += debug
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i810switch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i810switch/default.nix
new file mode 100644
index 000000000000..5b65f2a16fdd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/i810switch/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, pciutils }:
+
+stdenv.mkDerivation {
+ name = "i810switch-0.6.5";
+
+ phases = "unpackPhase installPhase";
+
+ installPhase = "
+ sed -i -e 's+/usr++' Makefile
+ sed -i -e 's+^\\(.*putenv(\"PATH=\\).*$+\\1${pciutils}/sbin\");+' i810switch.c
+ make clean
+ make install DESTDIR=\${out}
+ ";
+
+ src = fetchurl {
+ url = "http://www16.plala.or.jp/mano-a-mano/i810switch/i810switch-0.6.5.tar.gz";
+ sha256 = "d714840e3b14e1fa9c432c4be0044b7c008d904dece0d611554655b979cad4c3";
+ };
+
+ meta = {
+ description = "A utility for switching between the LCD and external VGA display on Intel graphics cards";
+ homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifenslave/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifenslave/default.nix
new file mode 100644
index 000000000000..1b22c1eafd3b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifenslave/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "ifenslave";
+ version = "1.1.0";
+
+ src = fetchurl {
+ url = "mirror://debian/pool/main/i/ifenslave-2.6/ifenslave-2.6_${version}.orig.tar.gz";
+ sha256 = "0h9hrmy19zdksl7ys250r158b943ihbgkb95n8p4k8l0vqsby5vr";
+ };
+
+ buildPhase = ''
+ gcc -o ifenslave ifenslave.c
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp -a ifenslave $out/bin
+ '';
+
+ hardeningDisable = [ "format" ];
+
+ meta = {
+ description = "Utility for enslaving networking interfaces under a bond";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifmetric/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifmetric/default.nix
new file mode 100644
index 000000000000..1f69d728f604
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ifmetric/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, lynx }:
+
+stdenv.mkDerivation rec {
+ pname = "ifmetric";
+ version = "0.3";
+
+ src = fetchurl {
+ url = "http://0pointer.de/lennart/projects/${pname}/${pname}-${version}.tar.gz";
+ sha256 = "1v0s5x81jzwnnl7hr254d4nkyc8qcv983pzr6vqmbr9l9q553a0g";
+ };
+
+ buildInputs = [ lynx ];
+
+ patches = [
+ # Fixes an issue related to the netlink API.
+ # Upstream is largely inactive; this is a Debian patch.
+ (fetchurl {
+ url = "https://launchpadlibrarian.net/85974387/10_netlink_fix.patch";
+ sha256 = "1pnlcr0qvk0bd5243wpg14i387zp978f4xhwwkcqn1cir91x7fbc";
+ })
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Tool for setting IP interface metrics";
+ longDescription = ''
+ ifmetric is a Linux tool for setting the metrics of all IPv4 routes
+ attached to a given network interface at once. This may be used to change
+ the priority of routing IPv4 traffic over the interface. Lower metrics
+ correlate with higher priorities.
+ '';
+ homepage = "http://0pointer.de/lennart/projects/ifmetric";
+ license = licenses.gpl2Plus;
+ maintainers = [ maintainers.anna328p ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iio-sensor-proxy/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iio-sensor-proxy/default.nix
new file mode 100644
index 000000000000..95f555cef8c0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iio-sensor-proxy/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchFromGitHub, autoconf-archive, gettext, libtool, intltool, autoconf, automake
+, glib, gtk3, gtk-doc, libgudev, pkgconfig, systemd }:
+
+stdenv.mkDerivation rec {
+ pname = "iio-sensor-proxy";
+ version = "2.8";
+
+ src = fetchFromGitHub {
+ owner = "hadess";
+ repo = pname;
+ rev = version;
+ sha256 = "07rzm1z2p6lh4iv5pyp0p2x5805m9gsh19kcsjls3fi25p3a2c00";
+ };
+
+ configurePhase = ''
+ runHook preConfigure
+
+ ./autogen.sh --prefix=$out \
+ --with-udevrulesdir=$out/lib/udev/rules.d \
+ --with-systemdsystemunitdir=$out/lib/systemd/system
+
+ runHook postConfigure
+ '';
+
+ buildInputs = [
+ glib
+ gtk3
+ gtk-doc
+ libgudev
+ systemd
+ ];
+
+ nativeBuildInputs = [
+ autoconf
+ autoconf-archive
+ automake
+ gettext
+ intltool
+ libtool
+ pkgconfig
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Proxy for sending IIO sensor data to D-Bus";
+ homepage = "https://github.com/hadess/iio-sensor-proxy";
+ license = licenses.gpl3 ;
+ maintainers = with maintainers; [ peterhoeg ];
+ platforms = platforms.linux;
+ inherit version;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/default.nix
new file mode 100644
index 000000000000..246c109faf34
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit, autoreconfHook, pkgconfig, openssl, attr, keyutils, asciidoc, libxslt, docbook_xsl }:
+
+stdenv.mkDerivation rec {
+ pname = "ima-evm-utils";
+ version = "1.1";
+
+ src = fetchgit {
+ url = "git://git.code.sf.net/p/linux-ima/ima-evm-utils";
+ rev = "v${version}";
+ sha256 = "1dhfw6d9z4dv82q9zg2g025hgr179kamz9chy7v5w9b71aam8jf8";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ openssl attr keyutils asciidoc libxslt ];
+
+ patches = [ ./xattr.patch ];
+
+ buildPhase = "make prefix=$out MANPAGE_DOCBOOK_XSL=${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl";
+
+ meta = {
+ description = "evmctl utility to manage digital signatures of the Linux kernel integrity subsystem (IMA/EVM)";
+ homepage = "https://sourceforge.net/projects/linux-ima/";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [ tstrobel ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/xattr.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/xattr.patch
new file mode 100644
index 000000000000..2d27570a5786
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ima-evm-utils/xattr.patch
@@ -0,0 +1,73 @@
+commit 6aea54d2ad2287b3e8894c262ee895f3d4a60516
+Author: André Draszik <git@andred.net>
+Date: Mon Oct 17 12:45:32 2016 +0100
+
+ evmctl: use correct include for xattr.h
+
+ The xattr API/ABI is provided by both the c-library, as well as by the
+ libattr package. The c-library's header file is sys/xattr.h, whereas
+ libattr's header file can be found in attr/xattr.h.
+
+ Given none of the code here *links* against the libattr.so shared library, it
+ is wrong to *compile* against libattr's API (header file).
+
+ Doing so avoids confusion as to which xattr.h is used as the least problem,
+ and potential ABI differences as the worst problem due the mismatching header
+ file used.
+
+ So make sure we compile and link against the same thing, the c-library in
+ both cases.
+
+ Signed-off-by: André Draszik <git@andred.net>
+ Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
+
+diff --git a/configure.ac b/configure.ac
+index 0497eb7..a5b4288 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -30,7 +30,7 @@ AC_SUBST(OPENSSL_LIBS)
+ AC_CHECK_HEADER(unistd.h)
+ AC_CHECK_HEADERS(openssl/conf.h)
+
+-AC_CHECK_HEADERS(attr/xattr.h, , [AC_MSG_ERROR([attr/xattr.h header not found. You need the libattr development package.])])
++AC_CHECK_HEADERS(sys/xattr.h, , [AC_MSG_ERROR([sys/xattr.h header not found. You need the c-library development package.])])
+ AC_CHECK_HEADERS(keyutils.h, , [AC_MSG_ERROR([keyutils.h header not found. You need the libkeyutils development package.])])
+
+ #debug support - yes for a while
+diff --git a/packaging/ima-evm-utils.spec b/packaging/ima-evm-utils.spec
+index a11a27a..63388d2 100644
+--- a/packaging/ima-evm-utils.spec
++++ b/packaging/ima-evm-utils.spec
+@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+ BuildRequires: autoconf
+ BuildRequires: automake
+ BuildRequires: openssl-devel
+-BuildRequires: libattr-devel
+ BuildRequires: keyutils-libs-devel
+
+ %description
+diff --git a/packaging/ima-evm-utils.spec.in b/packaging/ima-evm-utils.spec.in
+index 7ca6c6f..65c32f9 100644
+--- a/packaging/ima-evm-utils.spec.in
++++ b/packaging/ima-evm-utils.spec.in
+@@ -11,7 +11,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+ BuildRequires: autoconf
+ BuildRequires: automake
+ BuildRequires: openssl-devel
+-BuildRequires: libattr-devel
+ BuildRequires: keyutils-libs-devel
+
+ %description
+diff --git a/src/evmctl.c b/src/evmctl.c
+index 2ffee78..3fbcd33 100644
+--- a/src/evmctl.c
++++ b/src/evmctl.c
+@@ -49,7 +49,7 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <dirent.h>
+-#include <attr/xattr.h>
++#include <sys/xattr.h>
+ #include <linux/xattr.h>
+ #include <getopt.h>
+ #include <keyutils.h>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/input-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/input-utils/default.nix
new file mode 100644
index 000000000000..0fc2130d102a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/input-utils/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, linuxHeaders }:
+
+stdenv.mkDerivation rec {
+ pname = "input-utils";
+ version = "1.3";
+
+ src = fetchurl {
+ url = "https://www.kraxel.org/releases/input/input-${version}.tar.gz";
+ sha256 = "11w0pp20knx6qpgzmawdbk1nj2z3fzp8yd6nag6s8bcga16w6hli";
+ };
+
+ prePatch = ''
+ # Use proper include path for kernel include files.
+ substituteInPlace ./name.sh --replace "/usr/include/linux/" "${linuxHeaders}/include/linux/"
+ substituteInPlace ./lirc.sh --replace "/usr/include/linux/" "${linuxHeaders}/include/linux/"
+ '';
+
+ makeFlags = [
+ "prefix=$(out)"
+ "STRIP="
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Input layer utilities, includes lsinput";
+ homepage = "https://www.kraxel.org/blog/linux/input/";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ samueldr ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-compute-runtime/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-compute-runtime/default.nix
new file mode 100644
index 000000000000..e33a40e6a85f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-compute-runtime/default.nix
@@ -0,0 +1,54 @@
+{ stdenv
+, fetchFromGitHub
+, patchelf
+, cmake
+, pkgconfig
+
+, intel-gmmlib
+, intel-graphics-compiler
+, libva
+}:
+
+stdenv.mkDerivation rec {
+ pname = "intel-compute-runtime";
+ version = "20.33.17675";
+
+ src = fetchFromGitHub {
+ owner = "intel";
+ repo = "compute-runtime";
+ rev = version;
+ sha256 = "1ckzspf05skdrjh947gv96finxbv5dpgc84hppm5pdsp5q70iyxp";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+
+ buildInputs = [ intel-gmmlib intel-graphics-compiler libva ];
+
+ cmakeFlags = [
+ "-DSKIP_UNIT_TESTS=1"
+
+ "-DIGC_DIR=${intel-graphics-compiler}"
+ "-DOCL_ICD_VENDORDIR=${placeholder "out"}/etc/OpenCL/vendors"
+
+ # The install script assumes this path is relative to CMAKE_INSTALL_PREFIX
+ "-DCMAKE_INSTALL_LIBDIR=lib"
+ ];
+
+ postInstall = ''
+ # Avoid clash with intel-ocl
+ mv $out/etc/OpenCL/vendors/intel.icd $out/etc/OpenCL/vendors/intel-neo.icd
+ '';
+
+ postFixup = ''
+ patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ intel-gmmlib intel-graphics-compiler libva stdenv.cc.cc.lib ]} \
+ $out/lib/intel-opencl/libigdrcl.so
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/intel/compute-runtime";
+ description = "Intel Graphics Compute Runtime for OpenCL. Replaces Beignet for Gen8 (Broadwell) and beyond";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ gloaming ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-ocl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-ocl/default.nix
new file mode 100644
index 000000000000..95a2cfbd8460
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-ocl/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchzip, rpmextract, ncurses5, numactl, zlib }:
+
+stdenv.mkDerivation rec {
+ pname = "intel-ocl";
+ version = "5.0-63503";
+
+ src = fetchzip {
+ url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip";
+ sha256 = "0qbp63l74s0i80ysh9ya8x7r79xkddbbz4378nms9i7a0kprg9p2";
+ stripRoot = false;
+ };
+
+ buildInputs = [ rpmextract ];
+
+ sourceRoot = ".";
+
+ libPath = stdenv.lib.makeLibraryPath [
+ stdenv.cc.cc.lib
+ ncurses5
+ numactl
+ zlib
+ ];
+
+ postUnpack = ''
+ # Extract the RPMs contained within the source ZIP.
+ rpmextract source/intel-opencl-r${version}.x86_64.rpm
+ rpmextract source/intel-opencl-cpu-r${version}.x86_64.rpm
+ '';
+
+ patchPhase = ''
+ runHook prePatch
+
+ # Remove libOpenCL.so, since we use ocl-icd's libOpenCL.so instead and this would cause a clash.
+ rm opt/intel/opencl/libOpenCL.so*
+
+ # Patch shared libraries.
+ for lib in opt/intel/opencl/*.so; do
+ patchelf --set-rpath "${libPath}:$out/lib/intel-ocl" $lib || true
+ done
+
+ runHook postPatch
+ '';
+
+ buildPhase = ''
+ runHook preBuild
+
+ # Create ICD file, which just contains the path of the corresponding shared library.
+ echo "$out/lib/intel-ocl/libintelocl.so" > intel.icd
+
+ runHook postBuild
+ '';
+
+ installPhase = ''
+ runHook preInstall
+
+ install -D -m 0755 opt/intel/opencl/*.so* -t $out/lib/intel-ocl
+ install -D -m 0644 opt/intel/opencl/*.{o,rtl,bin} -t $out/lib/intel-ocl
+ install -D -m 0644 opt/intel/opencl/{LICENSE,NOTICES} -t $out/share/doc/intel-ocl
+ install -D -m 0644 intel.icd -t $out/etc/OpenCL/vendors
+
+ runHook postInstall
+ '';
+
+ dontStrip = true;
+
+ meta = {
+ description = "Official OpenCL runtime for Intel CPUs";
+ homepage = "https://software.intel.com/en-us/articles/opencl-drivers";
+ license = stdenv.lib.licenses.unfree;
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ stdenv.lib.maintainers.kierdavis ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-speed-select/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-speed-select/default.nix
new file mode 100644
index 000000000000..12536130a864
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/intel-speed-select/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, kernel }:
+
+stdenv.mkDerivation {
+ pname = "intel-speed-select";
+ inherit (kernel) src version;
+
+ makeFlags = [ "bindir=${placeholder "out"}/bin" ];
+
+ postPatch = ''
+ cd tools/power/x86/intel-speed-select
+ sed -i 's,/usr,,g' Makefile
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tool to enumerate and control the Intel Speed Select Technology features";
+ homepage = "https://www.kernel.org/";
+ license = licenses.gpl2;
+ platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iomelt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iomelt/default.nix
new file mode 100644
index 000000000000..860a7b446328
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iomelt/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchurl }:
+
+let version = "0.7";
+in stdenv.mkDerivation {
+ pname = "iomelt";
+ inherit version;
+ src = fetchurl {
+ url = "http://iomelt.com/s/iomelt-${version}.tar.gz";
+ sha256 = "1jhrdm5b7f1bcbrdwcc4yzg26790jxl4d2ndqiwd9brl2g5537im";
+ };
+
+ preBuild = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1
+
+ substituteInPlace Makefile \
+ --replace /usr $out
+ '';
+
+ meta = with lib; {
+ description = "A simple yet effective way to benchmark disk IO in Linux systems";
+ homepage = "http://www.iomelt.com";
+ maintainers = with maintainers; [ cstrahan ];
+ license = licenses.artistic2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ioport/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ioport/default.nix
new file mode 100644
index 000000000000..fad85335200c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ioport/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, perl, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "ioport-1.2";
+ src = fetchurl {
+ url = "https://people.redhat.com/rjones/ioport/files/ioport-1.2.tar.gz";
+ sha256 = "1h4d5g78y7kla0zl25jgyrk43wy3m3bygqg0blki357bc55irb3z";
+ };
+ buildInputs = [ perl ];
+ meta = with stdenv.lib; {
+ description = "Direct access to I/O ports from the command line";
+ homepage = "https://people.redhat.com/rjones/ioport/";
+ license = licenses.gpl2Plus;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = [ maintainers.cleverca22 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iotop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iotop/default.nix
new file mode 100644
index 000000000000..8f742aa01be8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iotop/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, python3Packages, fetchpatch }:
+
+python3Packages.buildPythonApplication rec {
+ name = "iotop-0.6";
+
+ src = fetchurl {
+ url = "http://guichaz.free.fr/iotop/files/${name}.tar.bz2";
+ sha256 = "0nzprs6zqax0cwq8h7hnszdl3d2m4c2d4vjfxfxbnjfs9sia5pis";
+ };
+
+ patches = [
+ (fetchpatch {
+ url = "https://repo.or.cz/iotop.git/patch/99c8d7cedce81f17b851954d94bfa73787300599";
+ sha256 = "0rdgz6xpmbx77lkr1ixklliy1aavdsjmfdqvzwrjylbv0xh5wc8z";
+ })
+ ];
+
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ description = "A tool to find out the processes doing the most IO";
+ homepage = "http://guichaz.free.fr/iotop";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.raskin ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/default.nix
new file mode 100644
index 000000000000..a9fcf455ee43
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl
+, buildPackages, bison, flex, pkg-config
+, db, iptables, libelf, libmnl
+}:
+
+stdenv.mkDerivation rec {
+ pname = "iproute2";
+ version = "5.8.0";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/net/${pname}/${pname}-${version}.tar.xz";
+ sha256 = "0vk4vickrpahdhl3zazr2qn2bf99v5549ncirjpwiy4h0a4izkfg";
+ };
+
+ preConfigure = ''
+ # Don't try to create /var/lib/arpd:
+ sed -e '/ARPDDIR/d' -i Makefile
+ # TODO: Drop temporary version fix for 5.8 (53159d81) once 5.9 is out:
+ substituteInPlace include/version.h \
+ --replace "v5.7.0-77-gb687d1067169" "5.8.0"
+ '';
+
+ outputs = [ "out" "dev" ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "SBINDIR=$(out)/sbin"
+ "DOCDIR=$(TMPDIR)/share/doc/${pname}" # Don't install docs
+ "HDRDIR=$(dev)/include/iproute2"
+ ];
+
+ buildFlags = [
+ "CONFDIR=/etc/iproute2"
+ ];
+
+ installFlags = [
+ "CONFDIR=$(out)/etc/iproute2"
+ ];
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ]; # netem requires $HOSTCC
+ nativeBuildInputs = [ bison flex pkg-config ];
+ buildInputs = [ db iptables libelf libmnl ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ homepage = "https://wiki.linuxfoundation.org/networking/iproute2";
+ description = "A collection of utilities for controlling TCP/IP networking and traffic control in Linux";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ primeos eelco fpletz globin ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix
new file mode 100644
index 000000000000..63f0abcd2a29
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix
@@ -0,0 +1,28 @@
+{ stdenv, iproute, fetchFromGitHub }:
+
+iproute.overrideAttrs (oa: rec {
+ pname = "iproute_mptcp";
+ version = "0.95";
+
+ src = fetchFromGitHub {
+ owner = "multipath-tcp";
+ repo = "iproute-mptcp";
+ rev = "mptcp_v${version}";
+ sha256 = "07fihvwlaj0ng8s8sxqhd0a9h1narcnp4ibk88km9cpsd32xv4q3";
+ };
+
+ preConfigure = ''
+ # Don't try to create /var/lib/arpd:
+ sed -e '/ARPDDIR/d' -i Makefile
+ patchShebangs configure
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/multipath-tcp/iproute-mptcp";
+ description = "IP-Route extensions for MultiPath TCP";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ teto ];
+ priority = 2;
+ };
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2015-4047.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2015-4047.patch
new file mode 100644
index 000000000000..00c23c6cac14
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2015-4047.patch
@@ -0,0 +1,16 @@
+Index: pkg-ipsec-tools/src/racoon/gssapi.c
+===================================================================
+--- pkg-ipsec-tools.orig/src/racoon/gssapi.c
++++ pkg-ipsec-tools/src/racoon/gssapi.c
+@@ -192,6 +192,11 @@ gssapi_init(struct ph1handle *iph1)
+ gss_name_t princ, canon_princ;
+ OM_uint32 maj_stat, min_stat;
+
++ if (iph1->rmconf == NULL) {
++ plog(LLV_ERROR, LOCATION, NULL, "no remote config\n");
++ return -1;
++ }
++
+ gps = racoon_calloc(1, sizeof (struct gssapi_ph1_state));
+ if (gps == NULL) {
+ plog(LLV_ERROR, LOCATION, NULL, "racoon_calloc failed\n");
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2016-10396.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2016-10396.patch
new file mode 100644
index 000000000000..b644d46f8c9d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/CVE-2016-10396.patch
@@ -0,0 +1,193 @@
+From: Antoine_Beaupre <anarcat@orangeseeds.org>
+Acked-by: Jiri Bohac <jbohac@suse.cz>
+Subject: PR/51682: Avoid DoS with fragment out of order insertion; keep fragments sorted in the list.
+References: bsc#1047443, CVE-2016-10396
+
+
+
+Index: a/src/racoon/handler.h
+===================================================================
+--- a/src/racoon/handler.h.orig 2018-01-26 18:05:21.114764376 +0100
++++ a/src/racoon/handler.h 2018-01-26 18:05:33.986741103 +0100
+@@ -141,6 +141,7 @@ struct ph1handle {
+ #endif
+ #ifdef ENABLE_FRAG
+ int frag; /* IKE phase 1 fragmentation */
++ int frag_last_index;
+ struct isakmp_frag_item *frag_chain; /* Received fragments */
+ #endif
+
+Index: a/src/racoon/isakmp.c
+===================================================================
+--- a/src/racoon/isakmp.c.orig 2018-01-26 18:05:21.118764369 +0100
++++ a/src/racoon/isakmp.c 2018-01-26 18:05:33.986741103 +0100
+@@ -1069,6 +1069,7 @@ isakmp_ph1begin_i(rmconf, remote, local)
+ iph1->frag = 1;
+ else
+ iph1->frag = 0;
++ iph1->frag_last_index = 0;
+ iph1->frag_chain = NULL;
+ #endif
+ iph1->approval = NULL;
+@@ -1173,6 +1174,7 @@ isakmp_ph1begin_r(msg, remote, local, et
+ #endif
+ #ifdef ENABLE_FRAG
+ iph1->frag = 0;
++ iph1->frag_last_index = 0;
+ iph1->frag_chain = NULL;
+ #endif
+ iph1->approval = NULL;
+Index: a/src/racoon/isakmp_frag.c
+===================================================================
+--- a/src/racoon/isakmp_frag.c.orig 2018-01-26 18:05:21.118764369 +0100
++++ a/src/racoon/isakmp_frag.c 2018-01-26 18:05:33.986741103 +0100
+@@ -173,6 +173,43 @@ vendorid_frag_cap(gen)
+ return ntohl(hp[MD5_DIGEST_LENGTH / sizeof(*hp)]);
+ }
+
++static int
++isakmp_frag_insert(struct ph1handle *iph1, struct isakmp_frag_item *item)
++{
++ struct isakmp_frag_item *pitem = NULL;
++ struct isakmp_frag_item *citem = iph1->frag_chain;
++
++ /* no frag yet, just insert at beginning of list */
++ if (iph1->frag_chain == NULL) {
++ iph1->frag_chain = item;
++ return 0;
++ }
++
++ do {
++ /* duplicate fragment number, abort (CVE-2016-10396) */
++ if (citem->frag_num == item->frag_num)
++ return -1;
++
++ /* need to insert before current item */
++ if (citem->frag_num > item->frag_num) {
++ if (pitem != NULL)
++ pitem->frag_next = item;
++ else
++ /* insert at the beginning of the list */
++ iph1->frag_chain = item;
++ item->frag_next = citem;
++ return 0;
++ }
++
++ pitem = citem;
++ citem = citem->frag_next;
++ } while (citem != NULL);
++
++ /* we reached the end of the list, insert */
++ pitem->frag_next = item;
++ return 0;
++}
++
+ int
+ isakmp_frag_extract(iph1, msg)
+ struct ph1handle *iph1;
+@@ -224,39 +261,43 @@ isakmp_frag_extract(iph1, msg)
+ item->frag_next = NULL;
+ item->frag_packet = buf;
+
+- /* Look for the last frag while inserting the new item in the chain */
+- if (item->frag_last)
+- last_frag = item->frag_num;
++ /* Check for the last frag before inserting the new item in the chain */
++ if (item->frag_last) {
++ /* if we have the last fragment, indices must match */
++ if (iph1->frag_last_index != 0 &&
++ item->frag_last != iph1->frag_last_index) {
++ plog(LLV_ERROR, LOCATION, NULL,
++ "Repeated last fragment index mismatch\n");
++ racoon_free(item);
++ vfree(buf);
++ return -1;
++ }
+
+- if (iph1->frag_chain == NULL) {
+- iph1->frag_chain = item;
+- } else {
+- struct isakmp_frag_item *current;
++ last_frag = iph1->frag_last_index = item->frag_num;
++ }
+
+- current = iph1->frag_chain;
+- while (current->frag_next) {
+- if (current->frag_last)
+- last_frag = item->frag_num;
+- current = current->frag_next;
+- }
+- current->frag_next = item;
++ /* insert fragment into chain */
++ if (isakmp_frag_insert(iph1, item) == -1) {
++ plog(LLV_ERROR, LOCATION, NULL,
++ "Repeated fragment index mismatch\n");
++ racoon_free(item);
++ vfree(buf);
++ return -1;
+ }
+
+- /* If we saw the last frag, check if the chain is complete */
++ /* If we saw the last frag, check if the chain is complete
++ * we have a sorted list now, so just walk through */
+ if (last_frag != 0) {
++ item = iph1->frag_chain;
+ for (i = 1; i <= last_frag; i++) {
+- item = iph1->frag_chain;
+- do {
+- if (item->frag_num == i)
+- break;
+- item = item->frag_next;
+- } while (item != NULL);
+-
++ if (item->frag_num != i)
++ break;
++ item = item->frag_next;
+ if (item == NULL) /* Not found */
+ break;
+ }
+
+- if (item != NULL) /* It is complete */
++ if (i > last_frag) /* It is complete */
+ return 1;
+ }
+
+@@ -291,15 +332,9 @@ isakmp_frag_reassembly(iph1)
+ }
+ data = buf->v;
+
++ item = iph1->frag_chain;
+ for (i = 1; i <= frag_count; i++) {
+- item = iph1->frag_chain;
+- do {
+- if (item->frag_num == i)
+- break;
+- item = item->frag_next;
+- } while (item != NULL);
+-
+- if (item == NULL) {
++ if (item->frag_num != i) {
+ plog(LLV_ERROR, LOCATION, NULL,
+ "Missing fragment #%d\n", i);
+ vfree(buf);
+@@ -308,6 +343,7 @@ isakmp_frag_reassembly(iph1)
+ }
+ memcpy(data, item->frag_packet->v, item->frag_packet->l);
+ data += item->frag_packet->l;
++ item = item->frag_next;
+ }
+
+ out:
+
+
+diff -u -p -r1.50 -r1.51
+--- a/src/racoon/isakmp_inf.c 2013/04/12 09:53:10 1.50
++++ a/src/racoon/isakmp_inf.c 2017/01/24 19:23:56 1.51
+@@ -720,6 +720,7 @@ isakmp_info_send_nx(isakmp, remote, loca
+ #endif
+ #ifdef ENABLE_FRAG
+ iph1->frag = 0;
++ iph1->frag_last_index = 0;
+ iph1->frag_chain = NULL;
+ #endif
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix
new file mode 100644
index 000000000000..bff356ccb6cf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, fetchpatch, linuxHeaders, readline, openssl, flex, kerberos, pam }:
+
+# TODO: These tools are supposed to work under NetBSD and FreeBSD as
+# well, so I guess it's not appropriate to place this expression in
+# "os-specific/linux/ipsec-tools". Since I cannot verify that the
+# expression actually builds on those platforms, I'll leave it here for
+# the time being.
+
+stdenv.mkDerivation rec {
+ name = "ipsec-tools-0.8.2";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/ipsec-tools/${name}.tar.bz2";
+ sha256 = "0b9gfbz78k2nj0k7jdlm5kajig628ja9qm0z5yksiwz22s3v7dlf";
+ };
+
+ buildInputs = [ readline openssl flex kerberos pam ];
+
+ patches = [
+ ./dont-create-localstatedir-during-install.patch
+ ./CVE-2015-4047.patch
+ ./CVE-2016-10396.patch
+ ];
+
+ # fix build with newer gcc versions
+ preConfigure = ''substituteInPlace configure --replace "-Werror" "" '';
+
+ configureFlags = [
+ "--sysconfdir=/etc --localstatedir=/var"
+ "--with-kernel-headers=${linuxHeaders}/include"
+ "--disable-security-context"
+ "--enable-adminport"
+ "--enable-dpd"
+ "--enable-frag"
+ "--enable-gssapi"
+ "--enable-hybrid"
+ "--enable-natt"
+ "--enable-shared"
+ "--enable-stats"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://ipsec-tools.sourceforge.net/";
+ description = "Port of KAME's IPsec utilities to the Linux-2.6 IPsec implementation";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/dont-create-localstatedir-during-install.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/dont-create-localstatedir-during-install.patch
new file mode 100644
index 000000000000..16b80c36d6a5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipsec-tools/dont-create-localstatedir-during-install.patch
@@ -0,0 +1,13 @@
+diff -ubr ipsec-tools-0.8.0-orig/src/racoon/Makefile.in ipsec-tools-0.8.0/src/racoon/Makefile.in
+--- ipsec-tools-0.8.0-orig/src/racoon/Makefile.in 2012-10-20 13:01:07.700903316 +0200
++++ ipsec-tools-0.8.0/src/racoon/Makefile.in 2012-10-20 13:01:13.177832616 +0200
+@@ -1085,9 +1085,6 @@
+ uninstall-sbinPROGRAMS
+
+
+-install-exec-local:
+- ${mkinstalldirs} $(DESTDIR)${adminsockdir}
+-
+ # special object rules
+ crypto_openssl_test.o: crypto_openssl.c
+ $(COMPILE) -DEAYDEBUG -o crypto_openssl_test.o -c $(srcdir)/crypto_openssl.c
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipset/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipset/default.nix
new file mode 100644
index 000000000000..2c433ba8c29a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipset/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pkgconfig, libmnl }:
+
+stdenv.mkDerivation rec {
+ pname = "ipset";
+ version = "7.6";
+
+ src = fetchurl {
+ url = "http://ipset.netfilter.org/${pname}-${version}.tar.bz2";
+ sha256 = "1ny2spcm6bmpj8vnazssg99k59impr7n84jzkdmdjly1m7548z8f";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ libmnl ];
+
+ configureFlags = [ "--with-kmod=no" ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://ipset.netfilter.org/";
+ description = "Administration tool for IP sets";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptables/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptables/default.nix
new file mode 100644
index 000000000000..c9c342ad7682
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptables/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, pkgconfig, pruneLibtoolFiles, flex, bison
+, libmnl, libnetfilter_conntrack, libnfnetlink, libnftnl, libpcap
+, nftablesCompat ? false
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ version = "1.8.5";
+ pname = "iptables";
+
+ src = fetchurl {
+ url = "https://www.netfilter.org/projects/${pname}/files/${pname}-${version}.tar.bz2";
+ sha256 = "02a3575ypdpg6a2x752mhk3f7h1381ymkq1n0gss6fp6292xfmyl";
+ };
+
+ nativeBuildInputs = [ pkgconfig pruneLibtoolFiles flex bison ];
+
+ buildInputs = [ libmnl libnetfilter_conntrack libnfnetlink libnftnl libpcap ];
+
+ preConfigure = ''
+ export NIX_LDFLAGS="$NIX_LDFLAGS -lmnl -lnftnl"
+ '';
+
+ configureFlags = [
+ "--enable-bpf-compiler"
+ "--enable-devel"
+ "--enable-libipq"
+ "--enable-nfsynproxy"
+ "--enable-shared"
+ ] ++ optional (!nftablesCompat) "--disable-nftables";
+
+ outputs = [ "out" "dev" ];
+
+ postInstall = optional nftablesCompat ''
+ rm $out/sbin/{iptables,iptables-restore,iptables-save,ip6tables,ip6tables-restore,ip6tables-save}
+ ln -sv xtables-nft-multi $out/bin/iptables
+ ln -sv xtables-nft-multi $out/bin/iptables-restore
+ ln -sv xtables-nft-multi $out/bin/iptables-save
+ ln -sv xtables-nft-multi $out/bin/ip6tables
+ ln -sv xtables-nft-multi $out/bin/ip6tables-restore
+ ln -sv xtables-nft-multi $out/bin/ip6tables-save
+ '';
+
+ meta = {
+ description = "A program to configure the Linux IP packet filtering ruleset";
+ homepage = "https://www.netfilter.org/projects/iptables/index.html";
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ fpletz ];
+ license = licenses.gpl2;
+ downloadPage = "https://www.netfilter.org/projects/iptables/files/";
+ updateWalker = true;
+ inherit version;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptstate/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptstate/default.nix
new file mode 100644
index 000000000000..529a82e96469
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iptstate/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, libnetfilter_conntrack, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "iptstate";
+ version = "2.2.6";
+
+ src = fetchurl {
+ url = "https://github.com/jaymzh/iptstate/releases/download/v${version}/${pname}-${version}.tar.bz2";
+ sha256 = "bef8eb67a4533e53079f397b71e91dd34da23f8cbd65cb2d5b67cb907b00c068";
+ };
+
+ buildInputs = [ libnetfilter_conntrack ncurses ];
+
+ meta = with stdenv.lib; {
+ description = "Conntrack top like tool";
+ homepage = "https://github.com/jaymzh/iptstate";
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ trevorj ];
+ downloadPage = "https://github.com/jaymzh/iptstate/releases";
+ license = licenses.zlib;
+ };
+
+ installPhase = ''
+ install -m755 -D iptstate $out/bin/iptstate
+ '';
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iputils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iputils/default.nix
new file mode 100644
index 000000000000..e12c44888a0b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iputils/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchFromGitHub
+, meson, ninja, pkgconfig, gettext, libxslt, docbook_xsl_ns
+, libcap, systemd, libidn2
+}:
+
+with stdenv.lib;
+
+let
+ version = "20200821";
+ sunAsIsLicense = {
+ fullName = "AS-IS, SUN MICROSYSTEMS license";
+ url = "https://github.com/iputils/iputils/blob/s${version}/rdisc.c";
+ };
+in stdenv.mkDerivation rec {
+ pname = "iputils";
+ inherit version;
+
+ src = fetchFromGitHub {
+ owner = pname;
+ repo = pname;
+ rev = "s${version}";
+ sha256 = "1jhbcz75a4ij1myyyi110ma1d8d5hpm3scz9pyw7js6qym50xvh4";
+ };
+
+ mesonFlags = [
+ "-DBUILD_RARPD=true"
+ "-DBUILD_TRACEROUTE6=true"
+ "-DBUILD_TFTPD=true"
+ "-DNO_SETCAP_OR_SUID=true"
+ "-Dsystemdunitdir=etc/systemd/system"
+ ]
+ # Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111):
+ ++ optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false";
+
+ nativeBuildInputs = [ meson ninja pkgconfig gettext libxslt.bin docbook_xsl_ns ];
+ buildInputs = [ libcap systemd ]
+ ++ optional (!stdenv.hostPlatform.isMusl) libidn2;
+
+ meta = {
+ description = "A set of small useful utilities for Linux networking";
+ inherit (src.meta) homepage;
+ changelog = "https://github.com/iputils/iputils/releases/tag/s${version}";
+ license = with licenses; [ gpl2Plus bsd3 sunAsIsLicense ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ primeos lheckemann ];
+
+ longDescription = ''
+ A set of small useful utilities for Linux networking including:
+
+ arping
+ clockdiff
+ ninfod
+ ping
+ rarpd
+ rdisc
+ tftpd
+ tracepath
+ traceroute6
+ '';
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipvsadm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipvsadm/default.nix
new file mode 100644
index 000000000000..5f91fa5dccd9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ipvsadm/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, libnl, popt, gnugrep }:
+
+stdenv.mkDerivation rec {
+ pname = "ipvsadm";
+ version = "1.31";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/kernel/ipvsadm/${pname}-${version}.tar.xz";
+ sha256 = "1nyzpv1hx75k9lh0vfxfhc0p2fpqaqb38xpvs8sn88m1nljmw2hs";
+ };
+
+ postPatch = ''
+ substituteInPlace Makefile --replace "-lnl" "$(pkg-config --libs libnl-genl-3.0)"
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ libnl popt ];
+
+ preBuild = ''
+ makeFlagsArray+=(
+ INCLUDE=$(pkg-config --cflags libnl-genl-3.0)
+ BUILD_ROOT=$out
+ MANDIR=share/man
+ )
+ '';
+
+ postInstall = ''
+ sed -i -e "s|^PATH=.*|PATH=$out/bin:${gnugrep}/bin|" $out/sbin/ipvsadm-{restore,save}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Linux Virtual Server support programs";
+ homepage = "http://www.linuxvirtualserver.org/software/ipvs.html";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/irqbalance/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/irqbalance/default.nix
new file mode 100644
index 000000000000..d61d02b5598d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/irqbalance/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, glib, ncurses, libcap_ng }:
+
+stdenv.mkDerivation rec {
+ pname = "irqbalance";
+ version = "1.7.0";
+
+ src = fetchFromGitHub {
+ owner = "irqbalance";
+ repo = "irqbalance";
+ rev = "v${version}";
+ sha256 = "1677ap6z4hvwga0vb8hrvpc0qggyarg9mlg11pxywz7mq94vdx19";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ glib ncurses libcap_ng ];
+
+ LDFLAGS = "-lncurses";
+
+ postInstall =
+ ''
+ # Systemd service
+ mkdir -p $out/lib/systemd/system
+ grep -vi "EnvironmentFile" misc/irqbalance.service >$out/lib/systemd/system/irqbalance.service
+ substituteInPlace $out/lib/systemd/system/irqbalance.service \
+ --replace /usr/sbin/irqbalance $out/bin/irqbalance \
+ --replace ' $IRQBALANCE_ARGS' ""
+ '';
+
+ meta = {
+ homepage = "https://github.com/Irqbalance/irqbalance";
+ description = "A daemon to help balance the cpu load generated by interrupts across all of a systems cpus";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/it87/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/it87/default.nix
new file mode 100644
index 000000000000..c48de130e5a1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/it87/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ name = "it87-${version}-${kernel.version}";
+ version = "2018-08-14";
+
+ # The original was deleted from github, but this seems to be an active fork
+ src = fetchFromGitHub {
+ owner = "hannesha";
+ repo = "it87";
+ rev = "5515f5b78838cb6be551943ffef5d1792012724c";
+ sha256 = "1ygi4mwds4q7byhg8gqnh3syamdj5rpjy3jj012k7vl54gdgrmgm";
+ };
+
+ 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=$(out)/lib/modules/${kernel.modDirVersion}/kernel/drivers/hwmon"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Patched module for IT87xx superio chip sensors support";
+ homepage = "https://github.com/hannesha/it87";
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = with maintainers; [ yorickvp ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iw/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iw/default.nix
new file mode 100644
index 000000000000..f0097e37a99d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iw/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkg-config, libnl }:
+
+stdenv.mkDerivation rec {
+ pname = "iw";
+ version = "5.9";
+
+ src = fetchurl {
+ url = "https://www.kernel.org/pub/software/network/${pname}/${pname}-${version}.tar.xz";
+ sha256 = "1wp1ky1v353qqy5fnrk67apgzsap53jkr7pmghk3czpbk880ffi9";
+ };
+
+ nativeBuildInputs = [ pkg-config ];
+ buildInputs = [ libnl ];
+
+ makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+ meta = {
+ description = "Tool to use nl80211";
+ longDescription = ''
+ iw is a new nl80211 based CLI configuration utility for wireless devices.
+ It supports all new drivers that have been added to the kernel recently.
+ The old tool iwconfig, which uses Wireless Extensions interface, is
+ deprecated and it's strongly recommended to switch to iw and nl80211.
+ '';
+ homepage = "https://wireless.wiki.kernel.org/en/users/Documentation/iw";
+ license = stdenv.lib.licenses.isc;
+ maintainers = with stdenv.lib.maintainers; [ viric primeos ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iwd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iwd/default.nix
new file mode 100644
index 000000000000..adf37a1b71b6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/iwd/default.nix
@@ -0,0 +1,90 @@
+{ stdenv
+, fetchgit
+, fetchpatch
+, autoreconfHook
+, pkgconfig
+, ell
+, coreutils
+, docutils
+, readline
+, openssl
+, python3Packages
+}:
+
+stdenv.mkDerivation rec {
+ pname = "iwd";
+ version = "1.9";
+
+ src = fetchgit {
+ url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
+ rev = version;
+ sha256 = "193wa13i2prfz1zr7nvwbgrxgacms57zj1n7x28yy5hmm3nnwbrd";
+ };
+
+ outputs = [ "out" "man" ];
+
+ nativeBuildInputs = [
+ autoreconfHook
+ docutils
+ pkgconfig
+ python3Packages.wrapPython
+ ];
+
+ buildInputs = [
+ ell
+ python3Packages.python
+ readline
+ ];
+
+ checkInputs = [ openssl ];
+
+ pythonPath = [
+ python3Packages.dbus-python
+ python3Packages.pygobject3
+ ];
+
+ configureFlags = [
+ "--enable-external-ell"
+ "--enable-wired"
+ "--localstatedir=/var/"
+ "--with-dbus-busdir=${placeholder "out"}/share/dbus-1/system-services/"
+ "--with-dbus-datadir=${placeholder "out"}/share/"
+ "--with-systemd-modloaddir=${placeholder "out"}/etc/modules-load.d/" # maybe
+ "--with-systemd-unitdir=${placeholder "out"}/lib/systemd/system/"
+ "--with-systemd-networkdir=${placeholder "out"}/lib/systemd/network/"
+ ];
+
+ postUnpack = ''
+ patchShebangs .
+ '';
+
+ doCheck = true;
+
+ postInstall = ''
+ cp -a test/* $out/bin/
+ mkdir -p $out/share
+ cp -a doc $out/share/
+ cp -a README AUTHORS TODO $out/share/doc/
+ '';
+
+ preFixup = ''
+ wrapPythonPrograms
+ '';
+
+ postFixup = ''
+ substituteInPlace $out/share/dbus-1/system-services/net.connman.ead.service \
+ --replace /bin/false ${coreutils}/bin/false
+ substituteInPlace $out/share/dbus-1/system-services/net.connman.iwd.service \
+ --replace /bin/false ${coreutils}/bin/false
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ homepage = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
+ description = "Wireless daemon for Linux";
+ license = licenses.lgpl21;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ dtzWill fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ixgbevf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ixgbevf/default.nix
new file mode 100644
index 000000000000..67b9a66a8abb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ixgbevf/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, kernel, kmod }:
+
+stdenv.mkDerivation rec {
+ name = "ixgbevf-${version}-${kernel.version}";
+ version = "4.6.1";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/e1000/ixgbevf-${version}.tar.gz";
+ sha256 = "0h8a2g4hm38wmr13gvi2188r7nlv2c5rx6cal9gkf1nh6sla181c";
+ };
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ configurePhase = ''
+ cd src
+ makeFlagsArray+=(KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build INSTALL_MOD_PATH=$out MANDIR=/share/man)
+ substituteInPlace common.mk --replace /sbin/depmod ${kmod}/bin/depmod
+ # prevent host system kernel introspection
+ substituteInPlace common.mk --replace /boot/System.map /not-exists
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Intel 82599 Virtual Function Driver";
+ homepage = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/";
+ license = licenses.gpl2;
+ priority = 20;
+ # kernels ship ixgbevf driver for a long time already, maybe switch to a newest kernel?
+ broken = versionAtLeast kernel.version "5.2";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jfbview/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jfbview/default.nix
new file mode 100644
index 000000000000..f8e211fb289f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jfbview/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchFromGitHub
+, freetype, harfbuzz, jbig2dec, libjpeg, libX11, mupdf, ncurses, openjpeg
+, openssl
+
+, imageSupport ? true, imlib2 ? null }:
+
+let
+ package = if imageSupport
+ then "jfbview"
+ else "jfbpdf";
+ binaries = if imageSupport
+ then [ "jfbview" "jpdfcat" "jpdfgrep" ] # all require imlib2
+ else [ "jfbpdf" ]; # does not
+in
+
+stdenv.mkDerivation rec {
+ name = "${package}-${version}";
+ version = "0.5.7";
+
+ src = fetchFromGitHub {
+ repo = "JFBView";
+ owner = "jichu4n";
+ rev = version;
+ sha256 = "0ppns49hnmp04zdjw6wc28v0yvz31rkzvd5ylcj7arikx20llpxf";
+ };
+
+ postPatch = ''
+ substituteInPlace main.cpp \
+ --replace "<stropts.h>" "<sys/ioctl.h>"
+ '';
+
+ hardeningDisable = [ "format" ];
+
+ buildInputs = [
+ freetype harfbuzz jbig2dec libjpeg libX11 mupdf ncurses openjpeg
+ openssl
+ ] ++ stdenv.lib.optionals imageSupport [
+ imlib2
+ ];
+
+ configurePhase = ''
+ # Hack. Probing (`ldconfig -p`) fails with ‘cannot execute binary file’.
+ # Overriding `OPENJP2 =` later works, but makes build output misleading:
+ substituteInPlace Makefile --replace "ldconfig -p" "echo libopenjp2"
+
+ make config.mk
+ '';
+
+ buildFlags = binaries;
+ enableParallelBuilding = true;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ install ${toString binaries} $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "PDF and image viewer for the Linux framebuffer";
+ longDescription = ''
+ A very fast PDF and image viewer for the Linux framebuffer with some
+ advanced and unique features, including:
+ - Reads PDFs (MuPDF) and common image formats (Imlib2)
+ - Supports arbitrary zoom (10% - 1000%) and rotation
+ - Table of Contents (TOC) viewer for PDF documents
+ - Multi-threaded rendering on multi-core machines
+ - Asynchronous background rendering of the next page
+ - Customizable multi-threaded caching
+ '';
+ homepage = "https://seasonofcode.com/pages/jfbview.html";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/cli.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/cli.nix
new file mode 100644
index 000000000000..2d6e624fee69
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/cli.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libnl, iptables }:
+
+let
+ sourceAttrs = (import ./source.nix) { inherit fetchFromGitHub; };
+in
+
+stdenv.mkDerivation {
+ name = "jool-cli-${sourceAttrs.version}";
+
+ src = sourceAttrs.src;
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ libnl iptables ];
+
+ makeFlags = [ "-C" "src/usr" ];
+
+ prePatch = ''
+ sed -e 's%^XTABLES_SO_DIR = .*%XTABLES_SO_DIR = '"$out"'/lib/xtables%g' -i src/usr/iptables/Makefile
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.jool.mx/";
+ description = "Fairly compliant SIIT and Stateful NAT64 for Linux - CLI tools";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/default.nix
new file mode 100644
index 000000000000..69c0da331364
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+let
+ sourceAttrs = (import ./source.nix) { inherit fetchFromGitHub; };
+in
+
+stdenv.mkDerivation {
+ name = "jool-${sourceAttrs.version}-${kernel.version}";
+
+ src = sourceAttrs.src;
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+ hardeningDisable = [ "pic" ];
+
+ prePatch = ''
+ sed -e 's@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@' -i src/mod/*/Makefile
+ '';
+
+ buildPhase = ''
+ make -C src/mod
+ '';
+
+ installPhase = ''
+ make -C src/mod modules_install INSTALL_MOD_PATH=$out
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.jool.mx/";
+ description = "Fairly compliant SIIT and Stateful NAT64 for Linux - kernel modules";
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/source.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/source.nix
new file mode 100644
index 000000000000..abf7b0dac45f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jool/source.nix
@@ -0,0 +1,11 @@
+{ fetchFromGitHub }:
+
+rec {
+ version = "4.0.9";
+ src = fetchFromGitHub {
+ owner = "NICMx";
+ repo = "Jool";
+ rev = "v${version}";
+ sha256 = "0zhdpk1sbsv1iyr9rvj94wk853684avz3zzn4cv2k4254d7n25m7";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix
new file mode 100644
index 000000000000..86b24fe6a5be
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, linuxHeaders }:
+
+stdenv.mkDerivation {
+ name = "jujuutils-0.2";
+
+ src = fetchurl {
+ url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jujuutils/jujuutils-0.2.tar.gz";
+ sha256 = "1r74m7s7rs9d6y7cffi7mdap3jf96qwm1v6jcw53x5cikgmfxn4x";
+ };
+
+ buildInputs = [ linuxHeaders ];
+
+ meta = {
+ homepage = "https://github.com/cladisch/linux-firewire-utils";
+ description = "Utilities around FireWire devices connected to a Linux computer";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/default.nix
new file mode 100644
index 000000000000..7ee449ff33ed
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, fetchurl, autoreconfHook,
+ gzip, bzip2, pkgconfig, flex, check,
+ pam, coreutils
+}:
+
+stdenv.mkDerivation rec {
+ pname = "kbd";
+ version = "2.0.4";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
+ sha256 = "124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz";
+ };
+
+ configureFlags = [
+ "--enable-optional-progs"
+ "--enable-libkeymap"
+ "--disable-nls"
+ ];
+
+ patches = [ ./search-paths.patch ];
+
+ postPatch =
+ ''
+ # Add Neo keymap subdirectory
+ sed -i -e 's,^KEYMAPSUBDIRS *= *,&i386/neo ,' data/Makefile.am
+
+ # Renaming keymaps with name clashes, because loadkeys just picks
+ # the first keymap it sees. The clashing names lead to e.g.
+ # "loadkeys no" defaulting to a norwegian dvorak map instead of
+ # the much more common qwerty one.
+ pushd data/keymaps/i386
+ mv qwertz/cz{,-qwertz}.map
+ mv olpc/es{,-olpc}.map
+ mv olpc/pt{,-olpc}.map
+ mv dvorak/{no.map,dvorak-no.map}
+ mv fgGIod/trf{,-fgGIod}.map
+ mv colemak/{en-latin9,colemak}.map
+ popd
+
+ # Fix the path to gzip/bzip2.
+ substituteInPlace src/libkeymap/findfile.c \
+ --replace gzip ${gzip}/bin/gzip \
+ --replace bzip2 ${bzip2.bin}/bin/bzip2 \
+
+ # We get a warning in armv5tel-linux and the fuloong2f, so we
+ # disable -Werror in it.
+ ${stdenv.lib.optionalString (stdenv.isAarch32 || stdenv.hostPlatform.isMips) ''
+ sed -i s/-Werror// src/Makefile.am
+ ''}
+ '';
+
+ postInstall = ''
+ for i in $out/bin/unicode_{start,stop}; do
+ substituteInPlace "$i" \
+ --replace /usr/bin/tty ${coreutils}/bin/tty
+ done
+ '';
+
+
+ buildInputs = [ check pam ];
+ nativeBuildInputs = [ autoreconfHook pkgconfig flex ];
+
+ makeFlags = [ "setowner=" ];
+
+ meta = with stdenv.lib; {
+ homepage = "ftp://ftp.altlinux.org/pub/people/legion/kbd/";
+ description = "Linux keyboard utilities and keyboard maps";
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/keymaps.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/keymaps.nix
new file mode 100644
index 000000000000..b3d5fe1b63cc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/keymaps.nix
@@ -0,0 +1,36 @@
+{ stdenv, lib, fetchurl, gzip }:
+
+{
+ dvp = stdenv.mkDerivation rec {
+ pname = "dvp";
+ version = "1.2.1";
+
+ src = fetchurl {
+ url = "http://kaufmann.no/downloads/linux/dvp-${lib.replaceStrings ["."] ["_"] version}.map.gz";
+ sha256 = "0e859211cfe16a18a3b9cbf2ca3e280a23a79b4e40b60d8d01d0fde7336b6d50";
+ };
+
+ nativeBuildInputs = [ gzip ];
+
+ buildCommand = ''
+ mkdir -p $out/share/keymaps/i386/dvorak
+ gzip -c -d $src > $out/share/keymaps/i386/dvorak/dvp.map
+ '';
+ };
+
+ neo = stdenv.mkDerivation {
+ pname = "neo";
+ version = "2476";
+
+ src = fetchurl {
+ name = "neo.map";
+ url = "https://raw.githubusercontent.com/neo-layout/neo-layout/"
+ + "a0dee06fed824abfad658b7f10e6d907b270be0a/linux/console/neo.map";
+ sha256 = "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g";
+ };
+
+ buildCommand = ''
+ install -D $src $out/share/keymaps/i386/neo/neo.map
+ '';
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/search-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/search-paths.patch
new file mode 100644
index 000000000000..c9405a56721d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbd/search-paths.patch
@@ -0,0 +1,71 @@
+--- a/src/libkeymap/analyze.l
++++ b/src/libkeymap/analyze.l
+@@ -101,6 +101,9 @@ stack_pop(struct lk_ctx *ctx, void *scan
+ static const char *const include_dirpath0[] = { "", 0 };
+ static const char *const include_dirpath1[] = { "", "../include/", "../../include/", 0 };
+ static const char *const include_dirpath3[] = {
++ "/etc/kbd/" KEYMAPDIR "/include/",
++ "/etc/kbd/" KEYMAPDIR "/i386/include/",
++ "/etc/kbd/" KEYMAPDIR "/mac/include/",
+ DATADIR "/" KEYMAPDIR "/include/",
+ DATADIR "/" KEYMAPDIR "/i386/include/",
+ DATADIR "/" KEYMAPDIR "/mac/include/", 0
+--- a/src/loadkeys.c
++++ b/src/loadkeys.c
+@@ -27,7 +27,7 @@
+ #include "keymap.h"
+
+ static const char *progname = NULL;
+-static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 };
++static const char *const dirpath1[] = { "", "/etc/kbd/" KEYMAPDIR "/**", DATADIR "/" KEYMAPDIR "/**", 0 };
+ static const char *const suffixes[] = { "", ".kmap", ".map", 0 };
+
+ static void __attribute__((noreturn))
+--- a/src/loadunimap.c
++++ b/src/loadunimap.c
+@@ -30,7 +30,7 @@
+ extern char *progname;
+ extern int force;
+
+-static const char *const unidirpath[] = { "", DATADIR "/" UNIMAPDIR "/", 0 };
++static const char *const unidirpath[] = { "", "/etc/kbd/" UNIMAPDIR "/", DATADIR "/" UNIMAPDIR "/", 0 };
+ static const char *const unisuffixes[] = { "", ".uni", ".sfm", 0 };
+
+ #ifdef MAIN
+--- a/src/mapscrn.c
++++ b/src/mapscrn.c
+@@ -27,7 +27,7 @@ void loadnewmap(int fd, char *mfil);
+ static int ctoi(char *);
+
+ /* search for the map file in these directories (with trailing /) */
+-static const char *const mapdirpath[] = { "", DATADIR "/" TRANSDIR "/", 0 };
++static const char *const mapdirpath[] = { "", "/etc/kbd/" TRANSDIR "/", DATADIR "/" TRANSDIR "/", 0 };
+ static const char *const mapsuffixes[] = { "", ".trans", "_to_uni.trans", ".acm", 0 };
+
+ #ifdef MAIN
+--- a/src/resizecons.c
++++ b/src/resizecons.c
+@@ -101,7 +101,7 @@ static int vga_get_fontheight(void);
+ static void vga_set_cursor(int, int);
+ static void vga_set_verticaldisplayend_lowbyte(int);
+
+-const char *const dirpath[] = { "", DATADIR "/" VIDEOMODEDIR "/", 0 };
++const char *const dirpath[] = { "", "/etc/kbd/" VIDEOMODEDIR "/", DATADIR "/" VIDEOMODEDIR "/", 0};
+ const char *const suffixes[] = { "", 0 };
+
+ int main(int argc, char **argv)
+--- a/src/setfont.c
++++ b/src/setfont.c
+@@ -53,10 +53,10 @@ int force = 0;
+ int debug = 0;
+
+ /* search for the font in these directories (with trailing /) */
+-const char *const fontdirpath[] = { "", DATADIR "/" FONTDIR "/", 0 };
++const char *const fontdirpath[] = { "", "/etc/kbd/" FONTDIR "/", DATADIR "/" FONTDIR "/", 0 };
+ const char *const fontsuffixes[] = { "", ".psfu", ".psf", ".cp", ".fnt", 0 };
+ /* hide partial fonts a bit - loading a single one is a bad idea */
+-const char *const partfontdirpath[] = { "", DATADIR "/" FONTDIR "/" PARTIALDIR "/", 0 };
++const char *const partfontdirpath[] = { "", "/etc/kbd/" FONTDIR "/" PARTIALDIR "/", DATADIR "/" FONTDIR "/" PARTIALDIR "/", 0 };
+ const char *const partfontsuffixes[] = { "", 0 };
+
+ static inline int
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbdlight/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbdlight/default.nix
new file mode 100644
index 000000000000..bc2d53b5e5d9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kbdlight/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "kbdlight";
+ version = "1.3";
+
+ src = fetchFromGitHub {
+ owner = "hobarrera";
+ repo = "kbdlight";
+ rev = "v${version}";
+ sha256 = "1f08aid1xrbl4sb5447gkip9lnvkia1c4ap0v8zih5s9w8v72bny";
+ };
+
+ preConfigure = ''
+ substituteInPlace Makefile \
+ --replace /usr/local $out \
+ --replace 4755 0755
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/hobarrera/kbdlight";
+ description = "A very simple application that changes MacBooks' keyboard backlight level";
+ license = licenses.isc;
+ maintainers = [ maintainers.womfoo ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/default.nix
new file mode 100644
index 000000000000..59656f54db28
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -0,0 +1,83 @@
+{ stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header }:
+
+let
+ makeLinuxHeaders = { src, version, patches ? [] }: stdenvNoCC.mkDerivation {
+ inherit src;
+
+ pname = "linux-headers";
+ inherit version;
+
+ ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch;
+
+ # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
+ # We do this so we have a build->build, not build->host, C compiler.
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ # `elf-header` is null when libc provides `elf.h`.
+ nativeBuildInputs = [ perl elf-header ];
+
+ extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"];
+
+ inherit patches;
+
+ hardeningDisable = lib.optional stdenvNoCC.buildPlatform.isDarwin "format";
+
+ makeFlags = [
+ "SHELL=bash"
+ # Avoid use of runtime build->host compilers for checks. These
+ # checks only cared to work around bugs in very old compilers, so
+ # these changes should be safe.
+ "cc-version:=9999"
+ "cc-fullversion:=999999"
+ # `$(..)` expanded by make alone
+ "HOSTCC:=$(CC_FOR_BUILD)"
+ "HOSTCXX:=$(CXX_FOR_BUILD)"
+ ];
+
+ # Skip clean on darwin, case-sensitivity issues.
+ buildPhase = lib.optionalString (!stdenvNoCC.buildPlatform.isDarwin) ''
+ make mrproper $makeFlags
+ '' + ''
+ make headers $makeFlags
+ '';
+
+ checkPhase = ''
+ make headers_check $makeFlags
+ '';
+
+ # The following command requires rsync:
+ # make headers_install INSTALL_HDR_PATH=$out $makeFlags
+ # but rsync depends on popt which does not compile on aarch64 without
+ # updateAutotoolsGnuConfigScriptsHook which is not enabled in stage2,
+ # so we replicate it with cp. This also reduces bootstrap closure size.
+ installPhase = ''
+ mkdir -p $out
+ cp -r usr/include $out
+ find $out -type f ! -name '*.h' -delete
+ ''
+ # Some builds (e.g. KVM) want a kernel.release.
+ + ''
+ mkdir -p $out/include/config
+ echo "${version}-default" > $out/include/config/kernel.release
+ '';
+
+ meta = with lib; {
+ description = "Header files and scripts for Linux kernel";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+ };
+in {
+ inherit makeLinuxHeaders;
+
+ linuxHeaders = let version = "5.5"; in
+ makeLinuxHeaders {
+ inherit version;
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
+ sha256 = "0c131fi6s7vgvka1c0597vnvcmwn1pp968rci5kq64iwj3pd9yx6";
+ };
+ patches = [
+ ./no-relocs.patch # for building x86 kernel headers on non-ELF platforms
+ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/no-relocs.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/no-relocs.patch
new file mode 100644
index 000000000000..32c88224b867
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel-headers/no-relocs.patch
@@ -0,0 +1,7 @@
+--- a/arch/x86/Makefile
++++ b/arch/x86/Makefile
+@@ -231,3 +231,3 @@ endif
+ archscripts: scripts_basic
+- $(Q)$(MAKE) $(build)=arch/x86/tools relocs
++ $(Q)$(MAKE) $(build)=arch/x86/tools
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/bridge-stp-helper.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/bridge-stp-helper.patch
new file mode 100644
index 000000000000..70d0f944c2a0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/bridge-stp-helper.patch
@@ -0,0 +1,13 @@
+diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
+index aea3d13..8fcbf81 100644
+--- a/net/bridge/br_private.h
++++ b/net/bridge/br_private.h
+@@ -39,7 +39,7 @@
+ #define BR_GROUPFWD_8021AD 0xB801u
+
+ /* Path to usermode spanning tree program */
+-#define BR_STP_PROG "/sbin/bridge-stp"
++#define BR_STP_PROG "/run/current-system/sw/bin/bridge-stp"
+
+ typedef struct bridge_id bridge_id;
+ typedef struct mac_addr mac_addr;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix
new file mode 100644
index 000000000000..8bd5d0212044
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix
@@ -0,0 +1,822 @@
+# WARNING/NOTE: whenever you want to add an option here you need to either
+# * mark it as an optional one with `option`,
+# * or make sure it works for all the versions in nixpkgs,
+# * or check for which kernel versions it will work (using kernel
+# changelog, google or whatever) and mark it with `whenOlder` or
+# `whenAtLeast`.
+# Then do test your change by building all the kernels (or at least
+# their configs) in Nixpkgs or else you will guarantee lots and lots
+# of pain to users trying to switch to an older kernel because of some
+# hardware problems with a new one.
+
+# Configuration
+{ stdenv, version
+
+, features ? { grsecurity = false; xen_dom0 = false; }
+}:
+
+with stdenv.lib;
+with stdenv.lib.kernel;
+with (stdenv.lib.kernel.whenHelpers version);
+
+let
+
+
+ # configuration items have to be part of a subattrs
+ flattenKConf = nested: mapAttrs (_: head) (zipAttrs (attrValues nested));
+
+ whenPlatformHasEBPFJit =
+ mkIf (stdenv.hostPlatform.isAarch32 ||
+ stdenv.hostPlatform.isAarch64 ||
+ stdenv.hostPlatform.isx86_64 ||
+ (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit) ||
+ (stdenv.hostPlatform.isMips && stdenv.hostPlatform.is64bit));
+
+ options = {
+
+ debug = {
+ DEBUG_INFO = if (features.debug or false) then yes else no;
+ DEBUG_KERNEL = yes;
+ DEBUG_DEVRES = no;
+ DYNAMIC_DEBUG = yes;
+ TIMER_STATS = whenOlder "4.11" yes;
+ DEBUG_NX_TEST = whenOlder "4.11" no;
+ DEBUG_STACK_USAGE = no;
+ DEBUG_STACKOVERFLOW = mkIf (!features.grsecurity) (option no);
+ RCU_TORTURE_TEST = no;
+ SCHEDSTATS = no;
+ DETECT_HUNG_TASK = yes;
+ CRASH_DUMP = option no;
+ # Easier debugging of NFS issues.
+ SUNRPC_DEBUG = yes;
+ # Provide access to tunables like sched_migration_cost_ns
+ SCHED_DEBUG = yes;
+ };
+
+ power-management = {
+ PM_ADVANCED_DEBUG = yes;
+ X86_INTEL_LPSS = yes;
+ X86_INTEL_PSTATE = yes;
+ INTEL_IDLE = yes;
+ CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes;
+ CPU_FREQ_GOV_SCHEDUTIL = whenAtLeast "4.9" yes;
+ PM_WAKELOCKS = yes;
+ # Power-capping framework and support for INTEL RAPL
+ POWERCAP = yes;
+ INTEL_RAPL = whenAtLeast "5.3" module;
+ };
+
+ external-firmware = {
+ # Support drivers that need external firmware.
+ STANDALONE = no;
+ };
+
+ proc-config-gz = {
+ # Make /proc/config.gz available
+ IKCONFIG = yes;
+ IKCONFIG_PROC = yes;
+ };
+
+ optimization = {
+ # Optimize with -O2, not -Os
+ CC_OPTIMIZE_FOR_SIZE = no;
+ };
+
+ memtest = {
+ MEMTEST = yes;
+ };
+
+ # Include the CFQ I/O scheduler in the kernel, rather than as a
+ # module, so that the initrd gets a good I/O scheduler.
+ scheduler = {
+ IOSCHED_CFQ = whenOlder "5.0" yes; # Removed in 5.0-RC1
+ BLK_CGROUP = yes; # required by CFQ"
+ BLK_CGROUP_IOLATENCY = whenAtLeast "4.19" yes;
+ BLK_CGROUP_IOCOST = whenAtLeast "5.4" yes;
+ IOSCHED_DEADLINE = whenOlder "5.0" yes; # Removed in 5.0-RC1
+ MQ_IOSCHED_DEADLINE = whenAtLeast "4.11" yes;
+ BFQ_GROUP_IOSCHED = whenAtLeast "4.12" yes;
+ MQ_IOSCHED_KYBER = whenAtLeast "4.12" yes;
+ IOSCHED_BFQ = whenAtLeast "4.12" module;
+ };
+
+ # Enable NUMA.
+ numa = {
+ NUMA = option yes;
+ };
+
+ networking = {
+ NET = yes;
+ IP_ADVANCED_ROUTER = yes;
+ IP_PNP = no;
+ IP_VS_PROTO_TCP = yes;
+ IP_VS_PROTO_UDP = yes;
+ IP_VS_PROTO_ESP = yes;
+ IP_VS_PROTO_AH = yes;
+ IP_VS_IPV6 = yes;
+ IP_DCCP_CCID3 = no; # experimental
+ CLS_U32_PERF = yes;
+ CLS_U32_MARK = yes;
+ BPF_JIT = whenPlatformHasEBPFJit yes;
+ BPF_JIT_ALWAYS_ON = whenPlatformHasEBPFJit no; # whenPlatformHasEBPFJit yes; # see https://github.com/NixOS/nixpkgs/issues/79304
+ HAVE_EBPF_JIT = whenPlatformHasEBPFJit yes;
+ BPF_STREAM_PARSER = whenAtLeast "4.19" yes;
+ XDP_SOCKETS = whenAtLeast "4.19" yes;
+ XDP_SOCKETS_DIAG = whenAtLeast "5.1" yes;
+ WAN = yes;
+ TCP_CONG_CUBIC = yes; # This is the default congestion control algorithm since 2.6.19
+ # Required by systemd per-cgroup firewalling
+ CGROUP_BPF = option yes;
+ CGROUP_NET_PRIO = yes; # Required by systemd
+ IP_ROUTE_VERBOSE = yes;
+ IP_MROUTE_MULTIPLE_TABLES = yes;
+ IP_MULTICAST = yes;
+ IP_MULTIPLE_TABLES = yes;
+ IPV6_ROUTER_PREF = yes;
+ IPV6_ROUTE_INFO = yes;
+ IPV6_OPTIMISTIC_DAD = yes;
+ IPV6_MULTIPLE_TABLES = yes;
+ IPV6_SUBTREES = yes;
+ IPV6_MROUTE = yes;
+ IPV6_MROUTE_MULTIPLE_TABLES = yes;
+ IPV6_PIMSM_V2 = yes;
+ IPV6_FOU_TUNNEL = whenAtLeast "4.7" module;
+ NET_CLS_BPF = whenAtLeast "4.4" module;
+ NET_ACT_BPF = whenAtLeast "4.4" module;
+ NET_SCHED = yes;
+ L2TP_V3 = yes;
+ L2TP_IP = module;
+ L2TP_ETH = module;
+ BRIDGE_VLAN_FILTERING = yes;
+ BONDING = module;
+ NET_L3_MASTER_DEV = option yes;
+ NET_FOU_IP_TUNNELS = option yes;
+ IP_NF_TARGET_REDIRECT = module;
+
+ PPP_MULTILINK = yes; # PPP multilink support
+ PPP_FILTER = yes;
+
+ # needed for iwd WPS support (wpa_supplicant replacement)
+ KEY_DH_OPERATIONS = whenAtLeast "4.7" yes;
+
+ # needed for nftables
+ # Networking Options
+ NETFILTER = yes;
+ NETFILTER_ADVANCED = yes;
+ # Core Netfilter Configuration
+ NF_CONNTRACK_ZONES = yes;
+ NF_CONNTRACK_EVENTS = yes;
+ NF_CONNTRACK_TIMEOUT = yes;
+ NF_CONNTRACK_TIMESTAMP = yes;
+ NETFILTER_NETLINK_GLUE_CT = yes;
+ NF_TABLES_INET = mkMerge [ (whenOlder "4.17" module)
+ (whenAtLeast "4.17" yes) ];
+ NF_TABLES_NETDEV = mkMerge [ (whenOlder "4.17" module)
+ (whenAtLeast "4.17" yes) ];
+ # IP: Netfilter Configuration
+ NF_TABLES_IPV4 = mkMerge [ (whenOlder "4.17" module)
+ (whenAtLeast "4.17" yes) ];
+ NF_TABLES_ARP = mkMerge [ (whenOlder "4.17" module)
+ (whenAtLeast "4.17" yes) ];
+ # IPv6: Netfilter Configuration
+ NF_TABLES_IPV6 = mkMerge [ (whenOlder "4.17" module)
+ (whenAtLeast "4.17" yes) ];
+ # Bridge Netfilter Configuration
+ NF_TABLES_BRIDGE = mkMerge [ (whenBetween "4.19" "5.3" yes)
+ (whenAtLeast "5.3" module) ];
+
+ # needed for `dropwatch`
+ # Builtin-only since https://github.com/torvalds/linux/commit/f4b6bcc7002f0e3a3428bac33cf1945abff95450
+ NET_DROP_MONITOR = yes;
+
+ # needed for ss
+ INET_DIAG = module;
+ INET_TCP_DIAG = module;
+ INET_UDP_DIAG = module;
+ INET_RAW_DIAG = whenAtLeast "4.14" module;
+ INET_DIAG_DESTROY = whenAtLeast "4.9" yes;
+ };
+
+ wireless = {
+ CFG80211_WEXT = option yes; # Without it, ipw2200 drivers don't build
+ IPW2100_MONITOR = option yes; # support promiscuous mode
+ IPW2200_MONITOR = option yes; # support promiscuous mode
+ HOSTAP_FIRMWARE = option yes; # Support downloading firmware images with Host AP driver
+ HOSTAP_FIRMWARE_NVRAM = option yes;
+ ATH9K_PCI = option yes; # Detect Atheros AR9xxx cards on PCI(e) bus
+ ATH9K_AHB = option yes; # Ditto, AHB bus
+ B43_PHY_HT = option yes;
+ BCMA_HOST_PCI = option yes;
+ RTW88 = whenAtLeast "5.2" module;
+ RTW88_8822BE = mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ];
+ RTW88_8822CE = mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ];
+ };
+
+ fb = {
+ FB = yes;
+ FB_EFI = yes;
+ FB_NVIDIA_I2C = yes; # Enable DDC Support
+ FB_RIVA_I2C = yes;
+ FB_ATY_CT = yes; # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+ FB_ATY_GX = yes; # Mach64 GX support
+ FB_SAVAGE_I2C = yes;
+ FB_SAVAGE_ACCEL = yes;
+ FB_SIS_300 = yes;
+ FB_SIS_315 = yes;
+ FB_3DFX_ACCEL = yes;
+ FB_VESA = yes;
+ FRAMEBUFFER_CONSOLE = yes;
+ FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = whenAtLeast "4.19" yes;
+ FRAMEBUFFER_CONSOLE_ROTATION = yes;
+ FB_GEODE = mkIf (stdenv.hostPlatform.system == "i686-linux") yes;
+ };
+
+ video = {
+ # Allow specifying custom EDID on the kernel command line
+ DRM_LOAD_EDID_FIRMWARE = yes;
+ VGA_SWITCHEROO = yes; # Hybrid graphics support
+ DRM_GMA600 = yes;
+ DRM_GMA3600 = yes;
+ DRM_VMWGFX_FBCON = yes;
+ # necessary for amdgpu polaris support
+ DRM_AMD_POWERPLAY = whenBetween "4.5" "4.9" yes;
+ # (experimental) amdgpu support for verde and newer chipsets
+ DRM_AMDGPU_SI = whenAtLeast "4.9" yes;
+ # (stable) amdgpu support for bonaire and newer chipsets
+ DRM_AMDGPU_CIK = whenAtLeast "4.9" yes;
+ # Allow device firmware updates
+ DRM_DP_AUX_CHARDEV = whenAtLeast "4.6" yes;
+ } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") {
+ # Intel GVT-g graphics virtualization supports 64-bit only
+ DRM_I915_GVT = whenAtLeast "4.16" yes;
+ DRM_I915_GVT_KVMGT = whenAtLeast "4.16" module;
+ };
+
+ sound = {
+ SND_DYNAMIC_MINORS = yes;
+ SND_AC97_POWER_SAVE = yes; # AC97 Power-Saving Mode
+ SND_HDA_INPUT_BEEP = yes; # Support digital beep via input layer
+ SND_HDA_RECONFIG = yes; # Support reconfiguration of jack functions
+ # Support configuring jack functions via fw mechanism at boot
+ SND_HDA_PATCH_LOADER = yes;
+ SND_HDA_CODEC_CA0132_DSP = whenOlder "5.7" yes; # Enable DSP firmware loading on Creative Soundblaster Z/Zx/ZxR/Recon
+ SND_OSSEMUL = yes;
+ SND_USB_CAIAQ_INPUT = yes;
+ # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+ PSS_MIXER = whenOlder "4.12" yes;
+ # Enable Sound Open Firmware support
+ } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" &&
+ versionAtLeast version "5.5") {
+ SND_SOC_SOF_TOPLEVEL = yes;
+ SND_SOC_SOF_ACPI = module;
+ SND_SOC_SOF_PCI = module;
+ SND_SOC_SOF_APOLLOLAKE_SUPPORT = yes;
+ SND_SOC_SOF_CANNONLAKE_SUPPORT = yes;
+ SND_SOC_SOF_COFFEELAKE_SUPPORT = yes;
+ SND_SOC_SOF_COMETLAKE_H_SUPPORT = whenOlder "5.8" yes;
+ SND_SOC_SOF_COMETLAKE_LP_SUPPORT = yes;
+ SND_SOC_SOF_ELKHARTLAKE_SUPPORT = yes;
+ SND_SOC_SOF_GEMINILAKE_SUPPORT = yes;
+ SND_SOC_SOF_HDA_AUDIO_CODEC = yes;
+ SND_SOC_SOF_HDA_COMMON_HDMI_CODEC = whenOlder "5.7" yes;
+ SND_SOC_SOF_HDA_LINK = yes;
+ SND_SOC_SOF_ICELAKE_SUPPORT = yes;
+ SND_SOC_SOF_INTEL_TOPLEVEL = yes;
+ SND_SOC_SOF_JASPERLAKE_SUPPORT = yes;
+ SND_SOC_SOF_MERRIFIELD_SUPPORT = yes;
+ SND_SOC_SOF_TIGERLAKE_SUPPORT = yes;
+ };
+
+ usb-serial = {
+ USB_SERIAL_GENERIC = yes; # USB Generic Serial Driver
+ } // optionalAttrs (versionOlder version "4.16") {
+ # Include firmware for various USB serial devices.
+ # Only applicable for kernels below 4.16, after that no firmware is shipped in the kernel tree.
+ USB_SERIAL_KEYSPAN_MPR = yes;
+ USB_SERIAL_KEYSPAN_USA28 = yes;
+ USB_SERIAL_KEYSPAN_USA28X = yes;
+ USB_SERIAL_KEYSPAN_USA28XA = yes;
+ USB_SERIAL_KEYSPAN_USA28XB = yes;
+ USB_SERIAL_KEYSPAN_USA19 = yes;
+ USB_SERIAL_KEYSPAN_USA18X = yes;
+ USB_SERIAL_KEYSPAN_USA19W = yes;
+ USB_SERIAL_KEYSPAN_USA19QW = yes;
+ USB_SERIAL_KEYSPAN_USA19QI = yes;
+ USB_SERIAL_KEYSPAN_USA49W = yes;
+ USB_SERIAL_KEYSPAN_USA49WLC = yes;
+ };
+
+ usb = {
+ USB_DEBUG = { optional = true; tristate = whenOlder "4.18" "n";};
+ USB_EHCI_ROOT_HUB_TT = yes; # Root Hub Transaction Translators
+ USB_EHCI_TT_NEWSCHED = yes; # Improved transaction translator scheduling
+ USB_HIDDEV = yes; # USB Raw HID Devices (like monitor controls and Uninterruptable Power Supplies)
+ };
+
+ # Filesystem options - in particular, enable extended attributes and
+ # ACLs for all filesystems that support them.
+ filesystem = {
+ FANOTIFY = yes;
+ TMPFS = yes;
+ TMPFS_POSIX_ACL = yes;
+ FS_ENCRYPTION = if (versionAtLeast version "5.1") then yes else whenAtLeast "4.9" (option module);
+
+ EXT2_FS_XATTR = yes;
+ EXT2_FS_POSIX_ACL = yes;
+ EXT2_FS_SECURITY = yes;
+
+ EXT3_FS_POSIX_ACL = yes;
+ EXT3_FS_SECURITY = yes;
+
+ EXT4_FS_POSIX_ACL = yes;
+ EXT4_FS_SECURITY = yes;
+ EXT4_ENCRYPTION = { optional = true; tristate = if (versionOlder version "4.8") then "m" else "y"; };
+
+ REISERFS_FS_XATTR = option yes;
+ REISERFS_FS_POSIX_ACL = option yes;
+ REISERFS_FS_SECURITY = option yes;
+
+ JFS_POSIX_ACL = option yes;
+ JFS_SECURITY = option yes;
+
+ XFS_QUOTA = option yes;
+ XFS_POSIX_ACL = option yes;
+ XFS_RT = option yes; # XFS Realtime subvolume support
+
+ OCFS2_DEBUG_MASKLOG = option no;
+
+ BTRFS_FS_POSIX_ACL = yes;
+
+ UBIFS_FS_ADVANCED_COMPR = option yes;
+
+ F2FS_FS = module;
+ F2FS_FS_SECURITY = option yes;
+ F2FS_FS_ENCRYPTION = option yes;
+ UDF_FS = module;
+
+ NFSD_PNFS = whenBetween "4.0" "4.6" yes;
+ NFSD_V2_ACL = yes;
+ NFSD_V3 = yes;
+ NFSD_V3_ACL = yes;
+ NFSD_V4 = yes;
+ NFSD_V4_SECURITY_LABEL = yes;
+
+ NFS_FSCACHE = yes;
+ NFS_SWAP = yes;
+ NFS_V3_ACL = yes;
+ NFS_V4_1 = yes; # NFSv4.1 client support
+ NFS_V4_2 = yes;
+ NFS_V4_SECURITY_LABEL = yes;
+
+ CIFS_XATTR = yes;
+ CIFS_POSIX = option yes;
+ CIFS_FSCACHE = yes;
+ CIFS_STATS = whenOlder "4.19" yes;
+ CIFS_WEAK_PW_HASH = yes;
+ CIFS_UPCALL = yes;
+ CIFS_ACL = whenOlder "5.3" yes;
+ CIFS_DFS_UPCALL = yes;
+ CIFS_SMB2 = whenOlder "4.13" yes;
+
+ CEPH_FSCACHE = yes;
+ CEPH_FS_POSIX_ACL = yes;
+
+ SQUASHFS_FILE_DIRECT = yes;
+ SQUASHFS_DECOMP_MULTI_PERCPU = yes;
+ SQUASHFS_XATTR = yes;
+ SQUASHFS_ZLIB = yes;
+ SQUASHFS_LZO = yes;
+ SQUASHFS_XZ = yes;
+ SQUASHFS_LZ4 = yes;
+ SQUASHFS_ZSTD = whenAtLeast "4.14" yes;
+
+ # Native Language Support modules, needed by some filesystems
+ NLS = yes;
+ NLS_DEFAULT = freeform "utf8";
+ NLS_UTF8 = module;
+ NLS_CODEPAGE_437 = module; # VFAT default for the codepage= mount option
+ NLS_ISO8859_1 = module; # VFAT default for the iocharset= mount option
+
+ DEVTMPFS = yes;
+ };
+
+ security = {
+ # Detect writes to read-only module pages
+ DEBUG_SET_MODULE_RONX = { optional = true; tristate = whenOlder "4.11" "y"; };
+ RANDOMIZE_BASE = option yes;
+ STRICT_DEVMEM = option yes; # Filter access to /dev/mem
+ SECURITY_SELINUX_BOOTPARAM_VALUE = whenOlder "5.1" (freeform "0"); # Disable SELinux by default
+ # Prevent processes from ptracing non-children processes
+ SECURITY_YAMA = option yes;
+ DEVKMEM = mkIf (!features.grsecurity) no; # Disable /dev/kmem
+
+ USER_NS = yes; # Support for user namespaces
+
+ SECURITY_APPARMOR = yes;
+ DEFAULT_SECURITY_APPARMOR = yes;
+
+ SECURITY_LOCKDOWN_LSM = whenAtLeast "5.4" yes;
+ } // optionalAttrs (!stdenv.hostPlatform.isAarch32) {
+
+ # Detect buffer overflows on the stack
+ CC_STACKPROTECTOR_REGULAR = {optional = true; tristate = whenOlder "4.18" "y";};
+ };
+
+ microcode = {
+ MICROCODE = yes;
+ MICROCODE_INTEL = yes;
+ MICROCODE_AMD = yes;
+ } // optionalAttrs (versionAtLeast version "4.10") {
+ # Write Back Throttling
+ # https://lwn.net/Articles/682582/
+ # https://bugzilla.kernel.org/show_bug.cgi?id=12309#c655
+ BLK_WBT = yes;
+ BLK_WBT_SQ = whenOlder "5.0" yes; # Removed in 5.0-RC1
+ BLK_WBT_MQ = yes;
+ };
+
+ container = {
+ NAMESPACES = yes; # Required by 'unshare' used by 'nixos-install'
+ RT_GROUP_SCHED = no;
+ CGROUP_DEVICE = yes;
+ CGROUP_HUGETLB = yes;
+ CGROUP_PERF = yes;
+ CGROUP_RDMA = whenAtLeast "4.11" yes;
+
+ MEMCG = yes;
+ MEMCG_SWAP = yes;
+
+ DEVPTS_MULTIPLE_INSTANCES = whenOlder "4.7" yes;
+ BLK_DEV_THROTTLING = yes;
+ CFQ_GROUP_IOSCHED = whenOlder "5.0" yes; # Removed in 5.0-RC1
+ CGROUP_PIDS = whenAtLeast "4.3" yes;
+ };
+
+ staging = {
+ # Enable staging drivers. These are somewhat experimental, but
+ # they generally don't hurt.
+ STAGING = yes;
+ };
+
+ proc-events = {
+ # PROC_EVENTS requires that the netlink connector is not built
+ # as a module. This is required by libcgroup's cgrulesengd.
+ CONNECTOR = yes;
+ PROC_EVENTS = yes;
+ };
+
+ tracing = {
+ FTRACE = yes;
+ KPROBES = yes;
+ FUNCTION_TRACER = yes;
+ FTRACE_SYSCALLS = yes;
+ SCHED_TRACER = yes;
+ STACK_TRACER = yes;
+ UPROBE_EVENT = { optional = true; tristate = whenOlder "4.11" "y";};
+ UPROBE_EVENTS = { optional = true; tristate = whenAtLeast "4.11" "y";};
+ BPF_SYSCALL = whenAtLeast "4.4" yes;
+ BPF_EVENTS = whenAtLeast "4.4" yes;
+ FUNCTION_PROFILER = yes;
+ RING_BUFFER_BENCHMARK = no;
+ };
+
+ virtualisation = {
+ PARAVIRT = option yes;
+
+ HYPERVISOR_GUEST = mkIf (!features.grsecurity) yes;
+ PARAVIRT_SPINLOCKS = option yes;
+
+ KVM_APIC_ARCHITECTURE = whenOlder "4.8" yes;
+ KVM_ASYNC_PF = yes;
+ KVM_COMPAT = { optional = true; tristate = whenBetween "4.0" "4.12" "y"; };
+ KVM_DEVICE_ASSIGNMENT = { optional = true; tristate = whenBetween "3.10" "4.12" "y"; };
+ KVM_GENERIC_DIRTYLOG_READ_PROTECT = whenAtLeast "4.0" yes;
+ KVM_GUEST = mkIf (!features.grsecurity) yes;
+ KVM_MMIO = yes;
+ KVM_VFIO = yes;
+ KSM = yes;
+ VIRT_DRIVERS = yes;
+ # We nneed 64 GB (PAE) support for Xen guest support
+ HIGHMEM64G = { optional = true; tristate = mkIf (!stdenv.is64bit) "y";};
+
+ VFIO_PCI_VGA = mkIf stdenv.is64bit yes;
+
+ # VirtualBox guest drivers in the kernel conflict with the ones in the
+ # official additions package and prevent the vboxsf module from loading,
+ # so disable them for now.
+ VBOXGUEST = option no;
+ DRM_VBOXVIDEO = option no;
+
+ } // optionalAttrs (stdenv.isx86_64 || stdenv.isi686) ({
+ XEN = option yes;
+
+ # XXX: why isn't this in the xen-dom0 conditional section below?
+ XEN_DOM0 = option yes;
+
+ } // optionalAttrs features.xen_dom0 {
+ PCI_XEN = option yes;
+ HVC_XEN = option yes;
+ HVC_XEN_FRONTEND = option yes;
+ XEN_SYS_HYPERVISOR = option yes;
+ SWIOTLB_XEN = option yes;
+ XEN_BACKEND = option yes;
+ XEN_BALLOON = option yes;
+ XEN_BALLOON_MEMORY_HOTPLUG = option yes;
+ XEN_EFI = option yes;
+ XEN_HAVE_PVMMU = option yes;
+ XEN_MCE_LOG = option yes;
+ XEN_PVH = option yes;
+ XEN_PVHVM = option yes;
+ XEN_SAVE_RESTORE = option yes;
+ XEN_SCRUB_PAGES = option yes;
+ XEN_SELFBALLOONING = option yes;
+ XEN_STUB = option yes;
+ XEN_TMEM = option yes;
+ });
+
+ media = {
+ MEDIA_DIGITAL_TV_SUPPORT = yes;
+ MEDIA_CAMERA_SUPPORT = yes;
+ MEDIA_RC_SUPPORT = whenOlder "4.14" yes;
+ MEDIA_CONTROLLER = yes;
+ MEDIA_PCI_SUPPORT = yes;
+ MEDIA_USB_SUPPORT = yes;
+ MEDIA_ANALOG_TV_SUPPORT = yes;
+ VIDEO_STK1160_COMMON = module;
+ VIDEO_STK1160_AC97 = whenOlder "4.11" yes;
+ };
+
+ "9p" = {
+ # Enable the 9P cache to speed up NixOS VM tests.
+ "9P_FSCACHE" = option yes;
+ "9P_FS_POSIX_ACL" = option yes;
+ };
+
+ huge-page = {
+ TRANSPARENT_HUGEPAGE = option yes;
+ TRANSPARENT_HUGEPAGE_ALWAYS = option no;
+ TRANSPARENT_HUGEPAGE_MADVISE = option yes;
+ };
+
+ zram = {
+ ZRAM = module;
+ ZSWAP = option yes;
+ ZBUD = option yes;
+ ZSMALLOC = module;
+ };
+
+ brcmfmac = {
+ # Enable PCIe and USB for the brcmfmac driver
+ BRCMFMAC_USB = option yes;
+ BRCMFMAC_PCIE = option yes;
+ };
+
+ # Support x2APIC (which requires IRQ remapping)
+ x2apic = optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") {
+ X86_X2APIC = yes;
+ IRQ_REMAP = yes;
+ };
+
+ # Disable various self-test modules that have no use in a production system
+ tests = {
+ # This menu disables all/most of them on >= 4.16
+ RUNTIME_TESTING_MENU = option no;
+ } // optionalAttrs (versionOlder version "4.16") {
+ # For older kernels, painstakingly disable each symbol.
+ ARM_KPROBES_TEST = option no;
+ ASYNC_RAID6_TEST = option no;
+ ATOMIC64_SELFTEST = option no;
+ BACKTRACE_SELF_TEST = option no;
+ INTERVAL_TREE_TEST = option no;
+ PERCPU_TEST = option no;
+ RBTREE_TEST = option no;
+ TEST_BITMAP = option no;
+ TEST_BPF = option no;
+ TEST_FIRMWARE = option no;
+ TEST_HASH = option no;
+ TEST_HEXDUMP = option no;
+ TEST_KMOD = option no;
+ TEST_KSTRTOX = option no;
+ TEST_LIST_SORT = option no;
+ TEST_LKM = option no;
+ TEST_PARMAN = option no;
+ TEST_PRINTF = option no;
+ TEST_RHASHTABLE = option no;
+ TEST_SORT = option no;
+ TEST_STATIC_KEYS = option no;
+ TEST_STRING_HELPERS = option no;
+ TEST_UDELAY = option no;
+ TEST_USER_COPY = option no;
+ TEST_UUID = option no;
+ } // {
+ CRC32_SELFTEST = option no;
+ CRYPTO_TEST = option no;
+ EFI_TEST = option no;
+ GLOB_SELFTEST = option no;
+ DRM_DEBUG_MM_SELFTEST = { optional = true; tristate = whenOlder "4.18" "n";};
+ LNET_SELFTEST = { optional = true; tristate = whenOlder "4.18" "n";};
+ LOCK_TORTURE_TEST = option no;
+ MTD_TESTS = option no;
+ NOTIFIER_ERROR_INJECTION = option no;
+ RCU_PERF_TEST = option no;
+ RCU_TORTURE_TEST = option no;
+ TEST_ASYNC_DRIVER_PROBE = option no;
+ WW_MUTEX_SELFTEST = option no;
+ XZ_DEC_TEST = option no;
+ };
+
+ criu = optionalAttrs (features.criu or false) ({
+ EXPERT = yes;
+ CHECKPOINT_RESTORE = yes;
+ } // optionalAttrs (features.criu_revert_expert or true) {
+ RFKILL_INPUT = option yes;
+ HID_PICOLCD_FB = option yes;
+ HID_PICOLCD_BACKLIGHT = option yes;
+ HID_PICOLCD_LCD = option yes;
+ HID_PICOLCD_LEDS = option yes;
+ HID_PICOLCD_CIR = option yes;
+ DEBUG_MEMORY_INIT = option yes;
+ });
+
+ misc = {
+ HID_BATTERY_STRENGTH = yes;
+ # enabled by default in x86_64 but not arm64, so we do that here
+ HIDRAW = yes;
+
+ HID_ACRUX_FF = yes;
+ DRAGONRISE_FF = yes;
+ HOLTEK_FF = yes;
+ SONY_FF = yes;
+ SMARTJOYPLUS_FF = yes;
+ THRUSTMASTER_FF = yes;
+ ZEROPLUS_FF = yes;
+
+ MODULE_COMPRESS = yes;
+ MODULE_COMPRESS_XZ = yes;
+ KERNEL_XZ = yes;
+
+ SYSVIPC = yes; # System-V IPC
+
+ AIO = yes; # POSIX asynchronous I/O
+
+ UNIX = yes; # Unix domain sockets.
+
+ MD = yes; # Device mapper (RAID, LVM, etc.)
+
+ # Enable initrd support.
+ BLK_DEV_RAM = yes;
+ BLK_DEV_INITRD = yes;
+
+ PM_TRACE_RTC = no; # Disable some expensive (?) features.
+ ACCESSIBILITY = yes; # Accessibility support
+ AUXDISPLAY = yes; # Auxiliary Display support
+ DONGLE = whenOlder "4.17" yes; # Serial dongle support
+ HIPPI = yes;
+ MTD_COMPLEX_MAPPINGS = yes; # needed for many devices
+
+ SCSI_LOWLEVEL = yes; # enable lots of SCSI devices
+ SCSI_LOWLEVEL_PCMCIA = yes;
+ SCSI_SAS_ATA = yes; # added to enable detection of hard drive
+
+ SPI = yes; # needed for many devices
+ SPI_MASTER = yes;
+
+ "8139TOO_8129" = yes;
+ "8139TOO_PIO" = no; # PIO is slower
+
+ AIC79XX_DEBUG_ENABLE = no;
+ AIC7XXX_DEBUG_ENABLE = no;
+ AIC94XX_DEBUG = no;
+ B43_PCMCIA = { optional=true; tristate = whenOlder "4.4" "y";};
+
+ BLK_DEV_INTEGRITY = yes;
+
+ BLK_SED_OPAL = whenAtLeast "4.14" yes;
+
+ BSD_PROCESS_ACCT_V3 = yes;
+
+ BT_HCIUART_BCSP = option yes;
+ BT_HCIUART_H4 = option yes; # UART (H4) protocol support
+ BT_HCIUART_LL = option yes;
+ BT_RFCOMM_TTY = option yes; # RFCOMM TTY support
+
+ CLEANCACHE = option yes;
+ CRASH_DUMP = option no;
+
+ DVB_DYNAMIC_MINORS = option yes; # we use udev
+
+ EFI_STUB = yes; # EFI bootloader in the bzImage itself
+ CGROUPS = yes; # used by systemd
+ FHANDLE = yes; # used by systemd
+ SECCOMP = yes; # used by systemd >= 231
+ SECCOMP_FILTER = yes; # ditto
+ POSIX_MQUEUE = yes;
+ FRONTSWAP = yes;
+ FUSION = yes; # Fusion MPT device support
+ IDE = no; # deprecated IDE support
+ IDLE_PAGE_TRACKING = yes;
+ IRDA_ULTRA = whenOlder "4.17" yes; # Ultra (connectionless) protocol
+
+ JOYSTICK_IFORCE_232 = { optional = true; tristate = whenOlder "5.3" "y"; }; # I-Force Serial joysticks and wheels
+ JOYSTICK_IFORCE_USB = { optional = true; tristate = whenOlder "5.3" "y"; }; # I-Force USB joysticks and wheels
+ JOYSTICK_XPAD_FF = option yes; # X-Box gamepad rumble support
+ JOYSTICK_XPAD_LEDS = option yes; # LED Support for Xbox360 controller 'BigX' LED
+
+ KEYBOARD_APPLESPI = whenAtLeast "5.3" module;
+
+ KEXEC_FILE = option yes;
+ KEXEC_JUMP = option yes;
+
+ PARTITION_ADVANCED = yes; # Needed for LDM_PARTITION
+ # Windows Logical Disk Manager (Dynamic Disk) support
+ LDM_PARTITION = yes;
+ LOGIRUMBLEPAD2_FF = yes; # Logitech Rumblepad 2 force feedback
+ LOGO = no; # not needed
+ MEDIA_ATTACH = yes;
+ MEGARAID_NEWGEN = yes;
+
+ MLX4_EN_VXLAN = whenOlder "4.8" yes;
+ MLX5_CORE_EN = option yes;
+
+ PSI = whenAtLeast "4.20" yes;
+
+ MODVERSIONS = whenOlder "4.9" yes;
+ MOUSE_ELAN_I2C_SMBUS = yes;
+ MOUSE_PS2_ELANTECH = yes; # Elantech PS/2 protocol extension
+ MTRR_SANITIZER = yes;
+ NET_FC = yes; # Fibre Channel driver support
+ # GPIO on Intel Bay Trail, for some Chromebook internal eMMC disks
+ PINCTRL_BAYTRAIL = yes;
+ # 8 is default. Modern gpt tables on eMMC may go far beyond 8.
+ MMC_BLOCK_MINORS = freeform "32";
+
+ REGULATOR = yes; # Voltage and Current Regulator Support
+ RC_DEVICES = option yes; # Enable IR devices
+
+ RT2800USB_RT53XX = yes;
+ RT2800USB_RT55XX = yes;
+
+ SCHED_AUTOGROUP = yes;
+ CFS_BANDWIDTH = yes;
+
+ SCSI_LOGGING = yes; # SCSI logging facility
+ SERIAL_8250 = yes; # 8250/16550 and compatible serial support
+
+ SLIP_COMPRESSED = yes; # CSLIP compressed headers
+ SLIP_SMART = yes;
+
+ HWMON = yes;
+ THERMAL_HWMON = yes; # Hardware monitoring support
+ NVME_HWMON = whenAtLeast "5.5" yes; # NVMe drives temperature reporting
+ UEVENT_HELPER = no;
+
+ USERFAULTFD = yes;
+ X86_CHECK_BIOS_CORRUPTION = yes;
+ X86_MCE = yes;
+
+ # Our initrd init uses shebang scripts, so can't be modular.
+ BINFMT_SCRIPT = yes;
+ # For systemd-binfmt
+ BINFMT_MISC = option yes;
+
+ # Disable the firmware helper fallback, udev doesn't implement it any more
+ FW_LOADER_USER_HELPER_FALLBACK = option no;
+
+ HOTPLUG_PCI_ACPI = yes; # PCI hotplug using ACPI
+ HOTPLUG_PCI_PCIE = yes; # PCI-Expresscard hotplug support
+
+ # Enable AMD's ROCm GPU compute stack
+ HSA_AMD = mkIf stdenv.hostPlatform.is64bit (whenAtLeast "4.20" yes);
+ ZONE_DEVICE = mkIf stdenv.hostPlatform.is64bit (whenAtLeast "5.3" yes);
+ HMM_MIRROR = whenAtLeast "5.3" yes;
+ DRM_AMDGPU_USERPTR = whenAtLeast "5.3" yes;
+
+ PREEMPT = no;
+ PREEMPT_VOLUNTARY = yes;
+
+ X86_AMD_PLATFORM_DEVICE = yes;
+
+ } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux") {
+ # Enable CPU/memory hotplug support
+ # Allows you to dynamically add & remove CPUs/memory to a VM client running NixOS without requiring a reboot
+ ACPI_HOTPLUG_CPU = yes;
+ ACPI_HOTPLUG_MEMORY = yes;
+ MEMORY_HOTPLUG = yes;
+ MEMORY_HOTREMOVE = yes;
+ HOTPLUG_CPU = yes;
+ MIGRATION = yes;
+ SPARSEMEM = yes;
+
+ # Bump the maximum number of CPUs to support systems like EC2 x1.*
+ # instances and Xeon Phi.
+ NR_CPUS = freeform "384";
+ } // optionalAttrs (stdenv.hostPlatform.system == "aarch64-linux") {
+ # Enables support for the Allwinner Display Engine 2.0
+ SUN8I_DE2_CCU = whenAtLeast "4.13" yes;
+
+ # See comments on https://github.com/NixOS/nixpkgs/commit/9b67ea9106102d882f53d62890468071900b9647
+ CRYPTO_AEGIS128_SIMD = whenAtLeast "5.4" no;
+ };
+ };
+in
+ flattenKConf options
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.11.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.11.patch
new file mode 100644
index 000000000000..38cc0532ba97
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.11.patch
@@ -0,0 +1,784 @@
+commit 827b86ad1dd21feed4c0b99faf6059f245f7dadb
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Misc preps for cgroup unified hierarchy interface
+
+ Make the following changes in preparation for the cpu controller
+ interface implementation for the unified hierarchy. This patch
+ doesn't cause any functional differences.
+
+ * s/cpu_stats_show()/cpu_cfs_stats_show()/
+
+ * s/cpu_files/cpu_legacy_files/
+
+ * Separate out cpuacct_stats_read() from cpuacct_stats_show(). While
+ at it, make the @val array u64 for consistency.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 3b31fc05a0f1..a1b95e83fa87 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -7174,7 +7174,7 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
+ return ret;
+ }
+
+-static int cpu_stats_show(struct seq_file *sf, void *v)
++static int cpu_cfs_stats_show(struct seq_file *sf, void *v)
+ {
+ struct task_group *tg = css_tg(seq_css(sf));
+ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
+@@ -7214,7 +7214,7 @@ static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css,
+ }
+ #endif /* CONFIG_RT_GROUP_SCHED */
+
+-static struct cftype cpu_files[] = {
++static struct cftype cpu_legacy_files[] = {
+ #ifdef CONFIG_FAIR_GROUP_SCHED
+ {
+ .name = "shares",
+@@ -7235,7 +7235,7 @@ static struct cftype cpu_files[] = {
+ },
+ {
+ .name = "stat",
+- .seq_show = cpu_stats_show,
++ .seq_show = cpu_cfs_stats_show,
+ },
+ #endif
+ #ifdef CONFIG_RT_GROUP_SCHED
+@@ -7261,7 +7261,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .fork = cpu_cgroup_fork,
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+- .legacy_cftypes = cpu_files,
++ .legacy_cftypes = cpu_legacy_files,
+ .early_init = true,
+ };
+
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index f95ab29a45d0..6151c23f722f 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -276,26 +276,33 @@ static int cpuacct_all_seq_show(struct seq_file *m, void *V)
+ return 0;
+ }
+
+-static int cpuacct_stats_show(struct seq_file *sf, void *v)
++static void cpuacct_stats_read(struct cpuacct *ca,
++ u64 (*val)[CPUACCT_STAT_NSTATS])
+ {
+- struct cpuacct *ca = css_ca(seq_css(sf));
+- s64 val[CPUACCT_STAT_NSTATS];
+ int cpu;
+- int stat;
+
+- memset(val, 0, sizeof(val));
++ memset(val, 0, sizeof(*val));
++
+ for_each_possible_cpu(cpu) {
+ u64 *cpustat = per_cpu_ptr(ca->cpustat, cpu)->cpustat;
+
+- val[CPUACCT_STAT_USER] += cpustat[CPUTIME_USER];
+- val[CPUACCT_STAT_USER] += cpustat[CPUTIME_NICE];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SYSTEM];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_IRQ];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SOFTIRQ];
++ (*val)[CPUACCT_STAT_USER] += cpustat[CPUTIME_USER];
++ (*val)[CPUACCT_STAT_USER] += cpustat[CPUTIME_NICE];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SYSTEM];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_IRQ];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SOFTIRQ];
+ }
++}
++
++static int cpuacct_stats_show(struct seq_file *sf, void *v)
++{
++ u64 val[CPUACCT_STAT_NSTATS];
++ int stat;
++
++ cpuacct_stats_read(css_ca(seq_css(sf)), &val);
+
+ for (stat = 0; stat < CPUACCT_STAT_NSTATS; stat++) {
+- seq_printf(sf, "%s %lld\n",
++ seq_printf(sf, "%s %llu\n",
+ cpuacct_stat_desc[stat],
+ (long long)nsec_to_clock_t(val[stat]));
+ }
+
+commit fdb64d002b3a223ce4bb11aa4448a42050470052
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Implement interface for cgroup unified hierarchy
+
+ While the cpu controller doesn't have any functional problems, there
+ are a couple interface issues which can be addressed in the v2
+ interface.
+
+ * cpuacct being a separate controller. This separation is artificial
+ and rather pointless as demonstrated by most use cases co-mounting
+ the two controllers. It also forces certain information to be
+ accounted twice.
+
+ * Use of different time units. Writable control knobs use
+ microseconds, some stat fields use nanoseconds while other cpuacct
+ stat fields use centiseconds.
+
+ * Control knobs which can't be used in the root cgroup still show up
+ in the root.
+
+ * Control knob names and semantics aren't consistent with other
+ controllers.
+
+ This patchset implements cpu controller's interface on the unified
+ hierarchy which adheres to the controller file conventions described
+ in Documentation/cgroups/unified-hierarchy.txt. Overall, the
+ following changes are made.
+
+ * cpuacct is implictly enabled and disabled by cpu and its information
+ is reported through "cpu.stat" which now uses microseconds for all
+ time durations. All time duration fields now have "_usec" appended
+ to them for clarity. While this doesn't solve the double accounting
+ immediately, once majority of users switch to v2, cpu can directly
+ account and report the relevant stats and cpuacct can be disabled on
+ the unified hierarchy.
+
+ Note that cpuacct.usage_percpu is currently not included in
+ "cpu.stat". If this information is actually called for, it can be
+ added later.
+
+ * "cpu.shares" is replaced with "cpu.weight" and operates on the
+ standard scale defined by CGROUP_WEIGHT_MIN/DFL/MAX (1, 100, 10000).
+ The weight is scaled to scheduler weight so that 100 maps to 1024
+ and the ratio relationship is preserved - if weight is W and its
+ scaled value is S, W / 100 == S / 1024. While the mapped range is a
+ bit smaller than the orignal scheduler weight range, the dead zones
+ on both sides are relatively small and covers wider range than the
+ nice value mappings. This file doesn't make sense in the root
+ cgroup and isn't create on root.
+
+ * "cpu.cfs_quota_us" and "cpu.cfs_period_us" are replaced by "cpu.max"
+ which contains both quota and period.
+
+ * "cpu.rt_runtime_us" and "cpu.rt_period_us" are replaced by
+ "cpu.rt.max" which contains both runtime and period.
+
+ v2: cpu_stats_show() was incorrectly using CONFIG_FAIR_GROUP_SCHED for
+ CFS bandwidth stats and also using raw division for u64. Use
+ CONFIG_CFS_BANDWITH and do_div() instead.
+
+ The semantics of "cpu.rt.max" is not fully decided yet. Dropped
+ for now.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index a1b95e83fa87..f01d56e58a1b 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -7253,6 +7253,139 @@ static struct cftype cpu_legacy_files[] = {
+ { } /* Terminate */
+ };
+
++static int cpu_stats_show(struct seq_file *sf, void *v)
++{
++ cpuacct_cpu_stats_show(sf);
++
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ struct task_group *tg = css_tg(seq_css(sf));
++ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
++ u64 throttled_usec;
++
++ throttled_usec = cfs_b->throttled_time;
++ do_div(throttled_usec, NSEC_PER_USEC);
++
++ seq_printf(sf, "nr_periods %d\n"
++ "nr_throttled %d\n"
++ "throttled_usec %llu\n",
++ cfs_b->nr_periods, cfs_b->nr_throttled,
++ throttled_usec);
++ }
++#endif
++ return 0;
++}
++
++#ifdef CONFIG_FAIR_GROUP_SCHED
++static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css,
++ struct cftype *cft)
++{
++ struct task_group *tg = css_tg(css);
++ u64 weight = scale_load_down(tg->shares);
++
++ return DIV_ROUND_CLOSEST_ULL(weight * CGROUP_WEIGHT_DFL, 1024);
++}
++
++static int cpu_weight_write_u64(struct cgroup_subsys_state *css,
++ struct cftype *cftype, u64 weight)
++{
++ /*
++ * cgroup weight knobs should use the common MIN, DFL and MAX
++ * values which are 1, 100 and 10000 respectively. While it loses
++ * a bit of range on both ends, it maps pretty well onto the shares
++ * value used by scheduler and the round-trip conversions preserve
++ * the original value over the entire range.
++ */
++ if (weight < CGROUP_WEIGHT_MIN || weight > CGROUP_WEIGHT_MAX)
++ return -ERANGE;
++
++ weight = DIV_ROUND_CLOSEST_ULL(weight * 1024, CGROUP_WEIGHT_DFL);
++
++ return sched_group_set_shares(css_tg(css), scale_load(weight));
++}
++#endif
++
++static void __maybe_unused cpu_period_quota_print(struct seq_file *sf,
++ long period, long quota)
++{
++ if (quota < 0)
++ seq_puts(sf, "max");
++ else
++ seq_printf(sf, "%ld", quota);
++
++ seq_printf(sf, " %ld\n", period);
++}
++
++/* caller should put the current value in *@periodp before calling */
++static int __maybe_unused cpu_period_quota_parse(char *buf,
++ u64 *periodp, u64 *quotap)
++{
++ char tok[21]; /* U64_MAX */
++
++ if (!sscanf(buf, "%s %llu", tok, periodp))
++ return -EINVAL;
++
++ *periodp *= NSEC_PER_USEC;
++
++ if (sscanf(tok, "%llu", quotap))
++ *quotap *= NSEC_PER_USEC;
++ else if (!strcmp(tok, "max"))
++ *quotap = RUNTIME_INF;
++ else
++ return -EINVAL;
++
++ return 0;
++}
++
++#ifdef CONFIG_CFS_BANDWIDTH
++static int cpu_max_show(struct seq_file *sf, void *v)
++{
++ struct task_group *tg = css_tg(seq_css(sf));
++
++ cpu_period_quota_print(sf, tg_get_cfs_period(tg), tg_get_cfs_quota(tg));
++ return 0;
++}
++
++static ssize_t cpu_max_write(struct kernfs_open_file *of,
++ char *buf, size_t nbytes, loff_t off)
++{
++ struct task_group *tg = css_tg(of_css(of));
++ u64 period = tg_get_cfs_period(tg);
++ u64 quota;
++ int ret;
++
++ ret = cpu_period_quota_parse(buf, &period, &quota);
++ if (!ret)
++ ret = tg_set_cfs_bandwidth(tg, period, quota);
++ return ret ?: nbytes;
++}
++#endif
++
++static struct cftype cpu_files[] = {
++ {
++ .name = "stat",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_stats_show,
++ },
++#ifdef CONFIG_FAIR_GROUP_SCHED
++ {
++ .name = "weight",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .read_u64 = cpu_weight_read_u64,
++ .write_u64 = cpu_weight_write_u64,
++ },
++#endif
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ .name = "max",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_max_show,
++ .write = cpu_max_write,
++ },
++#endif
++ { } /* terminate */
++};
++
+ struct cgroup_subsys cpu_cgrp_subsys = {
+ .css_alloc = cpu_cgroup_css_alloc,
+ .css_online = cpu_cgroup_css_online,
+@@ -7262,7 +7395,15 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+ .legacy_cftypes = cpu_legacy_files,
++ .dfl_cftypes = cpu_files,
+ .early_init = true,
++#ifdef CONFIG_CGROUP_CPUACCT
++ /*
++ * cpuacct is enabled together with cpu on the unified hierarchy
++ * and its stats are reported through "cpu.stat".
++ */
++ .depends_on = 1 << cpuacct_cgrp_id,
++#endif
+ };
+
+ #endif /* CONFIG_CGROUP_SCHED */
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index 6151c23f722f..fc1cf13c3af1 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -347,6 +347,31 @@ static struct cftype files[] = {
+ { } /* terminate */
+ };
+
++/* used to print cpuacct stats in cpu.stat on the unified hierarchy */
++void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++ struct cgroup_subsys_state *css;
++ u64 usage, val[CPUACCT_STAT_NSTATS];
++
++ css = cgroup_get_e_css(seq_css(sf)->cgroup, &cpuacct_cgrp_subsys);
++
++ usage = cpuusage_read(css, seq_cft(sf));
++ cpuacct_stats_read(css_ca(css), &val);
++
++ val[CPUACCT_STAT_USER] *= TICK_NSEC;
++ val[CPUACCT_STAT_SYSTEM] *= TICK_NSEC;
++ do_div(usage, NSEC_PER_USEC);
++ do_div(val[CPUACCT_STAT_USER], NSEC_PER_USEC);
++ do_div(val[CPUACCT_STAT_SYSTEM], NSEC_PER_USEC);
++
++ seq_printf(sf, "usage_usec %llu\n"
++ "user_usec %llu\n"
++ "system_usec %llu\n",
++ usage, val[CPUACCT_STAT_USER], val[CPUACCT_STAT_SYSTEM]);
++
++ css_put(css);
++}
++
+ /*
+ * charge this task's execution time to its accounting group.
+ *
+diff --git a/kernel/sched/cpuacct.h b/kernel/sched/cpuacct.h
+index ba72807c73d4..ddf7af466d35 100644
+--- a/kernel/sched/cpuacct.h
++++ b/kernel/sched/cpuacct.h
+@@ -2,6 +2,7 @@
+
+ extern void cpuacct_charge(struct task_struct *tsk, u64 cputime);
+ extern void cpuacct_account_field(struct task_struct *tsk, int index, u64 val);
++extern void cpuacct_cpu_stats_show(struct seq_file *sf);
+
+ #else
+
+@@ -14,4 +15,8 @@ cpuacct_account_field(struct task_struct *tsk, int index, u64 val)
+ {
+ }
+
++static inline void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++}
++
+ #endif
+
+commit 8dde150866b8c433216105c50b7e889d5242d583
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Aug 5 12:41:01 2016 -0400
+
+ cgroup: add documentation regarding CPU controller cgroup v2 support
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+
+diff --git a/Documentation/cgroup-v2-cpu.txt b/Documentation/cgroup-v2-cpu.txt
+new file mode 100644
+index 000000000000..1ed7032d4472
+--- /dev/null
++++ b/Documentation/cgroup-v2-cpu.txt
+@@ -0,0 +1,368 @@
++
++
++CPU Controller on Control Group v2
++
++August, 2016 Tejun Heo <tj@kernel.org>
++
++
++While most controllers have support for cgroup v2 now, the CPU
++controller support is not upstream yet due to objections from the
++scheduler maintainers on the basic designs of cgroup v2. This
++document explains the current situation as well as an interim
++solution, and details the disagreements and arguments. The latest
++version of this document can be found at the following URL.
++
++ https://git.kernel.org/cgit/linux/kernel/git/tj/cgroup.git/tree/Documentation/cgroup-v2-cpu.txt?h=cgroup-v2-cpu
++
++This document was posted to the linux-kernel and cgroup mailing lists.
++Unfortunately, no consensus was reached as of Oct, 2016. The thread
++can be found at the following URL.
++
++ http://lkml.kernel.org/r/20160805170752.GK2542@mtj.duckdns.org
++
++
++CONTENTS
++
++1. Current Situation and Interim Solution
++2. Disagreements and Arguments
++ 2-1. Contentious Restrictions
++ 2-1-1. Process Granularity
++ 2-1-2. No Internal Process Constraint
++ 2-2. Impact on CPU Controller
++ 2-2-1. Impact of Process Granularity
++ 2-2-2. Impact of No Internal Process Constraint
++ 2-3. Arguments for cgroup v2
++3. Way Forward
++4. References
++
++
++1. Current Situation and Interim Solution
++
++All objections from the scheduler maintainers apply to cgroup v2 core
++design, and there are no known objections to the specifics of the CPU
++controller cgroup v2 interface. The only blocked part is changes to
++expose the CPU controller interface on cgroup v2, which comprises the
++following two patches:
++
++ [1] sched: Misc preps for cgroup unified hierarchy interface
++ [2] sched: Implement interface for cgroup unified hierarchy
++
++The necessary changes are superficial and implement the interface
++files on cgroup v2. The combined diffstat is as follows.
++
++ kernel/sched/core.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++--
++ kernel/sched/cpuacct.c | 57 ++++++++++++------
++ kernel/sched/cpuacct.h | 5 +
++ 3 files changed, 189 insertions(+), 22 deletions(-)
++
++The patches are easy to apply and forward-port. The following git
++branch will always carry the two patches on top of the latest release
++of the upstream kernel.
++
++ git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu
++
++There also are versioned branches going back to v4.4.
++
++ git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu-$KERNEL_VER
++
++While it's difficult to tell whether the CPU controller support will
++be merged, there are crucial resource control features in cgroup v2
++that are only possible due to the design choices that are being
++objected to, and every effort will be made to ease enabling the CPU
++controller cgroup v2 support out-of-tree for parties which choose to.
++
++
++2. Disagreements and Arguments
++
++There have been several lengthy discussion threads [3][4] on LKML
++around the structural constraints of cgroup v2. The two that affect
++the CPU controller are process granularity and no internal process
++constraint. Both arise primarily from the need for common resource
++domain definition across different resources.
++
++The common resource domain is a powerful concept in cgroup v2 that
++allows controllers to make basic assumptions about the structural
++organization of processes and controllers inside the cgroup hierarchy,
++and thus solve problems spanning multiple types of resources. The
++prime example for this is page cache writeback: dirty page cache is
++regulated through throttling buffered writers based on memory
++availability, and initiating batched write outs to the disk based on
++IO capacity. Tracking and controlling writeback inside a cgroup thus
++requires the direct cooperation of the memory and the IO controller.
++
++This easily extends to other areas, such as CPU cycles consumed while
++performing memory reclaim or IO encryption.
++
++
++2-1. Contentious Restrictions
++
++For controllers of different resources to work together, they must
++agree on a common organization. This uniform model across controllers
++imposes two contentious restrictions on the CPU controller: process
++granularity and the no-internal-process constraint.
++
++
++ 2-1-1. Process Granularity
++
++ For memory, because an address space is shared between all threads
++ of a process, the terminal consumer is a process, not a thread.
++ Separating the threads of a single process into different memory
++ control domains doesn't make semantical sense. cgroup v2 ensures
++ that all controller can agree on the same organization by requiring
++ that threads of the same process belong to the same cgroup.
++
++ There are other reasons to enforce process granularity. One
++ important one is isolating system-level management operations from
++ in-process application operations. The cgroup interface, being a
++ virtual filesystem, is very unfit for multiple independent
++ operations taking place at the same time as most operations have to
++ be multi-step and there is no way to synchronize multiple accessors.
++ See also [5] Documentation/cgroup-v2.txt, "R-2. Thread Granularity"
++
++
++ 2-1-2. No Internal Process Constraint
++
++ cgroup v2 does not allow processes to belong to any cgroup which has
++ child cgroups when resource controllers are enabled on it (the
++ notable exception being the root cgroup itself). This is because,
++ for some resources, a resource domain (cgroup) is not directly
++ comparable to the terminal consumer (process/task) of said resource,
++ and so putting the two into a sibling relationship isn't meaningful.
++
++ - Differing Control Parameters and Capabilities
++
++ A cgroup controller has different resource control parameters and
++ capabilities from a terminal consumer, be that a task or process.
++ There are a couple cases where a cgroup control knob can be mapped
++ to a per-task or per-process API but they are exceptions and the
++ mappings aren't obvious even in those cases.
++
++ For example, task priorities (also known as nice values) set
++ through setpriority(2) are mapped to the CPU controller
++ "cpu.shares" values. However, how exactly the two ranges map and
++ even the fact that they map to each other at all are not obvious.
++
++ The situation gets further muddled when considering other resource
++ types and control knobs. IO priorities set through ioprio_set(2)
++ cannot be mapped to IO controller weights and most cgroup resource
++ control knobs including the bandwidth control knobs of the CPU
++ controller don't have counterparts in the terminal consumers.
++
++ - Anonymous Resource Consumption
++
++ For CPU, every time slice consumed from inside a cgroup, which
++ comprises most but not all of consumed CPU time for the cgroup,
++ can be clearly attributed to a specific task or process. Because
++ these two types of entities are directly comparable as consumers
++ of CPU time, it's theoretically possible to mix tasks and cgroups
++ on the same tree levels and let them directly compete for the time
++ quota available to their common ancestor.
++
++ However, the same can't be said for resource types like memory or
++ IO: the memory consumed by the page cache, for example, can be
++ tracked on a per-cgroup level, but due to mismatches in lifetimes
++ of involved objects (page cache can persist long after processes
++ are gone), shared usages and the implementation overhead of
++ tracking persistent state, it can no longer be attributed to
++ individual processes after instantiation. Consequently, any IO
++ incurred by page cache writeback can be attributed to a cgroup,
++ but not to the individual consumers inside the cgroup.
++
++ For memory and IO, this makes a resource domain (cgroup) an object
++ of a fundamentally different type than a terminal consumer
++ (process). A process can't be a first class object in the resource
++ distribution graph as its total resource consumption can't be
++ described without the containing resource domain.
++
++ Disallowing processes in internal cgroups avoids competition between
++ cgroups and processes which cannot be meaningfully defined for these
++ resources. All resource control takes place among cgroups and a
++ terminal consumer interacts with the containing cgroup the same way
++ it would with the system without cgroup.
++
++ Root cgroup is exempt from this constraint, which is in line with
++ how root cgroup is handled in general - it's excluded from cgroup
++ resource accounting and control.
++
++
++Enforcing process granularity and no internal process constraint
++allows all controllers to be on the same footing in terms of resource
++distribution hierarchy.
++
++
++2-2. Impact on CPU Controller
++
++As indicated earlier, the CPU controller's resource distribution graph
++is the simplest. Every schedulable resource consumption can be
++attributed to a specific task. In addition, for weight based control,
++the per-task priority set through setpriority(2) can be translated to
++and from a per-cgroup weight. As such, the CPU controller can treat a
++task and a cgroup symmetrically, allowing support for any tree layout
++of cgroups and tasks. Both process granularity and the no internal
++process constraint restrict how the CPU controller can be used.
++
++
++ 2-2-1. Impact of Process Granularity
++
++ Process granularity prevents tasks belonging to the same process to
++ be assigned to different cgroups. It was pointed out [6] that this
++ excludes the valid use case of hierarchical CPU distribution within
++ processes.
++
++ To address this issue, the rgroup (resource group) [7][8][9]
++ interface, an extension of the existing setpriority(2) API, was
++ proposed, which is in line with other programmable priority
++ mechanisms and eliminates the risk of in-application configuration
++ and system configuration stepping on each other's toes.
++ Unfortunately, the proposal quickly turned into discussions around
++ cgroup v2 design decisions [4] and no consensus could be reached.
++
++
++ 2-2-2. Impact of No Internal Process Constraint
++
++ The no internal process constraint disallows tasks from competing
++ directly against cgroups. Here is an excerpt from Peter Zijlstra
++ pointing out the issue [10] - R, L and A are cgroups; t1, t2, t3 and
++ t4 are tasks:
++
++
++ R
++ / | \
++ t1 t2 A
++ / \
++ t3 t4
++
++
++ Is fundamentally different from:
++
++
++ R
++ / \
++ L A
++ / \ / \
++ t1 t2 t3 t4
++
++
++ Because if in the first hierarchy you add a task (t5) to R, all of
++ its A will run at 1/4th of total bandwidth where before it had
++ 1/3rd, whereas with the second example, if you add our t5 to L, A
++ doesn't get any less bandwidth.
++
++
++ It is true that the trees are semantically different from each other
++ and the symmetric handling of tasks and cgroups is aesthetically
++ pleasing. However, it isn't clear what the practical usefulness of
++ a layout with direct competition between tasks and cgroups would be,
++ considering that number and behavior of tasks are controlled by each
++ application, and cgroups primarily deal with system level resource
++ distribution; changes in the number of active threads would directly
++ impact resource distribution. Real world use cases of such layouts
++ could not be established during the discussions.
++
++
++2-3. Arguments for cgroup v2
++
++There are strong demands for comprehensive hierarchical resource
++control across all major resources, and establishing a common resource
++hierarchy is an essential step. As with most engineering decisions,
++common resource hierarchy definition comes with its trade-offs. With
++cgroup v2, the trade-offs are in the form of structural constraints
++which, among others, restrict the CPU controller's space of possible
++configurations.
++
++However, even with the restrictions, cgroup v2, in combination with
++rgroup, covers most of identified real world use cases while enabling
++new important use cases of resource control across multiple resource
++types that were fundamentally broken previously.
++
++Furthermore, for resource control, treating resource domains as
++objects of a different type from terminal consumers has important
++advantages - it can account for resource consumptions which are not
++tied to any specific terminal consumer, be that a task or process, and
++allows decoupling resource distribution controls from in-application
++APIs. Even the CPU controller may benefit from it as the kernel can
++consume significant amount of CPU cycles in interrupt context or tasks
++shared across multiple resource domains (e.g. softirq).
++
++Finally, it's important to note that enabling cgroup v2 support for
++the CPU controller doesn't block use cases which require the features
++which are not available on cgroup v2. Unlikely, but should anybody
++actually rely on the CPU controller's symmetric handling of tasks and
++cgroups, backward compatibility is and will be maintained by being
++able to disconnect the controller from the cgroup v2 hierarchy and use
++it standalone. This also holds for cpuset which is often used in
++highly customized configurations which might be a poor fit for common
++resource domains.
++
++The required changes are minimal, the benefits for the target use
++cases are critical and obvious, and use cases which have to use v1 can
++continue to do so.
++
++
++3. Way Forward
++
++cgroup v2 primarily aims to solve the problem of comprehensive
++hierarchical resource control across all major computing resources,
++which is one of the core problems of modern server infrastructure
++engineering. The trade-offs that cgroup v2 took are results of
++pursuing that goal and gaining a better understanding of the nature of
++resource control in the process.
++
++I believe that real world usages will prove cgroup v2's model right,
++considering the crucial pieces of comprehensive resource control that
++cannot be implemented without common resource domains. This is not to
++say that cgroup v2 is fixed in stone and can't be updated; if there is
++an approach which better serves both comprehensive resource control
++and the CPU controller's flexibility, we will surely move towards
++that. It goes without saying that discussions around such approach
++should consider practical aspects of resource control as a whole
++rather than absolutely focusing on a particular controller.
++
++Until such consensus can be reached, the CPU controller cgroup v2
++support will be maintained out of the mainline kernel in an easily
++accessible form. If there is anything cgroup developers can do to
++ease the pain, please feel free to contact us on the cgroup mailing
++list at cgroups@vger.kernel.org.
++
++
++4. References
++
++[1] http://lkml.kernel.org/r/20160105164834.GE5995@mtj.duckdns.org
++ [PATCH 1/2] sched: Misc preps for cgroup unified hierarchy interface
++ Tejun Heo <tj@kernel.org>
++
++[2] http://lkml.kernel.org/r/20160105164852.GF5995@mtj.duckdns.org
++ [PATCH 2/2] sched: Implement interface for cgroup unified hierarchy
++ Tejun Heo <tj@kernel.org>
++
++[3] http://lkml.kernel.org/r/1438641689-14655-4-git-send-email-tj@kernel.org
++ [PATCH 3/3] sched: Implement interface for cgroup unified hierarchy
++ Tejun Heo <tj@kernel.org>
++
++[4] http://lkml.kernel.org/r/20160407064549.GH3430@twins.programming.kicks-ass.net
++ Re: [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource group and PRIO_RGRP
++ Peter Zijlstra <peterz@infradead.org>
++
++[5] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/cgroup-v2.txt
++ Control Group v2
++ Tejun Heo <tj@kernel.org>
++
++[6] http://lkml.kernel.org/r/CAPM31RJNy3jgG=DYe6GO=wyL4BPPxwUm1f2S6YXacQmo7viFZA@mail.gmail.com
++ Re: [PATCH 3/3] sched: Implement interface for cgroup unified hierarchy
++ Paul Turner <pjt@google.com>
++
++[7] http://lkml.kernel.org/r/20160105154503.GC5995@mtj.duckdns.org
++ [RFD] cgroup: thread granularity support for cpu controller
++ Tejun Heo <tj@kernel.org>
++
++[8] http://lkml.kernel.org/r/1457710888-31182-1-git-send-email-tj@kernel.org
++ [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource group and PRIO_RGRP
++ Tejun Heo <tj@kernel.org>
++
++[9] http://lkml.kernel.org/r/20160311160522.GA24046@htj.duckdns.org
++ Example program for PRIO_RGRP
++ Tejun Heo <tj@kernel.org>
++
++[10] http://lkml.kernel.org/r/20160407082810.GN3430@twins.programming.kicks-ass.net
++ Re: [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource
++ Peter Zijlstra <peterz@infradead.org>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.4.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.4.patch
new file mode 100644
index 000000000000..8f2418c9efce
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.4.patch
@@ -0,0 +1,407 @@
+commit e7cae741f6d645ac68fe8823ca6ef45dbbf6891b
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Misc preps for cgroup unified hierarchy interface
+
+ Make the following changes in preparation for the cpu controller
+ interface implementation for the unified hierarchy. This patch
+ doesn't cause any functional differences.
+
+ * s/cpu_stats_show()/cpu_cfs_stats_show()/
+
+ * s/cpu_files/cpu_legacy_files/
+
+ * Separate out cpuacct_stats_read() from cpuacct_stats_show(). While
+ at it, remove pointless cpuacct_stat_desc[] array.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 732e993..77f3ddd 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -8512,7 +8512,7 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
+ return ret;
+ }
+
+-static int cpu_stats_show(struct seq_file *sf, void *v)
++static int cpu_cfs_stats_show(struct seq_file *sf, void *v)
+ {
+ struct task_group *tg = css_tg(seq_css(sf));
+ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
+@@ -8552,7 +8552,7 @@ static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css,
+ }
+ #endif /* CONFIG_RT_GROUP_SCHED */
+
+-static struct cftype cpu_files[] = {
++static struct cftype cpu_legacy_files[] = {
+ #ifdef CONFIG_FAIR_GROUP_SCHED
+ {
+ .name = "shares",
+@@ -8573,7 +8573,7 @@ static struct cftype cpu_files[] = {
+ },
+ {
+ .name = "stat",
+- .seq_show = cpu_stats_show,
++ .seq_show = cpu_cfs_stats_show,
+ },
+ #endif
+ #ifdef CONFIG_RT_GROUP_SCHED
+@@ -8599,7 +8599,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .fork = cpu_cgroup_fork,
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+- .legacy_cftypes = cpu_files,
++ .legacy_cftypes = cpu_legacy_files,
+ .early_init = 1,
+ };
+
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index dd7cbb5..42b2dd5 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -177,36 +177,33 @@ static int cpuacct_percpu_seq_show(struct seq_file *m, void *V)
+ return 0;
+ }
+
+-static const char * const cpuacct_stat_desc[] = {
+- [CPUACCT_STAT_USER] = "user",
+- [CPUACCT_STAT_SYSTEM] = "system",
+-};
+-
+-static int cpuacct_stats_show(struct seq_file *sf, void *v)
++static void cpuacct_stats_read(struct cpuacct *ca, u64 *userp, u64 *sysp)
+ {
+- struct cpuacct *ca = css_ca(seq_css(sf));
+ int cpu;
+- s64 val = 0;
+
++ *userp = 0;
+ for_each_online_cpu(cpu) {
+ struct kernel_cpustat *kcpustat = per_cpu_ptr(ca->cpustat, cpu);
+- val += kcpustat->cpustat[CPUTIME_USER];
+- val += kcpustat->cpustat[CPUTIME_NICE];
++ *userp += kcpustat->cpustat[CPUTIME_USER];
++ *userp += kcpustat->cpustat[CPUTIME_NICE];
+ }
+- val = cputime64_to_clock_t(val);
+- seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_USER], val);
+
+- val = 0;
++ *sysp = 0;
+ for_each_online_cpu(cpu) {
+ struct kernel_cpustat *kcpustat = per_cpu_ptr(ca->cpustat, cpu);
+- val += kcpustat->cpustat[CPUTIME_SYSTEM];
+- val += kcpustat->cpustat[CPUTIME_IRQ];
+- val += kcpustat->cpustat[CPUTIME_SOFTIRQ];
++ *sysp += kcpustat->cpustat[CPUTIME_SYSTEM];
++ *sysp += kcpustat->cpustat[CPUTIME_IRQ];
++ *sysp += kcpustat->cpustat[CPUTIME_SOFTIRQ];
+ }
++}
+
+- val = cputime64_to_clock_t(val);
+- seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val);
++static int cpuacct_stats_show(struct seq_file *sf, void *v)
++{
++ cputime64_t user, sys;
+
++ cpuacct_stats_read(css_ca(seq_css(sf)), &user, &sys);
++ seq_printf(sf, "user %lld\n", cputime64_to_clock_t(user));
++ seq_printf(sf, "system %lld\n", cputime64_to_clock_t(sys));
+ return 0;
+ }
+
+
+commit 1bb33e8a69f089f2d3f58a0e681d4ff352e11c97
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Implement interface for cgroup unified hierarchy
+
+ While the cpu controller doesn't have any functional problems, there
+ are a couple interface issues which can be addressed in the v2
+ interface.
+
+ * cpuacct being a separate controller. This separation is artificial
+ and rather pointless as demonstrated by most use cases co-mounting
+ the two controllers. It also forces certain information to be
+ accounted twice.
+
+ * Use of different time units. Writable control knobs use
+ microseconds, some stat fields use nanoseconds while other cpuacct
+ stat fields use centiseconds.
+
+ * Control knobs which can't be used in the root cgroup still show up
+ in the root.
+
+ * Control knob names and semantics aren't consistent with other
+ controllers.
+
+ This patchset implements cpu controller's interface on the unified
+ hierarchy which adheres to the controller file conventions described
+ in Documentation/cgroups/unified-hierarchy.txt. Overall, the
+ following changes are made.
+
+ * cpuacct is implictly enabled and disabled by cpu and its information
+ is reported through "cpu.stat" which now uses microseconds for all
+ time durations. All time duration fields now have "_usec" appended
+ to them for clarity. While this doesn't solve the double accounting
+ immediately, once majority of users switch to v2, cpu can directly
+ account and report the relevant stats and cpuacct can be disabled on
+ the unified hierarchy.
+
+ Note that cpuacct.usage_percpu is currently not included in
+ "cpu.stat". If this information is actually called for, it can be
+ added later.
+
+ * "cpu.shares" is replaced with "cpu.weight" and operates on the
+ standard scale defined by CGROUP_WEIGHT_MIN/DFL/MAX (1, 100, 10000).
+ The weight is scaled to scheduler weight so that 100 maps to 1024
+ and the ratio relationship is preserved - if weight is W and its
+ scaled value is S, W / 100 == S / 1024. While the mapped range is a
+ bit smaller than the orignal scheduler weight range, the dead zones
+ on both sides are relatively small and covers wider range than the
+ nice value mappings. This file doesn't make sense in the root
+ cgroup and isn't create on root.
+
+ * "cpu.cfs_quota_us" and "cpu.cfs_period_us" are replaced by "cpu.max"
+ which contains both quota and period.
+
+ * "cpu.rt_runtime_us" and "cpu.rt_period_us" are replaced by
+ "cpu.rt.max" which contains both runtime and period.
+
+ v2: cpu_stats_show() was incorrectly using CONFIG_FAIR_GROUP_SCHED for
+ CFS bandwidth stats and also using raw division for u64. Use
+ CONFIG_CFS_BANDWITH and do_div() instead.
+
+ The semantics of "cpu.rt.max" is not fully decided yet. Dropped
+ for now.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 77f3ddd..7aafe63 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -8591,6 +8591,139 @@ static struct cftype cpu_legacy_files[] = {
+ { } /* terminate */
+ };
+
++static int cpu_stats_show(struct seq_file *sf, void *v)
++{
++ cpuacct_cpu_stats_show(sf);
++
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ struct task_group *tg = css_tg(seq_css(sf));
++ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
++ u64 throttled_usec;
++
++ throttled_usec = cfs_b->throttled_time;
++ do_div(throttled_usec, NSEC_PER_USEC);
++
++ seq_printf(sf, "nr_periods %d\n"
++ "nr_throttled %d\n"
++ "throttled_usec %llu\n",
++ cfs_b->nr_periods, cfs_b->nr_throttled,
++ throttled_usec);
++ }
++#endif
++ return 0;
++}
++
++#ifdef CONFIG_FAIR_GROUP_SCHED
++static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css,
++ struct cftype *cft)
++{
++ struct task_group *tg = css_tg(css);
++ u64 weight = scale_load_down(tg->shares);
++
++ return DIV_ROUND_CLOSEST_ULL(weight * CGROUP_WEIGHT_DFL, 1024);
++}
++
++static int cpu_weight_write_u64(struct cgroup_subsys_state *css,
++ struct cftype *cftype, u64 weight)
++{
++ /*
++ * cgroup weight knobs should use the common MIN, DFL and MAX
++ * values which are 1, 100 and 10000 respectively. While it loses
++ * a bit of range on both ends, it maps pretty well onto the shares
++ * value used by scheduler and the round-trip conversions preserve
++ * the original value over the entire range.
++ */
++ if (weight < CGROUP_WEIGHT_MIN || weight > CGROUP_WEIGHT_MAX)
++ return -ERANGE;
++
++ weight = DIV_ROUND_CLOSEST_ULL(weight * 1024, CGROUP_WEIGHT_DFL);
++
++ return sched_group_set_shares(css_tg(css), scale_load(weight));
++}
++#endif
++
++static void __maybe_unused cpu_period_quota_print(struct seq_file *sf,
++ long period, long quota)
++{
++ if (quota < 0)
++ seq_puts(sf, "max");
++ else
++ seq_printf(sf, "%ld", quota);
++
++ seq_printf(sf, " %ld\n", period);
++}
++
++/* caller should put the current value in *@periodp before calling */
++static int __maybe_unused cpu_period_quota_parse(char *buf,
++ u64 *periodp, u64 *quotap)
++{
++ char tok[21]; /* U64_MAX */
++
++ if (!sscanf(buf, "%s %llu", tok, periodp))
++ return -EINVAL;
++
++ *periodp *= NSEC_PER_USEC;
++
++ if (sscanf(tok, "%llu", quotap))
++ *quotap *= NSEC_PER_USEC;
++ else if (!strcmp(tok, "max"))
++ *quotap = RUNTIME_INF;
++ else
++ return -EINVAL;
++
++ return 0;
++}
++
++#ifdef CONFIG_CFS_BANDWIDTH
++static int cpu_max_show(struct seq_file *sf, void *v)
++{
++ struct task_group *tg = css_tg(seq_css(sf));
++
++ cpu_period_quota_print(sf, tg_get_cfs_period(tg), tg_get_cfs_quota(tg));
++ return 0;
++}
++
++static ssize_t cpu_max_write(struct kernfs_open_file *of,
++ char *buf, size_t nbytes, loff_t off)
++{
++ struct task_group *tg = css_tg(of_css(of));
++ u64 period = tg_get_cfs_period(tg);
++ u64 quota;
++ int ret;
++
++ ret = cpu_period_quota_parse(buf, &period, &quota);
++ if (!ret)
++ ret = tg_set_cfs_bandwidth(tg, period, quota);
++ return ret ?: nbytes;
++}
++#endif
++
++static struct cftype cpu_files[] = {
++ {
++ .name = "stat",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_stats_show,
++ },
++#ifdef CONFIG_FAIR_GROUP_SCHED
++ {
++ .name = "weight",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .read_u64 = cpu_weight_read_u64,
++ .write_u64 = cpu_weight_write_u64,
++ },
++#endif
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ .name = "max",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_max_show,
++ .write = cpu_max_write,
++ },
++#endif
++ { } /* terminate */
++};
++
+ struct cgroup_subsys cpu_cgrp_subsys = {
+ .css_alloc = cpu_cgroup_css_alloc,
+ .css_free = cpu_cgroup_css_free,
+@@ -8600,7 +8733,15 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+ .legacy_cftypes = cpu_legacy_files,
++ .dfl_cftypes = cpu_files,
+ .early_init = 1,
++#ifdef CONFIG_CGROUP_CPUACCT
++ /*
++ * cpuacct is enabled together with cpu on the unified hierarchy
++ * and its stats are reported through "cpu.stat".
++ */
++ .depends_on = 1 << cpuacct_cgrp_id,
++#endif
+ };
+
+ #endif /* CONFIG_CGROUP_SCHED */
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index 42b2dd5..b4d32a6 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -224,6 +224,30 @@ static struct cftype files[] = {
+ { } /* terminate */
+ };
+
++/* used to print cpuacct stats in cpu.stat on the unified hierarchy */
++void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++ struct cgroup_subsys_state *css;
++ u64 usage, user, sys;
++
++ css = cgroup_get_e_css(seq_css(sf)->cgroup, &cpuacct_cgrp_subsys);
++
++ usage = cpuusage_read(css, seq_cft(sf));
++ cpuacct_stats_read(css_ca(css), &user, &sys);
++
++ user *= TICK_NSEC;
++ sys *= TICK_NSEC;
++ do_div(usage, NSEC_PER_USEC);
++ do_div(user, NSEC_PER_USEC);
++ do_div(sys, NSEC_PER_USEC);
++
++ seq_printf(sf, "usage_usec %llu\n"
++ "user_usec %llu\n"
++ "system_usec %llu\n", usage, user, sys);
++
++ css_put(css);
++}
++
+ /*
+ * charge this task's execution time to its accounting group.
+ *
+diff --git a/kernel/sched/cpuacct.h b/kernel/sched/cpuacct.h
+index ed60562..44eace9 100644
+--- a/kernel/sched/cpuacct.h
++++ b/kernel/sched/cpuacct.h
+@@ -2,6 +2,7 @@
+
+ extern void cpuacct_charge(struct task_struct *tsk, u64 cputime);
+ extern void cpuacct_account_field(struct task_struct *p, int index, u64 val);
++extern void cpuacct_cpu_stats_show(struct seq_file *sf);
+
+ #else
+
+@@ -14,4 +15,8 @@ cpuacct_account_field(struct task_struct *p, int index, u64 val)
+ {
+ }
+
++static inline void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++}
++
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.9.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.9.patch
new file mode 100644
index 000000000000..6f0904cbce99
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/4.9.patch
@@ -0,0 +1,784 @@
+commit 280858b0bb3384b9ec06b455e196b453888bd6b8
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Misc preps for cgroup unified hierarchy interface
+
+ Make the following changes in preparation for the cpu controller
+ interface implementation for the unified hierarchy. This patch
+ doesn't cause any functional differences.
+
+ * s/cpu_stats_show()/cpu_cfs_stats_show()/
+
+ * s/cpu_files/cpu_legacy_files/
+
+ * Separate out cpuacct_stats_read() from cpuacct_stats_show(). While
+ at it, make the @val array u64 for consistency.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 154fd689fe02..57472485b79c 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -8705,7 +8705,7 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
+ return ret;
+ }
+
+-static int cpu_stats_show(struct seq_file *sf, void *v)
++static int cpu_cfs_stats_show(struct seq_file *sf, void *v)
+ {
+ struct task_group *tg = css_tg(seq_css(sf));
+ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
+@@ -8745,7 +8745,7 @@ static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css,
+ }
+ #endif /* CONFIG_RT_GROUP_SCHED */
+
+-static struct cftype cpu_files[] = {
++static struct cftype cpu_legacy_files[] = {
+ #ifdef CONFIG_FAIR_GROUP_SCHED
+ {
+ .name = "shares",
+@@ -8766,7 +8766,7 @@ static struct cftype cpu_files[] = {
+ },
+ {
+ .name = "stat",
+- .seq_show = cpu_stats_show,
++ .seq_show = cpu_cfs_stats_show,
+ },
+ #endif
+ #ifdef CONFIG_RT_GROUP_SCHED
+@@ -8791,7 +8791,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .fork = cpu_cgroup_fork,
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+- .legacy_cftypes = cpu_files,
++ .legacy_cftypes = cpu_legacy_files,
+ .early_init = true,
+ };
+
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index bc0b309c3f19..d1e5dd0b3a64 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -276,26 +276,33 @@ static int cpuacct_all_seq_show(struct seq_file *m, void *V)
+ return 0;
+ }
+
+-static int cpuacct_stats_show(struct seq_file *sf, void *v)
++static void cpuacct_stats_read(struct cpuacct *ca,
++ u64 (*val)[CPUACCT_STAT_NSTATS])
+ {
+- struct cpuacct *ca = css_ca(seq_css(sf));
+- s64 val[CPUACCT_STAT_NSTATS];
+ int cpu;
+- int stat;
+
+- memset(val, 0, sizeof(val));
++ memset(val, 0, sizeof(*val));
++
+ for_each_possible_cpu(cpu) {
+ u64 *cpustat = per_cpu_ptr(ca->cpustat, cpu)->cpustat;
+
+- val[CPUACCT_STAT_USER] += cpustat[CPUTIME_USER];
+- val[CPUACCT_STAT_USER] += cpustat[CPUTIME_NICE];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SYSTEM];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_IRQ];
+- val[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SOFTIRQ];
++ (*val)[CPUACCT_STAT_USER] += cpustat[CPUTIME_USER];
++ (*val)[CPUACCT_STAT_USER] += cpustat[CPUTIME_NICE];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SYSTEM];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_IRQ];
++ (*val)[CPUACCT_STAT_SYSTEM] += cpustat[CPUTIME_SOFTIRQ];
+ }
++}
++
++static int cpuacct_stats_show(struct seq_file *sf, void *v)
++{
++ u64 val[CPUACCT_STAT_NSTATS];
++ int stat;
++
++ cpuacct_stats_read(css_ca(seq_css(sf)), &val);
+
+ for (stat = 0; stat < CPUACCT_STAT_NSTATS; stat++) {
+- seq_printf(sf, "%s %lld\n",
++ seq_printf(sf, "%s %llu\n",
+ cpuacct_stat_desc[stat],
+ cputime64_to_clock_t(val[stat]));
+ }
+
+commit 015cbdcb90034fd566d00de9d3d405613da3cd26
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Mar 11 07:31:23 2016 -0500
+
+ sched: Implement interface for cgroup unified hierarchy
+
+ While the cpu controller doesn't have any functional problems, there
+ are a couple interface issues which can be addressed in the v2
+ interface.
+
+ * cpuacct being a separate controller. This separation is artificial
+ and rather pointless as demonstrated by most use cases co-mounting
+ the two controllers. It also forces certain information to be
+ accounted twice.
+
+ * Use of different time units. Writable control knobs use
+ microseconds, some stat fields use nanoseconds while other cpuacct
+ stat fields use centiseconds.
+
+ * Control knobs which can't be used in the root cgroup still show up
+ in the root.
+
+ * Control knob names and semantics aren't consistent with other
+ controllers.
+
+ This patchset implements cpu controller's interface on the unified
+ hierarchy which adheres to the controller file conventions described
+ in Documentation/cgroups/unified-hierarchy.txt. Overall, the
+ following changes are made.
+
+ * cpuacct is implictly enabled and disabled by cpu and its information
+ is reported through "cpu.stat" which now uses microseconds for all
+ time durations. All time duration fields now have "_usec" appended
+ to them for clarity. While this doesn't solve the double accounting
+ immediately, once majority of users switch to v2, cpu can directly
+ account and report the relevant stats and cpuacct can be disabled on
+ the unified hierarchy.
+
+ Note that cpuacct.usage_percpu is currently not included in
+ "cpu.stat". If this information is actually called for, it can be
+ added later.
+
+ * "cpu.shares" is replaced with "cpu.weight" and operates on the
+ standard scale defined by CGROUP_WEIGHT_MIN/DFL/MAX (1, 100, 10000).
+ The weight is scaled to scheduler weight so that 100 maps to 1024
+ and the ratio relationship is preserved - if weight is W and its
+ scaled value is S, W / 100 == S / 1024. While the mapped range is a
+ bit smaller than the orignal scheduler weight range, the dead zones
+ on both sides are relatively small and covers wider range than the
+ nice value mappings. This file doesn't make sense in the root
+ cgroup and isn't create on root.
+
+ * "cpu.cfs_quota_us" and "cpu.cfs_period_us" are replaced by "cpu.max"
+ which contains both quota and period.
+
+ * "cpu.rt_runtime_us" and "cpu.rt_period_us" are replaced by
+ "cpu.rt.max" which contains both runtime and period.
+
+ v2: cpu_stats_show() was incorrectly using CONFIG_FAIR_GROUP_SCHED for
+ CFS bandwidth stats and also using raw division for u64. Use
+ CONFIG_CFS_BANDWITH and do_div() instead.
+
+ The semantics of "cpu.rt.max" is not fully decided yet. Dropped
+ for now.
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+ Cc: Ingo Molnar <mingo@redhat.com>
+ Cc: Peter Zijlstra <peterz@infradead.org>
+ Cc: Li Zefan <lizefan@huawei.com>
+ Cc: Johannes Weiner <hannes@cmpxchg.org>
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 57472485b79c..c0ae869f51c4 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -8784,6 +8784,139 @@ static struct cftype cpu_legacy_files[] = {
+ { } /* terminate */
+ };
+
++static int cpu_stats_show(struct seq_file *sf, void *v)
++{
++ cpuacct_cpu_stats_show(sf);
++
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ struct task_group *tg = css_tg(seq_css(sf));
++ struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
++ u64 throttled_usec;
++
++ throttled_usec = cfs_b->throttled_time;
++ do_div(throttled_usec, NSEC_PER_USEC);
++
++ seq_printf(sf, "nr_periods %d\n"
++ "nr_throttled %d\n"
++ "throttled_usec %llu\n",
++ cfs_b->nr_periods, cfs_b->nr_throttled,
++ throttled_usec);
++ }
++#endif
++ return 0;
++}
++
++#ifdef CONFIG_FAIR_GROUP_SCHED
++static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css,
++ struct cftype *cft)
++{
++ struct task_group *tg = css_tg(css);
++ u64 weight = scale_load_down(tg->shares);
++
++ return DIV_ROUND_CLOSEST_ULL(weight * CGROUP_WEIGHT_DFL, 1024);
++}
++
++static int cpu_weight_write_u64(struct cgroup_subsys_state *css,
++ struct cftype *cftype, u64 weight)
++{
++ /*
++ * cgroup weight knobs should use the common MIN, DFL and MAX
++ * values which are 1, 100 and 10000 respectively. While it loses
++ * a bit of range on both ends, it maps pretty well onto the shares
++ * value used by scheduler and the round-trip conversions preserve
++ * the original value over the entire range.
++ */
++ if (weight < CGROUP_WEIGHT_MIN || weight > CGROUP_WEIGHT_MAX)
++ return -ERANGE;
++
++ weight = DIV_ROUND_CLOSEST_ULL(weight * 1024, CGROUP_WEIGHT_DFL);
++
++ return sched_group_set_shares(css_tg(css), scale_load(weight));
++}
++#endif
++
++static void __maybe_unused cpu_period_quota_print(struct seq_file *sf,
++ long period, long quota)
++{
++ if (quota < 0)
++ seq_puts(sf, "max");
++ else
++ seq_printf(sf, "%ld", quota);
++
++ seq_printf(sf, " %ld\n", period);
++}
++
++/* caller should put the current value in *@periodp before calling */
++static int __maybe_unused cpu_period_quota_parse(char *buf,
++ u64 *periodp, u64 *quotap)
++{
++ char tok[21]; /* U64_MAX */
++
++ if (!sscanf(buf, "%s %llu", tok, periodp))
++ return -EINVAL;
++
++ *periodp *= NSEC_PER_USEC;
++
++ if (sscanf(tok, "%llu", quotap))
++ *quotap *= NSEC_PER_USEC;
++ else if (!strcmp(tok, "max"))
++ *quotap = RUNTIME_INF;
++ else
++ return -EINVAL;
++
++ return 0;
++}
++
++#ifdef CONFIG_CFS_BANDWIDTH
++static int cpu_max_show(struct seq_file *sf, void *v)
++{
++ struct task_group *tg = css_tg(seq_css(sf));
++
++ cpu_period_quota_print(sf, tg_get_cfs_period(tg), tg_get_cfs_quota(tg));
++ return 0;
++}
++
++static ssize_t cpu_max_write(struct kernfs_open_file *of,
++ char *buf, size_t nbytes, loff_t off)
++{
++ struct task_group *tg = css_tg(of_css(of));
++ u64 period = tg_get_cfs_period(tg);
++ u64 quota;
++ int ret;
++
++ ret = cpu_period_quota_parse(buf, &period, &quota);
++ if (!ret)
++ ret = tg_set_cfs_bandwidth(tg, period, quota);
++ return ret ?: nbytes;
++}
++#endif
++
++static struct cftype cpu_files[] = {
++ {
++ .name = "stat",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_stats_show,
++ },
++#ifdef CONFIG_FAIR_GROUP_SCHED
++ {
++ .name = "weight",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .read_u64 = cpu_weight_read_u64,
++ .write_u64 = cpu_weight_write_u64,
++ },
++#endif
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ .name = "max",
++ .flags = CFTYPE_NOT_ON_ROOT,
++ .seq_show = cpu_max_show,
++ .write = cpu_max_write,
++ },
++#endif
++ { } /* terminate */
++};
++
+ struct cgroup_subsys cpu_cgrp_subsys = {
+ .css_alloc = cpu_cgroup_css_alloc,
+ .css_released = cpu_cgroup_css_released,
+@@ -8792,7 +8925,15 @@ struct cgroup_subsys cpu_cgrp_subsys = {
+ .can_attach = cpu_cgroup_can_attach,
+ .attach = cpu_cgroup_attach,
+ .legacy_cftypes = cpu_legacy_files,
++ .dfl_cftypes = cpu_files,
+ .early_init = true,
++#ifdef CONFIG_CGROUP_CPUACCT
++ /*
++ * cpuacct is enabled together with cpu on the unified hierarchy
++ * and its stats are reported through "cpu.stat".
++ */
++ .depends_on = 1 << cpuacct_cgrp_id,
++#endif
+ };
+
+ #endif /* CONFIG_CGROUP_SCHED */
+diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
+index d1e5dd0b3a64..57f390514c39 100644
+--- a/kernel/sched/cpuacct.c
++++ b/kernel/sched/cpuacct.c
+@@ -347,6 +347,31 @@ static struct cftype files[] = {
+ { } /* terminate */
+ };
+
++/* used to print cpuacct stats in cpu.stat on the unified hierarchy */
++void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++ struct cgroup_subsys_state *css;
++ u64 usage, val[CPUACCT_STAT_NSTATS];
++
++ css = cgroup_get_e_css(seq_css(sf)->cgroup, &cpuacct_cgrp_subsys);
++
++ usage = cpuusage_read(css, seq_cft(sf));
++ cpuacct_stats_read(css_ca(css), &val);
++
++ val[CPUACCT_STAT_USER] *= TICK_NSEC;
++ val[CPUACCT_STAT_SYSTEM] *= TICK_NSEC;
++ do_div(usage, NSEC_PER_USEC);
++ do_div(val[CPUACCT_STAT_USER], NSEC_PER_USEC);
++ do_div(val[CPUACCT_STAT_SYSTEM], NSEC_PER_USEC);
++
++ seq_printf(sf, "usage_usec %llu\n"
++ "user_usec %llu\n"
++ "system_usec %llu\n",
++ usage, val[CPUACCT_STAT_USER], val[CPUACCT_STAT_SYSTEM]);
++
++ css_put(css);
++}
++
+ /*
+ * charge this task's execution time to its accounting group.
+ *
+diff --git a/kernel/sched/cpuacct.h b/kernel/sched/cpuacct.h
+index ba72807c73d4..ddf7af466d35 100644
+--- a/kernel/sched/cpuacct.h
++++ b/kernel/sched/cpuacct.h
+@@ -2,6 +2,7 @@
+
+ extern void cpuacct_charge(struct task_struct *tsk, u64 cputime);
+ extern void cpuacct_account_field(struct task_struct *tsk, int index, u64 val);
++extern void cpuacct_cpu_stats_show(struct seq_file *sf);
+
+ #else
+
+@@ -14,4 +15,8 @@ cpuacct_account_field(struct task_struct *tsk, int index, u64 val)
+ {
+ }
+
++static inline void cpuacct_cpu_stats_show(struct seq_file *sf)
++{
++}
++
+ #endif
+
+commit 5019fe3d7ec456b58d451ef06fe1f81d7d9f28a9
+Author: Tejun Heo <tj@kernel.org>
+Date: Fri Aug 5 12:41:01 2016 -0400
+
+ cgroup: add documentation regarding CPU controller cgroup v2 support
+
+ Signed-off-by: Tejun Heo <tj@kernel.org>
+
+diff --git a/Documentation/cgroup-v2-cpu.txt b/Documentation/cgroup-v2-cpu.txt
+new file mode 100644
+index 000000000000..1ed7032d4472
+--- /dev/null
++++ b/Documentation/cgroup-v2-cpu.txt
+@@ -0,0 +1,368 @@
++
++
++CPU Controller on Control Group v2
++
++August, 2016 Tejun Heo <tj@kernel.org>
++
++
++While most controllers have support for cgroup v2 now, the CPU
++controller support is not upstream yet due to objections from the
++scheduler maintainers on the basic designs of cgroup v2. This
++document explains the current situation as well as an interim
++solution, and details the disagreements and arguments. The latest
++version of this document can be found at the following URL.
++
++ https://git.kernel.org/cgit/linux/kernel/git/tj/cgroup.git/tree/Documentation/cgroup-v2-cpu.txt?h=cgroup-v2-cpu
++
++This document was posted to the linux-kernel and cgroup mailing lists.
++Unfortunately, no consensus was reached as of Oct, 2016. The thread
++can be found at the following URL.
++
++ http://lkml.kernel.org/r/20160805170752.GK2542@mtj.duckdns.org
++
++
++CONTENTS
++
++1. Current Situation and Interim Solution
++2. Disagreements and Arguments
++ 2-1. Contentious Restrictions
++ 2-1-1. Process Granularity
++ 2-1-2. No Internal Process Constraint
++ 2-2. Impact on CPU Controller
++ 2-2-1. Impact of Process Granularity
++ 2-2-2. Impact of No Internal Process Constraint
++ 2-3. Arguments for cgroup v2
++3. Way Forward
++4. References
++
++
++1. Current Situation and Interim Solution
++
++All objections from the scheduler maintainers apply to cgroup v2 core
++design, and there are no known objections to the specifics of the CPU
++controller cgroup v2 interface. The only blocked part is changes to
++expose the CPU controller interface on cgroup v2, which comprises the
++following two patches:
++
++ [1] sched: Misc preps for cgroup unified hierarchy interface
++ [2] sched: Implement interface for cgroup unified hierarchy
++
++The necessary changes are superficial and implement the interface
++files on cgroup v2. The combined diffstat is as follows.
++
++ kernel/sched/core.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++--
++ kernel/sched/cpuacct.c | 57 ++++++++++++------
++ kernel/sched/cpuacct.h | 5 +
++ 3 files changed, 189 insertions(+), 22 deletions(-)
++
++The patches are easy to apply and forward-port. The following git
++branch will always carry the two patches on top of the latest release
++of the upstream kernel.
++
++ git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu
++
++There also are versioned branches going back to v4.4.
++
++ git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu-$KERNEL_VER
++
++While it's difficult to tell whether the CPU controller support will
++be merged, there are crucial resource control features in cgroup v2
++that are only possible due to the design choices that are being
++objected to, and every effort will be made to ease enabling the CPU
++controller cgroup v2 support out-of-tree for parties which choose to.
++
++
++2. Disagreements and Arguments
++
++There have been several lengthy discussion threads [3][4] on LKML
++around the structural constraints of cgroup v2. The two that affect
++the CPU controller are process granularity and no internal process
++constraint. Both arise primarily from the need for common resource
++domain definition across different resources.
++
++The common resource domain is a powerful concept in cgroup v2 that
++allows controllers to make basic assumptions about the structural
++organization of processes and controllers inside the cgroup hierarchy,
++and thus solve problems spanning multiple types of resources. The
++prime example for this is page cache writeback: dirty page cache is
++regulated through throttling buffered writers based on memory
++availability, and initiating batched write outs to the disk based on
++IO capacity. Tracking and controlling writeback inside a cgroup thus
++requires the direct cooperation of the memory and the IO controller.
++
++This easily extends to other areas, such as CPU cycles consumed while
++performing memory reclaim or IO encryption.
++
++
++2-1. Contentious Restrictions
++
++For controllers of different resources to work together, they must
++agree on a common organization. This uniform model across controllers
++imposes two contentious restrictions on the CPU controller: process
++granularity and the no-internal-process constraint.
++
++
++ 2-1-1. Process Granularity
++
++ For memory, because an address space is shared between all threads
++ of a process, the terminal consumer is a process, not a thread.
++ Separating the threads of a single process into different memory
++ control domains doesn't make semantical sense. cgroup v2 ensures
++ that all controller can agree on the same organization by requiring
++ that threads of the same process belong to the same cgroup.
++
++ There are other reasons to enforce process granularity. One
++ important one is isolating system-level management operations from
++ in-process application operations. The cgroup interface, being a
++ virtual filesystem, is very unfit for multiple independent
++ operations taking place at the same time as most operations have to
++ be multi-step and there is no way to synchronize multiple accessors.
++ See also [5] Documentation/cgroup-v2.txt, "R-2. Thread Granularity"
++
++
++ 2-1-2. No Internal Process Constraint
++
++ cgroup v2 does not allow processes to belong to any cgroup which has
++ child cgroups when resource controllers are enabled on it (the
++ notable exception being the root cgroup itself). This is because,
++ for some resources, a resource domain (cgroup) is not directly
++ comparable to the terminal consumer (process/task) of said resource,
++ and so putting the two into a sibling relationship isn't meaningful.
++
++ - Differing Control Parameters and Capabilities
++
++ A cgroup controller has different resource control parameters and
++ capabilities from a terminal consumer, be that a task or process.
++ There are a couple cases where a cgroup control knob can be mapped
++ to a per-task or per-process API but they are exceptions and the
++ mappings aren't obvious even in those cases.
++
++ For example, task priorities (also known as nice values) set
++ through setpriority(2) are mapped to the CPU controller
++ "cpu.shares" values. However, how exactly the two ranges map and
++ even the fact that they map to each other at all are not obvious.
++
++ The situation gets further muddled when considering other resource
++ types and control knobs. IO priorities set through ioprio_set(2)
++ cannot be mapped to IO controller weights and most cgroup resource
++ control knobs including the bandwidth control knobs of the CPU
++ controller don't have counterparts in the terminal consumers.
++
++ - Anonymous Resource Consumption
++
++ For CPU, every time slice consumed from inside a cgroup, which
++ comprises most but not all of consumed CPU time for the cgroup,
++ can be clearly attributed to a specific task or process. Because
++ these two types of entities are directly comparable as consumers
++ of CPU time, it's theoretically possible to mix tasks and cgroups
++ on the same tree levels and let them directly compete for the time
++ quota available to their common ancestor.
++
++ However, the same can't be said for resource types like memory or
++ IO: the memory consumed by the page cache, for example, can be
++ tracked on a per-cgroup level, but due to mismatches in lifetimes
++ of involved objects (page cache can persist long after processes
++ are gone), shared usages and the implementation overhead of
++ tracking persistent state, it can no longer be attributed to
++ individual processes after instantiation. Consequently, any IO
++ incurred by page cache writeback can be attributed to a cgroup,
++ but not to the individual consumers inside the cgroup.
++
++ For memory and IO, this makes a resource domain (cgroup) an object
++ of a fundamentally different type than a terminal consumer
++ (process). A process can't be a first class object in the resource
++ distribution graph as its total resource consumption can't be
++ described without the containing resource domain.
++
++ Disallowing processes in internal cgroups avoids competition between
++ cgroups and processes which cannot be meaningfully defined for these
++ resources. All resource control takes place among cgroups and a
++ terminal consumer interacts with the containing cgroup the same way
++ it would with the system without cgroup.
++
++ Root cgroup is exempt from this constraint, which is in line with
++ how root cgroup is handled in general - it's excluded from cgroup
++ resource accounting and control.
++
++
++Enforcing process granularity and no internal process constraint
++allows all controllers to be on the same footing in terms of resource
++distribution hierarchy.
++
++
++2-2. Impact on CPU Controller
++
++As indicated earlier, the CPU controller's resource distribution graph
++is the simplest. Every schedulable resource consumption can be
++attributed to a specific task. In addition, for weight based control,
++the per-task priority set through setpriority(2) can be translated to
++and from a per-cgroup weight. As such, the CPU controller can treat a
++task and a cgroup symmetrically, allowing support for any tree layout
++of cgroups and tasks. Both process granularity and the no internal
++process constraint restrict how the CPU controller can be used.
++
++
++ 2-2-1. Impact of Process Granularity
++
++ Process granularity prevents tasks belonging to the same process to
++ be assigned to different cgroups. It was pointed out [6] that this
++ excludes the valid use case of hierarchical CPU distribution within
++ processes.
++
++ To address this issue, the rgroup (resource group) [7][8][9]
++ interface, an extension of the existing setpriority(2) API, was
++ proposed, which is in line with other programmable priority
++ mechanisms and eliminates the risk of in-application configuration
++ and system configuration stepping on each other's toes.
++ Unfortunately, the proposal quickly turned into discussions around
++ cgroup v2 design decisions [4] and no consensus could be reached.
++
++
++ 2-2-2. Impact of No Internal Process Constraint
++
++ The no internal process constraint disallows tasks from competing
++ directly against cgroups. Here is an excerpt from Peter Zijlstra
++ pointing out the issue [10] - R, L and A are cgroups; t1, t2, t3 and
++ t4 are tasks:
++
++
++ R
++ / | \
++ t1 t2 A
++ / \
++ t3 t4
++
++
++ Is fundamentally different from:
++
++
++ R
++ / \
++ L A
++ / \ / \
++ t1 t2 t3 t4
++
++
++ Because if in the first hierarchy you add a task (t5) to R, all of
++ its A will run at 1/4th of total bandwidth where before it had
++ 1/3rd, whereas with the second example, if you add our t5 to L, A
++ doesn't get any less bandwidth.
++
++
++ It is true that the trees are semantically different from each other
++ and the symmetric handling of tasks and cgroups is aesthetically
++ pleasing. However, it isn't clear what the practical usefulness of
++ a layout with direct competition between tasks and cgroups would be,
++ considering that number and behavior of tasks are controlled by each
++ application, and cgroups primarily deal with system level resource
++ distribution; changes in the number of active threads would directly
++ impact resource distribution. Real world use cases of such layouts
++ could not be established during the discussions.
++
++
++2-3. Arguments for cgroup v2
++
++There are strong demands for comprehensive hierarchical resource
++control across all major resources, and establishing a common resource
++hierarchy is an essential step. As with most engineering decisions,
++common resource hierarchy definition comes with its trade-offs. With
++cgroup v2, the trade-offs are in the form of structural constraints
++which, among others, restrict the CPU controller's space of possible
++configurations.
++
++However, even with the restrictions, cgroup v2, in combination with
++rgroup, covers most of identified real world use cases while enabling
++new important use cases of resource control across multiple resource
++types that were fundamentally broken previously.
++
++Furthermore, for resource control, treating resource domains as
++objects of a different type from terminal consumers has important
++advantages - it can account for resource consumptions which are not
++tied to any specific terminal consumer, be that a task or process, and
++allows decoupling resource distribution controls from in-application
++APIs. Even the CPU controller may benefit from it as the kernel can
++consume significant amount of CPU cycles in interrupt context or tasks
++shared across multiple resource domains (e.g. softirq).
++
++Finally, it's important to note that enabling cgroup v2 support for
++the CPU controller doesn't block use cases which require the features
++which are not available on cgroup v2. Unlikely, but should anybody
++actually rely on the CPU controller's symmetric handling of tasks and
++cgroups, backward compatibility is and will be maintained by being
++able to disconnect the controller from the cgroup v2 hierarchy and use
++it standalone. This also holds for cpuset which is often used in
++highly customized configurations which might be a poor fit for common
++resource domains.
++
++The required changes are minimal, the benefits for the target use
++cases are critical and obvious, and use cases which have to use v1 can
++continue to do so.
++
++
++3. Way Forward
++
++cgroup v2 primarily aims to solve the problem of comprehensive
++hierarchical resource control across all major computing resources,
++which is one of the core problems of modern server infrastructure
++engineering. The trade-offs that cgroup v2 took are results of
++pursuing that goal and gaining a better understanding of the nature of
++resource control in the process.
++
++I believe that real world usages will prove cgroup v2's model right,
++considering the crucial pieces of comprehensive resource control that
++cannot be implemented without common resource domains. This is not to
++say that cgroup v2 is fixed in stone and can't be updated; if there is
++an approach which better serves both comprehensive resource control
++and the CPU controller's flexibility, we will surely move towards
++that. It goes without saying that discussions around such approach
++should consider practical aspects of resource control as a whole
++rather than absolutely focusing on a particular controller.
++
++Until such consensus can be reached, the CPU controller cgroup v2
++support will be maintained out of the mainline kernel in an easily
++accessible form. If there is anything cgroup developers can do to
++ease the pain, please feel free to contact us on the cgroup mailing
++list at cgroups@vger.kernel.org.
++
++
++4. References
++
++[1] http://lkml.kernel.org/r/20160105164834.GE5995@mtj.duckdns.org
++ [PATCH 1/2] sched: Misc preps for cgroup unified hierarchy interface
++ Tejun Heo <tj@kernel.org>
++
++[2] http://lkml.kernel.org/r/20160105164852.GF5995@mtj.duckdns.org
++ [PATCH 2/2] sched: Implement interface for cgroup unified hierarchy
++ Tejun Heo <tj@kernel.org>
++
++[3] http://lkml.kernel.org/r/1438641689-14655-4-git-send-email-tj@kernel.org
++ [PATCH 3/3] sched: Implement interface for cgroup unified hierarchy
++ Tejun Heo <tj@kernel.org>
++
++[4] http://lkml.kernel.org/r/20160407064549.GH3430@twins.programming.kicks-ass.net
++ Re: [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource group and PRIO_RGRP
++ Peter Zijlstra <peterz@infradead.org>
++
++[5] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/cgroup-v2.txt
++ Control Group v2
++ Tejun Heo <tj@kernel.org>
++
++[6] http://lkml.kernel.org/r/CAPM31RJNy3jgG=DYe6GO=wyL4BPPxwUm1f2S6YXacQmo7viFZA@mail.gmail.com
++ Re: [PATCH 3/3] sched: Implement interface for cgroup unified hierarchy
++ Paul Turner <pjt@google.com>
++
++[7] http://lkml.kernel.org/r/20160105154503.GC5995@mtj.duckdns.org
++ [RFD] cgroup: thread granularity support for cpu controller
++ Tejun Heo <tj@kernel.org>
++
++[8] http://lkml.kernel.org/r/1457710888-31182-1-git-send-email-tj@kernel.org
++ [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource group and PRIO_RGRP
++ Tejun Heo <tj@kernel.org>
++
++[9] http://lkml.kernel.org/r/20160311160522.GA24046@htj.duckdns.org
++ Example program for PRIO_RGRP
++ Tejun Heo <tj@kernel.org>
++
++[10] http://lkml.kernel.org/r/20160407082810.GN3430@twins.programming.kicks-ass.net
++ Re: [PATCHSET RFC cgroup/for-4.6] cgroup, sched: implement resource
++ Peter Zijlstra <peterz@infradead.org>
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/README.md b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/README.md
new file mode 100644
index 000000000000..6d48fde6beef
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/README.md
@@ -0,0 +1,21 @@
+Patches for CPU Controller on Control Group v2
+===============================================
+
+See Tejun Heo's [explanation][1] for why these patches are currently
+out-of-tree.
+
+Generating the patches
+-----------------------
+
+In a linux checkout, with remote tc-cgroup pointing to
+git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git, your
+nixpkgs checkout in the same directory as your linux checkout (or
+modify the command accordingly), and setting `ver` to the appropriate
+version:
+
+```shell
+$ ver=4.7
+$ git log --reverse --patch v$ver..remotes/tc-cgroup/cgroup-v2-cpu-v$ver > ../nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/$ver.patch
+```
+
+[1]: https://git.kernel.org/cgit/linux/kernel/git/tj/cgroup.git/tree/Documentation/cgroup-v2-cpu.txt?h=cgroup-v2-cpu
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/default.nix
new file mode 100644
index 000000000000..5bef5633aa03
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/default.nix
@@ -0,0 +1,11 @@
+let
+ ents = builtins.readDir ./.;
+in builtins.listToAttrs (builtins.filter (x: x != null) (map (name: let
+ match = builtins.match "(.*)\\.patch" name;
+in if match == null then null else {
+ name = builtins.head match;
+ value = {
+ name = "cpu-cgroup-v2-${name}";
+ patch = ./. + "/${name}";
+ };
+}) (builtins.attrNames ents)))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch
new file mode 100644
index 000000000000..205497aee2da
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_4_14.patch
@@ -0,0 +1,60 @@
+From 245e0f743d814c9ff2d1c748175e321301eb16cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Thu, 2 May 2019 05:28:08 +0100
+Subject: [PATCH] x86/fpu: Export __kernel_fpu_{begin,end}()
+
+This partially undo commit:
+
+12209993 x86/fpu: Don't export __kernel_fpu_{begin,end}()
+
+We need this symbol in zfs for AES-NI/AVX support.
+---
+ arch/x86/include/asm/fpu/api.h | 2 ++
+ arch/x86/kernel/fpu/core.c | 6 ++++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
+index b56d504af6545..7d53388d266ea 100644
+--- a/arch/x86/include/asm/fpu/api.h
++++ b/arch/x86/include/asm/fpu/api.h
+@@ -18,6 +18,8 @@
+ * If you intend to use the FPU in softirq you need to check first with
+ * irq_fpu_usable() if it is possible.
+ */
++extern void __kernel_fpu_begin(void);
++extern void __kernel_fpu_end(void);
+ extern void kernel_fpu_begin(void);
+ extern void kernel_fpu_end(void);
+ extern bool irq_fpu_usable(void);
+diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
+index 2e5003fef51a9..2ea85b32421a0 100644
+--- a/arch/x86/kernel/fpu/core.c
++++ b/arch/x86/kernel/fpu/core.c
+@@ -93,7 +93,7 @@ bool irq_fpu_usable(void)
+ }
+ EXPORT_SYMBOL(irq_fpu_usable);
+
+-static void __kernel_fpu_begin(void)
++void __kernel_fpu_begin(void)
+ {
+ struct fpu *fpu = &current->thread.fpu;
+
+@@ -111,8 +111,9 @@ static void __kernel_fpu_begin(void)
+ __cpu_invalidate_fpregs_state();
+ }
+ }
++EXPORT_SYMBOL(__kernel_fpu_begin);
+
+-static void __kernel_fpu_end(void)
++void __kernel_fpu_end(void)
+ {
+ struct fpu *fpu = &current->thread.fpu;
+
+@@ -121,6 +122,7 @@ static void __kernel_fpu_end(void)
+
+ kernel_fpu_enable();
+ }
++EXPORT_SYMBOL(__kernel_fpu_end);
+
+ void kernel_fpu_begin(void)
+ {
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch
new file mode 100644
index 000000000000..dc9ca64bdc1f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions_5_3.patch
@@ -0,0 +1,42 @@
+From 1e010beda2896bdf3082fb37a3e49f8ce20e04d8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Thu, 2 May 2019 05:28:08 +0100
+Subject: [PATCH] x86/fpu: Export kernel_fpu_{begin,end}() with
+ EXPORT_SYMBOL_GPL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We need these symbols in zfs as the fpu implementation breaks userspace:
+
+https://github.com/zfsonlinux/zfs/issues/9346
+Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
+---
+ arch/x86/kernel/fpu/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
+index 12c70840980e..352538b3bb5d 100644
+--- a/arch/x86/kernel/fpu/core.c
++++ b/arch/x86/kernel/fpu/core.c
+@@ -102,7 +102,7 @@ void kernel_fpu_begin(void)
+ }
+ __cpu_invalidate_fpregs_state();
+ }
+-EXPORT_SYMBOL_GPL(kernel_fpu_begin);
++EXPORT_SYMBOL(kernel_fpu_begin);
+
+ void kernel_fpu_end(void)
+ {
+@@ -111,7 +111,7 @@ void kernel_fpu_end(void)
+ this_cpu_write(in_kernel_fpu, false);
+ preempt_enable();
+ }
+-EXPORT_SYMBOL_GPL(kernel_fpu_end);
++EXPORT_SYMBOL(kernel_fpu_end);
+
+ /*
+ * Save the FPU state (mark it for reload if necessary):
+--
+2.23.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gen-kheaders-metadata.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gen-kheaders-metadata.patch
new file mode 100644
index 000000000000..0639f8b4e8fb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gen-kheaders-metadata.patch
@@ -0,0 +1,86 @@
+From 2cc99c9cdc8fde5e92e34f9655829449cebd3e00 Mon Sep 17 00:00:00 2001
+From: Dmitry Goldin <dgoldin+lkml@protonmail.ch>
+Date: Fri, 4 Oct 2019 10:40:07 +0000
+Subject: kheaders: make headers archive reproducible
+
+In commit 43d8ce9d65a5 ("Provide in-kernel headers to make
+extending kernel easier") a new mechanism was introduced, for kernels
+>=5.2, which embeds the kernel headers in the kernel image or a module
+and exposes them in procfs for use by userland tools.
+
+The archive containing the header files has nondeterminism caused by
+header files metadata. This patch normalizes the metadata and utilizes
+KBUILD_BUILD_TIMESTAMP if provided and otherwise falls back to the
+default behaviour.
+
+In commit f7b101d33046 ("kheaders: Move from proc to sysfs") it was
+modified to use sysfs and the script for generation of the archive was
+renamed to what is being patched.
+
+Signed-off-by: Dmitry Goldin <dgoldin+lkml@protonmail.ch>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+---
+
+nixos note: This patch is from
+https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=fixes&id=2cc99c9cdc8fde5e92e34f9655829449cebd3e00
+I commented out the documentation part here, so that it easily applies
+to linux 5.2 and 5.3, which does not ship with the reproducible build
+documentation yet, which only was introduced recently.
+
+---
+ Documentation/kbuild/reproducible-builds.rst | 13 +++++++++----
+ kernel/gen_kheaders.sh | 5 ++++-
+ 2 files changed, 13 insertions(+), 5 deletions(-)
+
+#diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst
+#index ab92e98c89c8..503393854e2e 100644
+# --- a/Documentation/kbuild/reproducible-builds.rst
+#+++ b/Documentation/kbuild/reproducible-builds.rst
+#@@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them.
+# Timestamps
+# ----------
+#
+#-The kernel embeds a timestamp in two places:
+#+The kernel embeds timestamps in three places:
+#
+# * The version string exposed by ``uname()`` and included in
+# ``/proc/version``
+#
+# * File timestamps in the embedded initramfs
+#
+#-By default the timestamp is the current time. This must be overridden
+#-using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building
+#-from a git commit, you could use its commit date.
+#+* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel
+#+ headers embedded in the kernel or respective module,
+#+ exposed via ``/sys/kernel/kheaders.tar.xz``
+#+
+#+By default the timestamp is the current time and in the case of
+#+``kheaders`` the various files' modification times. This must
+#+be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable.
+#+If you are building from a git commit, you could use its commit date.
+#
+# The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,
+# and enables warnings if they are used. If you incorporate external
+diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
+index 9ff449888d9c..aff79e461fc9 100755
+--- a/kernel/gen_kheaders.sh
++++ b/kernel/gen_kheaders.sh
+@@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
+ find $cpio_dir -type f -print0 |
+ xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
+
+-tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null
++# Create archive and try to normalize metadata for reproducibility
++tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
++ --owner=0 --group=0 --sort=name --numeric-owner \
++ -Jcf $tarfile -C $cpio_dir/ . > /dev/null
+
+ echo "$src_files_md5" > kernel/kheaders.md5
+ echo "$obj_files_md5" >> kernel/kheaders.md5
+--
+cgit 1.2-0.3.lf.el7
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generate-config.pl b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generate-config.pl
new file mode 100644
index 000000000000..26c559ea9086
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -0,0 +1,147 @@
+# This script runs `make config' to generate a Linux kernel
+# configuration file. For each question (i.e. kernel configuration
+# option), unless an override is provided, it answers "m" if possible,
+# and otherwise uses the default answer (as determined by the default
+# config for the architecture). Overrides are read from the file
+# $KERNEL_CONFIG, which on each line contains an option name and an
+# answer, e.g. "EXT2_FS_POSIX_ACL y". The script warns about ignored
+# options in $KERNEL_CONFIG, and barfs if `make config' selects
+# another answer for an option than the one provided in
+# $KERNEL_CONFIG.
+
+use strict;
+use IPC::Open2;
+use Cwd;
+
+# exported via nix
+my $debug = $ENV{'DEBUG'};
+my $autoModules = $ENV{'AUTO_MODULES'};
+my $preferBuiltin = $ENV{'PREFER_BUILTIN'};
+my $ignoreConfigErrors = $ENV{'ignoreConfigErrors'};
+my $buildRoot = $ENV{'BUILD_ROOT'};
+$SIG{PIPE} = 'IGNORE';
+
+# Read the answers.
+my %answers;
+my %requiredAnswers;
+open ANSWERS, "<$ENV{KERNEL_CONFIG}" or die "Could not open answer file";
+while (<ANSWERS>) {
+ chomp;
+ s/#.*//;
+ if (/^\s*([A-Za-z0-9_]+)(\?)?\s+(.*\S)\s*$/) {
+ $answers{$1} = $3;
+ $requiredAnswers{$1} = !(defined $2);
+ } elsif (!/^\s*$/) {
+ die "invalid config line: $_";
+ }
+}
+close ANSWERS;
+
+sub runConfig {
+
+ # Run `make config'.
+ my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$buildRoot config SHELL=bash ARCH=$ENV{ARCH}");
+
+ # Parse the output, look for questions and then send an
+ # appropriate answer.
+ my $line = ""; my $s;
+ my %choices = ();
+
+ my ($prevQuestion, $prevName);
+
+ while (!eof IN) {
+ read IN, $s, 1 or next;
+ $line .= $s;
+
+ #print STDERR "LINE: $line\n";
+
+ if ($s eq "\n") {
+ print STDERR "GOT: $line" if $debug;
+
+ # Remember choice alternatives ("> 1. bla (FOO)" or " 2. bla (BAR) (NEW)").
+ if ($line =~ /^\s*>?\s*(\d+)\.\s+.*?\(([A-Za-z0-9_]+)\)(?:\s+\(NEW\))?\s*$/) {
+ $choices{$2} = $1;
+ }
+
+ $line = "";
+ }
+
+ elsif ($line =~ /###$/) {
+ # The config program is waiting for an answer.
+
+ # Is this a regular question? ("bla bla (OPTION_NAME) [Y/n/m/...] ")
+ if ($line =~ /(.*) \(([A-Za-z0-9_]+)\) \[(.*)\].*###$/) {
+ my $question = $1; my $name = $2; my $alts = $3;
+ my $answer = "";
+ # Build everything as a module if possible.
+ $answer = "m" if $autoModules && $alts =~ /\/m/ && !($preferBuiltin && $alts =~ /Y/);
+ $answer = $answers{$name} if defined $answers{$name};
+ print STDERR "QUESTION: $question, NAME: $name, ALTS: $alts, ANSWER: $answer\n" if $debug;
+ print OUT "$answer\n";
+ die "repeated question: $question" if $prevQuestion && $prevQuestion eq $question && $name eq $prevName;
+ $prevQuestion = $question;
+ $prevName = $name;
+ }
+
+ # Is this a choice? ("choice[1-N]: ")
+ elsif ($line =~ /choice\[(.*)\]: ###$/) {
+ my $answer = "";
+ foreach my $name (keys %choices) {
+ $answer = $choices{$name} if ($answers{$name} || "") eq "y";
+ }
+ print STDERR "CHOICE: $1, ANSWER: $answer\n" if $debug;
+ print OUT "$answer\n" if $1 =~ /-/;
+ }
+
+ # Some questions lack the option name ("bla bla [Y/n/m/...] ").
+ elsif ($line =~ /(.*) \[(.*)\] ###$/) {
+ print OUT "\n";
+ }
+
+ else {
+ warn "don't know how to answer this question: $line\n";
+ print OUT "\n";
+ }
+
+ $line = "";
+ %choices = ();
+ }
+ }
+
+ close IN;
+ waitpid $pid, 0;
+}
+
+# Run `make config' several times to converge on the desired result.
+# (Some options may only become available after other options are
+# set in a previous run.)
+runConfig;
+runConfig;
+
+# Read the final .config file and check that our answers are in
+# there. `make config' often overrides answers if later questions
+# cause options to be selected.
+my %config;
+open CONFIG, "<$buildRoot/.config" or die "Could not read .config";
+while (<CONFIG>) {
+ chomp;
+ if (/^CONFIG_([A-Za-z0-9_]+)="(.*)"$/) {
+ # String options have double quotes, e.g. 'CONFIG_NLS_DEFAULT="utf8"' and allow escaping.
+ ($config{$1} = $2) =~ s/\\([\\"])/$1/g;
+ } elsif (/^CONFIG_([A-Za-z0-9_]+)=(.*)$/) {
+ $config{$1} = $2;
+ } elsif (/^# CONFIG_([A-Za-z0-9_]+) is not set$/) {
+ $config{$1} = "n";
+ }
+}
+close CONFIG;
+
+my $ret = 0;
+foreach my $name (sort (keys %answers)) {
+ my $f = $requiredAnswers{$name} && $ignoreConfigErrors ne "1"
+ ? sub { warn "error: " . $_[0]; $ret = -1; } : sub { warn "warning: " . $_[0]; };
+ &$f("unused option: $name\n") unless defined $config{$name};
+ &$f("option not set correctly: $name (wanted '$answers{$name}', got '$config{$name}')\n")
+ if $config{$name} && $config{$name} ne $answers{$name};
+}
+exit $ret;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix
new file mode 100644
index 000000000000..cab11cc87ae2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix
@@ -0,0 +1,182 @@
+{ buildPackages
+, callPackage
+, perl
+, bison ? null
+, flex ? null
+, gmp ? null
+, libmpc ? null
+, mpfr ? null
+, stdenv
+
+, # The kernel source tarball.
+ src
+
+, # The kernel version.
+ version
+
+, # Allows overriding the default defconfig
+ defconfig ? null
+
+, # Legacy overrides to the intermediate kernel config, as string
+ extraConfig ? ""
+
+, # kernel intermediate config overrides, as a set
+ structuredExtraConfig ? {}
+
+, # The version number used for the module directory
+ modDirVersion ? version
+
+, # An attribute set whose attributes express the availability of
+ # certain features in this kernel. E.g. `{iwlwifi = true;}'
+ # indicates a kernel that provides Intel wireless support. Used in
+ # NixOS to implement kernel-specific behaviour.
+ features ? {}
+
+, # Custom seed used for CONFIG_GCC_PLUGIN_RANDSTRUCT if enabled. This is
+ # automatically extended with extra per-version and per-config values.
+ randstructSeed ? ""
+
+, # A list of patches to apply to the kernel. Each element of this list
+ # should be an attribute set {name, patch} where `name' is a
+ # symbolic name and `patch' is the actual patch. The patch may
+ # optionally be compressed with gzip or bzip2.
+ kernelPatches ? []
+, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" ||
+ stdenv.hostPlatform != stdenv.buildPlatform
+, extraMeta ? {}
+
+# easy overrides to stdenv.hostPlatform.platform members
+, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules
+, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false
+, kernelArch ? stdenv.hostPlatform.platform.kernelArch
+
+, ...
+}:
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+assert stdenv.isLinux;
+
+let
+
+ lib = stdenv.lib;
+
+ # Combine the `features' attribute sets of all the kernel patches.
+ kernelFeatures = lib.fold (x: y: (x.features or {}) // y) ({
+ iwlwifi = true;
+ efiBootStub = true;
+ needsCifsUtils = true;
+ netfilterRPFilter = true;
+ grsecurity = false;
+ xen_dom0 = false;
+ ia32Emulation = true;
+ } // features) kernelPatches;
+
+ commonStructuredConfig = import ./common-config.nix {
+ inherit stdenv version ;
+
+ features = kernelFeatures; # Ensure we know of all extra patches, etc.
+ };
+
+ intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig
+ # extra config in legacy string format
+ + extraConfig
+ + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig;
+
+ structuredConfigFromPatches =
+ map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches;
+
+ # appends kernel patches extraConfig
+ kernelConfigFun = baseConfigStr:
+ let
+ configFromPatches =
+ map ({extraConfig ? "", ...}: extraConfig) kernelPatches;
+ in lib.concatStringsSep "\n" ([baseConfigStr] ++ configFromPatches);
+
+ configfile = stdenv.mkDerivation {
+ inherit ignoreConfigErrors autoModules preferBuiltin kernelArch;
+ pname = "linux-config";
+ inherit version;
+
+ generateConfig = ./generate-config.pl;
+
+ kernelConfig = kernelConfigFun intermediateNixConfig;
+ passAsFile = [ "kernelConfig" ];
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ perl gmp libmpc mpfr ]
+ ++ lib.optionals (stdenv.lib.versionAtLeast version "4.16") [ bison flex ];
+
+ platformName = stdenv.hostPlatform.platform.name;
+ # e.g. "defconfig"
+ kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig;
+ # e.g. "bzImage"
+ kernelTarget = stdenv.hostPlatform.platform.kernelTarget;
+
+ prePatch = kernel.prePatch + ''
+ # Patch kconfig to print "###" after every question so that
+ # generate-config.pl from the generic builder can answer them.
+ sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c
+ '';
+
+ preUnpack = kernel.preUnpack or "";
+
+ inherit (kernel) src patches;
+
+ buildPhase = ''
+ export buildRoot="''${buildRoot:-build}"
+
+ # Get a basic config file for later refinement with $generateConfig.
+ make -C . O="$buildRoot" $kernelBaseConfig \
+ ARCH=$kernelArch \
+ HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
+ HOSTCXX=${buildPackages.stdenv.cc.targetPrefix}g++
+
+ # Create the config file.
+ echo "generating kernel configuration..."
+ ln -s "$kernelConfigPath" "$buildRoot/kernel-config"
+ DEBUG=1 ARCH=$kernelArch KERNEL_CONFIG="$buildRoot/kernel-config" AUTO_MODULES=$autoModules \
+ PREFER_BUILTIN=$preferBuiltin BUILD_ROOT="$buildRoot" SRC=. perl -w $generateConfig
+ '';
+
+ installPhase = "mv $buildRoot/.config $out";
+
+ enableParallelBuilding = true;
+
+ passthru = rec {
+
+ module = import ../../../../nixos/modules/system/boot/kernel_config.nix;
+ # used also in apache
+ # { modules = [ { options = res.options; config = svc.config or svc; } ];
+ # check = false;
+ # The result is a set of two attributes
+ moduleStructuredConfig = (lib.evalModules {
+ modules = [
+ module
+ { settings = commonStructuredConfig; _file = "pkgs/os-specific/linux/kernel/common-config.nix"; }
+ { settings = structuredExtraConfig; _file = "structuredExtraConfig"; }
+ ]
+ ++ structuredConfigFromPatches
+ ;
+ }).config;
+
+ structuredConfig = moduleStructuredConfig.settings;
+ };
+ }; # end of configfile derivation
+
+ kernel = (callPackage ./manual-config.nix {}) {
+ inherit version modDirVersion src kernelPatches randstructSeed stdenv extraMeta configfile;
+
+ config = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; };
+ };
+
+ passthru = {
+ features = kernelFeatures;
+ inherit commonStructuredConfig;
+ passthru = kernel.passthru // (removeAttrs passthru [ "passthru" ]);
+ };
+
+in lib.extendDerivation true passthru kernel
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/genksyms-fix-segfault.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/genksyms-fix-segfault.patch
new file mode 100644
index 000000000000..47ae77a5a54d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/genksyms-fix-segfault.patch
@@ -0,0 +1,19 @@
+diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
+index 88632df..ba6cfa9 100644
+--- a/scripts/genksyms/genksyms.c
++++ b/scripts/genksyms/genksyms.c
+@@ -233,11 +233,11 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
+ free_list(last_enum_expr, NULL);
+ last_enum_expr = NULL;
+ enum_counter = 0;
+- if (!name)
+- /* Anonymous enum definition, nothing more to do */
+- return NULL;
+ }
+
++ if (!name)
++ return NULL;
++
+ h = crc32(name) % HASH_BUCKETS;
+ for (sym = symtab[h]; sym; sym = sym->hash_next) {
+ if (map_to_ns(sym->type) == map_to_ns(type) &&
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gpio-utils.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gpio-utils.nix
new file mode 100644
index 000000000000..e28d838efb3f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/gpio-utils.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, linux }:
+
+with lib;
+
+assert versionAtLeast linux.version "4.6";
+
+stdenv.mkDerivation {
+ name = "gpio-utils-${linux.version}";
+
+ inherit (linux) src makeFlags;
+
+ preConfigure = ''
+ cd tools/gpio
+ '';
+
+ separateDebugInfo = true;
+ installFlags = [ "install" "DESTDIR=$(out)" "bindir=/bin" ];
+
+ meta = {
+ description = "Linux tools to inspect the gpiochip interface";
+ maintainers = with maintainers; [ kwohlfahrt ];
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/anthraxx.asc b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/anthraxx.asc
new file mode 100644
index 000000000000..101ccfbf0f2b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/anthraxx.asc
@@ -0,0 +1,325 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2
+
+mQINBE64OEUBEADPS1v+zoCdKA6zyfUtVIaBoIwMhCibqurXi30tVoC9LgM6W1ve
+HwPFukWq7DAS0mZUPE3mSV63JFLaTy0bY/6GO1D4wLdWZx4ppH7XKNCvKCbsi70k
+UozFykNVf+83WEskuF1oYzXlF3aB5suz2IWJl7ey1EXgIpehwQaTJUA5JIWYFp9A
+566LRNJefYMzUR33xc4dRKj6Etg0xdLVq7/vZoo8HpLCBGNWiP0AKqFWEwTg0xQL
+7nsJA5tfJJdwAJvrzjpFsvb63PKG6waAtdHhON4q7E2Udak9fz2tRjxA5l9l2zXk
+aqsysUzkxPhNjwMENoQ04KZg4aT+ZhhBzTowSWLp3KV2uaZ66kdPUO3s+/1bPp5/
+N/IlykaUwyL773iYOZ5dOY/9hIuX/zssihcrGEMW6yIyZR5uKhzYdaM9ExTXP637
+UccgNS9/pskPGPx/xK23NDCfeHzL9YHS5KokA2wb/b9hqpwvLaeblbMl2pt79F1R
+ac+rZlrRyX3NvlTQP4hqM9Ei2YBAU7QFDJEjH8pVIceL7grxi1Ju1iD5QiSK+je5
+Jj5EAikfwSeAttSzsqNvaXJHfABrv5mkkVt1z3icP3HIHTYnG+uj+t8kvW+o9/1i
+pD6e6LUh4w5v1aY9kaK/M3+eBH59yNYI99crPUKUBVfW4gv4DBUJAQTWRQARAQAB
+tDVMZXZlbnRlIFBvbHlhayAoYW50aHJheHgpIDxsZXZlbnRlQGxldmVudGVwb2x5
+YWsubmV0PokCQQQTAQIAKwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4ACGQEF
+AlSXU9QFCQfATw8ACgkQ/BtUfI2BcsjPbxAAs+UR/bJz/HeYTpPy+HnKwDJgI9GP
+AZlNvp+QSIhOTtKCYkQ/Iu+5scY5J0Qyv0pcJW5Rxjx+l7KGovw84jzVznnYsJoy
+UQ5H3Ev9T2xW1nrZT3abJ7j6ZIck+Q+WFHu5Plsq6doSXOXmJNoehvT3BVolvc6w
+S1+CAoyA5Wm1yfocZgVOvWPWQaa1T4XA7OwxFWrvNWEZwAzTSjkGHkwmji+DxdBd
+RPam9+qm/rcN1IJTu6xJPr38a9LydWonsUpTR2Qn7Bo4EJp8yHJLaiLEMV/Nmgrr
+1orBYw/OzDzhbdMl+2zzwEBLUMPABdgnPM6ZCZ5PWyWnCU4jsBGyVd0IC5xEu3Eg
+a0EtIdvx2lXiLfh2dulpMn52uJY5iNwaTleO+z9CENQVhh5R4FuN9H0BLiyAxf1+
+MkD3jLT+DGl02hQghtxz18iTkRk7KOw/NFn4z0is+TRl4/ocNt1LiWQXt8dr7qdx
+zvUpDnxCSYZkeutzopo1TA4lKpnsS2mHabx6CbrUmF+wOIr8gHUfpBFeEQ8BHebU
+5X0JrFF5mjeNl4uK9l9lD9ng74rsSpKPr15DU41jIuQDHJYd6H3TXQ4K1z7Ciivy
+r4vgsruAFX/GduKseOx1obWW3GfIQzLAIuVdjldgREl61GWoLiGFqlcveiAIkN5p
+Bxc20hSrHgZP9ZyIRgQQEQIABgUCTrg/KAAKCRC+dA9BPyK7GTK7AKC8Sd1ndNvc
+1ispBaECbHT/JPfGrQCgvkfGBsFn/KBrgC5hTm0mSxdy942JAkEEEwECACsCGwMF
+CQIchwAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheABQJOuD2qAhkBAAoJEPwbVHyN
+gXLIXL4QAJtbs62EpOIFld0N+tTEFn1qQPPaExAXmH/RF5Epf+0rSS6B0OXEZBXz
+cWtMPbHxoLjN1iY8o0QC1ex7/KDfYq8Ho18M9P+Lf6XfW0sJ9d021U5MJWGPs4zA
+lNFXJqeMgfJZAno2N6dO/azcYHq1wmSgUbTb9Oyi1PHfn3g0UAW59dfkB8d2jEvY
+Yed1X0mBPPXcbgnYNZ514JQtm9wuDdVWrh/Si9EhKg6+MPcbv18G4lpPGR+yNq9y
+3Jze4vmmWen0ceDJEp06IAeTfJzzD80Oui2WXtLfaQxgf9uuZtGjrMX5l+mq7rBS
+VH/dsHP1VYI0efKIs7qbmiLcMRVWYIGix9I1C3UYr3ImYiCGlBG/uQ929xbjWAHa
+hy4W6rzruUWjyi/Kz7QRnyBgtHfhDO7hYziTr5hoGhd4VeUpcbxL+MegXFZsWJlE
+kz8TOOsZ/4XxXHVoalg8fYOcA7j/aoszsPMQUOL/5jsVRhyP3evtVxb3m1EwvYDK
+Lii4IkVxGztlBOIgeT4kwXgoJEASSZHgcd6tDv9q7o33n2I1DGL8X3axcHES2/C7
+cP+li3KL3Hc9vjgaJ9HfcQLuMcHqfoHn+YzVfbG5XeFcxhgQpwpYsZv3MTbXAQwI
+fRHXRuIfOiFwqUXahi5N1WSIXNBGSyI7pu9ht5I7gIIOINE+VS7FiQJBBBMBAgAr
+AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAIZAQUCUNol8QUJA/yTqwAKCRD8
+G1R8jYFyyIqUD/9yWw7WBQiWyIMpVuX9c2Ov1fAkDya43fDm0gqIgNsdaxCt5ATh
+XaXZ/p2jglWwon5jDLDNsVR0/Q/t8ugdcP3bcwRtW2YYQ2F1PaNjfr5WsuPEadyc
+J62DIobY4IzqBpDuqGLYdbzZeKr49VwbRRvIJpphrk3+CekFvdIs1ofEpA2Kn2oA
+DXfYuaWoVBF7fTwAZmc3hYPOI1jK7nrFZbCnAT4WZPzZ4IY9lsaNTF/4mQ8vV1xF
+De6HjfslHURlZWsWtQIKhIPBKoZC1nP5VRK3IHYgKw8toq780kalLH8ofv9BkSrs
+t98JOoJX4etdmE8Ta/+Wg5C9EzR+909tQfdWdkaRbhvbtl/x7X76HU4ItefLR5pW
+d0OSo488QZMQjCUWlzgPMsmnYMQm6ckNOp0B/RtMfbJV7t5H+JE3PLfFG55jcz3w
+uNGhfZyl/ZhV9fvGLU/sPyhIW7ewuIwd+7i12fH9r4NAGB/mkSKK+tHGcTZvXxux
+5QMKE+a9u6NMJRrbsIiTFwhrCLMgzLYL0mtX8FZXNFFZzGFYkiXymBR0ze4LKzRo
+dMFpyP/w/IIjYBhVpgboT2EMMIgJHSsMJDCdDjI+9cAykVF6ccSiUQ11devHL6Pv
+WwlT2Ub4TP4yCScHDPyfWq+tfdQlWFVRZMRJ7kmq0VagqomdRHgLPyPgDYkCHAQQ
+AQIABgUCUtgrXgAKCRBH1QFsQv98LACcEACFq3Oz8nHAa6KsyspIWo0+HjzCtTv0
+G6TB+svf3fl24C93IfFhpSyxNf8XVa9h9kCU5ZImYN+LaoUGiz3lcYxjdOeFYDc4
+GU5TFrJwY9eOYYCsr+z+NLn7wlLZEO772lGUDPJMWxSGqR9yOGhQCTIADLLcp6mt
+07zdejESYxMT6IjYR+rX6miWG5Hr9/lBdh/X4XhGpHEY64IL8vVB3C+FQfG3hiMB
+bHbvJ4/S/cjfNM1T9oKiA0H6jklRHIdstj+2eeWA7lS+GE3Mpkra+8KmkEjV4O03
+izcRpMm1yTGoTjp9UddTNYErb/sha5YigYAqK8bj3gh6tTFNJHbN4RWgtPDyc5Va
+1u+sH2ob6JS5tez8/Z6pMarGpTQujIGAlntP4igi0Q4hxyLof6Vtc6XF80uSwTvN
+RRmQrcq+kLPwX0NbyZCBCI+kjBPu2b932JDTfVBKwJCLF3e1zvQqN0C7EZnIzveX
+r7VtJ4WHIfSyi/HQP7xm5L0uQj+KRr+/LMaxkCDgrlqoWTgAoxCAPYH1XCvBoJRc
+DHjNikyEAS8WUGl9ZHQyAoFngi/jqH6WoDAmfBUKRoBMR2hXLOKUBmObw0DHgauM
+kk4kD6CW4UEy0SM/i9JD7sk9KiKoHMip1jguKRJkHJ1WSkNl7nZpeo+KG0WbGHXN
+b7hnrQsNyqJkUokCQQQTAQIAKwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AC
+GQEFAlLV0QIFCQXdHmsACgkQ/BtUfI2Bcsj8DA//b8wZrFY/Fj/iR5ZaO0AjmMV1
+hM7lAFWLfDiLyYofuiGLUg9rqFWj+Ks2kedVN7+22Bjgi5fvpXv3Uy4trZKKw8Xs
+FJ/s8HQ6jzIv6pFdIYPLFQBqS2tEgfsanPZWIqJI9fbhOrRGN7WV5tXiksCaRO+u
+rLjIhAYmsDb//BD2xqsY54ouRdrz5nRG3qG2odq2Lw8XquW6srouGaSm+BI3sow6
+l2eAW8UjbxwICQg2ZPZYCBc9ArbgLS1ha+yPhp65nGpVbqDA8rUKC11op1ArAbY3
+Yt6xzLg+RCuCHBa1gNPpDoYV9V8Zve03mEIcsK10X0RhJQ+z4INvrjtelPRCOLpN
+179JmsyxwOzwAPg773SK1Z31jSirsiEke/q8j13PGNDBCb4ZKpm/KOht+4d0jJLK
+GLqD85cv3/uAeSh2zWkoKcVW6uVZpiz3KA3i4YMWnteOlrlZH28nIrDXevPzkOxo
+pZlhuLboCD6g6yuZI4Wm9fEiga8xmRDw4RrOIuDXWjNW6IVaeFGvnYaNf0wnmBD+
+FE1SMWwcmqgB1yIylmKqH0lYce8SVAMLkkOlaijhWrfCO5iS7zjWaVz98HCqFfwR
+gHuJTxOwwlf9Qb6cyC3bGsfILBUuE0L5vUAZUAc61H+6Sv88CDDUO1EOKaqAAYhR
+plvoyYZ3xiSMgzYKGZ+0OkxldmVudGUgUG9seWFrIChKYWJiZXIvWE1QUCBvbmx5
+KSA8YW50aHJheHhAamFiYmVyLmNjYy5kZT6JAj4EEwECACgCGwMGCwkIBwMCBhUI
+AgkKCwQWAgMBAh4BAheABQJUl1PaBQkHwE8PAAoJEPwbVHyNgXLIQokQAKxJB9/F
+TfBae6eqcT+izxGSnsvbc2bcrtsmKkhu9HwpsJ4IDutphXFB0wFalI40BL0o1k54
+Wlfv5GHbq7Ju3kW2dmTMP0WpfFytV7rr2yqSmik+skJw27BDk74rP0v4TNOHaTrP
+nokfTnlaKuv1bqlwbIwV7rJ5jbAtw5hueeN4jghGU8SGlCOEZ/xGxYYsvtyPhZhn
+kmsAzcPr/BpW4NkSb2SnRIO8KzcPnzxz7JDdeIusq/YW7P5OlhDx4ejdh0Wg6ISl
+zxB5VoqFqNuKTBQNz4HHpqDVQqEDE4JngMerDr+4qAiDYI4w6kN3Ce2LqciRyMVh
+YYnTqyyjXYY3C1WwXIa1tZb2Cw2DorshNFdACr7wKQMOoJtAFpdd3d/DRKQWCc3x
+jkBERqZ+55unTY0/0uyNPoK0noAcGydiU8WGh6wyi+Do+Zxq4QJEcqL/FHrhlaiw
+LTmgDS+XDl7zRtQia7ykpi/xqe74ujOHcJO8tpY0ZCdR2A13xiOi+11wndbOkBFv
+dQ0vgih9ROzwe3hBbBQQOdF4hkA9vEd2Ks4gF8IR+5ixWAIyZAVbnDiLelWgQgnE
+aeEwTtfcXRNAxuj+MgMPQhXQ2/cK0dPD4z51DchVRIf9G3hAuBT/CEhTqNkkm5F0
+og7azwd75+vh5RxwVld3ES6CMXKaiV4csQkdiEYEEBECAAYFAk64PygACgkQvnQP
+QT8iuxlligCeNgfNE4w1AQuOC4ef3HNNY0GXgVMAnjmtCVIUJv/w6PDimvf20rgF
+GVHxiQI+BBMBAgAoBQJOuD0KAhsDBQkCHIcABgsJCAcDAgYVCAIJCgsEFgIDAQIe
+AQIXgAAKCRD8G1R8jYFyyPv3D/wJ+sYXqSxoo8OriGMUzG5LXs2Hf1YULdlysGa8
+mxWTwCIEMSSx8AoOKf/FyXglDVl9msfOgv6jRiN+UyNCQEv+6a5ZCL7BlAVU0Q4W
+w2/UUlOUlLMC1QAodGcC3kiPSy41jnDVswKYRrICuiW1Pqgad3h7u7caqvqG1D/A
+YOR2Q8JjY15j6Qf62Xx+YANx2tPWKeDyPUAN/x1W6RrEDbN5F+1qOpPFuTnpPmqH
+q4zxm4Dz4szypmAKsN+5/q8T6DJtSnP7COtsY467oX2XtNTTuCIsU79lBVo/yan9
+ofB6hu12KyXwJIl1OK34g9VEP5suU3hcEw7uVAvxyMYJQlxORUCG0DAFc/oPm3d0
+ypRdbxXJMjoS3pmCf7kwnEA9PIAjZDYuVHGZkAdmYYInTIH6ipjkVxDHEF1en0h2
+zHJEZC7NIYgPyzHXmH7Xy3VZVhhKKKM12VDOuIOOecQPuFIw3hG7dymjn5e9dMzv
++DMkbEZzoFahLYkbVGG1FGzhE6Uvb/IG0UJCC4nDz0pzZpV++QHvgEvbY/HLbHJ4
+o3CT5aVE0YIhTP+zqXNFMOao8yZy+AzdMzdX+Y3ADZfY0oiZ+JH1Zo++rdrgXUhg
+Y98QgMwVwESbwaBKjsC0JnlmWyNivhIOS6NRyqR75E7j7JSvgJdxhvpQXXkQ/BzL
+FM1Ej4kCPgQTAQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AFAlDaJfoF
+CQP8k6sACgkQ/BtUfI2BcsiEahAArZfD1yJK385eqgCZ5LryVLRXrocuF1zlHl/6
+ugRy2TEe43ex4eTOY+mv4ZJVSxbDzUqMbBv0m3IETbM0CSESjGD+i5I7K3IToZO9
+ZgIXDbpoy9x2KWjU+R5oaxCTmZ9jk1p+f4zHxc8lJdgOXPwcIIT5Euwk4LAFN+wn
+CUHkO/D0xzP2ivTrM+VHNWqSUcNInAGRx+R0NvdSryIAsdA/5E3ql786WQhPy6L6
+1d7cmxaLsfAKIOf8ydNyoiqmJkT62omLLnqyERfLZRa9RKt5EgnxX6kR2BA+h/Gn
+KVV18bCIJjF3Gjnh3qjJehKRaw9nmzrB9KtGQAHdIp8ivNvjMitc1ijRIECfidWd
+lGxgmuI/gX58eaV3scjbs5YUFmGhcZIgjCxWWxFSwmzJTUVT5XqBpXFQB4dokj9m
+NNMpM3YH8T9QaaS/m9j7cmCJ4gxp7i1bJsqsVG5BjRLiZv701eVKVmU6vqhubR0R
+eSZghqho9e44ZMbn4rJ5kTQhGc7ZGNsIyChMSaYVreB8IBLDC7rg8dB/umg1OYOp
+8EqRLJyXdtpa4DN3X0e4WcWb0Toj4QuyCh/es1CtBldhdqHr0aLZYCX4i/KuGTXI
+kA8LTOJmZsE+K+/NCux1VHK9DADKcNjhSV0QTf+8ntGlNW6i2Mlt34thZK5eeB6W
+Bbo1zl6JAhwEEAECAAYFAlLYK14ACgkQR9UBbEL/fCyyQBAA0931q8dBD/6COmat
+8S+JSgcuIpylukFxU2vySBWSGRHFmFzwbokUE4bbNyutwNO2cNBa9zcxRPrkIg+7
+d65QjdZNDV2zWTjv5GwzEMjWxhP7VpTwTouYgx9j2d2KpFo2jfhTtZ7OU7DDF9YT
+FsaRiZHHZT+W/JHuB9Lxc55HkSagu00yTaZURc0olBui5c/hqBte1b3OWTjCmysG
+mwDL2FwdmFi9mbEm77sdD8PSVfkZaBv5rIaet+Xe/JMZoz0WUkZRCFXMr6B7aOdS
+WeB7kUsPh2J5dhf4x4YaxKLOHod9JQF/DGJsdexKqMTqM/xOMSQ1FTUMCQ5SBWJc
+3PywqMB/0eqlteHydlk7bb9HLCT3M6vVxTkpj834wGRsoVXPqWKzAHPpO2kjxXtc
+4DBh7T88YGE2k5rxdJHb3MjWVJQzHGhrO5Ji8CQaHjUJ4BTyim++RDisDi4C/QJ4
+qPOrafw/+KyJoWyfmAUpxplPvY/LKJlvKaKxmpwlildYjH7HjoYvCjagbSCUOnzo
+uM//YIJ8/o8QdxEDdYiTd7cwskYWphrAlV8+vCl/Y0lepRf+hsUS+uZi/NX4qYMx
+CTsewnnqJQduuehQl9/RnoBX9T04kS64cWNaPZ4dxZUYJm3us5QFcQJMysZ4tT1Y
+A0oEUX1KUTDzTQXT/kFi8MtmXauJAj4EEwECACgCGwMGCwkIBwMCBhUIAgkKCwQW
+AgMBAh4BAheABQJS1dELBQkF3R5rAAoJEPwbVHyNgXLIV98P/jcu/DiP/muH2Qsy
+FtjscyLu1NzBbSFB9q1jMVfx3VbaIT22Ly6BIQNHF7L2fpjf36EWpdJzpfR+Glp5
+1+KqZgIMAW5CGguSy8v7iHs6Rh5hzChiF48wCqxUmMdQ0ITTrnAXIYq6H6s8ytKF
+Y31znXmne1XYBg8e4yb3pcBhkzIPeVU7rMz9PjPB0+Q2jWCpqPA4eUSV8rL2TxFR
+KbEt8XlkZ6yuCLnkN84aLZFxfZA1tIGifi0PpeaO2z/IwOmftbQRiljMdnsPye49
+j4wlJS7yRIpnH3nH9Zku/MrDV/M0z7BVwKfF2F95/2QX4Tdyd/UESTdLqGtXpX4c
+axahZKrOhNr+k60qSBxoBqKauZkSbZunRnbYmVa3nA2kQuIPF9/QmoZgDUfdkKZJ
+u1RjwcRUGKd1XV19QjUvBMD3oHA4G6Jbi5vWKQZ40KVcL78YIL7C8dUOiPIasA45
+olaGpCSsGsfrMp5ngegxM+uh9Tc2kTFC9bTqp17VYI96cAqGrEBUQrmLmZLk0HUm
+a6MNZO/+vKN4UTlgjpjxZon+/yK8bsmT/VNie5hzqZim6tfztl3rpJ9jPUeLgr5x
+oGePYV02inapzNHdWFHk0L9zR/3KKfJ3IRJwUXp00Eya28hEepIvdxgLYcN1UqVn
+VuFuMY8zYSl/VXtPxySCLENJHxvdtClMZXZlbnRlIFBvbHlhayA8bGV2ZW50ZUBs
+ZXZlbnRlcG9seWFrLmRlPokCPgQTAQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYCAwEC
+HgECF4AFAlSXU9oFCQfATw8ACgkQ/BtUfI2BcsiPxw//X2xUctIrd1O7UOk7LHBX
+/xI7xXoWQcA7l/1XMuZhM8yC8yIoAgvFrWBP1a29I0P3/yigkQXs+eTDTdvb0QP2
+q72q7Azt852v5u8+dHzoOXDpbo+4lfX+0OBDWimwJuChD8LQH7b7jO0oqWIV0AzM
+vegFJVp3cDbyqw08lBz3xZ79A9JtBeewf6PLpXKjEVS8bEAZjZKjsjAY+5ShtJAf
+PsD8r353dmkaHgC5Aji74ijZeY3PUCvGVVCGeN9isLnRpTEn7qUvN2DfHJU4w6aw
+sXu7m7zidISo6dQLUzo54dHKWPGFy6INNkzXPOgrlbYnjt7v0Ou21/R6HrhdmsSw
+lt7GALJcgAUxrcT/ljB3SZhSB0BdH0DXPcUziEdfhgMhhrXYpMjwH2XFBD1MLusW
+GaVDbpPrSoEnmPVePcDUonDHePcuLjfOl13mOER1Kf6WFapOCa+4HCLakfKcPnGY
+eyfD7Dbz3/046MmfQ8/Iyf8ipFXN6tI2WkRKj8uq9IFYrX3yoCBxZJN837DM3Grq
+h48/T3pYU1f9LiekxbsgXmcHoGNdXX5+EsuO+QILZPttlG5QLuqFdJHei77uvW+B
+4u8mgzi1Zhh0hRLm4K6UaJ/fBJ87BZSHShPKI9PI073U1O/CcYXnb8cdPLu3UgSQ
+FM/bxT70TSYKI01Dt4KXRfWIRgQQEQIABgUCTrg/KAAKCRC+dA9BPyK7GT9FAJ47
+X5+0dQaOFkfy3WnMgX3AmIXJYQCfR4XL47rZ9a66jWaD0IbcXMK4oE2JAj4EEwEC
+ACgFAk64PJ4CGwMFCQIchwAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEPwb
+VHyNgXLI2U8QAJGKPv1gWLn7P1KeHVsKkfRf+zgdsoY4mF3bUjX/03z1h1OKp+S7
+gZD/ZI80ckw/ElgFt9sr8J+pOgHk+aGHW+V0cZNgDHXCINb17s+Ra7SA/SWeJOrr
+d4IpvTnjGc88C/j+bzRFagfnGXU601PeJdXIe6H75xVGIb0DgQBfPB9m+7p3sq/R
+6UigzLwwhIQRW/l77hq79v5Rm77e0GTfcYHSuKu2Itim8p5OYCNchr4ZpBzrv5cF
+/nH+HyD0AnM1q4a3mT9y4abNgtxJMGJBoIUEDT5vaTRpPowVHIGg9QroHkrYkMWA
+ffIBzoq38WLnPjvjNtTncyP7sjbP8KS7NfjxZ6RAcNO6m6BTDYG/lM9jwCcOma90
+RZDVYD8hy+z1hXWFfB7zB+5TYuuKV5SXZpS9/JUR1BuI44WkY0hLHUa7inpqLlqc
+b9O7KYikgyaeUKAN5LkF8A7rMVzuhrSItNzJVOs7WLnNAe9+Frzqx/jZ9aU04avS
+r5OlWLdL7k9JNDnsLFqNtG/XQ7Hc8CPl0HvY3YXYGD3xwW6Ua6+ykxZGmQGPB68W
+6a7G5EX+MEWKZgMQYsl1HgU49/sOD6QnCG3m2IB7bRAf5Kd527BnSgAaYHjVug8G
++X9opDwUW1b73Ut5tWfZJqQ4XBjl0Hc7Zi7OtlqdBeKGu/65QU+N9x33iQI+BBMB
+AgAoAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUCUNol+gUJA/yTqwAKCRD8
+G1R8jYFyyPv+D/9lA9yMXPBROLaCRab8Ca2QJBEtpT6lGVlkQ5Am2C8xdoLGiuJF
+E7Cn/lS1j4RSVDK6DELeaBMXaY2g1eun8g2ERJIUGC98zrPjZXs/ZtCZtX8vYr1X
+Bf9U8Ty6N3rKgt1XHc1oMgzkKLUc72RC+P/fkDsiAg62nVcmOFFykyTXnpM/5Ux/
+9kaahjf4LwGeRqkDIoLrXdZ7FHPjei8VlKSiHTkl4F+UCzEySxiInV+BWAhL5Lvb
+zHxHaNDCquOb2zbgafVKON3oa8nCZoUw3iwpjrEy/JT+1BG6vxyT/LX7wPG3SKEw
+8QTl8YBF8wvHS0JHW4KTc4grCMNWDwfkrlXnp6ZzTpy4JXZfYs/ltR4FH3atDG2C
+xRCSAWXkGyTPMZkougdDbJ3jjViYcWO6B//LE1qDjeC05O9G3MXVxu16M5U8nVA2
+B3bo5cVv7+ECBTKaAvG3ZV6eOaeJ63gHRY8qI7y5OgzuNfxUXMTIAjHfO2mvSy5M
+qFgDI10F8rYevGOKxvPVE1F8aiD1uRAOMCcLTy3oUKHIdaskSytL1D/bT9WqWzii
+OXhLhSjMzkdPSUWVABeC6KM+Jcll0A0sHTkKWS3mavx3dUacB+O4efuTKNhSvo7n
+XhUvSOOikRityipE5Ma5WlXBiu54DdIMGFzANHFdb5GmC7da9F1aALkshokCHAQQ
+AQIABgUCUtgrXgAKCRBH1QFsQv98LMmaD/9W2qJyFlZAsjOWgNQPwUU4vV9/Ursj
+kt4RI/oS0Gzovw2bmL0a+Q/dp6wM4PBMuYQXCepF8V+o4uKzL2OjVZDVtU/KqGCY
+rEigiAhG0gHxgF1ukc9JQzhShFeq7/wkY+FQ4MOhuhuUsSMlvFzAd1hY+xlvckol
+DEeS54loDspUh4EwxsWlopaA1rs5dzVXrYcinz9iDzLj6ujb6uJzCQVogk9w3dv8
+smKn81TVhtR4RFecqL9mURZcGnj7NV3n2Lrl2Pe0u/DiTtpavCkzVx7v9qiB/2Di
+dqWR7OtYcywUr6lZeZsNabNwntPxSP7V6EcNXF3Qpi2IkAcwdJKb+aIG1v7/Wx77
+GhpBhbtdgKEebttzO4EVVeE8a2kmgqc8VXeAeqI89egU53dUdAinejFVDyemxHnJ
+L4L6uVnSxbk/vRzu+fr6EaPyBsqORGXj2OuwxlWcnWs/N9XzNaiq6funedUSYtbP
+trdpt7ogvzrQew7wetcwfxSB3IWcVwA9QvGDIBHTWPrb87jKV153w9I+cSfz9jg8
+qTIOw4qad7VOC4L1oaoRsLq6VFgnoW5DLsuhaVd6fgdY/byL6H5q2FPYJ+F8ovhR
+2yPlQm8UYIFwmnwzpnuGBaPtU0bP7C+SNMK+G/9+b5q4psh1MnK8sg1RfSr1w7sw
+b+Tur045QrUDu4kCPgQTAQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AF
+AlLV0QsFCQXdHmsACgkQ/BtUfI2BcsitRA/7BbFuuAXPJMA4XtPhlYbfhNkYQ7+v
+vx9HIZ1SgJfhpYwt/vbNTVclO79XD65v5JSWx+0gVJfHNolP5umB0++giIw9NCIx
+uVa5eh3kS5NFfJ0YHrYgpFDdZPHRA9wI+oZgJBC/Cm40kafgTUoPFqXb0Sdlcz3R
+hciLZBgYXV/uYubczfmAaJpmrVI1UuUWYrdPnmUkgitp9e6IePYiKVDeIGhBW8Bc
+7Nbs2hc9yH1zwv3Affs8m+4tQQiwQHsB29WEZcmBuFllTbA5g5bvTvhfCRmYVgWC
+Ti4SW+uA0B05a/aVP8fDXk82qCQ4cRB1BOwVNn+1/Aqcw+Zh8KKzH8gpPcsKGGP6
+uNg9uinuxYDneEY8cG7FSpm3XsXu4q4N6j5R63U6hz39pY/5Ib8mzYMEoLEZOLPu
+CkVH9OOQc8zuiRL/wGc0pbMiGPEp13rAI0WbIFahrWS60bwtM1YEM5Ep8vD3TLl1
+pTWlF/zWpM/uJ6n/4nDXGQsGzKQn5D5Nsu7+55C0du0d1VRvYd8oG3AaNqhtM46V
+C4eOqxH8XZtkJ3WMxhsHnV9acuDTpn5E5JKL7vEq0btN2UQ69lpKv7PmV/TgOJhf
+KKvHZ0dh6KYY7iKW7NUCouLGibBoxDa+K4reh0i0M5UcsNiPkCqDIHUAIxW6FrvQ
+xBr7NgCls+B9Kwu0JExldmVudGUgUG9seWFrIDxaM3IwLjB4MDBAZ21haWwuY29t
+PokCPgQTAQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AFAlSXU9oFCQfA
+Tw8ACgkQ/BtUfI2Bcsg4cw/5Af5/cxr5s8qiPvcGDglJyzFj8VBk0d7hpgdxcOi3
+VCOJY4YRoliu8WKThwxt7sD03fSZurFDDx+X27y3zPtgH/qBohmcr51jbSNom4mH
+Gf8gpViFqbQlFh7tYz4kSQExgmpFx/FIaxmwFoEqiVrp6VpM2DZ6kg//4M+Ka2Mt
+nuzV3C631A0eoMCJhPWPTgkGGknURvzhw6m2aGFWC/HE1yzf7Ej7fQeaqIxIG4Wy
+Fk3lMV9rxMxGuUZTqIhvcU85JSriHowfX1VsAI2LXJYQ9c0jI737FcLwHv8VCa5s
+NKDkLkb5S83/4Ep8e9M+a7u4WvkAqzmPfSna7bLxdsTS5gKGqEtMvMP2YGWWQxSR
+GRSttiMmIC8Cnd45S8cASA2mR/ebNcrYOpa48cjYpBKDG2BIYU7oSLNulsM1qbxL
+WJ0QM/g7iKHcrXhyIBaI22GS9hvmYcS960cox9oPCvNZcOKA6FBklnUg/ReJ3JTj
+6D6v9SUxOOfXPQIon8EzB7BNKGedHxCFgniZnl10k+pP34YGyphMZTYGdhtAm6zq
+T7PlraHQaFgQ3ba78lJcn3cWVZYpbCNJiH+Nna/Akm3/qQKTst3eW1lqopffCs1m
+F6G6wjiHCw2bio5uX1c/gDr4Peh0E28heAqKopjultPXPZbSZL4D3fJIGP2j6e1B
+wvmIRgQQEQIABgUCTrg/KAAKCRC+dA9BPyK7GcYrAKCgKW+qFwbMNeh4ikFg9fJx
+4/lH9wCdGevT7dwBzPe6L+aWZxipEXYmjx6JAj4EEwECACgFAk64PN0CGwMFCQIc
+hwAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEPwbVHyNgXLIThYP/AnoLpQl
+whEEKaIhOSOKXegfdUHK6cL4cHRACzRIbBk/S4G2Vg/bnUW8tvWZDQLZ3CGL8Z0F
+tNQ6GusUxt7mcYdSj7xynbi7bZiurgYp7B7hh1hVG3pAXEwlDnJgfoc0YZHrHZwt
+HnNVYOfGEQF4zyplmUUxDyp/ZMYcXMr3PVJkYBJhYKCHOkMUtzzNjSSginaqZY1p
+fgbP+Gou/9qgotkYiH84oUG9yTSKLIO5x0WzQYuoPNJyOdSHaLPfEqCC435vCYT5
+YLZB1YI5xzQiGsAL//cUCe267oiFmO9Ioky/azeX1Ouy2DH8uEDQPQFTJYXt3CbL
+i10HkoBWdmncPC6+b0IJjDUo8Iv4yk0xFt2/DGkGK3h6jJxJ9pzx5KBT46iLfU50
+iTWMTguXn9ud/UJV0MpKgKjvO9hB4fae60n2UootknzEw6Y5W55PfGkT14WcrGGo
+WHLSbpR6+gA9apU1cdoOC8nXlf3Eb2No6LP3X7RJXqiRsdP0s6QXkZGfR/qyNXI9
+S5j6wIyqNFU0cX21UgI9oJSKEKIKEFacgyD9za0gswEI+DZr8/p3cJE89ZX8ySgO
+FG148wgaakTNGyGwR6aogGZ8IAHc83bnwGCgTeK6ZPSKNLSE/sImcTOrxIN1/x39
+r8o0TxuZjqFH+zKWfpdHX+sJLyi8Gs29CsUhiQI+BBMBAgAoAhsDBgsJCAcDAgYV
+CAIJCgsEFgIDAQIeAQIXgAUCUNol+gUJA/yTqwAKCRD8G1R8jYFyyLl/EACG6QRV
+kKVBoI2Ycr4UISk2+gCD2r4xSK/QLEhDFcZRgMctvPVnhod3uJOsMGJCk3aPGu91
+Jtwuj0CkeURa/cVzOjC+f7baveTuWQaAqW+r70m6F4gYHU0aDD/uQ75rTCcrsmt2
+pnZCyA9jLJxQGG11AvbOcV+7K7BuIvXs4iAactZ0hRvDVuGXuup2LnUbxyBU2oj7
+OWCXKTpZcJ0KGTWapMf8ClYYsEgS0wvMWotJzAov7ijkoP2DyEQVOPTnGWcfjsTk
+QgbyqiFeBl+3IT4+xSzkPsd75dCYhsHBvCoT8cfUH4wvDXzU2CwpC1CDfHit6Hw5
+UigvZ8HXyn00Bm0UjLHGW+haS3kyOoz+z09gVFYd33cpjSnFr5is8ZMBPW31PE15
+q9/l6G/o6OGJCtOax3Yi6ttqn+KbDXIooZoRPZlayOSghyjoD40+ErevmqZPfJ3E
+o1kHz62B1YpoXmhUm2Ihf2SbjWJRaW9Hp2nd81kAAXjr+8k4yvOuHxwYPFnpBjfV
+cfYNQ3Zf5xF4nfszFuZMc5JYrIR3EYVgEk+n8VpulAqd0rXUEODwGy7rPjdxLY7w
+DhUEZMQN3xweIb4vjPDBb0Ax3ACyfWKIdT0kC3rGOy9xyCzxWO2CjHMjrbxy4jL7
+B0WIQ5fpRcV2+wozs2WYgJKVKJgJZGYsW8dDLYkCHAQQAQIABgUCUtgrXgAKCRBH
+1QFsQv98LIX0EADVefJUEMGKiTFLwUmWNF2X4oCzEZEMsQ6NliiQFvtNkKrT+OzZ
+zggxfINUr0XEKgjjoGZ03Hmm7xAFc1Y51QZEr25H18PuSixz2YSHPqYwwVgLUh0v
+u2AqaP0mQckssK+ZAQVvoZ7ZOI22ZXIZ6CPEPY6aJawHov8Strlm8oTbFgLfZ5Wo
+3NCxMkkq3NFNHuwesccelNPefgnFZWhwr1mkUeX+rCAbQF/QHYEAi7KjfKyY+XKs
+ccjYS+RWxpte21ejngp7pRYli3M8cZoaWKCzLTrD8gKztlo3op9Zc2+hjOY9gZtG
+CaXkN8lchJ1yMyWju61ZO++AJq6S2OdBVxgsj9xPm+x91RbZRHQmUuq8mefUzaEm
+NHE29udVFfuV//Fpabi04IrOuabkrSvP27eX9FT1y25tKFHuJdL5fDUFGnNnTvcR
+X51lJmvnuIKJQ+Lthup7npS0L06+dPIDoqyxF8hmdu3RtwEsvkboPaxx5XTB5d8y
+3wzBFWd4ePwBIumrY1YHSzdJCvyyLRXZbSOsHXgZfhfQ1LVgxxebP7E+stWqGLLC
+Fry0WGG8f/UUgVr1QpluT6NjioUnuI/ZmKR/aKewqVYWAnr54fF+np4VdxPfYwci
+lpbXpkamORZqPfq/nyoWgnp+y4AptDdDkSWnFxfcJ1wnFFcrHVUSFQ1wBYkCPgQT
+AQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AFAlLV0QsFCQXdHmsACgkQ
+/BtUfI2BcsjV6w/9Fe1+3Mc6wG3R9VbxiYo13/JV4t+tA9/tcJ1R/Y96eAqVajoK
+c2ZQ7FrimmlzvLIvxpH4Z76h3NmPWfOQ6qEumZQ5BM3QwBfQQ3Tmj10gfiL5vOZJ
+6dUaJjwXgjz0Qyk1G3gw7K1xmtnXgBPyGT9T9q3OAhHHdV2b6xS9dWoNKhUV8GUn
+HfIKwq+87aZqexjFE7ubZdOAe+5nrqnlMEfJKgDjXbazES9IYvPQiSjwR3xaIPOa
+ma5WfQV0SHg3Vkhtv2PjuoYWNfNy17N7u+dfg7nAtKLIQCPht45uKk66BYWYBoDI
+VQfg6zcFLpdNcFzzwmgrYRZvEvBf5aSG3KFD7UReT0695/lHheRxEAA3thsx8gaM
+CCavtVxbVUluEfYZ7TgXLMuIO9OBKhi7MwB3iL5qacrNShMB+1J5FxieJBmWXdla
++kCdCdS+9kIZH+mnQ8daGEJ5R9mNcVwcWasI0o9NObqIZwhKw4obrC5Q7m2NfXL6
+FUScfA7yn7+/icdQB9fH2ZXGJVuNm1b8OBN6Nbz0QauaCystWzKXKwpVb/5M623v
+Vw75RfnqCFiAf4tX58nL/QalJc4C0E+TvQ2pXC47VQvHmiAB31vKvU0nbo+lzi64
+hAPWJnhr2pmTvglquTFzLwEsWfO4zDtUwFo8KM1XFsonaoX5UzGTXPmIN5+0J0xl
+dmVudGUgUG9seWFrIDxhbnRocmF4eEBhcmNobGludXgub3JnPokCPwQTAQIAKQIb
+AwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheABQJUl1PbBQkHwE8PAAoJEPwbVHyN
+gXLIdGAP/0ch1NeFyXWszqA5ow+itBn6iyUaplXB5I56Q77cTIFB6LqJ5+2kdUuO
+UqPvOilGS3dxbyDsSdWDLs+bHRFG4uqZyGUDhmu2mvS+uDqPFwcKJUNDlgdccxph
+sA5HJFGg1ca0TWWg8vjwANdU4sL9Ujbaw93v0Mx/1+aSIxyEJBNxc6DJWEfCjpSy
+R9JB8WTHgvxEAImVNsT1OGNTvd2DN+17WBhxBktLHDocIGJ/fttzFgKkv6NTPwt+
+y4QyP3UgeYRZR21B6MVckk2/UuCuCY7gAGruTFVoINa/Wqn2YPPZhJYrTX7ysDaV
+QLObxlepeo0UWC7wFEiuqu5OM75MWLUX8j/1OAIE6my85vrlcWSf0Z3jOAgPTjJw
+VT5h7T/7NPP2azoIlOE2bh5UcKXFkT0xDYPcMr2hV2Ih+jU+Ygiyg/1yIIxearmm
+PFjfIHMLepa+7RPtTlHwu4fpNPXzL13W6PXSoCTTi/suGlYmSyLtOwxq15GGT3vg
+1Xh8wfkuWwbWJnBKXtt8HkteQRgDngDnRSJwsO2nnQ7+sr+F8J3rQDdlVdVcolic
+ekup8ZgSjJYinfcpF+H+qy2kK2jOYyyHI/+zHQtwy1R7MbLwPJe7WNWrBmEvmazB
+2//Iu5EVIfFX3flPjeRQbKX4B/SuXF48uo0/8WfdgaMW8glRWJnbiQI/BBMBAgAp
+BQJUSwOnAhsDBQkF3R5rBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQ/BtU
+fI2Bcsj5ihAAg0d0A8OUsNWG7TiPQTuC/D4e/5JTkJARmQ5xO6gMPxTpjSZCyWEl
+7gQOg/liU8nz5HZGaJgg4HuBwTs6euqdnVi6zhW1c1wye2thGTQ7DeSPJnhju3Qe
+mPS1jEdC34lXCo6eGjdKnGb7TV7hkptHKHh7XCU9n6qcXQ2cNQQbdqSCRsfVm1XD
++p+mM/FGOz8uFOrhERAUl99WkVZ4NKTdws8U6FXulbdWrWwI4eRggIdwI/Tl7zuy
+ja7KxBCCeJ/gFY6g+iOYmIo6//bJITgmAG60hFHJ9JigcN6xglYFI28TCdNqM0+C
+hgbZUner0vLmaxRNoXqV9Xw8ihNMQa7fUFYkX8VrXOdLdVvee7OaeLuWWE8x6usQ
+NzgLDQQx9fmxtrQY+dC6Y25IPMm094z0nrbM1wtfG2+8Vw4mQ2U099fT5t3Yl7fE
+PlanhgQxRZE78PxezyYxms4HV+wqvrhlBzFnWAd6H27uDPfUfO9cLgbmFTUlwFhg
+gsDeIFRFx8+h4/0xAIPqUODmTiN0mj5sLRW7zvqZW6zhsGIMdPd+IkhHiGjeJqme
+Ai0iOjpV3tRteoW51/+/ajPmyUBbvOxiFJNADHH2NvqoBMU1pkTvpc7Wy+2J9VcF
+4TFdWBbwjU8BoC3ZgixTrT0zCSwabnKriglOhA5Ik/n5HsR7S76V13y0KExldmVu
+dGUgUG9seWFrIDxhbnRocmF4eEBoYW1idXJnLmNjYy5kZT6JAj0EEwEIACcFAlSX
+VHICGwMFCQfATw8FCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ/BtUfI2Bcsia
+Wg//SKLFNUTEBQG11cV/AljxmI2s8y+cPKs3VqlwEjiuRMu4DRkFVaZNEuPq0b8q
+8pwcHIJ5/nZvOticm9M/g7TrTp3pOxmSYf7WG31vVrprig22dz8WxQAy76srNn1z
+stg0TFO7nKNVjZOFz5D0RpWazwnXyDed3l2/7RZ1CMv7ue/rZez8FnDHN7Di3daX
+AJ5XkvDAsD6AITYQd+4XEbh2rt9p8G6qUUjwzoVU/aGVgo1CGZydYMJQVccNL7kv
+fumnwkAED8u9j0ZI+xfaD3c1rP98bnqk9u8rJPCAeIkA4ppisDb7noz0NaO7dDyM
+ywBK4OR478fw5h7GfiIwZdVAHkCoEHNvF1ON8JnYgyplLvZvxZ0dtYGDYDiFdORN
+gVgGMU12kemPws4hEx3WMgUu/BBkF58XyQyqcwt7q+WGI2lQ88UzZ/FAsu8i8r/J
+jkV8FsiCJ2rSHEMddmOHoaTM+6oB2i9kZo7KmToSZu7DxuemlHpuOO3kG/iRga2y
+NeancRJwbxgZhNGBbhrA/7k5UOcXkmfW74oBkbCci0ncVhHu12dsJXhk+eprkOXv
+nD1vEIeuzL4V/SMDar3SxFlfLFwQk4cn9+pdeP3LxwHKBn74pABsbEBhEY4IjUEL
+YOTEVoP6s+Ou1NcLxFl3elmniwL2+GV5rDM8pctkKNemtZa5Ag0ETrg4RQEQALfu
+qEihKS+DTVlWUujzSq5zK/5oQ1ZL8AiTUTZuVtrRWCq0HE8tWaVxEP3Vt9FCo7yF
+afXigokChzHOgzczg80tctrlv+vbFyaZnjGQH20Nlz8EnZP102zudx/RdFXG/up8
+PX50Eck2lH+IvvosMLdvrZTkFJ4SgqMGSoAgMhJHZdZB5N0y8yPPAjcEnSXp8L2A
+mo9e0egCrEuqBrCZld00nIoipyDlYNZkLjPf0JRgFPO/AWWgBZLvLlteLu0emq8N
+96bT3QTdXpRVPM0qeX94+2gIj+0V1uQ9+k5Xkslbbii9TnOzMnLRO6dBAONVTTb3
+ajzdXK71iv2a8Y9lKShxhYWP9JNOFlXkAp+ZoD7EZex4dgu6giV3PrTDJLyWSu41
+WfqOz6cJGpJSTacrenC542ynAaSVKXH+1plqB9kq/M7HtE/P4GveQXIVT9Sho394
+4hwkuETo20KwCgFPMmiNaBysnOykIcDsDutBOyygdovzdGEyHVsM8/kz007QFgJf
+hKy91H6O/Cg7VH+yaUKllRZ+kFsoSy8/E0IqLzqBHG3sUGM6lJ0Q9fgSnpzIZsdE
+jRhczNCvlovGLa/kBHcEUWQ2zrjnfjsLkxvamKJ8N6LLIXIDRv5dE2smpdi3oiVg
+XdOKshyXB+obhRFlWtirK4udX5yYzUpcB0zBoo1hABEBAAGJAiUEGAECAA8CGwwF
+AlSXVAEFCQfATzwACgkQ/BtUfI2Bcsj0Tw//dyDYwcnh0BIb+nDCXFC91KiPUILa
+f+wI5w6c9YYEo6TR89q6Wsq8EDiqcqSJcztuNvw3MZGHWA25nNB/0046CGM/tUBd
+Jyudd3TxQBi6XMMSTbG1EMtSN1UMV4guuUfYcAGW38oZ+YJACCBFFz/Kt0aa/hhi
+/hBNyvI73vZfQ/fsScFDewkxikUEspRsLVmX6gaEmumOxOhJP3HBoxeBCM4Z3IXo
+dON2SiiMxt9BPIPJOyKNkFQGQ3dqJIag3GnsZ1s0CEoi8iqF7uS4RjC7uOJtvn74
+CODxg1Ibl1IweyAuBEA80wUh9DGLAdRJpxWy1B2fDhIROvpcg0R5p6j9UX0b0esc
+jKLQEiE1wRswjXhWpZhe7Pjl38KhwqMyaeR3OnDtP7JXazIG6HiBIp4cx4k5A2TT
+X+LhvG3NHCeuxIyjLTRTWgv241kf7uAu+qgjHDSKXQqpjvo+cUYQgSxQZZXnmlz0
+sz/tEeiWl+i8kW/RNKQvNNR8ghWDW3YRak/zS+WFNoLZchecIzMj+je1vSg411o4
+Xd3LHDur6boCetaq7ZkqoS+NcX9n8MnKhHKYJblvXyc1h67s90+wSwhlumA8WqlM
+yqn99m13aF8GuGZbw5B2/x/Cd7WW5wZV6ioola/yqDXB1XtDFBy2Hxr/VMRlE3Cu
+kekzzVjVTZxOgZE=
+=yRuG
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/config.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/config.nix
new file mode 100644
index 000000000000..c817f1044271
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/config.nix
@@ -0,0 +1,86 @@
+# Based on recommendations from:
+# http://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project#Recommended_settings
+# https://wiki.gentoo.org/wiki/Hardened/Hardened_Kernel_Project
+#
+# Dangerous features that can be permanently (for the boot session) disabled at
+# boot via sysctl or kernel cmdline are left enabled here, for improved
+# flexibility.
+#
+# See also <nixos/modules/profiles/hardened.nix>
+
+{ stdenv, version }:
+
+with stdenv.lib;
+with stdenv.lib.kernel;
+with (stdenv.lib.kernel.whenHelpers version);
+
+assert (versionAtLeast version "4.9");
+
+{
+ # Report BUG() conditions and kill the offending process.
+ BUG = yes;
+
+ # Safer page access permissions (wrt. code injection). Default on >=4.11.
+ DEBUG_RODATA = whenOlder "4.11" yes;
+ DEBUG_SET_MODULE_RONX = whenOlder "4.11" yes;
+
+ # Mark LSM hooks read-only after init. SECURITY_WRITABLE_HOOKS n
+ # conflicts with SECURITY_SELINUX_DISABLE y; disabling the latter
+ # implicitly marks LSM hooks read-only after init.
+ #
+ # SELinux can only be disabled at boot via selinux=0
+ #
+ # We set SECURITY_WRITABLE_HOOKS n primarily for documentation purposes; the
+ # config builder fails to detect that it has indeed been unset.
+ SECURITY_SELINUX_DISABLE = whenAtLeast "4.12" no;
+ SECURITY_WRITABLE_HOOKS = whenAtLeast "4.12" (option no);
+
+ STRICT_KERNEL_RWX = whenAtLeast "4.11" yes;
+
+ # Perform additional validation of commonly targeted structures.
+ DEBUG_CREDENTIALS = yes;
+ DEBUG_NOTIFIERS = yes;
+ DEBUG_PI_LIST = whenOlder "5.2" yes; # doesn't BUG()
+ DEBUG_PLIST = whenAtLeast "5.2" yes;
+ DEBUG_SG = yes;
+ SCHED_STACK_END_CHECK = yes;
+
+ REFCOUNT_FULL = whenBetween "4.13" "5.5" yes;
+
+ # Randomize page allocator when page_alloc.shuffle=1
+ SHUFFLE_PAGE_ALLOCATOR = whenAtLeast "5.2" yes;
+
+ # Allow enabling slub/slab free poisoning with slub_debug=P
+ SLUB_DEBUG = yes;
+
+ # Wipe higher-level memory allocations on free() with page_poison=1
+ PAGE_POISONING = yes;
+ PAGE_POISONING_NO_SANITY = yes;
+ PAGE_POISONING_ZERO = yes;
+
+ # Enable the SafeSetId LSM
+ SECURITY_SAFESETID = whenAtLeast "5.1" yes;
+
+ # Reboot devices immediately if kernel experiences an Oops.
+ PANIC_TIMEOUT = freeform "-1";
+
+ GCC_PLUGINS = yes; # Enable gcc plugin options
+ # Gather additional entropy at boot time for systems that may = no;ot have appropriate entropy sources.
+ GCC_PLUGIN_LATENT_ENTROPY = yes;
+
+ GCC_PLUGIN_STRUCTLEAK = whenAtLeast "4.11" yes; # A port of the PaX structleak plugin
+ GCC_PLUGIN_STRUCTLEAK_BYREF_ALL = whenAtLeast "4.14" yes; # Also cover structs passed by address
+ GCC_PLUGIN_STACKLEAK = whenAtLeast "4.20" yes; # A port of the PaX stackleak plugin
+ GCC_PLUGIN_RANDSTRUCT = whenAtLeast "4.13" yes; # A port of the PaX randstruct plugin
+ GCC_PLUGIN_RANDSTRUCT_PERFORMANCE = whenAtLeast "4.13" yes;
+
+ # Disable various dangerous settings
+ ACPI_CUSTOM_METHOD = no; # Allows writing directly to physical memory
+ PROC_KCORE = no; # Exposes kernel text image layout
+ INET_DIAG = no; # Has been used for heap based attacks in the past
+
+ # Use -fstack-protector-strong (gcc 4.9+) for best stack canary coverage.
+ CC_STACKPROTECTOR_REGULAR = whenOlder "4.18" no;
+ CC_STACKPROTECTOR_STRONG = whenOlder "4.18" yes;
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json
new file mode 100644
index 000000000000..036cc44ecea9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json
@@ -0,0 +1,22 @@
+{
+ "4.14": {
+ "name": "linux-hardened-4.14.201.a.patch",
+ "sha256": "16jkhib0fc8l96a092srqpg850wh0n49pa0yghpviz29rlids6vs",
+ "url": "https://github.com/anthraxx/linux-hardened/releases/download/4.14.201.a/linux-hardened-4.14.201.a.patch"
+ },
+ "4.19": {
+ "name": "linux-hardened-4.19.151.a.patch",
+ "sha256": "12sh1zvc72p7kkbgpm4cjppv1vlqbywsqfsva76pjx1mw0wsj7sj",
+ "url": "https://github.com/anthraxx/linux-hardened/releases/download/4.19.151.a/linux-hardened-4.19.151.a.patch"
+ },
+ "5.4": {
+ "name": "linux-hardened-5.4.71.a.patch",
+ "sha256": "1w4sfkx4qj9vx47z06bkf4biaiz58z2qp536g7dss26zdbx1im26",
+ "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.4.71.a/linux-hardened-5.4.71.a.patch"
+ },
+ "5.8": {
+ "name": "linux-hardened-5.8.15.a.patch",
+ "sha256": "0b7bfzknz2am9pfypazqzky9bcd6659sakcdx2a7p1i3bj6zxnn1",
+ "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.8.15.a/linux-hardened-5.8.15.a.patch"
+ }
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/tag-hardened.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/tag-hardened.patch
new file mode 100644
index 000000000000..ff8a3a127973
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/tag-hardened.patch
@@ -0,0 +1,7 @@
+diff --git a/localversion-hardened b/localversion-hardened
+new file mode 100644
+index 0000000000..e578045860
+--- /dev/null
++++ b/localversion-hardened
+@@ -0,0 +1 @@
++-hardened
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/update.py b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/update.py
new file mode 100755
index 000000000000..d6443d2e7511
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/hardened/update.py
@@ -0,0 +1,276 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i python -p "python38.withPackages (ps: [ps.PyGithub])" git gnupg
+
+# This is automatically called by ../update.sh.
+
+from __future__ import annotations
+
+import json
+import os
+import re
+import subprocess
+import sys
+from dataclasses import dataclass
+from pathlib import Path
+from tempfile import TemporaryDirectory
+from typing import (
+ Dict,
+ Iterator,
+ List,
+ Optional,
+ Sequence,
+ Tuple,
+ TypedDict,
+ Union,
+)
+
+from github import Github
+from github.GitRelease import GitRelease
+
+VersionComponent = Union[int, str]
+Version = List[VersionComponent]
+
+
+Patch = TypedDict("Patch", {"name": str, "url": str, "sha256": str})
+
+
+@dataclass
+class ReleaseInfo:
+ version: Version
+ release: GitRelease
+
+
+HERE = Path(__file__).resolve().parent
+NIXPKGS_KERNEL_PATH = HERE.parent
+NIXPKGS_PATH = HERE.parents[4]
+HARDENED_GITHUB_REPO = "anthraxx/linux-hardened"
+HARDENED_TRUSTED_KEY = HERE / "anthraxx.asc"
+HARDENED_PATCHES_PATH = HERE / "patches.json"
+MIN_KERNEL_VERSION: Version = [4, 14]
+
+
+def run(*args: Union[str, Path]) -> subprocess.CompletedProcess[bytes]:
+ try:
+ return subprocess.run(
+ args,
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ encoding="utf-8",
+ )
+ except subprocess.CalledProcessError as err:
+ print(
+ f"error: `{err.cmd}` failed unexpectedly\n"
+ f"status code: {err.returncode}\n"
+ f"stdout:\n{err.stdout.strip()}\n"
+ f"stderr:\n{err.stderr.strip()}",
+ file=sys.stderr,
+ )
+ sys.exit(1)
+
+
+def nix_prefetch_url(url: str) -> Tuple[str, Path]:
+ output = run("nix-prefetch-url", "--print-path", url).stdout
+ sha256, path = output.strip().split("\n")
+ return sha256, Path(path)
+
+
+def verify_openpgp_signature(
+ *, name: str, trusted_key: Path, sig_path: Path, data_path: Path,
+) -> bool:
+ with TemporaryDirectory(suffix=".nixpkgs-gnupg-home") as gnupg_home_str:
+ gnupg_home = Path(gnupg_home_str)
+ run("gpg", "--homedir", gnupg_home, "--import", trusted_key)
+ keyring = gnupg_home / "pubring.kbx"
+ try:
+ subprocess.run(
+ ("gpgv", "--keyring", keyring, sig_path, data_path),
+ check=True,
+ stderr=subprocess.PIPE,
+ encoding="utf-8",
+ )
+ return True
+ except subprocess.CalledProcessError as err:
+ print(
+ f"error: signature for {name} failed to verify!",
+ file=sys.stderr,
+ )
+ print(err.stderr, file=sys.stderr, end="")
+ return False
+
+
+def fetch_patch(*, name: str, release: GitRelease) -> Optional[Patch]:
+ def find_asset(filename: str) -> str:
+ try:
+ it: Iterator[str] = (
+ asset.browser_download_url
+ for asset in release.get_assets()
+ if asset.name == filename
+ )
+ return next(it)
+ except StopIteration:
+ raise KeyError(filename)
+
+ patch_filename = f"{name}.patch"
+ try:
+ patch_url = find_asset(patch_filename)
+ sig_url = find_asset(patch_filename + ".sig")
+ except KeyError:
+ print(f"error: {patch_filename}{{,.sig}} not present", file=sys.stderr)
+ return None
+
+ sha256, patch_path = nix_prefetch_url(patch_url)
+ _, sig_path = nix_prefetch_url(sig_url)
+ sig_ok = verify_openpgp_signature(
+ name=name,
+ trusted_key=HARDENED_TRUSTED_KEY,
+ sig_path=sig_path,
+ data_path=patch_path,
+ )
+ if not sig_ok:
+ return None
+
+ return Patch(name=patch_filename, url=patch_url, sha256=sha256)
+
+
+def parse_version(version_str: str) -> Version:
+ version: Version = []
+ for component in version_str.split("."):
+ try:
+ version.append(int(component))
+ except ValueError:
+ version.append(component)
+ return version
+
+
+def version_string(version: Version) -> str:
+ return ".".join(str(component) for component in version)
+
+
+def major_kernel_version_key(kernel_version: Version) -> str:
+ return version_string(kernel_version[:-1])
+
+
+def commit_patches(*, kernel_key: str, message: str) -> None:
+ new_patches_path = HARDENED_PATCHES_PATH.with_suffix(".new")
+ with open(new_patches_path, "w") as new_patches_file:
+ json.dump(patches, new_patches_file, indent=4, sort_keys=True)
+ new_patches_file.write("\n")
+ os.rename(new_patches_path, HARDENED_PATCHES_PATH)
+ message = f"linux/hardened/patches/{kernel_key}: {message}"
+ print(message)
+ if os.environ.get("COMMIT"):
+ run(
+ "git",
+ "-C",
+ NIXPKGS_PATH,
+ "commit",
+ f"--message={message}",
+ HARDENED_PATCHES_PATH,
+ )
+
+
+# Load the existing patches.
+patches: Dict[str, Patch]
+with open(HARDENED_PATCHES_PATH) as patches_file:
+ patches = json.load(patches_file)
+
+# Get the set of currently packaged kernel versions.
+kernel_versions = {}
+for filename in os.listdir(NIXPKGS_KERNEL_PATH):
+ filename_match = re.fullmatch(r"linux-(\d+)\.(\d+)\.nix", filename)
+ if filename_match:
+ nix_version_expr = f"""
+ with import {NIXPKGS_PATH} {{}};
+ (callPackage {NIXPKGS_KERNEL_PATH / filename} {{}}).version
+ """
+ kernel_version_json = run(
+ "nix-instantiate", "--eval", "--json", "--expr", nix_version_expr,
+ ).stdout
+ kernel_version = parse_version(json.loads(kernel_version_json))
+ if kernel_version < MIN_KERNEL_VERSION:
+ continue
+ kernel_key = major_kernel_version_key(kernel_version)
+ kernel_versions[kernel_key] = kernel_version
+
+# Remove patches for unpackaged kernel versions.
+for kernel_key in sorted(patches.keys() - kernel_versions.keys()):
+ commit_patches(kernel_key=kernel_key, message="remove")
+
+g = Github(os.environ.get("GITHUB_TOKEN"))
+repo = g.get_repo(HARDENED_GITHUB_REPO)
+failures = False
+
+# Match each kernel version with the best patch version.
+releases = {}
+for release in repo.get_releases():
+ version = parse_version(release.tag_name)
+ # needs to look like e.g. 5.6.3.a
+ if len(version) < 4:
+ continue
+
+ kernel_version = version[:-1]
+ kernel_key = major_kernel_version_key(kernel_version)
+ try:
+ packaged_kernel_version = kernel_versions[kernel_key]
+ except KeyError:
+ continue
+
+ release_info = ReleaseInfo(version=version, release=release)
+
+ if kernel_version == packaged_kernel_version:
+ releases[kernel_key] = release_info
+ else:
+ # Fall back to the latest patch for this major kernel version,
+ # skipping patches for kernels newer than the packaged one.
+ if kernel_version > packaged_kernel_version:
+ continue
+ elif (
+ kernel_key not in releases or releases[kernel_key].version < version
+ ):
+ releases[kernel_key] = release_info
+
+# Update hardened-patches.json for each release.
+for kernel_key in sorted(releases.keys()):
+ release_info = releases[kernel_key]
+ release = release_info.release
+ version = release_info.version
+ version_str = release.tag_name
+ name = f"linux-hardened-{version_str}"
+
+ old_version: Optional[Version] = None
+ old_version_str: Optional[str] = None
+ update: bool
+ try:
+ old_filename = patches[kernel_key]["name"]
+ old_version_str = old_filename.replace("linux-hardened-", "").replace(
+ ".patch", ""
+ )
+ old_version = parse_version(old_version_str)
+ update = old_version < version
+ except KeyError:
+ update = True
+
+ if update:
+ patch = fetch_patch(name=name, release=release)
+ if patch is None:
+ failures = True
+ else:
+ patches[kernel_key] = patch
+ if old_version:
+ message = f"{old_version_str} -> {version_str}"
+ else:
+ message = f"init at {version_str}"
+ commit_patches(kernel_key=kernel_key, message=message)
+
+missing_kernel_versions = kernel_versions.keys() - patches.keys()
+
+if missing_kernel_versions:
+ print(
+ f"warning: no patches for kernel versions "
+ + ", ".join(missing_kernel_versions),
+ file=sys.stderr,
+ )
+
+if failures:
+ sys.exit(1)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix
new file mode 100644
index 000000000000..dd0d2c2a627b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "4.14.201";
+
+ # modDirVersion needs to be x.y.z, will automatically add .0 if needed
+ modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
+
+ # branchVersion needs to be x.y
+ extraMeta.branch = versions.majorMinor version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+ sha256 = "0nr3w5m7dz28v7qfhp99ih4c369qrhq751wfikbz8ga3di0dqa72";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix
new file mode 100644
index 000000000000..d4e72cb3cbd2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "4.19.151";
+
+ # modDirVersion needs to be x.y.z, will automatically add .0 if needed
+ modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
+
+ # branchVersion needs to be x.y
+ extraMeta.branch = versions.majorMinor version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+ sha256 = "0vm3nsi9la3azxrsvndbd6fpz79pch7309f2144xyxszsk339cf7";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix
new file mode 100644
index 000000000000..49591f634794
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -0,0 +1,11 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, ... } @ args:
+
+buildLinux (args // rec {
+ version = "4.4.239";
+ extraMeta.branch = "4.4";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+ sha256 = "03myd9ngmjmnddh4iqqsgcfg9rd11vyvwym38yh4m1p08j1zbg0k";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix
new file mode 100644
index 000000000000..114629bad577
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -0,0 +1,11 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, ... } @ args:
+
+buildLinux (args // rec {
+ version = "4.9.239";
+ extraMeta.branch = "4.9";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+ sha256 = "0lfbn5amykvwz1svvxayzhsz1dvm4mgzsnq1g0wqffclxm148hr3";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix
new file mode 100644
index 000000000000..35025efb6572
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "5.4.71";
+
+ # modDirVersion needs to be x.y.z, will automatically add .0 if needed
+ modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
+
+ # branchVersion needs to be x.y
+ extraMeta.branch = versions.majorMinor version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
+ sha256 = "1ivcimngj5h7lxslkrdljpfw9hfvdhrm8wrp7gp4d3gk7kpljw3k";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.8.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.8.nix
new file mode 100644
index 000000000000..3e13d9eb9ce2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.8.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "5.8.15";
+
+ # modDirVersion needs to be x.y.z, will automatically add .0 if needed
+ modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
+
+ # branchVersion needs to be x.y
+ extraMeta.branch = versions.majorMinor version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
+ sha256 = "0hfnq4n902pws8sjxd1lsdxxa0v45g988imp73xnqfqv2d71r0bj";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.9.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.9.nix
new file mode 100644
index 000000000000..a7aefa209cc9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.9.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "5.9";
+
+ # modDirVersion needs to be x.y.z, will automatically add .0 if needed
+ modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
+
+ # branchVersion needs to be x.y
+ extraMeta.branch = versions.majorMinor version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
+ sha256 = "01hsddf4sf9q5l1innyyl34b51y48v5wi34qpr421gsh2bpa8f9j";
+ };
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix
new file mode 100644
index 000000000000..ba37c71d1345
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix
@@ -0,0 +1,33 @@
+{ stdenv, buildPackages, fetchFromGitHub, perl, buildLinux, libelf, utillinux, ... } @ args:
+
+buildLinux (args // rec {
+ version = "4.14.165-172";
+
+ # modDirVersion needs to be x.y.z.
+ modDirVersion = "4.14.165";
+
+ # branchVersion needs to be x.y.
+ extraMeta.branch = "4.14";
+
+ src = fetchFromGitHub {
+ owner = "hardkernel";
+ repo = "linux";
+ rev = version;
+ sha256 = "10ayqjjs2hxj1q7sb0mxa3gv75q28lznjha19rpxvig2fpi8015s";
+ };
+
+ defconfig = "odroidxu4_defconfig";
+
+ # This extraConfig is (only) required because the gator module fails to build as-is.
+ extraConfig = ''
+
+ GATOR n
+
+ # This attempted fix applies correctly but does not fix the build.
+ #GATOR_MALI_MIDGARD_PATH ${src}/drivers/gpu/arm/midgard
+
+ '' + (args.extraConfig or "");
+
+ extraMeta.platforms = [ "armv7l-linux" ];
+
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix
new file mode 100644
index 000000000000..4e308d657ac4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix
@@ -0,0 +1,41 @@
+{ stdenv, lib, fetchsvn, linux
+, scripts ? fetchsvn {
+ url = "https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/";
+ rev = "17724";
+ sha256 = "0aqg8il35a1mda4icqprvriham81vvnsa04rjc86b6x7khxdhiq2";
+ }
+, ...
+}:
+
+let
+ majorMinor = lib.versions.majorMinor linux.modDirVersion;
+
+ major = lib.versions.major linux.modDirVersion;
+ minor = lib.versions.minor linux.modDirVersion;
+ patch = lib.versions.patch linux.modDirVersion;
+
+in linux.override {
+ argsOverride = {
+ modDirVersion = "${linux.modDirVersion}-gnu";
+
+ src = stdenv.mkDerivation {
+ name = "${linux.name}-libre-src";
+ src = linux.src;
+ buildPhase = ''
+ # --force flag to skip empty files after deblobbing
+ ${scripts}/${majorMinor}/deblob-${majorMinor} --force \
+ ${major} ${minor} ${patch}
+ '';
+ checkPhase = ''
+ ${scripts}/deblob-check
+ '';
+ installPhase = ''
+ cp -r . "$out"
+ '';
+ };
+
+ passthru.updateScript = ./update-libre.sh;
+
+ maintainers = [ lib.maintainers.qyliss ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-94.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-94.nix
new file mode 100644
index 000000000000..e53c3ceb5c46
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-94.nix
@@ -0,0 +1,26 @@
+{ stdenv, buildPackages, fetchFromGitHub, perl, buildLinux, structuredExtraConfig ? {}, ... } @ args:
+let
+ mptcpVersion = "0.94.6";
+ modDirVersion = "4.14.127";
+in
+buildLinux ({
+ version = "${modDirVersion}-mptcp_v${mptcpVersion}";
+ inherit modDirVersion;
+
+ extraMeta = {
+ branch = "4.4";
+ maintainers = with stdenv.lib.maintainers; [ teto layus ];
+ };
+
+ src = fetchFromGitHub {
+ owner = "multipath-tcp";
+ repo = "mptcp";
+ rev = "v${mptcpVersion}";
+ sha256 = "071cx9205wpzhi5gc2da79w2abs3czd60jg0xml7j1szc5wl4yfn";
+ };
+
+ structuredExtraConfig = stdenv.lib.mkMerge [
+ (import ./mptcp-config.nix { inherit stdenv; })
+ structuredExtraConfig
+ ];
+} // args)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-95.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-95.nix
new file mode 100644
index 000000000000..ad933ff63a7a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-mptcp-95.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPackages, fetchFromGitHub, perl, buildLinux, structuredExtraConfig ? {}, ... } @ args:
+let
+ mptcpVersion = "0.95";
+ modDirVersion = "4.19.55";
+in
+buildLinux ({
+ version = "${modDirVersion}-mptcp_v${mptcpVersion}";
+ inherit modDirVersion;
+
+ extraMeta = {
+ branch = "4.19";
+ maintainers = with stdenv.lib.maintainers; [ teto layus ];
+ };
+
+ src = fetchFromGitHub {
+ owner = "multipath-tcp";
+ repo = "mptcp";
+ rev = "v${mptcpVersion}";
+ sha256 = "04a66iq5vsiz8mkpszfxmqknz7y4w3lsckrcz6q1syjpk0pdyiyw";
+ };
+
+ structuredExtraConfig = stdenv.lib.mkMerge [
+ (import ./mptcp-config.nix { inherit stdenv; })
+ structuredExtraConfig
+ ];
+
+} // args)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rpi.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rpi.nix
new file mode 100644
index 000000000000..a3d2bfd4836c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rpi.nix
@@ -0,0 +1,70 @@
+{ stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, rpiVersion, ... } @ args:
+
+let
+ modDirVersion = "4.19.118";
+ tag = "1.20200601";
+in
+lib.overrideDerivation (buildLinux (args // {
+ version = "${modDirVersion}-${tag}";
+ inherit modDirVersion;
+
+ src = fetchFromGitHub {
+ owner = "raspberrypi";
+ repo = "linux";
+ rev = "raspberrypi-kernel_${tag}-1";
+ sha256 = "11jzsmnd1qry2ir9vmsv0nfdzjpgkn5yab5ylxcz406plc073anp";
+ };
+
+ defconfig = {
+ "1" = "bcmrpi_defconfig";
+ "2" = "bcm2709_defconfig";
+ "3" = if stdenv.hostPlatform.isAarch64 then "bcmrpi3_defconfig" else "bcm2709_defconfig";
+ "4" = "bcm2711_defconfig";
+ }.${toString rpiVersion};
+
+ features = {
+ efiBootStub = false;
+ } // (args.features or {});
+
+ extraMeta = if (rpiVersion < 3) then {
+ platforms = with lib.platforms; [ arm ];
+ hydraPlatforms = [];
+ } else {
+ platforms = with lib.platforms; [ arm aarch64 ];
+ hydraPlatforms = [ "aarch64-linux" ];
+ };
+} // (args.argsOverride or {}))) (oldAttrs: {
+ postConfigure = ''
+ # The v7 defconfig has this set to '-v7' which screws up our modDirVersion.
+ sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
+ sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
+ '';
+
+ # Make copies of the DTBs named after the upstream names so that U-Boot finds them.
+ # This is ugly as heck, but I don't know a better solution so far.
+ postFixup = ''
+ dtbDir=${if stdenv.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"}
+ rm $dtbDir/bcm283*.dtb
+ copyDTB() {
+ cp -v "$dtbDir/$1" "$dtbDir/$2"
+ }
+ '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv6l-linux"]) ''
+ copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero.dtb
+ copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb
+ copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
+ copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
+ copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
+ copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb
+ copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
+ copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
+ copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
+ '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv7l-linux"]) ''
+ copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
+ '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv7l-linux" "aarch64-linux"]) ''
+ copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
+ copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-a-plus.dtb
+ copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
+ copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
+ copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb
+ '';
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
new file mode 100644
index 000000000000..b1f40ac1c96c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
@@ -0,0 +1,41 @@
+{ lib, buildLinux, fetchurl
+, kernelPatches ? [ ]
+, structuredExtraConfig ? {}
+, extraMeta ? {}
+, argsOverride ? {}
+, ... } @ args:
+
+let
+ version = "5.4.70-rt40"; # updated by ./update-rt.sh
+ branch = lib.versions.majorMinor version;
+ kversion = builtins.elemAt (lib.splitString "-" version) 0;
+in buildLinux (args // {
+ inherit version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
+ sha256 = "01shqhibrxirl9bik8jwiag70n9n0l7782xh73gkb8jvbh4dicy0";
+ };
+
+ kernelPatches = let rt-patch = {
+ name = "rt";
+ patch = fetchurl {
+ url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
+ sha256 = "19px04cmv1v65ad7dr3y0bjr9xviawhb26iijvnxiwyjvm0054kw";
+ };
+ }; in [ rt-patch ] ++ lib.remove rt-patch kernelPatches;
+
+ structuredExtraConfig = with lib.kernel; {
+ PREEMPT_RT = yes;
+ # Fix error: unused option: PREEMPT_RT.
+ EXPERT = yes; # PREEMPT_RT depends on it (in kernel/Kconfig.preempt)
+ # Fix error: option not set correctly: PREEMPT_VOLUNTARY (wanted 'y', got 'n').
+ PREEMPT_VOLUNTARY = lib.mkForce no; # PREEMPT_RT deselects it.
+ # Fix error: unused option: RT_GROUP_SCHED.
+ RT_GROUP_SCHED = lib.mkForce (option no); # Removed by sched-disable-rt-group-sched-on-rt.patch.
+ } // structuredExtraConfig;
+
+ extraMeta = extraMeta // {
+ inherit branch;
+ };
+} // argsOverride)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.6.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.6.nix
new file mode 100644
index 000000000000..7c77454040d5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.6.nix
@@ -0,0 +1,41 @@
+{ lib, buildLinux, fetchurl
+, kernelPatches ? [ ]
+, structuredExtraConfig ? {}
+, extraMeta ? {}
+, argsOverride ? {}
+, ... } @ args:
+
+let
+ version = "5.6.19-rt12"; # updated by ./update-rt.sh
+ branch = lib.versions.majorMinor version;
+ kversion = builtins.elemAt (lib.splitString "-" version) 0;
+in buildLinux (args // {
+ inherit version;
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
+ sha256 = "1s0yc1138sglbm4vyizl4r7hnc1l7nykdjp4063ad67yayr2ylv2";
+ };
+
+ kernelPatches = let rt-patch = {
+ name = "rt";
+ patch = fetchurl {
+ url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
+ sha256 = "0ia8rx0615x0z2s4ppw1244crg7c5ak07c9n3wbnz7y8bk8hyxws";
+ };
+ }; in [ rt-patch ] ++ lib.remove rt-patch kernelPatches;
+
+ structuredExtraConfig = with lib.kernel; {
+ PREEMPT_RT = yes;
+ # Fix error: unused option: PREEMPT_RT.
+ EXPERT = yes; # PREEMPT_RT depends on it (in kernel/Kconfig.preempt)
+ # Fix error: option not set correctly: PREEMPT_VOLUNTARY (wanted 'y', got 'n').
+ PREEMPT_VOLUNTARY = lib.mkForce no; # PREEMPT_RT deselects it.
+ # Fix error: unused option: RT_GROUP_SCHED.
+ RT_GROUP_SCHED = lib.mkForce (option no); # Removed by sched-disable-rt-group-sched-on-rt.patch.
+ } // structuredExtraConfig;
+
+ extraMeta = extraMeta // {
+ inherit branch;
+ };
+} // argsOverride)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix
new file mode 100644
index 000000000000..81dcb5d4563b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix
@@ -0,0 +1,23 @@
+{ stdenv, buildPackages, fetchFromGitHub, fetchpatch, perl, buildLinux, ... } @ args:
+
+buildLinux (args // {
+ version = "5.8.0-2020.09.07";
+ modDirVersion = "5.8.0";
+
+ src = fetchFromGitHub {
+ owner = "koverstreet";
+ repo = "bcachefs";
+ rev = "fb2821e72648f35d3cff61ac26041d634fd1dacf";
+ sha256 = "0f9hx6fz27rm8h1lk9868v727klvyzcbw6hcgm5mypbfq1nqirdy";
+ };
+
+ extraConfig = "BCACHEFS_FS m";
+
+ extraMeta = {
+ branch = "master";
+ hydraPlatforms = []; # Should the testing kernels ever be built on Hydra?
+ maintainers = with stdenv.lib.maintainers; [ davidak chiiruno ];
+ platforms = [ "x86_64-linux" ];
+ };
+
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing.nix
new file mode 100644
index 000000000000..b056568b1663
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-testing.nix
@@ -0,0 +1,20 @@
+{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
+
+with stdenv.lib;
+
+buildLinux (args // rec {
+ version = "5.9-rc8";
+ extraMeta.branch = "5.9";
+
+ # modDirVersion needs to be x.y.z, will always add .0
+ modDirVersion = if (modDirVersionArg == null) then builtins.replaceStrings ["-"] [".0-"] version else modDirVersionArg;
+
+ src = fetchurl {
+ url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
+ sha256 = "0yhjanmrg0cjmdn7yq8nx0h7q3aq9cimqhn9k4nis1a976p8wpgw";
+ };
+
+ # Should the testing kernels ever be built on Hydra?
+ extraMeta.hydraPlatforms = [];
+
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix
new file mode 100644
index 000000000000..947aa7c19ab3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, buildLinux, ... } @ args:
+
+let
+ version = "5.8.13";
+in
+
+buildLinux (args // {
+ modDirVersion = "${version}-zen1";
+ inherit version;
+
+ src = fetchFromGitHub {
+ owner = "zen-kernel";
+ repo = "zen-kernel";
+ rev = "v${version}-zen1";
+ sha256 = "161bvrmic7gspkgkv0pqssk6dzv95vkxld69rir968khwlnpsnim";
+ };
+
+ extraMeta = {
+ branch = "5.8/master";
+ maintainers = with stdenv.lib.maintainers; [ atemu ];
+ };
+
+} // (args.argsOverride or {}))
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mac-nvme-t2.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mac-nvme-t2.patch
new file mode 100644
index 000000000000..2f1fa6a0daec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mac-nvme-t2.patch
@@ -0,0 +1,283 @@
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
+index dd10cf78f2d3..8f006638452b 100644
+--- a/drivers/nvme/host/pci.c
++++ b/drivers/nvme/host/pci.c
+@@ -28,8 +28,8 @@
+ #include "trace.h"
+ #include "nvme.h"
+
+-#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
+-#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
++#define SQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_command))
++#define CQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_completion))
+
+ #define SGES_PER_PAGE (PAGE_SIZE / sizeof(struct nvme_sgl_desc))
+
+@@ -1344,16 +1344,16 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
+
+ static void nvme_free_queue(struct nvme_queue *nvmeq)
+ {
+- dma_free_coherent(nvmeq->dev->dev, CQ_SIZE(nvmeq->q_depth),
++ dma_free_coherent(nvmeq->dev->dev, CQ_SIZE(nvmeq),
+ (void *)nvmeq->cqes, nvmeq->cq_dma_addr);
+ if (!nvmeq->sq_cmds)
+ return;
+
+ if (test_and_clear_bit(NVMEQ_SQ_CMB, &nvmeq->flags)) {
+ pci_free_p2pmem(to_pci_dev(nvmeq->dev->dev),
+- nvmeq->sq_cmds, SQ_SIZE(nvmeq->q_depth));
++ nvmeq->sq_cmds, SQ_SIZE(nvmeq));
+ } else {
+- dma_free_coherent(nvmeq->dev->dev, SQ_SIZE(nvmeq->q_depth),
++ dma_free_coherent(nvmeq->dev->dev, SQ_SIZE(nvmeq),
+ nvmeq->sq_cmds, nvmeq->sq_dma_addr);
+ }
+ }
+@@ -1433,12 +1433,12 @@ static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
+ }
+
+ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
+- int qid, int depth)
++ int qid)
+ {
+ struct pci_dev *pdev = to_pci_dev(dev->dev);
+
+ if (qid && dev->cmb_use_sqes && (dev->cmbsz & NVME_CMBSZ_SQS)) {
+- nvmeq->sq_cmds = pci_alloc_p2pmem(pdev, SQ_SIZE(depth));
++ nvmeq->sq_cmds = pci_alloc_p2pmem(pdev, SQ_SIZE(nvmeq));
+ if (nvmeq->sq_cmds) {
+ nvmeq->sq_dma_addr = pci_p2pmem_virt_to_bus(pdev,
+ nvmeq->sq_cmds);
+@@ -1447,11 +1447,11 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq,
+ return 0;
+ }
+
+- pci_free_p2pmem(pdev, nvmeq->sq_cmds, SQ_SIZE(depth));
++ pci_free_p2pmem(pdev, nvmeq->sq_cmds, SQ_SIZE(nvmeq));
+ }
+ }
+
+- nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth),
++ nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(nvmeq),
+ &nvmeq->sq_dma_addr, GFP_KERNEL);
+ if (!nvmeq->sq_cmds)
+ return -ENOMEM;
+@@ -1465,12 +1465,13 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)
+ if (dev->ctrl.queue_count > qid)
+ return 0;
+
+- nvmeq->cqes = dma_alloc_coherent(dev->dev, CQ_SIZE(depth),
++ nvmeq->q_depth = depth;
++ nvmeq->cqes = dma_alloc_coherent(dev->dev, CQ_SIZE(nvmeq),
+ &nvmeq->cq_dma_addr, GFP_KERNEL);
+ if (!nvmeq->cqes)
+ goto free_nvmeq;
+
+- if (nvme_alloc_sq_cmds(dev, nvmeq, qid, depth))
++ if (nvme_alloc_sq_cmds(dev, nvmeq, qid))
+ goto free_cqdma;
+
+ nvmeq->dev = dev;
+@@ -1479,15 +1480,14 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)
+ nvmeq->cq_head = 0;
+ nvmeq->cq_phase = 1;
+ nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
+- nvmeq->q_depth = depth;
+ nvmeq->qid = qid;
+ dev->ctrl.queue_count++;
+
+ return 0;
+
+ free_cqdma:
+- dma_free_coherent(dev->dev, CQ_SIZE(depth), (void *)nvmeq->cqes,
+- nvmeq->cq_dma_addr);
++ dma_free_coherent(dev->dev, CQ_SIZE(nvmeq), (void *)nvmeq->cqes,
++ nvmeq->cq_dma_addr);
+ free_nvmeq:
+ return -ENOMEM;
+ }
+@@ -1515,7 +1515,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
+ nvmeq->cq_head = 0;
+ nvmeq->cq_phase = 1;
+ nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
+- memset((void *)nvmeq->cqes, 0, CQ_SIZE(nvmeq->q_depth));
++ memset((void *)nvmeq->cqes, 0, CQ_SIZE(nvmeq));
+ nvme_dbbuf_init(dev, nvmeq, qid);
+ dev->online_queues++;
+ wmb(); /* ensure the first interrupt sees the initialization */
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index cc09b81fc7f4..716ebe87a2b8 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -1986,6 +1986,7 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl, u64 cap)
+ ctrl->ctrl_config = NVME_CC_CSS_NVM;
+ ctrl->ctrl_config |= (page_shift - 12) << NVME_CC_MPS_SHIFT;
+ ctrl->ctrl_config |= NVME_CC_AMS_RR | NVME_CC_SHN_NONE;
++ /* Use default IOSQES. We'll update it later if needed */
+ ctrl->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES;
+ ctrl->ctrl_config |= NVME_CC_ENABLE;
+
+@@ -2698,6 +2699,30 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
+ ctrl->hmmin = le32_to_cpu(id->hmmin);
+ ctrl->hmminds = le32_to_cpu(id->hmminds);
+ ctrl->hmmaxd = le16_to_cpu(id->hmmaxd);
++
++ /* Grab required IO queue size */
++ ctrl->iosqes = id->sqes & 0xf;
++ if (ctrl->iosqes < NVME_NVM_IOSQES) {
++ dev_err(ctrl->device,
++ "unsupported required IO queue size %d\n", ctrl->iosqes);
++ ret = -EINVAL;
++ goto out_free;
++ }
++ /*
++ * If our IO queue size isn't the default, update the setting
++ * in CC:IOSQES.
++ */
++ if (ctrl->iosqes != NVME_NVM_IOSQES) {
++ ctrl->ctrl_config &= ~(0xfu << NVME_CC_IOSQES_SHIFT);
++ ctrl->ctrl_config |= ctrl->iosqes << NVME_CC_IOSQES_SHIFT;
++ ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC,
++ ctrl->ctrl_config);
++ if (ret) {
++ dev_err(ctrl->device,
++ "error updating CC register\n");
++ goto out_free;
++ }
++ }
+ }
+
+ ret = nvme_mpath_init(ctrl, id);
+diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
+index 716a876119c8..34ef35fcd8a5 100644
+--- a/drivers/nvme/host/nvme.h
++++ b/drivers/nvme/host/nvme.h
+@@ -244,6 +244,7 @@ struct nvme_ctrl {
+ u32 hmmin;
+ u32 hmminds;
+ u16 hmmaxd;
++ u8 iosqes;
+
+ /* Fabrics only */
+ u16 sqsize;
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
+index 8f006638452b..54b35ea4af88 100644
+--- a/drivers/nvme/host/pci.c
++++ b/drivers/nvme/host/pci.c
+@@ -28,7 +28,7 @@
+ #include "trace.h"
+ #include "nvme.h"
+
+-#define SQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_command))
++#define SQ_SIZE(q) ((q)->q_depth << (q)->sqes)
+ #define CQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_completion))
+
+ #define SGES_PER_PAGE (PAGE_SIZE / sizeof(struct nvme_sgl_desc))
+@@ -162,7 +162,7 @@ static inline struct nvme_dev *to_nvme_dev(struct nvme_ctrl *ctrl)
+ struct nvme_queue {
+ struct nvme_dev *dev;
+ spinlock_t sq_lock;
+- struct nvme_command *sq_cmds;
++ void *sq_cmds;
+ /* only used for poll queues: */
+ spinlock_t cq_poll_lock ____cacheline_aligned_in_smp;
+ volatile struct nvme_completion *cqes;
+@@ -178,6 +178,7 @@ struct nvme_queue {
+ u16 last_cq_head;
+ u16 qid;
+ u8 cq_phase;
++ u8 sqes;
+ unsigned long flags;
+ #define NVMEQ_ENABLED 0
+ #define NVMEQ_SQ_CMB 1
+@@ -488,7 +489,8 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
+ bool write_sq)
+ {
+ spin_lock(&nvmeq->sq_lock);
+- memcpy(&nvmeq->sq_cmds[nvmeq->sq_tail], cmd, sizeof(*cmd));
++ memcpy(nvmeq->sq_cmds + (nvmeq->sq_tail << nvmeq->sqes),
++ cmd, sizeof(*cmd));
+ if (++nvmeq->sq_tail == nvmeq->q_depth)
+ nvmeq->sq_tail = 0;
+ nvme_write_sq_db(nvmeq, write_sq);
+@@ -1465,6 +1467,7 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)
+ if (dev->ctrl.queue_count > qid)
+ return 0;
+
++ nvmeq->sqes = qid ? dev->ctrl.iosqes : NVME_NVM_ADMSQES;
+ nvmeq->q_depth = depth;
+ nvmeq->cqes = dma_alloc_coherent(dev->dev, CQ_SIZE(nvmeq),
+ &nvmeq->cq_dma_addr, GFP_KERNEL);
+diff --git a/include/linux/nvme.h b/include/linux/nvme.h
+index 01aa6a6c241d..7af18965fb57 100644
+--- a/include/linux/nvme.h
++++ b/include/linux/nvme.h
+@@ -141,6 +141,7 @@ enum {
+ * (In bytes and specified as a power of two (2^n)).
+ */
+ #define NVME_NVM_IOSQES 6
++#define NVME_NVM_ADMSQES 6
+ #define NVME_NVM_IOCQES 4
+
+ enum {
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index 716ebe87a2b8..480ea24d8cf4 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -2701,7 +2701,10 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
+ ctrl->hmmaxd = le16_to_cpu(id->hmmaxd);
+
+ /* Grab required IO queue size */
+- ctrl->iosqes = id->sqes & 0xf;
++ if (ctrl->quirks & NVME_QUIRK_128_BYTES_SQES)
++ ctrl->iosqes = 7;
++ else
++ ctrl->iosqes = id->sqes & 0xf;
+ if (ctrl->iosqes < NVME_NVM_IOSQES) {
+ dev_err(ctrl->device,
+ "unsupported required IO queue size %d\n", ctrl->iosqes);
+diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
+index 34ef35fcd8a5..b2a78d08b984 100644
+--- a/drivers/nvme/host/nvme.h
++++ b/drivers/nvme/host/nvme.h
+@@ -92,6 +92,16 @@ enum nvme_quirks {
+ * Broken Write Zeroes.
+ */
+ NVME_QUIRK_DISABLE_WRITE_ZEROES = (1 << 9),
++
++ /*
++ * Use only one interrupt vector for all queues
++ */
++ NVME_QUIRK_SINGLE_VECTOR = (1 << 10),
++
++ /*
++ * Use non-standard 128 bytes SQEs.
++ */
++ NVME_QUIRK_128_BYTES_SQES = (1 << 11),
+ };
+
+ /*
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
+index 54b35ea4af88..ab2358137419 100644
+--- a/drivers/nvme/host/pci.c
++++ b/drivers/nvme/host/pci.c
+@@ -2080,6 +2080,9 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)
+ dev->io_queues[HCTX_TYPE_DEFAULT] = 1;
+ dev->io_queues[HCTX_TYPE_READ] = 0;
+
++ if (dev->ctrl.quirks & NVME_QUIRK_SINGLE_VECTOR)
++ irq_queues = 1;
++
+ return pci_alloc_irq_vectors_affinity(pdev, 1, irq_queues,
+ PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY, &affd);
+ }
+@@ -3037,6 +3040,9 @@ static const struct pci_device_id nvme_id_table[] = {
+ { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
++ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005),
++ .driver_data = NVME_QUIRK_SINGLE_VECTOR |
++ NVME_QUIRK_128_BYTES_SQES },
+ { 0, }
+ };
+ MODULE_DEVICE_TABLE(pci, nvme_id_table);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix
new file mode 100644
index 000000000000..92dc334135ad
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -0,0 +1,313 @@
+{ buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl
+, libelf, cpio, elfutils
+, writeTextFile
+}:
+
+let
+ readConfig = configfile: import (runCommand "config.nix" {} ''
+ echo "{" > "$out"
+ while IFS='=' read key val; do
+ [ "x''${key#CONFIG_}" != "x$key" ] || continue
+ no_firstquote="''${val#\"}";
+ echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out"
+ done < "${configfile}"
+ echo "}" >> $out
+ '').outPath;
+in {
+ # Allow overriding stdenv on each buildLinux call
+ stdenv,
+ # The kernel version
+ version,
+ # The version of the kernel module directory
+ modDirVersion ? version,
+ # The kernel source (tarball, git checkout, etc.)
+ src,
+ # a list of { name=..., patch=..., extraConfig=...} patches
+ kernelPatches ? [],
+ # The kernel .config file
+ configfile,
+ # Manually specified nixexpr representing the config
+ # If unspecified, this will be autodetected from the .config
+ config ? stdenv.lib.optionalAttrs allowImportFromDerivation (readConfig configfile),
+ # Custom seed used for CONFIG_GCC_PLUGIN_RANDSTRUCT if enabled. This is
+ # automatically extended with extra per-version and per-config values.
+ randstructSeed ? "",
+ # Use defaultMeta // extraMeta
+ extraMeta ? {},
+ # Whether to utilize the controversial import-from-derivation feature to parse the config
+ allowImportFromDerivation ? false,
+ # ignored
+ features ? null,
+}:
+
+let
+ inherit (stdenv.lib)
+ hasAttr getAttr optional optionals optionalString optionalAttrs maintainers platforms;
+
+ # Dependencies that are required to build kernel modules
+ moduleBuildDependencies = optional (stdenv.lib.versionAtLeast version "4.14") libelf;
+
+ installkernel = writeTextFile { name = "installkernel"; executable=true; text = ''
+ #!${stdenv.shell} -e
+ mkdir -p $4
+ cp -av $2 $4
+ cp -av $3 $4
+ ''; };
+
+ commonMakeFlags = [
+ "O=$(buildRoot)"
+ ] ++ stdenv.lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags)
+ stdenv.hostPlatform.platform.kernelMakeFlags;
+
+ drvAttrs = config_: platform: kernelPatches: configfile:
+ let
+ config = let attrName = attr: "CONFIG_" + attr; in {
+ isSet = attr: hasAttr (attrName attr) config;
+
+ getValue = attr: if config.isSet attr then getAttr (attrName attr) config else null;
+
+ isYes = attr: (config.getValue attr) == "y";
+
+ isNo = attr: (config.getValue attr) == "n";
+
+ isModule = attr: (config.getValue attr) == "m";
+
+ isEnabled = attr: (config.isModule attr) || (config.isYes attr);
+
+ isDisabled = attr: (!(config.isSet attr)) || (config.isNo attr);
+ } // config_;
+
+ isModular = config.isYes "MODULES";
+
+ installsFirmware = (config.isEnabled "FW_LOADER") &&
+ (isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")) &&
+ (stdenv.lib.versionOlder version "4.14");
+ in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // {
+ passthru = {
+ inherit version modDirVersion config kernelPatches configfile
+ moduleBuildDependencies stdenv;
+ };
+
+ inherit src;
+
+ patches =
+ map (p: p.patch) kernelPatches
+ # Required for deterministic builds along with some postPatch magic.
+ ++ optional (stdenv.lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch
+ # Fixes determinism by normalizing metadata for the archive of kheaders
+ ++ optional (stdenv.lib.versionAtLeast version "5.2" && stdenv.lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch;
+
+ prePatch = ''
+ for mf in $(find -name Makefile -o -name Makefile.include -o -name install.sh); do
+ echo "stripping FHS paths in \`$mf'..."
+ sed -i "$mf" -e 's|/usr/bin/||g ; s|/bin/||g ; s|/sbin/||g'
+ done
+ sed -i Makefile -e 's|= depmod|= ${buildPackages.kmod}/bin/depmod|'
+ sed -i scripts/ld-version.sh -e "s|/usr/bin/awk|${buildPackages.gawk}/bin/awk|"
+ '';
+
+ postPatch = ''
+ # Set randstruct seed to a deterministic but diversified value. Note:
+ # we could have instead patched gen-random-seed.sh to take input from
+ # the buildFlags, but that would require also patching the kernel's
+ # toplevel Makefile to add a variable export. This would be likely to
+ # cause future patch conflicts.
+ if [ -f scripts/gcc-plugins/gen-random-seed.sh ]; then
+ substituteInPlace scripts/gcc-plugins/gen-random-seed.sh \
+ --replace NIXOS_RANDSTRUCT_SEED \
+ $(echo ${randstructSeed}${src} ${configfile} | sha256sum | cut -d ' ' -f 1 | tr -d '\n')
+ fi
+ '';
+
+ configurePhase = ''
+ runHook preConfigure
+
+ mkdir build
+ export buildRoot="$(pwd)/build"
+
+ echo "manual-config configurePhase buildRoot=$buildRoot pwd=$PWD"
+
+ if [ -f "$buildRoot/.config" ]; then
+ echo "Could not link $buildRoot/.config : file exists"
+ exit 1
+ fi
+ ln -sv ${configfile} $buildRoot/.config
+
+ # reads the existing .config file and prompts the user for options in
+ # the current kernel source that are not found in the file.
+ make $makeFlags "''${makeFlagsArray[@]}" oldconfig
+ runHook postConfigure
+
+ make $makeFlags "''${makeFlagsArray[@]}" prepare
+ actualModDirVersion="$(cat $buildRoot/include/config/kernel.release)"
+ if [ "$actualModDirVersion" != "${modDirVersion}" ]; then
+ echo "Error: modDirVersion ${modDirVersion} specified in the Nix expression is wrong, it should be: $actualModDirVersion"
+ exit 1
+ fi
+
+ # Note: we can get rid of this once http://permalink.gmane.org/gmane.linux.kbuild.devel/13800 is merged.
+ buildFlagsArray+=("KBUILD_BUILD_TIMESTAMP=$(date -u -d @$SOURCE_DATE_EPOCH)")
+
+ cd $buildRoot
+ '';
+
+ buildFlags = [
+ "KBUILD_BUILD_VERSION=1-NixOS"
+ platform.kernelTarget
+ "vmlinux" # for "perf" and things like that
+ ] ++ optional isModular "modules";
+
+ installFlags = [
+ "INSTALLKERNEL=${installkernel}"
+ "INSTALL_PATH=$(out)"
+ ] ++ (optional isModular "INSTALL_MOD_PATH=$(out)")
+ ++ optional installsFirmware "INSTALL_FW_PATH=$(out)/lib/firmware";
+
+ preInstall = ''
+ installFlagsArray+=("-j$NIX_BUILD_CORES")
+ '';
+
+ # Some image types need special install targets (e.g. uImage is installed with make uinstall)
+ installTargets = [ (
+ if platform ? kernelInstallTarget then platform.kernelInstallTarget
+ else if platform.kernelTarget == "uImage" then "uinstall"
+ else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall"
+ else "install"
+ ) ];
+
+ postInstall = (optionalString installsFirmware ''
+ mkdir -p $out/lib/firmware
+ '') + (if (platform ? kernelDTB && platform.kernelDTB) then ''
+ make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs
+ '' else "") + (if isModular then ''
+ mkdir -p $dev
+ cp vmlinux $dev/
+ if [ -z "''${dontStrip-}" ]; then
+ installFlagsArray+=("INSTALL_MOD_STRIP=1")
+ fi
+ make modules_install $makeFlags "''${makeFlagsArray[@]}" \
+ $installFlags "''${installFlagsArray[@]}"
+ unlink $out/lib/modules/${modDirVersion}/build
+ unlink $out/lib/modules/${modDirVersion}/source
+
+ mkdir -p $dev/lib/modules/${modDirVersion}/{build,source}
+
+ # To save space, exclude a bunch of unneeded stuff when copying.
+ (cd .. && rsync --archive --prune-empty-dirs \
+ --exclude='/build/' \
+ * $dev/lib/modules/${modDirVersion}/source/)
+
+ cd $dev/lib/modules/${modDirVersion}/source
+
+ cp $buildRoot/{.config,Module.symvers} $dev/lib/modules/${modDirVersion}/build
+ make modules_prepare $makeFlags "''${makeFlagsArray[@]}" O=$dev/lib/modules/${modDirVersion}/build
+
+ # For reproducibility, removes accidental leftovers from a `cc1` call
+ # from a `try-run` call from the Makefile
+ rm -f $dev/lib/modules/${modDirVersion}/build/.[0-9]*.d
+
+ # Keep some extra files on some arches (powerpc, aarch64)
+ for f in arch/powerpc/lib/crtsavres.o arch/arm64/kernel/ftrace-mod.o; do
+ if [ -f "$buildRoot/$f" ]; then
+ cp $buildRoot/$f $dev/lib/modules/${modDirVersion}/build/$f
+ fi
+ done
+
+ # !!! No documentation on how much of the source tree must be kept
+ # If/when kernel builds fail due to missing files, you can add
+ # them here. Note that we may see packages requiring headers
+ # from drivers/ in the future; it adds 50M to keep all of its
+ # headers on 3.10 though.
+
+ chmod u+w -R ..
+ arch=$(cd $dev/lib/modules/${modDirVersion}/build/arch; ls)
+
+ # Remove unused arches
+ for d in $(cd arch/; ls); do
+ if [ "$d" = "$arch" ]; then continue; fi
+ if [ "$arch" = arm64 ] && [ "$d" = arm ]; then continue; fi
+ rm -rf arch/$d
+ done
+
+ # Remove all driver-specific code (50M of which is headers)
+ rm -fR drivers
+
+ # Keep all headers
+ find . -type f -name '*.h' -print0 | xargs -0 chmod u-w
+
+ # Keep linker scripts (they are required for out-of-tree modules on aarch64)
+ find . -type f -name '*.lds' -print0 | xargs -0 chmod u-w
+
+ # Keep root and arch-specific Makefiles
+ chmod u-w Makefile
+ chmod u-w arch/$arch/Makefile*
+
+ # Keep whole scripts dir
+ chmod u-w -R scripts
+
+ # Delete everything not kept
+ find . -type f -perm -u=w -print0 | xargs -0 rm
+
+ # Delete empty directories
+ find -empty -type d -delete
+
+ # Remove reference to kmod
+ sed -i Makefile -e 's|= ${buildPackages.kmod}/bin/depmod|= depmod|'
+ '' else optionalString installsFirmware ''
+ make firmware_install $makeFlags "''${makeFlagsArray[@]}" \
+ $installFlags "''${installFlagsArray[@]}"
+ '');
+
+ requiredSystemFeatures = [ "big-parallel" ];
+
+ meta = {
+ description =
+ "The Linux kernel" +
+ (if kernelPatches == [] then "" else
+ " (with patches: "
+ + stdenv.lib.concatStringsSep ", " (map (x: x.name) kernelPatches)
+ + ")");
+ license = stdenv.lib.licenses.gpl2;
+ homepage = "https://www.kernel.org/";
+ repositories.git = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git";
+ maintainers = [
+ maintainers.thoughtpolice
+ ];
+ platforms = platforms.linux;
+ timeout = 14400; # 4 hours
+ } // extraMeta;
+ };
+in
+
+assert (stdenv.lib.versionAtLeast version "4.14" && stdenv.lib.versionOlder version "5.8") -> libelf != null;
+assert stdenv.lib.versionAtLeast version "5.8" -> elfutils != null;
+
+stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // {
+ pname = "linux";
+ inherit version;
+
+ enableParallelBuilding = true;
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr ]
+ ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools
+ ++ optional (stdenv.lib.versionAtLeast version "4.14" && stdenv.lib.versionOlder version "5.8") libelf
+ # Removed utillinuxMinimal since it should not be a dependency.
+ ++ optionals (stdenv.lib.versionAtLeast version "4.16") [ bison flex ]
+ ++ optional (stdenv.lib.versionAtLeast version "5.2") cpio
+ ++ optional (stdenv.lib.versionAtLeast version "5.8") elfutils
+ ;
+
+ hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ];
+
+ # Absolute paths for compilers avoid any PATH-clobbering issues.
+ makeFlags = commonMakeFlags ++ [
+ "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
+ "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+ ];
+
+ karch = stdenv.hostPlatform.platform.kernelArch;
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch
new file mode 100644
index 000000000000..58a9191989ae
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch
@@ -0,0 +1,14 @@
+diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
+index 07650ee..934a7a8 100644
+--- a/scripts/Makefile.modinst
++++ b/scripts/Makefile.modinst
+@@ -9,7 +9,8 @@ include scripts/Kbuild.include
+
+ #
+
+-__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
++__modules := $(sort $(foreach f,$(wildcard $(MODVERDIR)/*.mod),$(shell \
++ grep -h '\.ko$$' '$f')))
+ modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
+
+ PHONY += $(modules)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mptcp-config.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mptcp-config.nix
new file mode 100644
index 000000000000..9752e63d9f94
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/mptcp-config.nix
@@ -0,0 +1,28 @@
+{ stdenv }:
+with stdenv.lib.kernel;
+{
+ # DRM_AMDGPU = yes;
+
+ IPV6 = yes;
+ MPTCP = yes;
+ IP_MULTIPLE_TABLES = yes;
+
+ # Enable advanced path-managers...
+ MPTCP_PM_ADVANCED = yes;
+ MPTCP_FULLMESH = yes;
+ MPTCP_NDIFFPORTS = yes;
+ # ... but use none by default.
+ # The default is safer if source policy routing is not setup.
+ DEFAULT_DUMMY = yes;
+ DEFAULT_MPTCP_PM.freeform = "default";
+
+ # MPTCP scheduler selection.
+ MPTCP_SCHED_ADVANCED = yes;
+ DEFAULT_MPTCP_SCHED.freeform = "default";
+
+ # Smarter TCP congestion controllers
+ TCP_CONG_LIA = module;
+ TCP_CONG_OLIA = module;
+ TCP_CONG_WVEGAS = module;
+ TCP_CONG_BALIA = module;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/p9-fixes.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/p9-fixes.patch
new file mode 100644
index 000000000000..f6061b60667a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/p9-fixes.patch
@@ -0,0 +1,85 @@
+diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
+--- a/fs/9p/vfs_inode.c
++++ b/fs/9p/vfs_inode.c
+@@ -483,6 +483,9 @@ static int v9fs_test_inode(struct inode *inode, void *data)
+
+ if (v9inode->qid.type != st->qid.type)
+ return 0;
++
++ if (v9inode->qid.path != st->qid.path)
++ return 0;
+ return 1;
+ }
+
+diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
+--- a/fs/9p/vfs_inode_dotl.c
++++ b/fs/9p/vfs_inode_dotl.c
+@@ -87,6 +87,9 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data)
+
+ if (v9inode->qid.type != st->qid.type)
+ return 0;
++
++ if (v9inode->qid.path != st->qid.path)
++ return 0;
+ return 1;
+ }
+
+diff --git a/net/9p/client.c b/net/9p/client.c
+index 3ce672af1596..f1c8ad373f90 100644
+--- a/net/9p/client.c
++++ b/net/9p/client.c
+@@ -749,8 +749,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
+ }
+ again:
+ /* Wait for the response */
+- err = wait_event_interruptible(*req->wq,
+- req->status >= REQ_STATUS_RCVD);
++ err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
+
+ /*
+ * Make sure our req is coherent with regard to updates in other
+diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
+index f24b25c25106..f3a4efcf1456 100644
+--- a/net/9p/trans_virtio.c
++++ b/net/9p/trans_virtio.c
+@@ -286,8 +286,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
+ if (err == -ENOSPC) {
+ chan->ring_bufs_avail = 0;
+ spin_unlock_irqrestore(&chan->lock, flags);
+- err = wait_event_interruptible(*chan->vc_wq,
+- chan->ring_bufs_avail);
++ err = wait_event_killable(*chan->vc_wq,
++ chan->ring_bufs_avail);
+ if (err == -ERESTARTSYS)
+ return err;
+
+@@ -327,7 +327,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
+ * Other zc request to finish here
+ */
+ if (atomic_read(&vp_pinned) >= chan->p9_max_pages) {
+- err = wait_event_interruptible(vp_wq,
++ err = wait_event_killable(vp_wq,
+ (atomic_read(&vp_pinned) < chan->p9_max_pages));
+ if (err == -ERESTARTSYS)
+ return err;
+@@ -471,8 +471,8 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
+ if (err == -ENOSPC) {
+ chan->ring_bufs_avail = 0;
+ spin_unlock_irqrestore(&chan->lock, flags);
+- err = wait_event_interruptible(*chan->vc_wq,
+- chan->ring_bufs_avail);
++ err = wait_event_killable(*chan->vc_wq,
++ chan->ring_bufs_avail);
+ if (err == -ERESTARTSYS)
+ goto err_out;
+
+@@ -489,8 +489,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
+ virtqueue_kick(chan->vq);
+ spin_unlock_irqrestore(&chan->lock, flags);
+ p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
+- err = wait_event_interruptible(*req->wq,
+- req->status >= REQ_STATUS_RCVD);
++ err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
+ /*
+ * Non kernel buffers are pinned, unpin them
+ */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/patches.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/patches.nix
new file mode 100644
index 000000000000..8ce1ac2b587c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/patches.nix
@@ -0,0 +1,95 @@
+{ lib, fetchpatch, fetchurl }:
+
+{
+ bridge_stp_helper =
+ { name = "bridge-stp-helper";
+ patch = ./bridge-stp-helper.patch;
+ };
+
+ request_key_helper =
+ { name = "request-key-helper";
+ patch = ./request-key-helper.patch;
+ };
+
+ request_key_helper_updated =
+ { name = "request-key-helper-updated";
+ patch = ./request-key-helper-updated.patch;
+ };
+
+ p9_fixes =
+ { name = "p9-fixes";
+ patch = ./p9-fixes.patch;
+ };
+
+ modinst_arg_list_too_long =
+ { name = "modinst-arglist-too-long";
+ patch = ./modinst-arg-list-too-long.patch;
+ };
+
+ genksyms_fix_segfault =
+ { name = "genksyms-fix-segfault";
+ patch = ./genksyms-fix-segfault.patch;
+ };
+
+ cpu-cgroup-v2 = import ./cpu-cgroup-v2-patches;
+
+ tag_hardened = {
+ name = "tag-hardened";
+ patch = ./hardened/tag-hardened.patch;
+ };
+
+ hardened = let
+ mkPatch = kernelVersion: src: {
+ name = lib.removeSuffix ".patch" src.name;
+ patch = fetchurl src;
+ };
+ patches = builtins.fromJSON (builtins.readFile ./hardened/patches.json);
+ in lib.mapAttrs mkPatch patches;
+
+ # https://bugzilla.kernel.org/show_bug.cgi?id=197591#c6
+ iwlwifi_mvm_support_version_7_scan_req_umac_fw_command = rec {
+ name = "iwlwifi_mvm_support_version_7_scan_req_umac_fw_command";
+ patch = fetchpatch {
+ name = name + ".patch";
+ url = "https://bugzilla.kernel.org/attachment.cgi?id=260597";
+ sha256 = "09096npxpgvlwdz3pb3m9brvxh7vy0xc9z9p8hh85xyczyzcsjhr";
+ };
+ };
+
+ # https://github.com/NixOS/nixpkgs/issues/42755
+ xen-netfront_fix_mismatched_rtnl_unlock = rec {
+ name = "xen-netfront_fix_mismatched_rtnl_unlock";
+ patch = fetchpatch {
+ name = name + ".patch";
+ url = "https://github.com/torvalds/linux/commit/cb257783c2927b73614b20f915a91ff78aa6f3e8.patch";
+ sha256 = "0xhblx2j8wi3kpnfpgjjwlcwdry97ji2aaq54r3zirk5g5p72zs8";
+ };
+ };
+
+ # https://github.com/NixOS/nixpkgs/issues/42755
+ xen-netfront_update_features_after_registering_netdev = rec {
+ name = "xen-netfront_update_features_after_registering_netdev";
+ patch = fetchpatch {
+ name = name + ".patch";
+ url = "https://github.com/torvalds/linux/commit/45c8184c1bed1ca8a7f02918552063a00b909bf5.patch";
+ sha256 = "1l8xq02rd7vakxg52xm9g4zng0ald866rpgm8kjlh88mwwyjkrwv";
+ };
+ };
+
+ export_kernel_fpu_functions = {
+ "4.14" = {
+ name = "export_kernel_fpu_functions";
+ patch = ./export_kernel_fpu_functions_4_14.patch;
+ };
+ "5.3" = {
+ name = "export_kernel_fpu_functions";
+ patch = ./export_kernel_fpu_functions_5_3.patch;
+ };
+ };
+
+ # patches from https://lkml.org/lkml/2019/7/15/1748
+ mac_nvme_t2 = rec {
+ name = "mac_nvme_t2";
+ patch = ./mac-nvme-t2.patch;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/perf.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/perf.nix
new file mode 100644
index 000000000000..a35582442979
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/perf.nix
@@ -0,0 +1,78 @@
+{ lib, stdenv, kernel, elfutils, python2, python3, perl, newt, slang, asciidoc, xmlto, makeWrapper
+, docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkgconfig, libunwind, binutils
+, libiberty, audit, libbfd, libopcodes, openssl, systemtap, numactl
+, zlib, withGtk ? false, gtk2 ? null
+}:
+
+with lib;
+
+assert withGtk -> gtk2 != null;
+assert versionAtLeast kernel.version "3.12";
+
+stdenv.mkDerivation {
+ name = "perf-linux-${kernel.version}";
+
+ inherit (kernel) src;
+
+ preConfigure = ''
+ cd tools/perf
+
+ substituteInPlace Makefile \
+ --replace /usr/include/elfutils $elfutils/include/elfutils
+
+ for x in util/build-id.c util/dso.c; do
+ substituteInPlace $x --replace /usr/lib/debug /run/current-system/sw/lib/debug
+ done
+
+ if [ -f bash_completion ]; then
+ sed -i 's,^have perf,_have perf,' bash_completion
+ fi
+ '';
+
+ makeFlags = ["prefix=$(out)" "WERROR=0"] ++ kernel.makeFlags;
+
+ hardeningDisable = [ "format" ];
+
+ # perf refers both to newt and slang
+ nativeBuildInputs = [
+ asciidoc xmlto docbook_xsl docbook_xml_dtd_45 libxslt
+ flex bison libiberty audit makeWrapper pkgconfig python3
+ ];
+ buildInputs = [
+ elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl
+ libopcodes python3 perl
+ ] ++ stdenv.lib.optional withGtk gtk2
+ ++ (if (versionAtLeast kernel.version "4.19") then [ python3 ] else [ python2 ]);
+
+ # Note: we don't add elfutils to buildInputs, since it provides a
+ # bad `ld' and other stuff.
+ NIX_CFLAGS_COMPILE = toString [
+ "-Wno-error=cpp"
+ "-Wno-error=bool-compare"
+ "-Wno-error=deprecated-declarations"
+ "-DOBJDUMP_PATH=\"${binutils}/bin/objdump\""
+ "-Wno-error=stringop-truncation"
+ ];
+
+ postPatch = ''
+ patchShebangs scripts/bpf_helpers_doc.py
+ '';
+
+ doCheck = false; # requires "sparse"
+ doInstallCheck = false; # same
+
+ separateDebugInfo = true;
+ installFlags = [ "install" "install-man" "ASCIIDOC8=1" "prefix=$(out)" ];
+
+ preFixup = ''
+ wrapProgram $out/bin/perf \
+ --prefix PATH : "${binutils}/bin"
+ '';
+
+ meta = {
+ homepage = "https://perf.wiki.kernel.org/";
+ description = "Linux tools to profile with performance counters";
+ maintainers = with stdenv.lib.maintainers; [viric];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/randstruct-provide-seed.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/randstruct-provide-seed.patch
new file mode 100644
index 000000000000..1328b9cee3c9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/randstruct-provide-seed.patch
@@ -0,0 +1,12 @@
+diff -ru a/scripts/gcc-plugins/gen-random-seed.sh b/scripts/gcc-plugins/gen-random-seed.sh
+--- a/scripts/gcc-plugins/gen-random-seed.sh 2019-01-11 11:50:29.228258920 +0100
++++ b/scripts/gcc-plugins/gen-random-seed.sh 2019-01-11 12:18:33.555902720 +0100
+@@ -2,7 +2,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+
+ if [ ! -f "$1" ]; then
+- SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
++ SEED="NIXOS_RANDSTRUCT_SEED"
+ echo "const char *randstruct_seed = \"$SEED\";" > "$1"
+ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
+ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper-updated.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper-updated.patch
new file mode 100644
index 000000000000..aabb9e801be4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper-updated.patch
@@ -0,0 +1,13 @@
+diff --git a/security/keys/request_key.c b/security/keys/request_key.c
+index 88172c163953..4da74a1eebb2 100644
+--- a/security/keys/request_key.c
++++ b/security/keys/request_key.c
+@@ -161,7 +161,7 @@ static int call_sbin_request_key(struct key_construction *cons,
+
+ /* set up the argument list */
+ i = 0;
+- argv[i++] = "/sbin/request-key";
++ argv[i++] = "/run/current-system/sw/bin/request-key";
+ argv[i++] = (char *) op;
+ argv[i++] = key_str;
+ argv[i++] = uid_str;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper.patch
new file mode 100644
index 000000000000..8264e265aedf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/request-key-helper.patch
@@ -0,0 +1,13 @@
+diff --git a/security/keys/request_key.c b/security/keys/request_key.c
+index 957b9e3e1492..5436a0d8b81d 100644
+--- a/security/keys/request_key.c
++++ b/security/keys/request_key.c
+@@ -114,7 +114,7 @@ static int call_usermodehelper_keys(const char *path, char **argv, char **envp,
+ */
+ static int call_sbin_request_key(struct key *authkey, void *aux)
+ {
+- static char const request_key[] = "/sbin/request-key";
++ static char const request_key[] = "/run/current-system/sw/bin/request-key";
+ struct request_key_auth *rka = get_request_key_auth(authkey);
+ const struct cred *cred = current_cred();
+ key_serial_t prkey, sskey;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-libre.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-libre.sh
new file mode 100755
index 000000000000..aea12df55cc5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-libre.sh
@@ -0,0 +1,33 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p nix-prefetch-svn git curl
+set -euo pipefail
+
+nixpkgs="$(git rev-parse --show-toplevel)"
+path="$nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix"
+
+old_rev="$(grep -o 'rev = ".*"' "$path" | awk -F'"' '{print $2}')"
+old_sha256="$(grep -o 'sha256 = ".*"' "$path" | awk -F'"' '{print $2}')"
+
+svn_url=https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/
+rev="$(curl -s "$svn_url" | grep -Em 1 -o 'Revision [0-9]+' | awk '{print $2}')"
+
+if [ "$old_rev" = "$rev" ]; then
+ echo "No updates for linux-libre"
+ exit 0
+fi
+
+sha256="$(QUIET=1 nix-prefetch-svn "$svn_url" "$rev" | tail -1)"
+
+if [ "$old_sha256" = "$sha256" ]; then
+ echo "No updates for linux-libre"
+ exit 0
+fi
+
+sed -i -e "s/rev = \".*\"/rev = \"$rev\"/" \
+ -e "s/sha256 = \".*\"/sha256 = \"$sha256\"/" "$path"
+
+if [ -n "${COMMIT-}" ]; then
+ git commit -qm "linux_latest-libre: $old_rev -> $rev" "$path" \
+ $nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix
+ echo "Updated linux_latest-libre $old_rev -> $rev"
+fi
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-rt.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-rt.sh
new file mode 100755
index 000000000000..bcfa494d7e7a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update-rt.sh
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# To update all rt kernels run: ./update-rt.sh
+
+# To update just one ./linux-rt-5.X.nix run: ./update-rt.sh ./linux-rt-5.X.nix
+
+# To add a new kernel branch 5.Y run: ./update-rt.sh ./linux-rt-5.Y.nix
+# (with nonexistent .nix file) and update all-packages.nix.
+
+# To commit run with: env COMMIT=1
+
+mirror=https://kernel.org/pub/linux/kernel
+
+main() {
+ if [ $# -ge 1 ]; then
+ update-if-needed "$1"
+ else
+ update-all-if-needed
+ fi
+}
+
+update-all-if-needed() {
+ for f in "$(dirname "$0")"/linux-rt-*.nix; do
+ update-if-needed "$f"
+ done
+}
+
+file-version() {
+ file="$1" # e.g. ./linux-rt-5.4.nix
+ if [ -e "$file" ]; then
+ grep ' version = ' "$file" | grep -o '[0-9].[^"]*'
+ fi
+}
+
+latest-rt-version() {
+ branch="$1" # e.g. 5.4
+ curl -sL "$mirror/projects/rt/$branch/sha256sums.asc" |
+ sed -ne '/.patch.xz/ { s/.*patch-\(.*\).patch.xz/\1/; p; q }'
+}
+
+update-if-needed() {
+ file="$1" # e.g. ./linux-rt-5.4.nix (created if does not exist)
+ branch=$(basename "$file" .nix) # e.g. linux-rt-5.4
+ branch=${branch#linux-rt-} # e.g. 5.4
+ cur=$(file-version "$file") # e.g. 5.4.59-rt36 or empty
+ new=$(latest-rt-version "$branch") # e.g. 5.4.61-rt37
+ kversion=${new%-*} # e.g. 5.4.61
+ major=${branch%.*} # e.g 5
+ nixattr="linux-rt_${branch/./_}"
+ if [ "$new" = "$cur" ]; then
+ echo "$nixattr: $cur (up-to-date)"
+ return
+ fi
+ khash=$(nix-prefetch-url "$mirror/v${major}.x/linux-${kversion}.tar.xz")
+ phash=$(nix-prefetch-url "$mirror/projects/rt/${branch}/older/patch-${new}.patch.xz")
+ if [ "$cur" ]; then
+ msg="$nixattr: $cur -> $new"
+ else
+ msg="$nixattr: init at $new"
+ prev=$(ls "$(dirname "$0")"/linux-rt-*.nix | tail -1)
+ cp "$prev" "$file"
+ cur=$(file-version "$file")
+ fi
+ echo "$msg"
+ sed -i "$file" \
+ -e "s/$cur/$new/" \
+ -e "s|kernel/v[0-9]*|kernel/v$major|" \
+ -e "1,/.patch.xz/ s/sha256 = .*/sha256 = \"$khash\";/" \
+ -e "1,/.patch.xz/! s/sha256 = .*/sha256 = \"$phash\";/"
+ if [ "${COMMIT:-}" ]; then
+ git add "$file"
+ git commit -m "$msg"
+ fi
+}
+
+return 2>/dev/null || main "$@"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update.sh
new file mode 100755
index 000000000000..560edced36ea
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kernel/update.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+set -e
+
+# Get the latest versions from kernel.org
+LINUXSED='s/.*linux-\([0-9]\+\(.[0-9]\+\)*\).*/\1/p'
+KDATA="$(curl -s https://www.kernel.org | sed -n -e '/Download complete/p')"
+VERSIONS=($(sed -n -e $LINUXSED <<< "$KDATA" | sort -Vr))
+
+# Remove mainline version if there is a stable update
+# Note due to sorting these two will always exist at the bottom
+if grep -q "^${VERSIONS[1]}" <<< "${VERSIONS[0]}"; then
+ VERSIONS=(${VERSIONS[@]:0:1} ${VERSIONS[@]:2})
+fi
+
+# Inspect each file and see if it has the latest version
+NIXPKGS="$(git rev-parse --show-toplevel)"
+ls $NIXPKGS/pkgs/os-specific/linux/kernel | while read FILE; do
+ KERNEL="$(sed -n -e $LINUXSED <<< "$FILE")"
+ [ -z "$KERNEL" ] && continue
+
+ # Find the matching new kernel version
+ MATCHING=""
+ for V in "${VERSIONS[@]}"; do
+ if grep -q "^$KERNEL" <<< "$V"; then
+ MATCHING="$V"
+ break
+ fi
+ done
+ if [ -z "$MATCHING" ]; then
+ echo "Out-of-support $KERNEL"
+ continue
+ fi
+
+ # Inspect the nix expression to check for changes
+ DATA="$(<$NIXPKGS/pkgs/os-specific/linux/kernel/$FILE)"
+ URL="$(sed -n -e 's/.*url = "\(.*\)";.*/\1/p' <<< "$DATA" | sed -e "s/\${version}/$MATCHING/g")"
+ OLDVER=$(sed -n -e 's/.*version = "\(.*\)".*/\1/p' <<< "$DATA")
+ if [ "$OLDVER" = "$V" ]; then
+ echo "No updates for $KERNEL"
+ continue
+ fi
+
+ # Download the new file for the hash
+ if ! HASH="$(nix-prefetch-url $URL 2>/dev/null)"; then
+ echo "Failed to get hash of $URL"
+ continue
+ fi
+ sed -i -e "s/sha256 = \".*\"/sha256 = \"$HASH\"/g" $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE
+
+ # Rewrite the expression
+ sed -i -e '/version = /d' $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE
+ sed -i -e "\#buildLinux (args // rec {#a \ version = \"$V\";" $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE
+
+ # Commit the changes
+ git add -u $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE
+ git commit -m "linux: $OLDVER -> $V" >/dev/null 2>&1
+
+ echo "Updated $OLDVER -> $V"
+done
+
+# Update linux-rt
+COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/update-rt.sh
+
+# Update linux-libre
+COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/update-libre.sh
+
+# Update linux-hardened
+COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/hardened/update.py
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kexectools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kexectools/default.nix
new file mode 100644
index 000000000000..a70cb2e087fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kexectools/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, buildPackages, fetchurl, zlib, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ pname = "kexec-tools";
+ version = "2.0.20";
+
+ src = fetchurl {
+ urls = [
+ "mirror://kernel/linux/utils/kernel/kexec/${pname}-${version}.tar.xz"
+ "http://horms.net/projects/kexec/kexec-tools/${pname}-${version}.tar.xz"
+ ];
+ sha256 = "1j7qlhxk1rbv9jbj8wd6hb7zl8p2mp29ymrmccgmsi0m0dzhgn6s";
+ };
+
+ hardeningDisable = [ "format" "pic" "relro" "pie" ];
+
+ # Prevent kexec-tools from using uname to detect target, which is wrong in
+ # cases like compiling for aarch32 on aarch64
+ configurePlatforms = [ "build" "host" ];
+ configureFlags = [ "BUILD_CC=${buildPackages.stdenv.cc.targetPrefix}cc" ];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ buildInputs = [ zlib ];
+
+ patches = [
+ # fix build on i686
+ # See: https://src.fedoraproject.org/rpms/kexec-tools/c/cb1e5463b5298b064e9b6c86ad6fe3505fec9298
+ (fetchpatch {
+ name = "kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch";
+ url = "https://src.fedoraproject.org/rpms/kexec-tools/raw/cb1e5463b5298b064e9b6c86ad6fe3505fec9298/f/kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch";
+ sha256 = "1kzmcsbhwfdgxlc5s88ir0n494phww1j16yk0z42x09qlkxxkg0l";
+ })
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://horms.net/projects/kexec/kexec-tools";
+ description = "Tools related to the kexec Linux feature";
+ platforms = platforms.linux;
+ badPlatforms = [
+ "riscv64-linux" "riscv32-linux"
+ "sparc-linux" "sparc64-linux"
+ ];
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/conf-symlink.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/conf-symlink.patch
new file mode 100644
index 000000000000..02762e857a81
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/conf-symlink.patch
@@ -0,0 +1,13 @@
+diff --git a/request-key.c b/request-key.c
+index bf47c0a..105fee8 100644
+--- a/request-key.c
++++ b/request-key.c
+@@ -313,7 +313,7 @@ static void scan_conf_dir(struct parameters *params, const char *confdir)
+ while ((d = readdir(dir))) {
+ if (d->d_name[0] == '.')
+ continue;
+- if (d->d_type != DT_UNKNOWN && d->d_type != DT_REG)
++ if (d->d_type != DT_UNKNOWN && d->d_type != DT_REG && d->d_type != DT_LNK)
+ continue;
+ l = strlen(d->d_name);
+ if (l < 5)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/default.nix
new file mode 100644
index 000000000000..fb06f942e482
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/keyutils/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl }:
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+stdenv.mkDerivation rec {
+ pname = "keyutils";
+ version = "1.6.3";
+
+ src = fetchurl {
+ url = "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/snapshot/${pname}-${version}.tar.gz";
+ sha256 = "sha256-ph1XBhNq5MBb1I+GGGvP29iN2L1RB+Phlckkz8Gzm7Q=";
+ };
+
+ patches = [
+ (fetchurl {
+ # improve reproducibility
+ url = "https://salsa.debian.org/debian/keyutils/raw/4cecffcb8e2a2aa4ef41777ed40e4e4bcfb2e5bf/debian/patches/Make-build-reproducible.patch";
+ sha256 = "0wnvbjfrbk7rghd032z684l7vk7mhy3bd41zvhkrhgp3cd5id0bm";
+ })
+ ./conf-symlink.patch
+ ];
+
+ BUILDDATE = "1970-01-01";
+ outputs = [ "out" "lib" "dev" ];
+
+ enableParallelBuilding = true;
+
+ installFlags = [
+ "ETCDIR=$(out)/etc"
+ "BINDIR=$(out)/bin"
+ "SBINDIR=$(out)/sbin"
+ "SHAREDIR=$(out)/share/keyutils"
+ "MANDIR=$(out)/share/man"
+ "INCLUDEDIR=$(dev)/include"
+ "LIBDIR=$(lib)/lib"
+ "USRLIBDIR=$(lib)/lib"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://people.redhat.com/dhowells/keyutils/";
+ description = "Tools used to control the Linux kernel key management system";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/default.nix
new file mode 100644
index 000000000000..55faa216a12c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv, fetchurl, linuxHeaders, perl }:
+
+let
+ commonMakeFlags = [
+ "prefix=$(out)"
+ "SHLIBDIR=$(out)/lib"
+ ];
+in
+
+stdenv.mkDerivation rec {
+ pname = "klibc";
+ version = "2.0.8";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/libs/klibc/2.0/klibc-${version}.tar.xz";
+ sha256 = "0dmlkhnn5q8fc6rkzsisir4chkzmmiq6xkjmvyvf0g7yihwz2j2f";
+ };
+
+ patches = [ ./no-reinstall-kernel-headers.patch ];
+
+ nativeBuildInputs = [ perl ];
+
+ hardeningDisable = [ "format" "stackprotector" ];
+
+ makeFlags = commonMakeFlags ++ [
+ "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "KLIBCKERNELSRC=${linuxHeaders}"
+ ] # TODO(@Ericson2314): We now can get the ABI from
+ # `stdenv.hostPlatform.parsed.abi`, is this still a good idea?
+ ++ stdenv.lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
+ ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
+
+ # Install static binaries as well.
+ postInstall = ''
+ dir=$out/lib/klibc/bin.static
+ mkdir $dir
+ cp $(find $(find . -name static) -type f ! -name "*.g" -a ! -name ".*") $dir/
+
+ for file in ${linuxHeaders}/include/*; do
+ ln -sv $file $out/lib/klibc/include
+ done
+ '';
+
+ meta = {
+ description = "Minimalistic libc subset for initramfs usage";
+ homepage = "https://kernel.org/pub/linux/libs/klibc/";
+ maintainers = with lib.maintainers; [ fpletz ];
+ license = lib.licenses.bsd3;
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch
new file mode 100644
index 000000000000..709dd30f8c7e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch
@@ -0,0 +1,11 @@
+diff -Naur klibc-2.0.3-orig/scripts/Kbuild.install klibc-2.0.3/scripts/Kbuild.install
+--- klibc-2.0.3-orig/scripts/Kbuild.install 2013-12-03 13:53:46.000000000 -0500
++++ klibc-2.0.3/scripts/Kbuild.install 2014-01-04 18:17:09.342609021 -0500
+@@ -95,7 +95,6 @@
+ $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
+ $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
+ $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
+- $(Q)cp -rfL $(KLIBCKERNELSRC)/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
+ $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
+ $(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
+ $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix
new file mode 100644
index 000000000000..8b79940ed78c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix
@@ -0,0 +1,26 @@
+{stdenv, klibc}:
+
+stdenv.mkDerivation {
+ # !!! For now, the name has to be exactly as long as the original
+ # name due to the sed hackery below. Once patchelf 0.4 is in the
+ # tree, we can do this properly.
+ #name = "${klibc.name}-shrunk";
+ name = klibc.name;
+ buildCommand = ''
+ mkdir -p $out/lib
+ cp -prd ${klibc.out}/lib/klibc/bin $out/
+ cp -p ${klibc.out}/lib/*.so $out/lib/
+ chmod +w $out/*
+ old=$(echo ${klibc.out}/lib/klibc-*.so)
+ new=$(echo $out/lib/klibc-*.so)
+ for i in $out/bin/*; do
+ echo $i
+ sed "s^$old^$new^" -i $i
+ # !!! use patchelf
+ #patchelf --set-interpreter $new $i
+ done
+ ''; # */
+ allowedReferences = ["out"];
+
+ inherit (klibc) meta;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
new file mode 100644
index 000000000000..17f34f9bbd79
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, gnugrep, findutils }:
+
+let
+ version = "22-1.1ubuntu1"; # Zesty
+
+in stdenv.mkDerivation {
+ pname = "kmod-blacklist";
+ inherit version;
+
+ src = fetchurl {
+ url = "https://launchpad.net/ubuntu/+archive/primary/+files/kmod_${version}.debian.tar.xz";
+ sha256 = "1k749g707ccb82l4xmrkp53khl71f57cpj9fzd1qyzrz147fjyhi";
+ };
+
+ installPhase = ''
+ mkdir "$out"
+ for f in modprobe.d/*.conf; do
+ echo "''\n''\n## file: "`basename "$f"`"''\n''\n" >> "$out"/modprobe.conf
+ cat "$f" >> "$out"/modprobe.conf
+ # https://bugs.launchpad.net/ubuntu/+source/kmod/+bug/1475945
+ sed -i '/^blacklist i2c_i801/d' $out/modprobe.conf
+ done
+
+ substituteInPlace "$out"/modprobe.conf \
+ --replace "blacklist bochs-drm" "" \
+ --replace /sbin/lsmod /run/booted-system/sw/bin/lsmod \
+ --replace /sbin/rmmod /run/booted-system/sw/bin/rmmod \
+ --replace /sbin/modprobe /run/booted-system/sw/bin/modprobe \
+ --replace " grep " " ${gnugrep}/bin/grep " \
+ --replace " xargs " " ${findutils}/bin/xargs "
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://packages.ubuntu.com/source/zesty/kmod";
+ description = "Linux kernel module blacklists from Ubuntu";
+ platforms = platforms.linux;
+ license = with licenses; [ gpl2Plus lgpl21Plus ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-debian-aliases/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-debian-aliases/default.nix
new file mode 100644
index 000000000000..23d323f84b8f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod-debian-aliases/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, lib }:
+
+stdenv.mkDerivation rec {
+ name = "kmod-debian-aliases-${version}.conf";
+ version = "22-1.1";
+
+ src = fetchurl {
+ url = "https://snapshot.debian.org/archive/debian/20160404T220610Z/pool/main/k/kmod/kmod_${version}.debian.tar.xz";
+ sha256 = "0daap2n4bvjqcnksaayy6csmdb1px4r02w3xp36bcp6w3lbnqamh";
+ };
+
+ installPhase = ''
+ patch -i patches/aliases_conf
+ cp aliases.conf $out
+ '';
+
+ meta = with lib; {
+ homepage = "https://packages.debian.org/source/sid/kmod";
+ description = "Linux configuration file for modprobe";
+ maintainers = with maintainers; [ mathnerd314 ];
+ platforms = with platforms; linux;
+ license = with licenses; [ gpl2Plus lgpl21Plus ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/aggregator.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/aggregator.nix
new file mode 100644
index 000000000000..cd138f1d7f55
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/aggregator.nix
@@ -0,0 +1,35 @@
+{ stdenvNoCC, kmod, modules, buildEnv, name ? "kernel-modules" }:
+
+buildEnv {
+ inherit name;
+
+ paths = modules;
+
+ postBuild =
+ ''
+ source ${stdenvNoCC}/setup
+
+ if ! test -d "$out/lib/modules"; then
+ echo "No modules found."
+ # To support a kernel without modules
+ exit 0
+ fi
+
+ kernelVersion=$(cd $out/lib/modules && ls -d *)
+ if test "$(echo $kernelVersion | wc -w)" != 1; then
+ echo "inconsistent kernel versions: $kernelVersion"
+ exit 1
+ fi
+
+ echo "kernel version is $kernelVersion"
+
+ shopt -s extglob
+
+ # Regenerate the depmod map files. Be sure to pass an explicit
+ # kernel version number, otherwise depmod will use `uname -r'.
+ if test -w $out/lib/modules/$kernelVersion; then
+ rm -f $out/lib/modules/$kernelVersion/modules.!(builtin*|order*)
+ ${kmod}/bin/depmod -b $out -C $out/etc/depmod.d -a $kernelVersion
+ fi
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch
new file mode 100644
index 000000000000..69dbf479f9f1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch
@@ -0,0 +1,123 @@
+diff --git a/Makefile.am b/Makefile.am
+index 194e111..0a095b5 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -80,8 +80,7 @@ EXTRA_DIST += libkmod/README \
+ libkmod/COPYING testsuite/COPYING tools/COPYING COPYING
+
+ libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
+- -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
+- -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
++ -version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE)
+ libkmod_libkmod_la_DEPENDENCIES = \
+ shared/libshared.la \
+ ${top_srcdir}/libkmod/libkmod.sym
+@@ -91,8 +90,7 @@ libkmod_libkmod_la_LIBADD = \
+
+ noinst_LTLIBRARIES += libkmod/libkmod-internal.la
+ libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
+-libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
+- -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
++libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS)
+ libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES)
+ libkmod_libkmod_internal_la_LIBADD = $(libkmod_libkmod_la_LIBADD)
+
+diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
+index 889f264..6f0a285 100644
+--- a/libkmod/libkmod-module.c
++++ b/libkmod/libkmod-module.c
+@@ -787,7 +787,11 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod,
+ flags &= KMOD_REMOVE_FORCE;
+ flags |= KMOD_REMOVE_NOWAIT;
+
++#if defined(__linux__)
+ err = delete_module(mod->name, flags);
++#else
++ err = -1;
++#endif
+ if (err != 0) {
+ err = -errno;
+ ERR(mod->ctx, "could not remove '%s': %m\n", mod->name);
+@@ -879,7 +883,11 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod,
+ }
+ size = kmod_file_get_size(mod->file);
+
++#if defined(__linux__)
+ err = init_module(mem, size, args);
++#else
++ err = -1;
++#endif
+ init_finished:
+ if (err < 0) {
+ err = -errno;
+diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
+index 429ffbd..17a3b9c 100644
+--- a/libkmod/libkmod-signature.c
++++ b/libkmod/libkmod-signature.c
+@@ -17,7 +17,10 @@
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
++#if defined(__linux__)
+ #include <endian.h>
++#endif
++
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/shared/macro.h b/shared/macro.h
+index 4fc5405..b5a2702 100644
+--- a/shared/macro.h
++++ b/shared/macro.h
+@@ -71,3 +71,7 @@
+ #endif
+
+ #define UNIQ __COUNTER__
++
++ #if !defined(__linux__)
++#define program_invocation_short_name getprogname()
++#endif
+diff --git a/shared/missing.h b/shared/missing.h
+index 4c0d136..ad8ec0f 100644
+--- a/shared/missing.h
++++ b/shared/missing.h
+@@ -45,6 +45,9 @@ static inline int finit_module(int fd, const char *uargs, int flags)
+ #endif
+
+ #if !HAVE_DECL_BE32TOH
++
++#if defined(__linux__)
++
+ #include <endian.h>
+ #include <byteswap.h>
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+@@ -52,4 +55,16 @@ static inline int finit_module(int fd, const char *uargs, int flags)
+ #else
+ #define be32toh(x) (x)
+ #endif
++
++#elif defined(__APPLE__)
++
++#include <libkern/OSByteOrder.h>
++#define be32toh(x) OSSwapBigToHostInt32(x)
++
++#else
++
++#error No be32toh known for platform
++
++#endif
++
+ #endif
+diff --git a/shared/util.c b/shared/util.c
+index fd2028d..ecb0141 100644
+--- a/shared/util.c
++++ b/shared/util.c
+@@ -367,7 +367,7 @@ char *path_make_absolute_cwd(const char *p)
+ if (path_is_absolute(p))
+ return strdup(p);
+
+- cwd = get_current_dir_name();
++ cwd = getcwd(NULL, 0);
+ if (!cwd)
+ return NULL;
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/default.nix
new file mode 100644
index 000000000000..805b8a32aedd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, lib, fetchurl, autoreconfHook, pkgconfig
+, libxslt, xz, elf-header
+, withStatic ? false }:
+
+let
+ systems = [ "/run/current-system/kernel-modules" "/run/booted-system/kernel-modules" "" ];
+ modulesDirs = lib.concatMapStringsSep ":" (x: "${x}/lib/modules") systems;
+
+in stdenv.mkDerivation rec {
+ pname = "kmod";
+ version = "27";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/kernel/${pname}/${pname}-${version}.tar.xz";
+ sha256 = "035wzfzjx4nwidk747p8n085mgkvy531ppn16krrajx2dkqzply1";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig libxslt ];
+ buildInputs = [ xz ] ++ lib.optional stdenv.isDarwin elf-header;
+
+ configureFlags = [
+ "--sysconfdir=/etc"
+ "--with-xz"
+ "--with-modulesdirs=${modulesDirs}"
+ ] ++ lib.optional withStatic "--enable-static";
+
+ patches = [ ./module-dir.patch ./no-name-field.patch ]
+ ++ lib.optional stdenv.isDarwin ./darwin.patch
+ ++ lib.optional withStatic ./enable-static.patch;
+
+ postInstall = ''
+ for prog in rmmod insmod lsmod modinfo modprobe depmod; do
+ ln -sv $out/bin/kmod $out/bin/$prog
+ done
+
+ # Backwards compatibility
+ ln -s bin $out/sbin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tools for loading and managing Linux kernel modules";
+ longDescription = ''
+ kmod is a set of tools to handle common tasks with Linux kernel modules
+ like insert, remove, list, check properties, resolve dependencies and
+ aliases. These tools are designed on top of libkmod, a library that is
+ shipped with kmod.
+ '';
+ homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/";
+ downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/";
+ changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}";
+ license = licenses.lgpl21;
+ platforms = platforms.unix;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/enable-static.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/enable-static.patch
new file mode 100644
index 000000000000..8308c6557921
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/enable-static.patch
@@ -0,0 +1,12 @@
+diff --git a/configure.ac b/configure.ac
+index ee72283..b42c42a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -19,7 +19,6 @@ AM_SILENT_RULES([yes])
+ LT_INIT([disable-static pic-only])
+ DOLT
+
+-AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by kmod])])
+ AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by kmod])])
+
+ #####################################################################
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/module-dir.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/module-dir.patch
new file mode 100644
index 000000000000..f7432e3756e9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/module-dir.patch
@@ -0,0 +1,157 @@
+diff --git a/Makefile.am b/Makefile.am
+index d4eeb7e..5c9f603 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -19,6 +19,7 @@ AM_CPPFLAGS = \
+ -include $(top_builddir)/config.h \
+ -I$(top_srcdir) \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
++ -DMODULESDIRS=\""$(shell echo $(modulesdirs) | $(SED) 's|:|\\",\\"|g')"\" \
+ ${zlib_CFLAGS}
+
+ AM_CFLAGS = $(OUR_CFLAGS)
+diff --git a/configure.ac b/configure.ac
+index 23510c8..66490cf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -202,6 +202,12 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat])
+ ], [
+ AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
+
++AC_ARG_WITH([modulesdirs],
++ AS_HELP_STRING([--with-modulesdirs=DIRS], [Kernel modules directories, separated by :]),
++ [],
++ [with_modulesdirs=/lib/modules])
++AC_SUBST([modulesdirs], [$with_modulesdirs])
++
+
+ #####################################################################
+ # Default CFLAGS and LDFLAGS
+diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
+index 69fe431..d37da32 100644
+--- a/libkmod/libkmod.c
++++ b/libkmod/libkmod.c
+@@ -206,12 +206,15 @@ static int log_priority(const char *priority)
+ return 0;
+ }
+
+-static const char *dirname_default_prefix = "/lib/modules";
++static const char *dirname_default_prefixes[] = {
++ MODULESDIRS,
++ NULL
++};
+
+ static char *get_kernel_release(const char *dirname)
+ {
+ struct utsname u;
+- char *p;
++ char *p, *dirname_prefix;
+
+ if (dirname != NULL)
+ return path_make_absolute_cwd(dirname);
+@@ -219,8 +222,42 @@ static char *get_kernel_release(const char *dirname)
+ if (uname(&u) < 0)
+ return NULL;
+
+- if (asprintf(&p, "%s/%s", dirname_default_prefix, u.release) < 0)
+- return NULL;
++ if ((dirname_prefix = getenv("MODULE_DIR")) != NULL) {
++ if(asprintf(&p, "%s/%s", dirname_prefix, u.release) < 0)
++ return NULL;
++ } else {
++ size_t i;
++ char buf[PATH_MAX];
++
++ for (i = 0; dirname_default_prefixes[i] != NULL; i++) {
++ int plen;
++ struct stat dirstat;
++
++ plen = snprintf(buf, sizeof(buf), "%s/%s", dirname_default_prefixes[i], u.release);
++ if (plen < 0)
++ return NULL;
++ else if (plen >= PATH_MAX)
++ continue;
++
++ if (dirname_default_prefixes[i + 1] != NULL) {
++ if (stat(buf, &dirstat) < 0) {
++ if (errno == ENOENT)
++ continue;
++ else
++ return NULL;
++ }
++
++ if (!S_ISDIR(dirstat.st_mode))
++ continue;
++ }
++
++ p = malloc(plen + 1);
++ if (p == NULL)
++ return NULL;
++ memcpy(p, buf, plen + 1);
++ break;
++ }
++ }
+
+ return p;
+ }
+diff --git a/tools/static-nodes.c b/tools/static-nodes.c
+index 8d2356d..2ed306d 100644
+--- a/tools/static-nodes.c
++++ b/tools/static-nodes.c
+@@ -29,10 +29,11 @@
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+-#include <sys/utsname.h>
+
+ #include <shared/util.h>
+
++#include <libkmod/libkmod.h>
++
+ #include "kmod.h"
+
+ struct static_nodes_format {
+@@ -154,8 +155,8 @@ static void help(void)
+
+ static int do_static_nodes(int argc, char *argv[])
+ {
+- struct utsname kernel;
+ char modules[PATH_MAX], buf[4096];
++ struct kmod_ctx *ctx;
+ const char *output = "/dev/stdout";
+ FILE *in = NULL, *out = NULL;
+ const struct static_nodes_format *format = &static_nodes_format_human;
+@@ -206,22 +207,25 @@ static int do_static_nodes(int argc, char *argv[])
+ }
+ }
+
+- if (uname(&kernel) < 0) {
+- fputs("Error: uname failed!\n", stderr);
++ ctx = kmod_new(NULL, NULL);
++ if (ctx == NULL) {
++ fprintf(stderr, "Error: failed to create kmod context\n");
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+-
+- snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname", kernel.release);
++ if (snprintf(modules, sizeof(modules), "%s/modules.devname", kmod_get_dirname(ctx)) < 0) {
++ fprintf(stderr, "Error: path to modules.devname is too long\n");
++ ret = EXIT_FAILURE;
++ goto finish;
++ }
++ kmod_unref(ctx);
+ in = fopen(modules, "re");
+ if (in == NULL) {
+ if (errno == ENOENT) {
+- fprintf(stderr, "Warning: /lib/modules/%s/modules.devname not found - ignoring\n",
+- kernel.release);
++ fprintf(stderr, "Warning: %s not found - ignoring\n", modules);
+ ret = EXIT_SUCCESS;
+ } else {
+- fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n",
+- kernel.release);
++ fprintf(stderr, "Error: could not open %s - %m\n", modules);
+ ret = EXIT_FAILURE;
+ }
+ goto finish;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch
new file mode 100644
index 000000000000..282f59e55e52
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch
@@ -0,0 +1,24 @@
+
+---
+ tools/modinfo.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/tools/modinfo.c b/tools/modinfo.c
+index 0231bb0..7b2259e 100644
+--- a/tools/modinfo.c
++++ b/tools/modinfo.c
+@@ -178,7 +178,10 @@ static int modinfo_do(struct kmod_module *mod)
+ is_builtin = (filename == NULL);
+
+ if (is_builtin) {
+- printf("%-16s%s%c", "name:", kmod_module_get_name(mod), separator);
++ if (field == NULL || field != NULL && streq(field, "name")){
++ printf("%-16s%s%c", "name:",
++ kmod_module_get_name(mod), separator);
++ }
+ filename = "(builtin)";
+ }
+
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscon/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscon/default.nix
new file mode 100644
index 000000000000..29f99629df87
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscon/default.nix
@@ -0,0 +1,59 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, libtsm
+, systemd
+, libxkbcommon
+, libdrm
+, libGLU, libGL
+, pango
+, pixman
+, pkgconfig
+, docbook_xsl
+, libxslt
+}:
+
+stdenv.mkDerivation rec {
+ pname = "kmscon";
+ version = "unstable-2018-09-07";
+
+ src = fetchFromGitHub {
+ owner = "Aetf";
+ repo = "kmscon";
+ rev = "01dd0a231e2125a40ceba5f59fd945ff29bf2cdc";
+ sha256 = "0q62kjsvy2iwy8adfiygx2bfwlh83rphgxbis95ycspqidg9py87";
+ };
+
+ buildInputs = [
+ libGLU libGL
+ libdrm
+ libtsm
+ libxkbcommon
+ libxslt
+ pango
+ pixman
+ systemd
+ ];
+
+ nativeBuildInputs = [
+ autoreconfHook
+ docbook_xsl
+ pkgconfig
+ ];
+
+ configureFlags = [
+ "--enable-multi-seat"
+ "--disable-debug"
+ "--enable-optimizations"
+ "--with-renderers=bbulk,gltex,pixman"
+ ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "KMS/DRM based System Console";
+ homepage = "http://www.freedesktop.org/wiki/Software/kmscon/";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix
new file mode 100644
index 000000000000..e2e63bc10a18
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchgit, autoreconfHook, libdrm, libX11, libGL, mesa, pkgconfig }:
+
+stdenv.mkDerivation {
+ name = "kmscube-2018-06-17";
+
+ src = fetchgit {
+ url = "git://anongit.freedesktop.org/mesa/kmscube";
+ rev = "9dcce71e603616ee7a54707e932f962cdf8fb20a";
+ sha256 = "1q5b5yvyfj3127385mp1bfmcbnpnbdswdk8gspp7g4541xk4k933";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ libdrm libX11 libGL mesa ];
+
+ meta = with stdenv.lib; {
+ description = "Example OpenGL app using KMS/GBM";
+ homepage = "https://gitlab.freedesktop.org/mesa/kmscube";
+ license = licenses.mit;
+ maintainers = with maintainers; [ dezgeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix
new file mode 100644
index 000000000000..40095e543b44
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, ncurses, glib, pkgconfig, gtk2 }:
+
+stdenv.mkDerivation rec {
+ name = "latencytop-0.5";
+
+ patchPhase = "sed -i s,/usr,$out, Makefile";
+ preInstall = "mkdir -p $out/sbin";
+
+ src = fetchurl {
+ urls = [ "http://latencytop.org/download/${name}.tar.gz"
+ "http://dbg.download.sourcemage.org/mirror/latencytop-0.5.tar.gz" ];
+ sha256 = "1vq3j9zdab6njly2wp900b3d5244mnxfm88j2bkiinbvxbxp4zwy";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ ncurses glib gtk2 ];
+
+ meta = {
+ homepage = "http://latencytop.org";
+ description = "Tool to show kernel reports on latencies (LATENCYTOP option)";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ stdenv.lib.maintainers.viric ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ldm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ldm/default.nix
new file mode 100644
index 000000000000..bbc341caf11f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ldm/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchgit, udev, utillinux, mountPath ? "/media/" }:
+
+assert mountPath != "";
+
+let
+ version = "0.5";
+ git = "https://github.com/LemonBoy/ldm.git";
+in
+stdenv.mkDerivation rec {
+ pname = "ldm";
+ inherit version;
+
+ # There is a stable release, but we'll use the lvm branch, which
+ # contains important fixes for LVM setups.
+ src = fetchgit {
+ url = meta.repositories.git;
+ rev = "refs/tags/v${version}";
+ sha256 = "0lxfypnbamfx6p9ar5k9wra20gvwn665l4pp2j4vsx4yi5q7rw2n";
+ };
+
+ buildInputs = [ udev utillinux ];
+
+ postPatch = ''
+ substituteInPlace ldm.c \
+ --replace "/mnt/" "${mountPath}"
+ sed '16i#include <sys/stat.h>' -i ldm.c
+ '';
+
+ buildFlags = [ "ldm" ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp -v ldm $out/bin
+ '';
+
+ meta = {
+ description = "A lightweight device mounter, with libudev as only dependency";
+ license = stdenv.lib.licenses.mit;
+
+ platforms = stdenv.lib.platforms.linux;
+ repositories.git = git;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ledger-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ledger-udev-rules/default.nix
new file mode 100644
index 000000000000..e85eb02f8c80
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ledger-udev-rules/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ pname = "ledger-udev-rules";
+ version = "unstable-2019-05-30";
+
+ src = fetchFromGitHub {
+ owner = "LedgerHQ";
+ repo = "udev-rules";
+ rev = "765b7fdf57b20fd9326cedf48ee52e905024ab4f";
+ sha256 = "10a42al020zpkx918y6b1l9az45vk3921b2l1mx87w3m0ad9qvif";
+ };
+
+ dontBuild = true;
+ dontConfigure = true;
+
+ installPhase = ''
+ mkdir -p $out/lib/udev/rules.d
+ cp 20-hw1.rules $out/lib/udev/rules.d/20-ledger.rules
+ '';
+
+ meta = with stdenv.lib; {
+ description = "udev rules for Ledger devices";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ asymmetric ];
+ platforms = platforms.linux;
+ homepage = "https://github.com/LedgerHQ/udev-rules";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libaio/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libaio/default.nix
new file mode 100644
index 000000000000..ac000976a680
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libaio/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ version = "0.3.111";
+ pname = "libaio";
+
+ src = fetchurl {
+ url = "https://pagure.io/libaio/archive/${pname}-${version}/${pname}-${pname}-${version}.tar.gz";
+ sha256 = "1fih2y2js0dl9qshpyb14m0nnxlms2527shgcxg0hnbflv5igg76";
+ };
+
+ postPatch = ''
+ patchShebangs harness
+
+ # Makefile is too optimistic, gcc is too smart
+ substituteInPlace harness/Makefile \
+ --replace "-Werror" ""
+ '';
+
+ makeFlags = [
+ "prefix=${placeholder ''out''}"
+ ];
+
+ hardeningDisable = stdenv.lib.optional (stdenv.isi686) "stackprotector";
+
+ checkTarget = "partcheck"; # "check" needs root
+
+ meta = {
+ description = "Library for asynchronous I/O in Linux";
+ homepage = "http://lse.sourceforge.net/io/aio.html";
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.lgpl21;
+ maintainers = with stdenv.lib.maintainers; [ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix
new file mode 100644
index 000000000000..cf5fc54ed65b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, udev, buildPackages }:
+
+stdenv.mkDerivation rec {
+ name = "libatasmart-0.19";
+
+ src = fetchurl {
+ url = "http://0pointer.de/public/${name}.tar.xz";
+ sha256 = "138gvgdwk6h4ljrjsr09pxk1nrki4b155hqdzyr8mlk3bwsfmw31";
+ };
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ udev ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://0pointer.de/blog/projects/being-smart.html";
+ description = "Library for querying ATA SMART status";
+ license = licenses.lgpl21;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
new file mode 100644
index 000000000000..948b8aab9afd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchFromGitHub, pkgconfig
+, libelf, zlib
+, fetchpatch
+}:
+
+with builtins;
+
+stdenv.mkDerivation rec {
+ pname = "libbpf";
+ version = "0.1.1";
+
+ src = fetchFromGitHub {
+ owner = "libbpf";
+ repo = "libbpf";
+ rev = "v${version}";
+ sha256 = "0ilnnm4q22f8fagwp8kb37licy4ks861i2iqh2djsypqhnxvx3fv";
+ };
+
+ patches = [
+ (fetchpatch { # included upstream for > 0.1.0
+ name = "link-zlib.patch";
+ url = "https://github.com/libbpf/libbpf/commit/8b14cb43ff837.diff";
+ sha256 = "17mvjrs7s727drz013a8qlyj0345ldi2kph6pazcmxv6kl1qrz2z";
+ })
+ ];
+ patchFlags = "-p2";
+ # https://github.com/libbpf/libbpf/pull/201#issuecomment-689174740
+ postPatch = ''
+ substituteInPlace ../scripts/check-reallocarray.sh \
+ --replace 'mktemp /tmp/' 'mktemp ' \
+ --replace '/bin/rm' 'rm'
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ libelf zlib ];
+
+ sourceRoot = "source/src";
+ enableParallelBuilding = true;
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ # FIXME: Multi-output requires some fixes to the way the pkgconfig file is
+ # constructed (it gets put in $out instead of $dev for some reason, with
+ # improper paths embedded). Don't enable it for now.
+
+ # outputs = [ "out" "dev" ];
+
+ meta = with stdenv.lib; {
+ description = "Upstream mirror of libbpf";
+ homepage = "https://github.com/libbpf/libbpf";
+ license = with licenses; [ lgpl21 /* or */ bsd2 ];
+ maintainers = with maintainers; [ thoughtpolice vcunat ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
new file mode 100644
index 000000000000..c9b061fe03bf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, swig ? null, python2 ? null, python3 ? null }:
+
+assert python2 != null || python3 != null -> swig != null;
+
+stdenv.mkDerivation rec {
+ pname = "libcap-ng";
+ # When updating make sure to test that the version with
+ # all of the python bindings still works
+ version = "0.7.10";
+
+ src = fetchurl {
+ url = "${meta.homepage}/${pname}-${version}.tar.gz";
+ sha256 = "1gzzy12agfa9ddipdf72h9y68zqqnvsjjylv4vnq6hj4w2safk58";
+ };
+
+ nativeBuildInputs = [ swig ];
+ buildInputs = [ python2 python3 ];
+
+ postPatch = ''
+ function get_header() {
+ echo -e "#include <$1>" | gcc -M -xc - | tr ' ' '\n' | grep "$1" | head -n 1
+ }
+
+ # Fix some hardcoding of header paths
+ sed -i "s,/usr/include/linux/capability.h,$(get_header linux/capability.h),g" bindings/python{,3}/Makefile.in
+ '';
+
+ configureFlags = [
+ (if python2 != null then "--with-python" else "--without-python")
+ (if python3 != null then "--with-python3" else "--without-python3")
+ ];
+
+ meta = let inherit (stdenv.lib) platforms licenses; in {
+ description = "Library for working with POSIX capabilities";
+ homepage = "https://people.redhat.com/sgrubb/libcap-ng/";
+ platforms = platforms.linux;
+ license = licenses.lgpl21;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap/default.nix
new file mode 100644
index 000000000000..174f1be99dba
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcap/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, buildPackages, fetchurl, attr, perl, pam }:
+
+stdenv.mkDerivation rec {
+ pname = "libcap";
+ version = "2.27";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/libs/security/linux-privs/libcap2/${pname}-${version}.tar.xz";
+ sha256 = "0sj8kidl7qgf2qwxcbw1vadnlb30y4zvjzxswsmfdghq04npkhfs";
+ };
+
+ outputs = [ "out" "dev" "lib" "man" "doc" "pam" ];
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ perl ];
+
+ buildInputs = [ pam ];
+
+ propagatedBuildInputs = [ attr ];
+
+ makeFlags = [
+ "lib=lib"
+ "PAM_CAP=yes"
+ "BUILD_CC=$(CC_FOR_BUILD)"
+ "CC:=$(CC)"
+ ];
+
+ prePatch = ''
+ # use relative bash path
+ substituteInPlace progs/capsh.c --replace "/bin/bash" "bash"
+
+ # ensure capsh can find bash in $PATH
+ substituteInPlace progs/capsh.c --replace execve execvpe
+
+ # set prefixes
+ substituteInPlace Make.Rules \
+ --replace 'prefix=/usr' "prefix=$lib" \
+ --replace 'exec_prefix=' "exec_prefix=$out" \
+ --replace 'lib_prefix=$(exec_prefix)' "lib_prefix=$lib" \
+ --replace 'inc_prefix=$(prefix)' "inc_prefix=$dev" \
+ --replace 'man_prefix=$(prefix)' "man_prefix=$doc"
+ '';
+
+ installFlags = [ "RAISE_SETFCAP=no" ];
+
+ postInstall = ''
+ rm "$lib"/lib/*.a
+ mkdir -p "$doc/share/doc/${pname}-${version}"
+ cp License "$doc/share/doc/${pname}-${version}/"
+ '' + stdenv.lib.optionalString (pam != null) ''
+ mkdir -p "$pam/lib/security"
+ mv "$lib"/lib/security "$pam/lib"
+ '';
+
+ meta = {
+ description = "Library for working with POSIX capabilities";
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.bsd3;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcgroup/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcgroup/default.nix
new file mode 100644
index 000000000000..4d93c3bb4fe4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libcgroup/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, fetchpatch, pam, yacc, flex }:
+
+stdenv.mkDerivation rec {
+ pname = "libcgroup";
+ version = "0.41";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/libcg/${pname}-${version}.tar.bz2";
+ sha256 = "0lgvyq37gq84sk30sg18admxaj0j0p5dq3bl6g74a1ppgvf8pqz4";
+ };
+
+ buildInputs = [ pam yacc flex ];
+
+ patches = [
+ (fetchpatch {
+ name = "CVE-2018-14348.patch";
+ url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/libcgroup/files/libcgroup-0.41-remove-umask.patch?id=33e9f4c81de754bbf76b893ea1133ed023f2a0e5";
+ sha256 = "1x0x29ld0cgmfwq4qy13s6d5c8sym1frfh1j2q47d8gfw6qaxka5";
+ })
+ ];
+
+ postPatch = ''
+ substituteInPlace src/tools/Makefile.in \
+ --replace 'chmod u+s' 'chmod +x'
+ '';
+
+ meta = {
+ description = "Library and tools to manage Linux cgroups";
+ homepage = "http://libcg.sourceforge.net/";
+ license = stdenv.lib.licenses.lgpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libevdevc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libevdevc/default.nix
new file mode 100644
index 000000000000..372f110f3471
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libevdevc/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, coreutils, pkgconfig, glib, jsoncpp }:
+
+stdenv.mkDerivation rec {
+ name = "libevdevc";
+ version = "2.0.1";
+ src = fetchFromGitHub {
+ owner = "hugegreenbug";
+ repo = "libevdevc";
+ rev = "v${version}";
+ sha256 = "0ry30krfizh87yckmmv8n082ad91mqhhbbynx1lfidqzb6gdy2dd";
+ };
+
+ postPatch = ''
+ substituteInPlace common.mk \
+ --replace /bin/echo ${coreutils}/bin/echo
+ substituteInPlace include/module.mk \
+ --replace /usr/include /include
+ '';
+
+ makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
+
+ meta = with stdenv.lib; {
+ description = "ChromiumOS libevdev. Renamed to avoid conflicts with the standard libevdev found in Linux distros";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ homepage = "https://chromium.googlesource.com/chromiumos/platform/libevdev/";
+ maintainers = with maintainers; [ kcalvinalvin ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix
new file mode 100644
index 000000000000..52de79e1f2df
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook, libpsm2 }:
+
+stdenv.mkDerivation rec {
+ pname = "libfabric";
+ version = "1.11.0";
+
+ enableParallelBuilding = true;
+
+ src = fetchFromGitHub {
+ owner = "ofiwg";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1wgn6gsiy64rb76i46dsqlvp687lwqzxwg5lgj1y5y7lyqbq96wp";
+ };
+
+ nativeBuildInputs = [ pkgconfig autoreconfHook ] ;
+
+ buildInputs = [ libpsm2 ] ;
+
+ configureFlags = [ "--enable-psm2=${libpsm2}" ] ;
+
+ meta = with stdenv.lib; {
+ homepage = "http://libfabric.org/";
+ description = "Open Fabric Interfaces";
+ license = with licenses; [ gpl2 bsd2 ];
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ maintainers.bzizou ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/default.nix
new file mode 100644
index 000000000000..46d25df31b9f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, pkgconfig, glib, jsoncpp }:
+
+stdenv.mkDerivation rec {
+ name = "libgestures-${version}";
+ version = "2.0.1";
+ src = fetchFromGitHub {
+ owner = "hugegreenbug";
+ repo = "libgestures";
+ rev = "v${version}";
+ sha256 = "0dfvads2adzx4k8cqc1rbwrk1jm2wn9wl2jk51m26xxpmh1g0zab";
+ };
+ patches = [ ./include-fix.patch ];
+
+ postPatch = ''
+ substituteInPlace Makefile \
+ --replace -Werror -Wno-error \
+ --replace '$(DESTDIR)/usr/include' '$(DESTDIR)/include'
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ glib jsoncpp ];
+
+
+ makeFlags = [ "DESTDIR=$(out)" "LIBDIR=/lib" ];
+
+ meta = with stdenv.lib; {
+ description = "ChromiumOS libgestures modified to compile for Linux";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ homepage = "https://chromium.googlesource.com/chromiumos/platform/gestures";
+ maintainers = with maintainers; [ kcalvinalvin ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/include-fix.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/include-fix.patch
new file mode 100644
index 000000000000..851be4771434
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libgestures/include-fix.patch
@@ -0,0 +1,12 @@
+diff -ur a/include/gestures/include/finger_metrics.h b/include/gestures/include/finger_metrics.h
+--- a/include/gestures/include/finger_metrics.h 1970-01-01 09:00:01.000000000 +0900
++++ b/include/gestures/include/finger_metrics.h 2018-12-01 16:58:51.590718511 +0900
+@@ -5,6 +5,8 @@
+ #ifndef GESTURES_FINGER_METRICS_H_
+ #define GESTURES_FINGER_METRICS_H_
+
++#include <math.h>
++
+ #include "gestures/include/gestures.h"
+ #include "gestures/include/prop_registry.h"
+#include "gestures/include/vector.h"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libnl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libnl/default.nix
new file mode 100644
index 000000000000..551352fa46c6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libnl/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, file, lib, fetchFromGitHub, autoreconfHook, bison, flex, pkgconfig
+, pythonSupport ? false, swig ? null, python}:
+
+stdenv.mkDerivation rec {
+ pname = "libnl";
+ version = "3.5.0";
+
+ src = fetchFromGitHub {
+ repo = "libnl";
+ owner = "thom311";
+ rev = "libnl${lib.replaceStrings ["."] ["_"] version}";
+ sha256 = "1ak30jcx52gl5yz1691qq0b76ldbcp2z6vsvdr2mrrwqiplqbcs2";
+ };
+
+ outputs = [ "bin" "dev" "out" "man" ] ++ lib.optional pythonSupport "py";
+
+ enableParallelBuilding = true;
+
+ nativeBuildInputs = [ autoreconfHook bison flex pkgconfig file ]
+ ++ lib.optional pythonSupport swig;
+
+ postBuild = lib.optionalString (pythonSupport) ''
+ cd python
+ ${python}/bin/python setup.py install --prefix=../pythonlib
+ cd -
+ '';
+
+ postFixup = lib.optionalString pythonSupport ''
+ mv "pythonlib/" "$py"
+ '';
+
+ passthru = {
+ inherit pythonSupport;
+ };
+
+ meta = with lib; {
+ inherit version;
+ homepage = "http://www.infradead.org/~tgr/libnl/";
+ description = "Linux Netlink interface library suite";
+ license = licenses.lgpl21;
+ maintainers = with maintainers; [ fpletz ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix
new file mode 100644
index 000000000000..b9e41380da8c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchFromGitHub, numactl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+ pname = "libpsm2";
+ version = "11.2.156";
+ ifs_version = "10_10_2_0_44";
+
+ preConfigure= ''
+ export UDEVDIR=$out/etc/udev
+ substituteInPlace ./Makefile --replace "udevrulesdir}" "prefix}/etc/udev";
+ '';
+
+ enableParallelBuilding = true;
+
+ buildInputs = [ numactl pkgconfig ];
+
+ installFlags = [
+ "DESTDIR=$(out)"
+ "UDEVDIR=/etc/udev"
+ "LIBPSM2_COMPAT_CONF_DIR=/etc"
+ ];
+
+ src = fetchFromGitHub {
+ owner = "intel";
+ repo = "opa-psm2";
+ rev = "IFS_RELEASE_${ifs_version}";
+ sha256 = "0ckrfzih1ga9yvximxjdh0z05kn9l858ykqiblv18w6ka3gra1xz";
+ };
+
+ postInstall = ''
+ mv $out/usr/* $out
+ rmdir $out/usr
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/intel/opa-psm2";
+ description = "The PSM2 library supports a number of fabric media and stacks";
+ license = with licenses; [ gpl2 bsd3 ];
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ maintainers.bzizou ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libratbag/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libratbag/default.nix
new file mode 100644
index 000000000000..48ee5d16c5c0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libratbag/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, meson, ninja, pkgconfig
+, glib, systemd, udev, libevdev, gitMinimal, check, valgrind, swig, python3
+, json-glib, libunistring }:
+
+stdenv.mkDerivation rec {
+ pname = "libratbag";
+ version = "0.14";
+
+ src = fetchFromGitHub {
+ owner = "libratbag";
+ repo = "libratbag";
+ rev = "v${version}";
+ sha256 = "1fpwp2sj8mf98bqasq2h8qwgprxi7k3iw33gcfid3d1lbyiacw0x";
+ };
+
+ nativeBuildInputs = [
+ meson ninja pkgconfig gitMinimal swig check valgrind
+ ];
+
+ buildInputs = [
+ glib systemd udev libevdev json-glib libunistring
+ (python3.withPackages (ps: with ps; [ evdev pygobject3 ]))
+ ];
+
+ mesonFlags = [
+ "-Dsystemd-unit-dir=./lib/systemd/system/"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Configuration library for gaming mice";
+ homepage = "https://github.com/libratbag/libratbag";
+ license = licenses.mit;
+ maintainers = with maintainers; [ mvnetbiz ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libselinux/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libselinux/default.nix
new file mode 100644
index 000000000000..741c51e2233b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libselinux/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, pcre, pkgconfig, libsepol
+, enablePython ? true, swig ? null, python ? null
+, fts
+}:
+
+assert enablePython -> swig != null && python != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ pname = "libselinux";
+ version = "2.9";
+ inherit (libsepol) se_release se_url;
+
+ outputs = [ "bin" "out" "dev" "man" ] ++ optional enablePython "py";
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/libselinux-${version}.tar.gz";
+ sha256 = "14r69mgmz7najf9wbizvp68q56mqx4yjbkxjlbcqg5a47s3wik0v";
+ };
+
+ nativeBuildInputs = [ pkgconfig ] ++ optionals enablePython [ swig python ];
+ buildInputs = [ libsepol pcre fts ] ++ optionals enablePython [ python ];
+
+ # drop fortify here since package uses it by default, leading to compile error:
+ # command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
+ hardeningDisable = [ "fortify" ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error";
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "INCDIR=$(dev)/include/selinux"
+ "INCLUDEDIR=$(dev)/include"
+ "MAN3DIR=$(man)/share/man/man3"
+ "MAN5DIR=$(man)/share/man/man5"
+ "MAN8DIR=$(man)/share/man/man8"
+ "PYTHON=${python.pythonForBuild}/bin/python"
+ "PYTHONLIBDIR=$(py)/${python.sitePackages}"
+ "SBINDIR=$(bin)/sbin"
+ "SHLIBDIR=$(out)/lib"
+
+ "LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a"
+ ];
+
+ installTargets = [ "install" ] ++ optional enablePython "install-pywrap";
+
+ meta = removeAttrs libsepol.meta ["outputsToInstall"] // {
+ description = "SELinux core library";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsemanage/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsemanage/default.nix
new file mode 100644
index 000000000000..70b2508451bb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsemanage/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, pkgconfig, bison, flex, libsepol, libselinux, bzip2, audit
+, enablePython ? true, swig ? null, python ? null
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ pname = "libsemanage";
+ version = "2.9";
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/libsemanage-${version}.tar.gz";
+ sha256 = "075w6y3l9hiy5hicgwrmijyxmhfyd1r7cnc08qxyg4j46jfk8xi5";
+ };
+
+ outputs = [ "out" "dev" "man" ] ++ optional enablePython "py";
+
+ nativeBuildInputs = [ bison flex pkgconfig ];
+ buildInputs = [ libsepol libselinux bzip2 audit ]
+ ++ optionals enablePython [ swig python ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "INCLUDEDIR=$(dev)/include"
+ "MAN3DIR=$(man)/share/man/man3"
+ "MAN5DIR=$(man)/share/man/man5"
+ "PYTHON=python"
+ "PYTHONLIBDIR=$(py)/${python.sitePackages}"
+ "DEFAULT_SEMANAGE_CONF_LOCATION=$(out)/etc/selinux/semanage.conf"
+ ];
+
+ installTargets = [ "install" ] ++ optionals enablePython [ "install-pywrap" ];
+
+ meta = removeAttrs libsepol.meta ["outputsToInstall"] // {
+ description = "Policy management tools for SELinux";
+ license = stdenv.lib.licenses.lgpl21;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsepol/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsepol/default.nix
new file mode 100644
index 000000000000..497961af11b4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsepol/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, flex }:
+
+stdenv.mkDerivation rec {
+ pname = "libsepol";
+ version = "2.9";
+ se_release = "20190315";
+ se_url = "https://github.com/SELinuxProject/selinux/releases/download";
+
+ outputs = [ "bin" "out" "dev" "man" ];
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/libsepol-${version}.tar.gz";
+ sha256 = "0p8x7w73jn1nysx1d7416wqrhbi0r6isrjxib7jf68fi72q14jx3";
+ };
+
+ nativeBuildInputs = [ flex ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "BINDIR=$(bin)/bin"
+ "INCDIR=$(dev)/include/sepol"
+ "INCLUDEDIR=$(dev)/include"
+ "MAN3DIR=$(man)/share/man/man3"
+ "MAN8DIR=$(man)/share/man/man8"
+ "SHLIBDIR=$(out)/lib"
+ ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error";
+
+ passthru = { inherit se_release se_url; };
+
+ meta = with stdenv.lib; {
+ description = "SELinux binary policy manipulation library";
+ homepage = "http://userspace.selinuxproject.org";
+ platforms = platforms.linux;
+ maintainers = [ maintainers.phreedom ];
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsmbios/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsmbios/default.nix
new file mode 100644
index 000000000000..268588f53ab1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libsmbios/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook, help2man, gettext
+, libxml2, perl, python3, doxygen }:
+
+
+stdenv.mkDerivation rec {
+ pname = "libsmbios";
+ version = "2.4.3";
+
+ src = fetchFromGitHub {
+ owner = "dell";
+ repo = "libsmbios";
+ rev = "v${version}";
+ sha256 = "0krwwydyvb9224r884y1mlmzyxhlfrcqw73vi1j8787rl0gl5a2i";
+ };
+
+ nativeBuildInputs = [ autoreconfHook doxygen gettext libxml2 help2man perl pkgconfig ];
+
+ buildInputs = [ python3 ];
+
+ configureFlags = [ "--disable-graphviz" ];
+
+ enableParallelBuilding = true;
+
+ postInstall = ''
+ mkdir -p $out/include
+ cp -a src/include/smbios_c $out/include/
+ cp -a out/public-include/smbios_c $out/include/
+ '';
+
+ preFixup = ''rm -rf "$(pwd)" ''; # Hack to avoid TMPDIR in RPATHs
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/dell/libsmbios";
+ description = "A library to obtain BIOS information";
+ license = with licenses; [ osl21 gpl2Plus ];
+ maintainers = with maintainers; [ ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libudev0-shim/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libudev0-shim/default.nix
new file mode 100644
index 000000000000..2073f9f6f56f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libudev0-shim/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, udev }:
+
+stdenv.mkDerivation rec {
+ pname = "libudev0-shim";
+ version = "1";
+
+ src = fetchFromGitHub {
+ owner = "archlinux";
+ repo = "libudev0-shim";
+ rev = "v${version}";
+ sha256 = "1460qm6rp1cqnns39lj24z7191m8sbpvbjabqbzb55dkdd2kw50z";
+ };
+
+ buildInputs = [ udev ];
+
+ installPhase = ''
+ name="$(echo libudev.so.*)"
+ install -Dm755 "$name" "$out/lib/$name"
+ ln -s "$name" "$out/lib/libudev.so.0"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Shim to preserve libudev.so.0 compatibility";
+ homepage = "https://github.com/archlinux/libudev0-shim";
+ platforms = platforms.linux;
+ license = licenses.lgpl21;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix
new file mode 100644
index 000000000000..98ddc50e2e48
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+ name = "libvolume_id-0.81.1";
+
+ src = fetchurl {
+ url = "https://www.marcuscom.com/downloads/libvolume_id-0.81.1.tar.bz2";
+ sha256 = "029z04vdxxsl8gycm9whcljhv6dy4b12ybsxdb99jr251gl1ifs5";
+ };
+
+ preBuild = "
+ makeFlagsArray=(prefix=$out E=echo RANLIB=ranlib INSTALL='install -c')
+ ";
+
+ # Work around a broken Makefile.
+ postInstall = "
+ rm $out/lib/libvolume_id.so.0
+ cp -f libvolume_id.so.0 $out/lib/
+ ";
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/default.nix
new file mode 100644
index 000000000000..5cccc82b8430
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, stdenv
+, fetchurl
+, cmake
+, pkgconfig
+, libxml2
+}:
+
+stdenv.mkDerivation rec {
+ pname = "libwebcam";
+ version = "0.2.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/${pname}/source/${pname}-src-${version}.tar.gz";
+ sha256 = "0hcxv8di83fk41zjh0v592qm7c0v37a3m3n3lxavd643gff1k99w";
+ };
+
+ patches = [
+ ./uvcdynctrl_symlink_support_and_take_data_dir_from_env.patch
+ ];
+
+ buildInputs = [
+ cmake
+ pkgconfig
+ libxml2
+ ];
+
+ postPatch = ''
+ substituteInPlace ./uvcdynctrl/CMakeLists.txt \
+ --replace "/lib/udev" "$out/lib/udev"
+
+ substituteInPlace ./uvcdynctrl/udev/scripts/uvcdynctrl \
+ --replace 'debug=0' 'debug=''${NIX_UVCDYNCTRL_UDEV_DEBUG:-0}' \
+ --replace 'uvcdynctrlpath=uvcdynctrl' "uvcdynctrlpath=$out/bin/uvcdynctrl"
+
+ substituteInPlace ./uvcdynctrl/udev/rules/80-uvcdynctrl.rules \
+ --replace "/lib/udev" "$out/lib/udev"
+ '';
+
+
+ preConfigure = ''
+ cmakeFlagsArray=(
+ $cmakeFlagsArray
+ "-DCMAKE_INSTALL_PREFIX=$out"
+ )
+ '';
+
+ meta = with lib; {
+ description = "The webcam-tools package";
+ platforms = platforms.linux;
+ license = licenses.lgpl3;
+ maintainers = with maintainers; [ jraygauthier ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/uvcdynctrl_symlink_support_and_take_data_dir_from_env.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/uvcdynctrl_symlink_support_and_take_data_dir_from_env.patch
new file mode 100644
index 000000000000..07e5f0bf852b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/libwebcam/uvcdynctrl_symlink_support_and_take_data_dir_from_env.patch
@@ -0,0 +1,65 @@
+diff --git a/uvcdynctrl/main.c b/uvcdynctrl/main.c
+index b7befd1..f3a768c 100644
+--- a/uvcdynctrl/main.c
++++ b/uvcdynctrl/main.c
+@@ -674,27 +674,31 @@ get_filename (const char *dir_path, const char *vid)
+ printf ( "checking dir: %s \n", dir_path);
+ while ((dp = readdir(dir)) != NULL)
+ {
+- if((dp->d_type == DT_DIR) && (fnmatch("[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]", dp->d_name, 0) == 0))
++ if((dp->d_type == DT_DIR || dp->d_type == DT_LNK ) && (fnmatch("[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]", dp->d_name, 0) == 0))
+ {
+ if( strcasecmp(vid, dp->d_name) != 0)
+ {
+ /*doesn't match - clean up and move to the next entry*/
+ continue;
+ }
+-
++
+ char *tmp = path_cat (dir_path, dp->d_name);
+- printf("found dir: %s \n", dp->d_name);
++
+ DIR * subdir = opendir(tmp);
+- while ((sdp = readdir(subdir)) != NULL)
++ if ( subdir != NULL )
+ {
+- if( fnmatch("*.xml", sdp->d_name, 0) == 0 )
++ printf("found dir: %s \n", dp->d_name);
++ while ((sdp = readdir(subdir)) != NULL)
+ {
+- file_list[nf-1] = path_cat (tmp, sdp->d_name);
+- printf("found: %s \n", file_list[nf-1]);
+- nf++;
+- file_list = realloc(file_list,nf*sizeof(file_list));
+- file_list[nf-1] = NULL;
+- }
++ if( fnmatch("*.xml", sdp->d_name, 0) == 0 )
++ {
++ file_list[nf-1] = path_cat (tmp, sdp->d_name);
++ printf("found: %s \n", file_list[nf-1]);
++ nf++;
++ file_list = realloc(file_list,nf*sizeof(file_list));
++ file_list[nf-1] = NULL;
++ }
++ }
+ }
+ closedir(subdir);
+ free (tmp);
+@@ -869,9 +873,15 @@ main (int argc, char **argv)
+ pid_set = 1; /*flag pid.xml check*/
+ //printf("vid:%s pid:%s\n", vid, pid);
+ }
+-
++
++ const char* dataDir = getenv( "NIX_UVCDYNCTRL_DATA_DIR" );
++ // When unavailable, fallback on data dir specified at build time.
++ if ( !dataDir ) {
++ dataDir = DATA_DIR;
++ }
++
+ /* get xml file list from DATA_DIR/vid/ */
+- char **xml_files = get_filename (DATA_DIR, vid);
++ char **xml_files = get_filename (dataDir, vid);
+
+ /*check for pid.xml*/
+ char fname[9];
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/light/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/light/default.nix
new file mode 100644
index 000000000000..45af4e7ae8e4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/light/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, coreutils }:
+
+stdenv.mkDerivation rec {
+ version = "1.2.1";
+ pname = "light";
+ src = fetchFromGitHub {
+ owner = "haikarainen";
+ repo = "light";
+ rev = "v${version}";
+ sha256 = "0zrjipd392bzjvxx0rjrb0cgi0ix1d83fwgw1mcy8kc4d16cgyjg";
+ };
+
+ configureFlags = [ "--with-udev" ];
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ # ensure udev rules can find the commands used
+ postPatch = ''
+ substituteInPlace 90-backlight.rules \
+ --replace '/bin/chgrp' '${coreutils}/bin/chgrp' \
+ --replace '/bin/chmod' '${coreutils}/bin/chmod'
+ '';
+
+ meta = {
+ description = "GNU/Linux application to control backlights";
+ homepage = "https://haikarainen.github.io/light/";
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = with stdenv.lib.maintainers; [ puffnfresh dtzWill ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lightum/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lightum/default.nix
new file mode 100644
index 000000000000..3c37b66d2315
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lightum/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchgit, libX11, libXScrnSaver, libXext, glib, dbus, pkgconfig, systemd }:
+
+stdenv.mkDerivation {
+ name = "lightum-2014-06-07";
+ src = fetchgit {
+ url = "https://github.com/poliva/lightum";
+ rev = "123e6babe0669b23d4c1dfa5511088608ff2baa8";
+ sha256 = "01x24rcrkgksyvqpgkr9zafg3jgs8nqng8yf0hx0kbmcimar8dbp";
+ };
+
+ buildInputs = [
+ dbus
+ glib
+ libX11
+ libXScrnSaver
+ libXext
+ pkgconfig
+ systemd
+ ];
+
+ patchPhase = ''
+ substituteInPlace Makefile \
+ --replace "libsystemd-login" "libsystemd"
+ '';
+
+ installPhase = ''
+ make install prefix=$out bindir=$out/bin docdir=$out/share/doc \
+ mandir=$out/share/man INSTALL="install -c" INSTALLDATA="install -c -m 644"
+ '';
+
+ meta = {
+ description = "MacBook automatic light sensor daemon";
+ homepage = "https://github.com/poliva/lightum";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [ puffnfresh ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/linuxptp/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/linuxptp/default.nix
new file mode 100644
index 000000000000..c836cfe5c433
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/linuxptp/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, linuxHeaders } :
+
+
+stdenv.mkDerivation rec {
+ pname = "linuxptp";
+ version = "3.1";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/linuxptp/${pname}-${version}.tgz";
+ sha256 = "0zff502w3nlycgv2ad8cy8nd0hqf34kzpzcygi7prp0lrw8mp3zm";
+ };
+
+ postPatch = ''
+ substituteInPlace incdefs.sh --replace \
+ '/usr/include/linux/' "${linuxHeaders}/include/linux/"
+ '';
+
+ makeFlags = [ "prefix=" ];
+
+ preInstall = ''
+ export DESTDIR=$out
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Implementation of the Precision Time Protocol (PTP) according to IEEE standard 1588 for Linux";
+ homepage = "http://linuxptp.sourceforge.net/";
+ maintainers = [ maintainers.markuskowa ];
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix
new file mode 100644
index 000000000000..6ddf4db562b7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "lksctp-tools-1.0.17";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/lksctp/${name}.tar.gz";
+ sha256 = "05da6c2v3acc18ndvmkrag6x5lf914b7s0xkkr6wkvrbvd621sqs";
+ };
+
+ meta = with stdenv.lib; {
+ description = "Linux Kernel Stream Control Transmission Protocol Tools";
+ homepage = "http://lksctp.sourceforge.net/";
+ license = with licenses; [ gpl2 lgpl21 ]; # library is lgpl21
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix
new file mode 100644
index 000000000000..fa71d1fd1551
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchzip, bison, flex, which, perl
+, sensord ? false, rrdtool ? null
+}:
+
+assert sensord -> rrdtool != null;
+
+stdenv.mkDerivation rec {
+ pname = "lm-sensors";
+ version = "3.6.0";
+ dashedVersion = stdenv.lib.replaceStrings ["."] ["-"] version;
+
+ src = fetchzip {
+ url = "https://github.com/lm-sensors/lm-sensors/archive/V${dashedVersion}.tar.gz";
+ sha256 = "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn";
+ };
+
+ nativeBuildInputs = [ bison flex which ];
+ buildInputs = [ perl ]
+ ++ stdenv.lib.optional sensord rrdtool;
+
+ makeFlags = [
+ "PREFIX=${placeholder "out"}"
+ "ETCDIR=${placeholder "out"}/etc"
+ "CC=${stdenv.cc.targetPrefix}cc"
+ "AR=${stdenv.cc.targetPrefix}ar"
+ ] ++ stdenv.lib.optional sensord "PROG_EXTRA=sensord";
+
+ meta = with stdenv.lib; {
+ homepage = "https://hwmon.wiki.kernel.org/lm_sensors";
+ changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/V${dashedVersion}/CHANGES";
+ description = "Tools for reading hardware sensors";
+ license = with licenses; [ lgpl21Plus gpl2Plus ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lockdep/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lockdep/default.nix
new file mode 100644
index 000000000000..2e9003c3f926
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lockdep/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, bash, flex, bison, valgrind }:
+
+stdenv.mkDerivation rec {
+ pname = "lockdep";
+
+ # it would be nice to be able to pick a kernel version in sync with something
+ # else we already ship, but it seems userspace lockdep isn't very well maintained
+ # and appears broken in many kernel releases
+ version = "5.0.21";
+ fullver = "5.0.21";
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
+ sha256 = "1my2m9hvnvdrvzcg0fgqgaga59y2cd5zlpv7xrfj2nn98sjhglwq";
+ };
+
+ # ensure *this* kernel's userspace-headers are picked up before we
+ # fall back to those in glibc, as they will be from a mismatched
+ # kernel version
+ postPatch = ''
+ substituteInPlace tools/lib/lockdep/Makefile \
+ --replace 'CONFIG_INCLUDES =' $'CONFIG_INCLUDES = -I../../../usr/include\n#'
+ '';
+
+ nativeBuildInputs = [ flex bison ];
+
+ buildPhase = ''
+ make defconfig
+ make headers_install
+ cd tools/lib/lockdep
+ make
+ '';
+
+ doCheck = true;
+ checkInputs = [ valgrind ];
+ checkPhase = ''
+ # there are more /bin/bash references than just shebangs
+ for f in lockdep run_tests.sh tests/*.sh; do
+ substituteInPlace $f \
+ --replace '/bin/bash' '${bash}/bin/bash'
+ done
+
+ ./run_tests.sh
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin $out/lib $out/include
+
+ cp -R include/liblockdep $out/include
+ make install DESTDIR=$out prefix=""
+
+ substituteInPlace $out/bin/lockdep --replace "./liblockdep.so" "$out/lib/liblockdep.so.$fullver"
+ '';
+
+ meta = {
+ description = "Userspace locking validation tool built on the Linux kernel";
+ homepage = "https://kernel.org/";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/logitech-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/logitech-udev-rules/default.nix
new file mode 100644
index 000000000000..369f412fbfc5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/logitech-udev-rules/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, solaar }:
+
+# ltunifi and solaar both provide udev rules but solaar's rules are more
+# up-to-date so we simply use that instead of having to maintain our own rules
+
+stdenv.mkDerivation {
+ pname = "logitech-udev-rules";
+ inherit (solaar) version;
+
+ buildCommand = ''
+ install -Dm644 -t $out/etc/udev/rules.d ${solaar.src}/rules.d/*.rules
+ '';
+
+ meta = with stdenv.lib; {
+ description = "udev rules for Logitech devices";
+ inherit (solaar.meta) homepage license platforms;
+ maintainers = with maintainers; [ peterhoeg ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/default.nix
new file mode 100644
index 000000000000..7ab10bfac124
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/default.nix
@@ -0,0 +1,21 @@
+{ substituteAll, lib
+, coreutils, getopt
+}:
+
+substituteAll {
+ name = "lsb_release";
+
+ src = ./lsb_release.sh;
+
+ dir = "bin";
+ isExecutable = true;
+
+ inherit coreutils getopt;
+
+ meta = with lib; {
+ description = "Prints certain LSB (Linux Standard Base) and Distribution information";
+ license = [ licenses.mit ];
+ maintainers = with maintainers; [ primeos ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/lsb_release.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/lsb_release.sh
new file mode 100644
index 000000000000..47b449c31614
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsb-release/lsb_release.sh
@@ -0,0 +1,190 @@
+#! @shell@
+
+set -o errexit
+set -o nounset
+
+show_help() {
+ @coreutils@/bin/cat << EOF
+Usage: lsb_release [options]
+
+Options:
+ -h, --help show this help message and exit
+ -v, --version show LSB modules this system supports
+ -i, --id show distributor ID
+ -d, --description show description of this distribution
+ -r, --release show release number of this distribution
+ -c, --codename show code name of this distribution
+ -a, --all show all of the above information
+ -s, --short show requested information in short format
+EOF
+ exit 0
+}
+
+# Potential command-line options.
+version=0
+id=0
+description=0
+release=0
+codename=0
+all=0
+short=0
+
+@getopt@/bin/getopt --test > /dev/null && rc=$? || rc=$?
+if [[ $rc -ne 4 ]]; then
+ # This shouldn't happen.
+ echo "Warning: Enhanced getopt not supported, please open an issue." >&2
+else
+ # Define all short and long options.
+ SHORT=hvidrcas
+ LONG=help,version,id,description,release,codename,all,short
+
+ # Parse all options.
+ PARSED=`@getopt@/bin/getopt --options $SHORT --longoptions $LONG --name "$0" -- "$@"`
+
+ eval set -- "$PARSED"
+fi
+
+
+# Process each argument, and set the appropriate flag if we recognize it.
+while [[ $# -ge 1 ]]; do
+ case "$1" in
+ -v|--version)
+ version=1
+ ;;
+ -i|--id)
+ id=1
+ ;;
+ -d|--description)
+ description=1
+ ;;
+ -r|--release)
+ release=1
+ ;;
+ -c|--codename)
+ codename=1
+ ;;
+ -a|--all)
+ all=1
+ ;;
+ -s|--short)
+ short=1
+ ;;
+ -h|--help)
+ show_help
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "lsb_release: unrecognized option '$1'"
+ echo "Type 'lsb_release -h' for a list of available options."
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# Read our variables.
+if [[ -e /etc/os-release ]]; then
+ . /etc/os-release
+ OS_RELEASE_FOUND=1
+else
+ # This is e.g. relevant for the Nix build sandbox and compatible with the
+ # original lsb_release binary:
+ OS_RELEASE_FOUND=0
+ NAME="n/a"
+ PRETTY_NAME="(none)"
+ VERSION_ID="n/a"
+ VERSION_CODENAME="n/a"
+fi
+
+# Default output
+if [[ "$version" = "0" ]] && [[ "$id" = "0" ]] && \
+ [[ "$description" = "0" ]] && [[ "$release" = "0" ]] && \
+ [[ "$codename" = "0" ]] && [[ "$all" = "0" ]]; then
+ if [[ "$OS_RELEASE_FOUND" = "1" ]]; then
+ echo "No LSB modules are available." >&2
+ else
+ if [[ "$short" = "0" ]]; then
+ printf "LSB Version:\tn/a\n"
+ else
+ printf "n/a\n"
+ fi
+ fi
+ exit 0
+fi
+
+# Now output the data - The order of these was chosen to match
+# what the original lsb_release used.
+
+SHORT_OUTPUT=""
+append_short_output() {
+ if [[ "$1" = "n/a" ]]; then
+ SHORT_OUTPUT+=" $1"
+ else
+ SHORT_OUTPUT+=" \"$1\""
+ fi
+}
+
+if [[ "$all" = "1" ]] || [[ "$version" = "1" ]]; then
+ if [[ "$OS_RELEASE_FOUND" = "1" ]]; then
+ if [[ "$short" = "0" ]]; then
+ echo "No LSB modules are available." >&2
+ else
+ append_short_output "n/a"
+ fi
+ else
+ if [[ "$short" = "0" ]]; then
+ printf "LSB Version:\tn/a\n"
+ else
+ append_short_output "n/a"
+ fi
+ fi
+fi
+
+if [[ "$all" = "1" ]] || [[ "$id" = "1" ]]; then
+ if [[ "$short" = "0" ]]; then
+ printf "Distributor ID:\t$NAME\n"
+ else
+ append_short_output "$NAME"
+ fi
+fi
+
+if [[ "$all" = "1" ]] || [[ "$description" = "1" ]]; then
+ if [[ "$short" = "0" ]]; then
+ printf "Description:\t$PRETTY_NAME\n"
+ else
+ append_short_output "$PRETTY_NAME"
+ fi
+fi
+
+if [[ "$all" = "1" ]] || [[ "$release" = "1" ]]; then
+ if [[ "$short" = "0" ]]; then
+ printf "Release:\t$VERSION_ID\n"
+ else
+ append_short_output "$VERSION_ID"
+ fi
+fi
+
+if [[ "$all" = "1" ]] || [[ "$codename" = "1" ]]; then
+ if [[ "$short" = "0" ]]; then
+ printf "Codename:\t$VERSION_CODENAME\n"
+ else
+ append_short_output "$VERSION_CODENAME"
+ fi
+fi
+
+if [[ "$short" = "1" ]]; then
+ # Output in one line without the first space:
+ echo "${SHORT_OUTPUT:1}"
+fi
+
+# For compatibility with the original lsb_release:
+if [[ "$OS_RELEASE_FOUND" = "0" ]]; then
+ if [[ "$all" = "1" ]] || [[ "$id" = "1" ]] || \
+ [[ "$description" = "1" ]] || [[ "$release" = "1" ]] || \
+ [[ "$codename" = "1" ]]; then
+ exit 3
+ fi
+fi
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsiutil/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsiutil/default.nix
new file mode 100644
index 000000000000..da45e202c022
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsiutil/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, unzip }:
+
+let
+
+ version = "1.60";
+
+ src = fetchurl {
+ name = "lsiutil-${version}.zip";
+ url = "http://www.lsi.com/DistributionSystem/AssetDocument/support/downloads/hbas/fibre_channel/hardware_drivers/LSIUtil%20Kit_${version}.zip";
+ sha256 = "1d4337faa56e24f7d98db87b9de94d6e2c17ab671f4e301b93833eea08b9e426";
+ };
+
+in
+
+stdenv.mkDerivation {
+ pname = "lsiutils";
+ inherit version;
+
+ srcs = [ src "Source/lsiutil.tar.gz" ];
+
+ buildInputs = [ unzip ];
+
+ sourceRoot = "lsiutil";
+
+ preBuild =
+ ''
+ mkdir -p $out/bin
+ substituteInPlace Makefile --replace /usr/bin $out/bin
+ substituteInPlace lsiutil.c \
+ --replace /sbin/modprobe modprobe \
+ --replace /bin/mknod $(type -P mknod)
+ '';
+
+ installPhase = "true";
+
+ meta = {
+ homepage = "http://www.lsi.com/";
+ description = "LSI Logic Fusion MPT command line management tool";
+ license = stdenv.lib.licenses.unfree;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix
new file mode 100644
index 000000000000..57778357d006
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "lsscsi-0.31";
+
+ src = fetchurl {
+ url = "http://sg.danny.cz/scsi/lsscsi-0.31.tgz";
+ sha256 = "1jpk15y9vqjb1lcj4pdzygpg0jf0lja7azjldpywc0s805rikgqj";
+ };
+
+ preConfigure = ''
+ substituteInPlace Makefile.in --replace /usr "$out"
+ '';
+
+ meta = with stdenv.lib; {
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lttng-modules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lttng-modules/default.nix
new file mode 100644
index 000000000000..30d4a29b166c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lttng-modules/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, kernel }:
+
+stdenv.mkDerivation rec {
+ pname = "lttng-modules-${version}";
+ name = "${pname}-${kernel.version}";
+ version = "2.10.5";
+
+ src = fetchurl {
+ url = "https://lttng.org/files/lttng-modules/lttng-modules-${version}.tar.bz2";
+ sha256 = "07rs01zwr4bmjamplix5qz1c6mb6wdawb68vyn0w6wx68ppbpnxq";
+ };
+
+ buildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
+
+ preConfigure = ''
+ export KERNELDIR="${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ export INSTALL_MOD_PATH="$out"
+ '';
+
+ installTargets = [ "modules_install" ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Linux kernel modules for LTTng tracing";
+ homepage = "https://lttng.org/";
+ license = with licenses; [ lgpl21 gpl2 mit ];
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ broken = builtins.compareVersions kernel.version "3.18" == -1
+ || builtins.compareVersions kernel.version "4.16" == 1;
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix
new file mode 100644
index 000000000000..7bbd1768c043
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix
@@ -0,0 +1,128 @@
+{ stdenv
+, fetchpatch
+, fetchurl
+, pkgconfig
+, utillinux
+, libuuid
+, thin-provisioning-tools, libaio
+, enableCmdlib ? false
+, enableDmeventd ? false
+, udev ? null
+, nixosTests
+}:
+
+# configure: error: --enable-dmeventd requires --enable-cmdlib to be used as well
+assert enableDmeventd -> enableCmdlib;
+
+stdenv.mkDerivation rec {
+ pname = "lvm2" + stdenv.lib.optionalString enableDmeventd "with-dmeventd";
+ version = "2.03.10";
+
+ src = fetchurl {
+ url = "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${version}.tgz";
+ sha256 = "1l0fkn9abrgk5mfn6jfh9qhdr86b59l1c5pk6lp8jh0491d69las";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ udev libuuid thin-provisioning-tools libaio ];
+
+ configureFlags = [
+ "--disable-readline"
+ "--enable-pkgconfig"
+ "--with-default-locking-dir=/run/lock/lvm"
+ "--with-default-run-dir=/run/lvm"
+ "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
+ ] ++ stdenv.lib.optionals (!enableCmdlib) [
+ "--bindir=${placeholder "bin"}/bin"
+ "--sbindir=${placeholder "bin"}/bin"
+ "--libdir=${placeholder "lib"}/lib"
+ ] ++ stdenv.lib.optional enableCmdlib "--enable-cmdlib"
+ ++ stdenv.lib.optionals enableDmeventd [
+ "--enable-dmeventd"
+ "--with-dmeventd-pidfile=/run/dmeventd/pid"
+ "--with-default-dm-run-dir=/run/dmeventd"
+ ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "ac_cv_func_malloc_0_nonnull=yes"
+ "ac_cv_func_realloc_0_nonnull=yes"
+ ] ++
+ stdenv.lib.optionals (udev != null) [
+ "--enable-udev_rules"
+ "--enable-udev_sync"
+ ];
+
+ preConfigure = ''
+ sed -i /DEFAULT_SYS_DIR/d Makefile.in
+ sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in
+ substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \
+ --replace /usr/bin/udevadm /run/current-system/systemd/bin/udevadm
+ # https://github.com/lvmteam/lvm2/issues/36
+ substituteInPlace udev/69-dm-lvm-metad.rules.in \
+ --replace "(BINDIR)/systemd-run" /run/current-system/systemd/bin/systemd-run
+
+ substituteInPlace make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system"
+ substituteInPlace libdm/make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system"
+ '';
+
+ postConfigure = ''
+ sed -i 's|^#define LVM_CONFIGURE_LINE.*$|#define LVM_CONFIGURE_LINE "<removed>"|g' ./include/configure.h
+ '';
+
+
+ patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ name = "fix-stdio-usage.patch";
+ url = "https://git.alpinelinux.org/aports/plain/main/lvm2/fix-stdio-usage.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "0m6wr6qrvxqi2d2h054cnv974jq1v65lqxy05g1znz946ga73k3p";
+ })
+ (fetchpatch {
+ name = "mallinfo.patch";
+ url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0";
+ })
+ (fetchpatch {
+ name = "mlockall-default-config.patch";
+ url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mlockall-default-config.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "1ivbj3sphgf8n1ykfiv5rbw7s8dgnj5jcr9jl2v8cwf28lkacw5l";
+ })
+ ];
+
+ doCheck = false; # requires root
+
+ makeFlags = stdenv.lib.optionals (udev != null) [
+ "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators"
+ ];
+
+ # To prevent make install from failing.
+ installFlags = [ "OWNER=" "GROUP=" "confdir=$(out)/etc" ];
+
+ # Install systemd stuff.
+ installTargets = [ "install" ] ++ stdenv.lib.optionals (udev != null) [
+ "install_systemd_generators"
+ "install_systemd_units"
+ "install_tmpfiles_configuration"
+ ];
+
+ # only split bin and lib out from out if cmdlib isn't enabled
+ outputs = [
+ "out"
+ "dev"
+ "man"
+ ] ++ stdenv.lib.optionals (enableCmdlib != true) [
+ "bin"
+ "lib"
+ ];
+
+ postInstall = stdenv.lib.optionalString (enableCmdlib != true) ''
+ moveToOutput lib/libdevmapper.so $lib
+ '';
+
+ passthru.tests.installer = nixosTests.installer.lvm;
+
+ meta = with stdenv.lib; {
+ homepage = "http://sourceware.org/lvm2/";
+ description = "Tools to support Logical Volume Management (LVM) on Linux";
+ platforms = platforms.linux;
+ license = with licenses; [ gpl2 bsd2 lgpl21 ];
+ maintainers = with maintainers; [ raskin ajs124 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/default.nix
new file mode 100644
index 000000000000..21c1eede9d7a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/default.nix
@@ -0,0 +1,99 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, perl, docbook2x
+, docbook_xml_dtd_45, python3Packages, pam
+
+# Optional Dependencies
+, libapparmor ? null, gnutls ? null, libselinux ? null, libseccomp ? null
+, libcap ? null, systemd ? null
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ pname = "lxc";
+ version = "4.0.4";
+
+ src = fetchurl {
+ url = "https://linuxcontainers.org/downloads/lxc/lxc-${version}.tar.gz";
+ sha256 = "15frszz5am9bnr8vh1zpg89x0xigcfm19jax0z16cazd42xahr9w";
+ };
+
+ nativeBuildInputs = [
+ autoreconfHook pkgconfig perl docbook2x python3Packages.wrapPython
+ ];
+ buildInputs = [
+ pam libapparmor gnutls libselinux libseccomp libcap
+ python3Packages.python python3Packages.setuptools systemd
+ ];
+
+ patches = [
+ ./support-db2x.patch
+ ];
+
+ postPatch = ''
+ sed -i '/chmod u+s/d' src/lxc/Makefile.am
+ '';
+
+ XML_CATALOG_FILES = "${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml";
+
+ configureFlags = [
+ "--enable-pam"
+ "--localstatedir=/var"
+ "--sysconfdir=/etc"
+ "--disable-api-docs"
+ "--with-init-script=none"
+ "--with-distro=nixos" # just to be sure it is "unknown"
+ ] ++ optional (libapparmor != null) "--enable-apparmor"
+ ++ optional (libselinux != null) "--enable-selinux"
+ ++ optional (libseccomp != null) "--enable-seccomp"
+ ++ optional (libcap != null) "--enable-capabilities"
+ ++ [
+ "--disable-examples"
+ "--enable-python"
+ "--disable-lua"
+ "--enable-bash"
+ (if doCheck then "--enable-tests" else "--disable-tests")
+ "--with-rootfs-path=/var/lib/lxc/rootfs"
+ ];
+
+ doCheck = false;
+
+ installFlags = [
+ "localstatedir=\${TMPDIR}"
+ "sysconfdir=\${out}/etc"
+ "sysconfigdir=\${out}/etc/default"
+ "bashcompdir=\${out}/share/bash-completion/completions"
+ "READMEdir=\${TMPDIR}/var/lib/lxc/rootfs"
+ "LXCPATH=\${TMPDIR}/var/lib/lxc"
+ ];
+
+ postInstall = ''
+ wrapPythonPrograms
+
+ completions=(
+ lxc-attach lxc-cgroup lxc-console lxc-destroy lxc-device lxc-execute
+ lxc-freeze lxc-info lxc-monitor lxc-snapshot lxc-stop lxc-unfreeze
+ )
+ pushd $out/share/bash-completion/completions/
+ mv lxc lxc-start
+ for completion in ''${completions[@]}; do
+ ln -sfn lxc-start $completion
+ done
+ popd
+ '';
+
+ meta = {
+ homepage = "https://linuxcontainers.org/";
+ description = "Userspace tools for Linux Containers, a lightweight virtualization system";
+ license = licenses.lgpl21Plus;
+
+ longDescription = ''
+ LXC is the userspace control package for Linux Containers, a
+ lightweight virtual system mechanism sometimes described as
+ "chroot on steroids". LXC builds up from chroot to implement
+ complete virtual systems, adding resource management and isolation
+ mechanisms to Linux’s existing process management infrastructure.
+ '';
+
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/support-db2x.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/support-db2x.patch
new file mode 100644
index 000000000000..16715992d35f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxc/support-db2x.patch
@@ -0,0 +1,16 @@
+diff --git a/configure.ac b/configure.ac
+index 84f8699..dce9033 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -192,9 +192,9 @@ if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
+ AC_SUBST(db2xman)
+ fi
+ AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
+-AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
++AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "no-no-no"])
+
+-if test "x$db2xman" = "xdocbook2man"; then
++if test "x$db2xman" = "no-no-no"; then
+ docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
+ else
+ docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxcfs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxcfs/default.nix
new file mode 100644
index 000000000000..bcc8614bc6ab
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/lxcfs/default.nix
@@ -0,0 +1,51 @@
+{ config, stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, help2man, fuse
+, utillinux, makeWrapper
+, enableDebugBuild ? config.lxcfs.enableDebugBuild or false }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ pname = "lxcfs";
+ version = "4.0.5";
+
+ src = fetchFromGitHub {
+ owner = "lxc";
+ repo = "lxcfs";
+ rev = "lxcfs-${version}";
+ sha256 = "12mk9hgqzzh1874389lrpvldlp87qxxa1sxzk5zr0d0n1857am5y";
+ };
+
+ nativeBuildInputs = [ pkgconfig help2man autoreconfHook ];
+ buildInputs = [ fuse makeWrapper ];
+
+ preConfigure = stdenv.lib.optionalString enableDebugBuild ''
+ sed -i 's,#AM_CFLAGS += -DDEBUG,AM_CFLAGS += -DDEBUG,' Makefile.am
+ '';
+
+ configureFlags = [
+ "--with-init-script=systemd"
+ "--sysconfdir=/etc"
+ "--localstatedir=/var"
+ ];
+
+ installFlags = [ "SYSTEMD_UNIT_DIR=\${out}/lib/systemd" ];
+
+ postInstall = ''
+ # `mount` hook requires access to the `mount` command from `utillinux`:
+ wrapProgram "$out/share/lxcfs/lxc.mount.hook" \
+ --prefix PATH : "${utillinux}/bin"
+ '';
+
+ postFixup = ''
+ # liblxcfs.so is reloaded with dlopen()
+ patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
+ '';
+
+ meta = {
+ description = "FUSE filesystem for LXC";
+ homepage = "https://linuxcontainers.org/lxcfs";
+ changelog = "https://linuxcontainers.org/lxcfs/news/";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ mic92 fpletz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/macchanger/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/macchanger/default.nix
new file mode 100644
index 000000000000..29d2a3914a29
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/macchanger/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, texinfo }:
+
+stdenv.mkDerivation rec {
+ pname = "macchanger";
+ version = "1.7.0";
+
+ src = fetchFromGitHub {
+ owner = "alobbs";
+ repo = "macchanger";
+ rev = version;
+ sha256 = "1hypx6sxhd2b1nsxj314hpkhj7q4x9p2kfaaf20rjkkkig0nck9r";
+ };
+
+ nativeBuildInputs = [ autoreconfHook texinfo ];
+
+ outputs = [ "out" "info" ];
+
+ meta = with stdenv.lib; {
+ description = "A utility for viewing/manipulating the MAC address of network interfaces";
+ maintainers = with maintainers; [ joachifm ma27 ];
+ license = licenses.gpl2Plus;
+ homepage = "https://www.gnu.org/software/macchanger";
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix
new file mode 100644
index 000000000000..f48a3dbb62f5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix
@@ -0,0 +1,30 @@
+{ fetchFromGitHub, kernel, stdenv }:
+
+stdenv.mkDerivation {
+ name = "mba6x_bl-2016-12-08";
+
+ src = fetchFromGitHub {
+ owner = "patjak";
+ repo = "mba6x_bl";
+ rev = "b96aafd30c18200b4ad1f6eb995bc19200f60c47";
+ sha256 = "10payvfxahazdxisch4wm29fhl8y07ki72q4c78sl4rn73sj6yjq";
+ };
+
+ enableParallelBuilding = true;
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "INSTALL_MOD_PATH=$(out)"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "MacBook Air 6,1 and 6,2 (mid 2013) backlight driver";
+ homepage = "https://github.com/patjak/mba6x_bl";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.simonvandel ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mbpfan/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mbpfan/default.nix
new file mode 100644
index 000000000000..675d9417a01a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mbpfan/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "mbpfan";
+ version = "2.2.1";
+ src = fetchFromGitHub {
+ owner = "dgraziotin";
+ repo = "mbpfan";
+ rev = "v${version}";
+ sha256 = "0gc9ypxi55vxs77nx8ihhh9zk7fr9v0m0zfm76q7x0bi6jz11mbr";
+ };
+ installPhase = ''
+ mkdir -p $out/bin $out/etc
+ cp bin/mbpfan $out/bin
+ cp mbpfan.conf $out/etc
+ '';
+ meta = with lib; {
+ description = "Daemon that uses input from coretemp module and sets the fan speed using the applesmc module";
+ homepage = "https://github.com/dgraziotin/mbpfan";
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cstrahan ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mcelog/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mcelog/default.nix
new file mode 100644
index 000000000000..9ead1f6ad4bd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mcelog/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchFromGitHub, utillinux }:
+
+stdenv.mkDerivation rec {
+ pname = "mcelog";
+ version = "169";
+
+ src = fetchFromGitHub {
+ owner = "andikleen";
+ repo = "mcelog";
+ rev = "v${version}";
+ sha256 = "0ghkwfaky026qwj6hmcvz2w2hm8qqj3ysbkxxi603vslmwj56chv";
+ };
+
+ postPatch = ''
+ for i in mcelog.conf paths.h; do
+ substituteInPlace $i --replace /etc $out/etc
+ done
+ touch mcelog.conf.5 # avoid regeneration requiring Python
+
+ substituteInPlace Makefile --replace '"unknown"' '"${version}"'
+
+ for i in triggers/*; do
+ substituteInPlace $i --replace 'logger' '${utillinux}/bin/logger'
+ done
+ '';
+
+ enableParallelBuilding = true;
+
+ installFlags = [ "DESTDIR=$(out)" "prefix=" "DOCDIR=/share/doc" ];
+
+ postInstall = ''
+ mkdir -p $out/lib/systemd/system
+ substitute mcelog.service $out/lib/systemd/system/mcelog.service \
+ --replace /usr/sbin $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Log x86 machine checks: memory, IO, and CPU hardware errors";
+ longDescription = ''
+ The mcelog daemon accounts memory and some other errors in various ways
+ on modern x86 Linux systems. The daemon can be queried and/or execute
+ triggers when configurable error thresholds are exceeded. This is used to
+ implement a range of automatic predictive failure analysis algorithms,
+ including bad page offlining and automatic cache error handling. All
+ errors are logged to /var/log/mcelog or syslog or the journal.
+ '';
+ homepage = "http://mcelog.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
new file mode 100644
index 000000000000..6a71196157b7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, utillinux, coreutils, fetchurl, groff, system-sendmail }:
+
+stdenv.mkDerivation rec {
+ name = "mdadm-4.1";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.xz";
+ sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
+ };
+
+ patches = [ ./no-self-references.patch ];
+
+ makeFlags = [
+ "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin"
+ "SYSTEMD_DIR=$(out)/lib/systemd/system"
+ "MANDIR=$(out)/share/man" "RUN_DIR=/dev/.mdadm"
+ "STRIP="
+ ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+ ];
+
+ installFlags = [ "install-systemd" ];
+
+ enableParallelBuilding = true;
+
+ nativeBuildInputs = [ groff ];
+
+ postPatch = ''
+ sed -e 's@/lib/udev@''${out}/lib/udev@' \
+ -e 's@ -Werror @ @' \
+ -e 's@/usr/sbin/sendmail@${system-sendmail}/bin/sendmail@' -i Makefile
+ sed -i \
+ -e 's@/usr/bin/basename@${coreutils}/bin/basename@g' \
+ -e 's@BINDIR/blkid@${utillinux}/bin/blkid@g' \
+ *.rules
+ '';
+
+ # This is to avoid self-references, which causes the initrd to explode
+ # in size and in turn prevents mdraid systems from booting.
+ postFixup = ''
+ grep -r $out $out/bin && false || true
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Programs for managing RAID arrays under Linux";
+ homepage = "http://neil.brown.name/blog/mdadm";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ ekleog ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/no-self-references.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/no-self-references.patch
new file mode 100644
index 000000000000..cf0366e52d11
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mdadm/no-self-references.patch
@@ -0,0 +1,130 @@
+diff --git a/Makefile b/Makefile
+index d82e30f..d231cf9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -51,6 +51,9 @@ endif
+ ifdef DEBIAN
+ CPPFLAGS += -DDEBIAN
+ endif
++ifdef NIXOS
++CPPFLAGS += -DNIXOS
++endif
+ ifdef DEFAULT_OLD_METADATA
+ CPPFLAGS += -DDEFAULT_OLD_METADATA
+ DEFAULT_METADATA=0.90
+@@ -105,6 +108,7 @@ endif
+ INSTALL = /usr/bin/install
+ DESTDIR =
+ BINDIR = /sbin
++INSTALL_BINDIR = ${BINDIR}
+ MANDIR = /usr/share/man
+ MAN4DIR = $(MANDIR)/man4
+ MAN5DIR = $(MANDIR)/man5
+@@ -259,20 +263,20 @@ sha1.o : sha1.c sha1.h md5.h
+ $(CC) $(CFLAGS) -DHAVE_STDINT_H -o sha1.o -c sha1.c
+
+ install : mdadm mdmon install-man install-udev
+- $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm
+- $(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(BINDIR)/mdmon
++ $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(INSTALL_BINDIR)/mdadm
++ $(INSTALL) -D $(STRIP) -m 755 mdmon $(DESTDIR)$(INSTALL_BINDIR)/mdmon
+
+ install-static : mdadm.static install-man
+- $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(BINDIR)/mdadm
++ $(INSTALL) -D $(STRIP) -m 755 mdadm.static $(DESTDIR)$(INSTALL_BINDIR)/mdadm
+
+ install-tcc : mdadm.tcc install-man
+- $(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(BINDIR)/mdadm
++ $(INSTALL) -D $(STRIP) -m 755 mdadm.tcc $(DESTDIR)$(INSTALL_BINDIR)/mdadm
+
+ install-uclibc : mdadm.uclibc install-man
+- $(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(BINDIR)/mdadm
++ $(INSTALL) -D $(STRIP) -m 755 mdadm.uclibc $(DESTDIR)$(INSTALL_BINDIR)/mdadm
+
+ install-klibc : mdadm.klibc install-man
+- $(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(BINDIR)/mdadm
++ $(INSTALL) -D $(STRIP) -m 755 mdadm.klibc $(DESTDIR)$(INSTALL_BINDIR)/mdadm
+
+ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
+ $(INSTALL) -D -m 644 mdadm.8 $(DESTDIR)$(MAN8DIR)/mdadm.8
+@@ -305,7 +309,7 @@ install-systemd: systemd/mdmon@.service
+ if [ -f /etc/SuSE-release -o -n "$(SUSE)" ] ;then $(INSTALL) -D -m 755 systemd/SUSE-mdadm_env.sh $(DESTDIR)$(SYSTEMD_DIR)/../scripts/mdadm_env.sh ;fi
+
+ uninstall:
+- rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm
++ rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(INSTALL_BINDIR)/mdadm
+
+ test: mdadm mdmon test_stripe swap_super raid6check
+ @echo "Please run './test' as root"
+diff --git a/policy.c b/policy.c
+index 064d349..6b2f2b1 100644
+--- a/policy.c
++++ b/policy.c
+@@ -796,12 +796,39 @@ char *find_rule(struct rule *rule, char *rule_type)
+ #define UDEV_RULE_FORMAT \
+ "ACTION==\"add\", SUBSYSTEM==\"block\", " \
+ "ENV{DEVTYPE}==\"%s\", ENV{ID_PATH}==\"%s\", " \
+-"RUN+=\"" BINDIR "/mdadm --incremental $env{DEVNAME}\"\n"
++"RUN+=\"%s/mdadm --incremental $env{DEVNAME}\"\n"
+
+ #define UDEV_RULE_FORMAT_NOTYPE \
+ "ACTION==\"add\", SUBSYSTEM==\"block\", " \
+ "ENV{ID_PATH}==\"%s\", " \
+-"RUN+=\"" BINDIR "/mdadm --incremental $env{DEVNAME}\"\n"
++"RUN+=\"%s/mdadm --incremental $env{DEVNAME}\"\n"
++
++#ifdef NIXOS
++const char *get_mdadm_bindir(void)
++{
++ static char *bindir = NULL;
++ if (bindir != NULL) {
++ return bindir;
++ } else {
++ int len;
++ bindir = xmalloc(1025);
++ len = readlink("/proc/self/exe", bindir, 1024);
++ if (len > 0) {
++ char *basename;
++ if ((basename = strrchr(bindir, '/')) != NULL)
++ *basename = '\0';
++ else
++ *(bindir + len) = '\0';
++ } else {
++ *bindir = '\0';
++ }
++ return bindir;
++ }
++}
++#define SELF get_mdadm_bindir()
++#else
++#define SELF BINDIR
++#endif
+
+ /* Write rule in the rule file. Use format from UDEV_RULE_FORMAT */
+ int write_rule(struct rule *rule, int fd, int force_part)
+@@ -815,9 +842,9 @@ int write_rule(struct rule *rule, int fd, int force_part)
+ if (force_part)
+ typ = type_part;
+ if (typ)
+- snprintf(line, sizeof(line) - 1, UDEV_RULE_FORMAT, typ, pth);
++ snprintf(line, sizeof(line) - 1, UDEV_RULE_FORMAT, typ, pth, SELF);
+ else
+- snprintf(line, sizeof(line) - 1, UDEV_RULE_FORMAT_NOTYPE, pth);
++ snprintf(line, sizeof(line) - 1, UDEV_RULE_FORMAT_NOTYPE, pth, SELF);
+ return write(fd, line, strlen(line)) == (int)strlen(line);
+ }
+
+diff --git a/util.c b/util.c
+index cc98d3b..1ada2f4 100644
+--- a/util.c
++++ b/util.c
+@@ -1700,7 +1700,9 @@ int start_mdmon(char *devnm)
+ char pathbuf[1024];
+ char *paths[4] = {
+ pathbuf,
++#ifndef NIXOS
+ BINDIR "/mdmon",
++#endif
+ "./mdmon",
+ NULL
+ };
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/metastore/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/metastore/default.nix
new file mode 100644
index 000000000000..590b931ac920
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/metastore/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, libbsd, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ version = "1.1.2";
+ pname = "metastore";
+
+ src = fetchFromGitHub {
+ owner = "przemoc";
+ repo = "metastore";
+ rev = "v${version}";
+ sha256 = "0mb10wfckswqgi0bq25ncgabnd3iwj7s7hhg3wpcyfgckdynwizv";
+ };
+
+ buildInputs = [ libbsd ];
+ installFlags = [ "PREFIX=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "Store and restore metadata from a filesystem";
+ homepage = "https://software.przemoc.net/#metastore";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ sstef ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/amd.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/amd.nix
new file mode 100644
index 000000000000..135187c9a108
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/amd.nix
@@ -0,0 +1,29 @@
+{ stdenv, firmwareLinuxNonfree, libarchive }:
+
+stdenv.mkDerivation {
+ name = "amd-ucode-${firmwareLinuxNonfree.version}";
+
+ src = firmwareLinuxNonfree;
+
+ sourceRoot = ".";
+
+ buildInputs = [ libarchive ];
+
+ buildPhase = ''
+ mkdir -p kernel/x86/microcode
+ find ${firmwareLinuxNonfree}/lib/firmware/amd-ucode -name \*.bin \
+ -exec sh -c 'cat {} >> kernel/x86/microcode/AuthenticAMD.bin' \;
+ '';
+
+ installPhase = ''
+ mkdir -p $out
+ echo kernel/x86/microcode/AuthenticAMD.bin | bsdcpio -o -H newc -R 0:0 > $out/amd-ucode.img
+ '';
+
+ meta = with stdenv.lib; {
+ description = "AMD Processor microcode patch";
+ homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/intel.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/intel.nix
new file mode 100644
index 000000000000..475288a0b6f6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/intel.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, libarchive, iucode-tool }:
+
+stdenv.mkDerivation rec {
+ pname = "microcode-intel";
+ version = "20200616";
+
+ src = fetchFromGitHub {
+ owner = "intel";
+ repo = "Intel-Linux-Processor-Microcode-Data-Files";
+ rev = "microcode-${version}";
+ sha256 = "13jrs8hwh7dhjjb9kncb8lk199afaxglkh1cfisl6zca1h36g563";
+ };
+
+ nativeBuildInputs = [ iucode-tool libarchive ];
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out kernel/x86/microcode
+ iucode_tool -w kernel/x86/microcode/GenuineIntel.bin intel-ucode/
+ echo kernel/x86/microcode/GenuineIntel.bin | bsdcpio -o -H newc -R 0:0 > $out/intel-ucode.img
+
+ runHook postInstall
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.intel.com/";
+ description = "Microcode for Intel processors";
+ license = licenses.unfreeRedistributableFirmware;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ andir ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/iucode-tool.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/iucode-tool.nix
new file mode 100644
index 000000000000..65cb01c84a52
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/microcode/iucode-tool.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitLab, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ pname = "iucode-tool";
+ version = "2.3.1";
+
+ src = fetchFromGitLab {
+ owner = "iucode-tool";
+ repo = "iucode-tool";
+ rev = "v${version}";
+ sha256 = "04dlisw87dd3q3hhmkqc5dd58cp22fzx3rzah7pvcyij135yjc3a";
+ };
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Intel® 64 and IA-32 processor microcode tool";
+ homepage = "https://gitlab.com/iucode-tool/iucode-tool";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ peterhoeg ];
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix
new file mode 100644
index 000000000000..775910d30d6f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "mingetty-1.08";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/mingetty/mingetty-1.08.tar.gz";
+ sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g";
+ };
+
+ preInstall = ''
+ mkdir -p $out/sbin $out/share/man/man8
+ makeFlagsArray=(SBINDIR=$out/sbin MANDIR=$out/share/man/man8)
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://sourceforge.net/projects/mingetty";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/miraclecast/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/miraclecast/default.nix
new file mode 100644
index 000000000000..d04695ef619d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/miraclecast/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, meson, ninja, pkgconfig
+, glib, readline, pcre, systemd, udev }:
+
+stdenv.mkDerivation {
+ pname = "miraclecast";
+ version = "1.0-20190403";
+
+ src = fetchFromGitHub {
+ owner = "albfan";
+ repo = "miraclecast";
+ rev = "960a785e10523cc525885380dd03aa2c5ba11bc7";
+ sha256 = "05afqi33rv7k6pbkkw4mynj6p97vkzhhh13y5nh0yxkyhcgf45pm";
+ };
+
+ nativeBuildInputs = [ meson ninja pkgconfig ];
+
+ buildInputs = [ glib pcre readline systemd udev ];
+
+ enableParallelBuilding = true;
+
+ mesonFlags = [
+ "-Drely-udev=true"
+ "-Dbuild-tests=true"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Connect external monitors via Wi-Fi";
+ homepage = "https://github.com/albfan/miraclecast";
+ license = licenses.lgpl21Plus;
+ maintainers = with maintainers; [ tstrobel ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
new file mode 100644
index 000000000000..8a20a2f733af
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "mkinitcpio-nfs-utils-0.3";
+
+ src = fetchurl {
+ url = "https://sources.archlinux.org/other/mkinitcpio/${name}.tar.xz";
+ sha256 = "0fc93sfk41ycpa33083kyd7i4y00ykpbhj5qlw611bjghj4x946j";
+ # ugh, upstream...
+ name = "${name}.tar.gz";
+ };
+
+ makeFlags = [ "DESTDIR=$(out)" "bindir=/bin" ];
+
+ postInstall = ''
+ rm -rf $out/usr
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://archlinux.org/";
+ description = "ipconfig and nfsmount tools for root on NFS, ported from klibc";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mmc-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mmc-utils/default.nix
new file mode 100644
index 000000000000..6a9f807947d4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mmc-utils/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchgit }:
+
+stdenv.mkDerivation {
+ pname = "mmc-utils";
+ version = "2019-10-04";
+
+ src = fetchgit {
+ url = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git";
+ rev = "73d6c59af8d1bcedf5de4aa1f5d5b7f765f545f5";
+ sha256 = "18a7qm86gavg15gv4h6xfnapgq24v4dyvhwfp53lkssxyhjbli0z";
+ };
+
+ makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
+
+ installPhase = ''
+ make install prefix=$out
+ mkdir -p $out/share/man/man1
+ cp man/mmc.1 $out/share/man/man1/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Configure MMC storage devices from userspace";
+ homepage = "http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git/";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.dezgeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/molly-guard/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/molly-guard/default.nix
new file mode 100644
index 000000000000..c9bdff9de3ec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/molly-guard/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, dpkg, busybox, systemd }:
+
+stdenv.mkDerivation rec {
+ pname = "molly-guard";
+ version = "0.7.2";
+
+ src = fetchurl {
+ url = "https://launchpad.net/ubuntu/+archive/primary/+files/molly-guard_${version}_all.deb";
+ sha256 = "1k6b1hn8lc4rj9n036imsl7s9lqj6ny3acdhnbnamsdkkndmxrw7";
+ };
+
+ buildInputs = [ dpkg ];
+
+ sourceRoot = ".";
+
+ unpackCmd = ''
+ dpkg-deb -x "$src" .
+ '';
+
+ installPhase = ''
+ sed -i "s|/lib/molly-guard|${systemd}/sbin|g" lib/molly-guard/molly-guard
+ sed -i "s|run-parts|${busybox}/bin/run-parts|g" lib/molly-guard/molly-guard
+ sed -i "s|/etc/molly-guard/|$out/etc/molly-guard/|g" lib/molly-guard/molly-guard
+ cp -r ./ $out/
+ '';
+
+ postFixup = ''
+ for modus in init halt poweroff reboot runlevel shutdown telinit; do
+ ln -sf $out/lib/molly-guard/molly-guard $out/bin/$modus;
+ done;
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Attempts to prevent you from accidentally shutting down or rebooting machines";
+ homepage = "https://salsa.debian.org/debian/molly-guard";
+ license = licenses.artistic2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ DerTim1 ];
+ priority = -10;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/msr-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/msr-tools/default.nix
new file mode 100644
index 000000000000..f7b81bd3915d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/msr-tools/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+ pname = "msr-tools";
+ version = "1.3";
+
+ src = fetchurl {
+ url = "https://01.org/sites/default/files/downloads/msr-tools/${pname}-${version}.zip";
+ sha256 = "07hxmddg0l31kjfmaq84ni142lbbvgq6391r8bd79wpm819pnigr";
+ };
+
+ buildInputs = [ unzip ];
+
+ preInstall = ''
+ mkdir -p $out/bin
+ substituteInPlace Makefile \
+ --replace /usr/sbin $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tool to read/write from/to MSR CPU registers on Linux";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ peterhoeg ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mstpd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mstpd/default.nix
new file mode 100644
index 000000000000..4a7c6282d4c7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mstpd/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ pname = "mstpd";
+ version = "0.0.8";
+
+ src = fetchFromGitHub {
+ owner = pname;
+ repo = pname;
+ rev = version;
+ sha256 = "1xkfydxljdnj49p5r3mirk4k146428b6imfc9bkfps9yjn64mkgb";
+ };
+
+ patches = [
+ (fetchpatch {
+ name = "fix-strncpy-gcc9.patch";
+ url = "https://github.com/mstpd/mstpd/commit/d27d7e93485d881d8ff3a7f85309b545edbe1fc6.patch";
+ sha256 = "19456daih8l3y6m9kphjr7pj7slrqzbj6yacnlgznpxyd8y4d86y";
+ })
+ ];
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ configureFlags = [
+ "--prefix=$(out)"
+ "--sysconfdir=$(out)/etc"
+ "--sbindir=$(out)/sbin"
+ "--libexecdir=$(out)/lib"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Multiple Spanning Tree Protocol daemon";
+ homepage = "https://github.com/mstpd/mstpd";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/default.nix
new file mode 100644
index 000000000000..02853f6497fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, pkgconfig, perl, lvm2, libaio, gzip, readline, systemd, liburcu, json_c }:
+
+stdenv.mkDerivation rec {
+ pname = "multipath-tools";
+ version = "0.8.3";
+
+ src = fetchurl {
+ name = "${pname}-${version}.tar.gz";
+ url = "https://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=snapshot;h=refs/tags/${version};sf=tgz";
+ sha256 = "1mgjylklh1cx8px8ffgl12kyc0ln3445vbabd2sy8chq31rpiiq8";
+ };
+
+ patches = [
+ # fix build with json-c 0.14 https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html
+ ./json-c-0.14.patch
+ ];
+
+ postPatch = ''
+ substituteInPlace libmultipath/Makefile --replace /usr/include/libdevmapper.h ${stdenv.lib.getDev lvm2}/include/libdevmapper.h
+ sed -i -re '
+ s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
+ ' libmultipath/defaults.h
+ sed -i -e 's,\$(DESTDIR)/\(usr/\)\?,$(prefix)/,g' \
+ kpartx/Makefile libmpathpersist/Makefile
+ sed -i -e "s,GZIP,GZ," \
+ $(find * -name Makefile\*)
+ '';
+
+ nativeBuildInputs = [ gzip pkgconfig perl ];
+ buildInputs = [ systemd lvm2 libaio readline liburcu json_c ];
+
+ makeFlags = [
+ "LIB=lib"
+ "prefix=$(out)"
+ "man8dir=$(out)/share/man/man8"
+ "man5dir=$(out)/share/man/man5"
+ "man3dir=$(out)/share/man/man3"
+ "SYSTEMDPATH=lib"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Tools for the Linux multipathing driver";
+ homepage = "http://christophe.varoqui.free.fr/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/json-c-0.14.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/json-c-0.14.patch
new file mode 100644
index 000000000000..d5fee4248830
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/multipath-tools/json-c-0.14.patch
@@ -0,0 +1,21 @@
+diff --git a/libdmmp/libdmmp_private.h b/libdmmp/libdmmp_private.h
+index ac85b63f..b1a6ddea 100644
+--- a/libdmmp/libdmmp_private.h
++++ b/libdmmp/libdmmp_private.h
+@@ -30,6 +30,7 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <assert.h>
++#include <stdbool.h>
+ #include <json.h>
+
+ #include "libdmmp/libdmmp.h"
+@@ -82,7 +83,7 @@ static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \
+ do { \
+ json_type j_type = json_type_null; \
+ json_object *j_obj_tmp = NULL; \
+- if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE) { \
++ if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != true) { \
+ _error(ctx, "Invalid JSON output from multipathd IPC: " \
+ "key '%s' not found", key); \
+ rc = DMMP_ERR_IPC_ERROR; \
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/musl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/musl/default.nix
new file mode 100644
index 000000000000..67d08454a844
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/musl/default.nix
@@ -0,0 +1,129 @@
+{ stdenv, lib, fetchurl
+, linuxHeaders ? null
+, useBSDCompatHeaders ? true
+}:
+let
+ cdefs_h = fetchurl {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-cdefs.h";
+ sha256 = "16l3dqnfq0f20rzbkhc38v74nqcsh9n3f343bpczqq8b1rz6vfrh";
+ };
+ queue_h = fetchurl {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-queue.h";
+ sha256 = "12qm82id7zys92a1qh2l1qf2wqgq6jr4qlbjmqyfffz3s3nhfd61";
+ };
+ tree_h = fetchurl {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-tree.h";
+ sha256 = "14igk6k00bnpfw660qhswagyhvr0gfqg4q55dxvaaq7ikfkrir71";
+ };
+
+ # iconv tool, implemented by musl author.
+ # Original: http://git.etalabs.net/cgit/noxcuse/plain/src/iconv.c?id=02d288d89683e99fd18fe9f54d4e731a6c474a4f
+ # We use copy from Alpine which fixes error messages, see:
+ # https://git.alpinelinux.org/aports/commit/main/musl/iconv.c?id=a3d97e95f766c9c378194ee49361b375f093b26f
+ iconv_c = fetchurl {
+ name = "iconv.c";
+ url = "https://git.alpinelinux.org/aports/plain/main/musl/iconv.c?id=a3d97e95f766c9c378194ee49361b375f093b26f";
+ sha256 = "1mzxnc2ncq8lw9x6n7p00fvfklc9p3wfv28m68j0dfz5l8q2k6pp";
+ };
+
+ arch = if stdenv.hostPlatform.isx86_64
+ then "x86_64"
+ else if stdenv.hostPlatform.isx86_32
+ then "i386"
+ else null;
+
+in
+stdenv.mkDerivation rec {
+ pname = "musl";
+ version = "1.2.0";
+
+ src = fetchurl {
+ url = "https://www.musl-libc.org/releases/${pname}-${version}.tar.gz";
+ sha256 = "1s6lix02k1ijm4nmhzpmwzk5w6xfkhn70nvvk8zjs51r24cpppn6";
+ };
+
+ enableParallelBuilding = true;
+
+ # Disable auto-adding stack protector flags,
+ # so musl can selectively disable as needed
+ hardeningDisable = [ "stackprotector" ];
+
+ # Leave these, be friendlier to debuggers/perf tools
+ # Don't force them on, but don't force off either
+ postPatch = ''
+ substituteInPlace configure \
+ --replace -fno-unwind-tables "" \
+ --replace -fno-asynchronous-unwind-tables ""
+ '';
+
+ patches = [
+ # Minor touchup to build system making dynamic linker symlink relative
+ (fetchurl {
+ url = "https://raw.githubusercontent.com/openwrt/openwrt/87606e25afac6776d1bbc67ed284434ec5a832b4/toolchain/musl/patches/300-relative.patch";
+ sha256 = "0hfadrycb60sm6hb6by4ycgaqc9sgrhh42k39v8xpmcvdzxrsq2n";
+ })
+ ];
+ CFLAGS = [ "-fstack-protector-strong" ]
+ ++ lib.optional stdenv.hostPlatform.isPower "-mlong-double-64";
+
+ configureFlags = [
+ "--enable-shared"
+ "--enable-static"
+ "--enable-debug"
+ "--enable-wrapper=all"
+ "--syslibdir=${placeholder "out"}/lib"
+ ];
+
+ outputs = [ "out" "dev" ];
+
+ dontDisableStatic = true;
+ separateDebugInfo = true;
+
+ NIX_DONT_SET_RPATH = true;
+
+ postInstall = ''
+ # Not sure why, but link in all but scsi directory as that's what uclibc/glibc do.
+ # Apparently glibc provides scsi itself?
+ (cd $dev/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .)
+
+ # Strip debug out of the static library
+ $STRIP -S $out/lib/libc.a
+ mkdir -p $out/bin
+
+ # Create 'ldd' symlink, builtin
+ ln -rs $out/lib/libc.so $out/bin/ldd
+
+ # (impure) cc wrapper around musl for interactive usuage
+ for i in musl-gcc musl-clang ld.musl-clang; do
+ moveToOutput bin/$i $dev
+ done
+ moveToOutput lib/musl-gcc.specs $dev
+ substituteInPlace $dev/bin/musl-gcc \
+ --replace $out/lib/musl-gcc.specs $dev/lib/musl-gcc.specs
+
+ # provide 'iconv' utility, using just-built headers, libc/ldso
+ $CC ${iconv_c} -o $out/bin/iconv \
+ -I$dev/include \
+ -L$out/lib -Wl,-rpath=$out/lib \
+ -lc \
+ -B $out/lib \
+ -Wl,-dynamic-linker=$(ls $out/lib/ld-*)
+ '' + lib.optionalString (arch != null) ''
+ # Create 'libc.musl-$arch' symlink
+ ln -rs $out/lib/libc.so $out/lib/libc.musl-${arch}.so.1
+ '' + lib.optionalString useBSDCompatHeaders ''
+ install -D ${queue_h} $dev/include/sys/queue.h
+ install -D ${cdefs_h} $dev/include/sys/cdefs.h
+ install -D ${tree_h} $dev/include/sys/tree.h
+ '';
+
+ passthru.linuxHeaders = linuxHeaders;
+
+ meta = with lib; {
+ description = "An efficient, small, quality libc implementation";
+ homepage = "http://www.musl-libc.org";
+ license = licenses.mit;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ thoughtpolice dtzWill ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mwprocapture/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mwprocapture/default.nix
new file mode 100644
index 000000000000..c5f293011db3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mwprocapture/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, fetchurl, kernel, alsaLib }:
+
+with stdenv.lib;
+
+# The Magewell Pro Capture drivers are not supported for kernels older than 3.2
+assert versionAtLeast kernel.version "3.2.0";
+
+let
+ bits =
+ if stdenv.is64bit then "64"
+ else "32";
+
+ libpath = makeLibraryPath [ stdenv.cc.cc stdenv.glibc alsaLib ];
+
+in
+stdenv.mkDerivation rec {
+ name = "mwprocapture-1.2.${version}-${kernel.version}";
+ version = "4177";
+
+ src = fetchurl {
+ url = "http://www.magewell.com/files/drivers/ProCaptureForLinux_${version}.tar.gz";
+ sha256 = "1nf51w9yixpvr767k49sfdb9n9rv5qc72f5yki1mkghbmabw7vys";
+ };
+
+ nativeBuildInputs = [ kernel.moduleBuildDependencies ];
+
+ preConfigure =
+ ''
+ cd ./src
+ export INSTALL_MOD_PATH="$out"
+ '';
+
+ hardeningDisable = [ "pic" "format" ];
+
+ makeFlags = [
+ "KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ postInstall = ''
+ cd ../
+ mkdir -p $out/bin
+ cp bin/mwcap-control_${bits} $out/bin/mwcap-control
+ cp bin/mwcap-info_${bits} $out/bin/mwcap-info
+ mkdir -p $out/lib/udev/rules.d
+ # source has a filename typo
+ cp scripts/10-procatpure-event-dev.rules $out/lib/udev/rules.d/10-procapture-event-dev.rules
+ cp -r src/res $out
+
+ patchelf \
+ --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
+ --set-rpath "${libpath}" \
+ "$out"/bin/mwcap-control
+
+ patchelf \
+ --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
+ --set-rpath "${libpath}" \
+ "$out"/bin/mwcap-info
+ '';
+
+ meta = {
+ homepage = "http://www.magewell.com/";
+ description = "Linux driver for the Magewell Pro Capture family";
+ license = licenses.unfreeRedistributable;
+ maintainers = with maintainers; [ MP2E ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
new file mode 100644
index 000000000000..ab0b927f1bd1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, kernel }:
+
+stdenv.mkDerivation {
+ name = "mxu11x0-1.4-${kernel.version}";
+
+ src = fetchurl {
+ url = "https://www.moxa.com/Moxa/media/PDIM/S100000385/moxa-uport-1000-series-linux-3.x-and-4.x-for-uport-11x0-series-driver-v1.4.tgz";
+ sha256 = "1hz9ygabbp8pv49k1j4qcsr0v3zw9xy0bh1akqgxp5v29gbdgxjl";
+ };
+
+ preBuild = ''
+ sed -i -e "s/\$(uname -r).*/${kernel.modDirVersion}/g" driver/mxconf
+ sed -i -e "s/\$(shell uname -r).*/${kernel.modDirVersion}/g" driver/Makefile
+ sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/mxconf
+ sed -i -e 's|/lib/modules|${kernel.dev}/lib/modules|' driver/Makefile
+ '';
+
+ installPhase = ''
+ install -v -D -m 644 ./driver/mxu11x0.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/usb/serial/mxu11x0.ko"
+ install -v -D -m 644 ./driver/mxu11x0.ko "$out/lib/modules/${kernel.modDirVersion}/misc/mxu11x0.ko"
+ '';
+
+ dontStrip = true;
+
+ enableParallelBuilding = true;
+
+ hardeningDisable = [ "pic" ];
+
+ meta = with stdenv.lib; {
+ description = "MOXA UPort 11x0 USB to Serial Hub driver";
+ homepage = "https://www.moxa.com/en/products/industrial-edge-connectivity/usb-to-serial-converters-usb-hubs/usb-to-serial-converters/uport-1000-series";
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ uralbash ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/default.nix
new file mode 100644
index 000000000000..34c77bc3e6a7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, kernel, perl, kmod, libelf }:
+let
+ version = "1.62-pre";
+in
+stdenv.mkDerivation {
+ name = "ndiswrapper-${version}-${kernel.version}";
+ inherit version;
+
+ hardeningDisable = [ "pic" ];
+
+ patches = [ ./no-sbin.patch ];
+
+ # need at least .config and include
+ kernel = kernel.dev;
+
+ buildPhase = "
+ cd ndiswrapper
+ echo make KBUILD=$(echo \$kernel/lib/modules/*/build);
+ echo -n $kernel/lib/modules/*/build > kbuild_path
+ export PATH=${kmod}/sbin:$PATH
+ make KBUILD=$(echo \$kernel/lib/modules/*/build);
+ ";
+
+ installPhase = ''
+ make install KBUILD=$(cat kbuild_path) DESTDIR=$out
+ mv $out/usr/sbin/* $out/sbin/
+ mv $out/usr/share $out/
+ rm -r $out/usr
+
+ patchShebangs $out/sbin
+ '';
+
+ # should we use unstable?
+ src = fetchFromGitHub {
+ owner = "pgiri";
+ repo = "ndiswrapper";
+ rev = "5e29f6a9d41df949b435066c173e3b1947f179d3";
+ sha256 = "0sprrmxxkf170bmh1nz9xw00gs89dddr84djlf666bn5bhy6jffi";
+ };
+
+ buildInputs = [ perl libelf ];
+
+ meta = {
+ description = "Ndis driver wrapper for the Linux kernel";
+ homepage = "https://sourceforge.net/projects/ndiswrapper";
+ license = "GPL";
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/no-sbin.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/no-sbin.patch
new file mode 100644
index 000000000000..34965540d248
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ndiswrapper/no-sbin.patch
@@ -0,0 +1,13 @@
+diff --git a/ndiswrapper/driver/Makefile b/ndiswrapper/driver/Makefile
+index bf42f7bc..ad23aa2d 100644
+--- a/ndiswrapper/driver/Makefile
++++ b/ndiswrapper/driver/Makefile
+@@ -191,7 +191,7 @@ clean:
+ rm -rf .tmp_versions
+
+ install: config_check $(MODULE)
+- @/sbin/modinfo $(MODULE) | grep -q "^vermagic: *$(KVERS) " || \
++ @modinfo $(MODULE) | grep -q "^vermagic: *$(KVERS) " || \
+ { echo "$(MODULE)" is not for Linux $(KVERS); exit 1; }
+ mkdir -p -m 755 $(DESTDIR)$(INST_DIR)
+ install -m 0644 $(MODULE) $(DESTDIR)$(INST_DIR)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/config.h b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/config.h
new file mode 100644
index 000000000000..dedaac6247d0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/config.h
@@ -0,0 +1,79 @@
+/*
+* config.h Automatically generated configuration includefile
+*
+* NET-TOOLS A collection of programs that form the base set of the
+* NET-3 Networking Distribution for the LINUX operating
+* system.
+*
+* DO NOT EDIT DIRECTLY
+*
+*/
+
+/*
+ *
+ * Internationalization
+ *
+ * The net-tools package has currently been translated to French,
+ * German and Brazilian Portugese. Other translations are, of
+ * course, welcome. Answer `n' here if you have no support for
+ * internationalization on your system.
+ *
+ */
+#define I18N 0
+
+/*
+ *
+ * Protocol Families.
+ *
+ */
+#define HAVE_AFUNIX 1
+#define HAVE_AFINET 1
+#define HAVE_AFINET6 1
+#define HAVE_AFIPX 1
+#define HAVE_AFATALK 1
+#define HAVE_AFAX25 0
+#define HAVE_AFNETROM 1
+#define HAVE_AFROSE 0
+#define HAVE_AFX25 0
+#define HAVE_AFECONET 0
+#define HAVE_AFDECnet 0
+#define HAVE_AFASH 0
+#define HAVE_AFBLUETOOTH 0
+
+/*
+ *
+ * Device Hardware types.
+ *
+ */
+#define HAVE_HWETHER 1
+#define HAVE_HWARC 1
+#define HAVE_HWSLIP 1
+#define HAVE_HWPPP 1
+#define HAVE_HWTUNNEL 1
+#define HAVE_HWSTRIP 0
+#define HAVE_HWTR 0
+#define HAVE_HWAX25 0
+#define HAVE_HWROSE 0
+#define HAVE_HWNETROM 1
+#define HAVE_HWX25 0
+#define HAVE_HWFR 1
+#define HAVE_HWSIT 1
+#define HAVE_HWFDDI 0
+#define HAVE_HWHIPPI 0
+#define HAVE_HWASH 0
+#define HAVE_HWHDLCLAPB 0
+#define HAVE_HWIRDA 1
+#define HAVE_HWEC 0
+#define HAVE_HWEC 0
+#define HAVE_HWEUI64 1
+#define HAVE_HWIB 1
+
+/*
+ *
+ * Other Features.
+ *
+ */
+#define HAVE_FW_MASQUERADE 0
+#define HAVE_IP_TOOLS 0
+#define HAVE_MII 0
+#define HAVE_SELINUX 0
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/default.nix
new file mode 100644
index 000000000000..9095b652b42b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "net-tools";
+ version = "1.60_p20180626073013";
+
+ src = fetchurl {
+ url = "mirror://gentoo/distfiles/${pname}-${version}.tar.xz";
+ sha256 = "0mzsjjmz5kn676w2glmxwwd8bj0xy9dhhn21aplb435b767045q4";
+ };
+
+ preBuild =
+ ''
+ cp ${./config.h} config.h
+ '';
+
+ makeFlags = [
+ "CC=${stdenv.cc.targetPrefix}cc"
+ "AR=${stdenv.cc.targetPrefix}ar"
+ "BASEDIR=$(out)"
+ "mandir=/share/man"
+ "HAVE_ARP_TOOLS=1"
+ "HAVE_PLIP_TOOLS=1"
+ "HAVE_SERIAL_TOOLS=1"
+ "HAVE_HOSTNAME_TOOLS=1"
+ "HAVE_HOSTNAME_SYMLINKS=1"
+ ];
+
+ meta = {
+ homepage = "http://net-tools.sourceforge.net/";
+ description = "A set of tools for controlling the network subsystem in Linux";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/mptcp.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/mptcp.nix
new file mode 100644
index 000000000000..6e798e6807d7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/net-tools/mptcp.nix
@@ -0,0 +1,21 @@
+{ stdenv, nettools, fetchFromGitHub }:
+
+nettools.overrideAttrs(oa: rec {
+ name = "net-tools-mptcp";
+ version = "0.95";
+
+ src = fetchFromGitHub {
+ owner = "multipath-tcp";
+ repo = "net-tools";
+ rev = "mptcp_v${version}";
+ sha256 = "0i7gr1y699nc7j9qllsx8kicqkpkhw51x4chcmyl5xs06b2mdjri";
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/multipath-tcp/net-tools";
+ description = "A set of tools for controlling the network subsystem in Linux";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ teto ];
+ };
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/netatop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/netatop/default.nix
new file mode 100644
index 000000000000..e433fd1e9f33
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/netatop/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, kernel, zlib }:
+
+let
+ version = "3.1";
+in
+
+stdenv.mkDerivation {
+ name = "netatop-${kernel.version}-${version}";
+
+ src = fetchurl {
+ url = "http://www.atoptool.nl/download/netatop-${version}.tar.gz";
+ sha256 = "0qjw8glfdmngfvbn1w63q128vxdz2jlabw13y140ga9i5ibl6vvk";
+ };
+
+ buildInputs = [ zlib ];
+
+ hardeningDisable = [ "pic" ];
+
+ preConfigure = ''
+ patchShebangs mkversion
+ sed -i -e 's,^KERNDIR.*,KERNDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build,' \
+ */Makefile
+ sed -i -e 's,/lib/modules.*extra,'$out'/lib/modules/${kernel.modDirVersion}/extra,' \
+ -e s,/usr,$out, \
+ -e /init.d/d \
+ -e /depmod/d \
+ -e /netatop.service/d \
+ Makefile
+ '';
+
+ preInstall = ''
+ mkdir -p $out/bin $out/sbin $out/share/man/man{4,8}
+ mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra
+ '';
+
+ meta = {
+ description = "Network monitoring module for atop";
+ homepage = "https://www.atoptool.nl/downloadnetatop.php";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [viric];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nfs-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nfs-utils/default.nix
new file mode 100644
index 000000000000..81ec7e5a661e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nfs-utils/default.nix
@@ -0,0 +1,131 @@
+{ stdenv, fetchurl, fetchpatch, lib, pkgconfig, utillinux, libcap, libtirpc, libevent
+, sqlite, kerberos, kmod, libuuid, keyutils, lvm2, systemd, coreutils, tcp_wrappers
+, python3, buildPackages, nixosTests, rpcsvc-proto
+, enablePython ? true
+}:
+
+let
+ statdPath = lib.makeBinPath [ systemd utillinux coreutils ];
+in
+
+stdenv.mkDerivation rec {
+ pname = "nfs-utils";
+ version = "2.5.1";
+
+ src = fetchurl {
+ url = "https://kernel.org/pub/linux/utils/nfs-utils/${version}/${pname}-${version}.tar.xz";
+ sha256 = "1i1h3n2m35q9ixs1i2qf1rpjp10cipa3c25zdf1xj1vaw5q8270g";
+ };
+
+ # libnfsidmap is built together with nfs-utils from the same source,
+ # put it in the "lib" output, and the headers in "dev"
+ outputs = [ "out" "dev" "lib" "man" ];
+
+ nativeBuildInputs = [ pkgconfig buildPackages.stdenv.cc rpcsvc-proto ];
+
+ buildInputs = [
+ libtirpc libcap libevent sqlite lvm2
+ libuuid keyutils kerberos tcp_wrappers
+ ] ++ lib.optional enablePython python3;
+
+ enableParallelBuilding = true;
+
+ preConfigure =
+ ''
+ substituteInPlace configure \
+ --replace '$dir/include/gssapi' ${lib.getDev kerberos}/include/gssapi \
+ --replace '$dir/bin/krb5-config' ${lib.getDev kerberos}/bin/krb5-config
+ '';
+
+ configureFlags =
+ [ "--enable-gss"
+ "--enable-svcgss"
+ "--with-statedir=/var/lib/nfs"
+ "--with-krb5=${lib.getLib kerberos}"
+ "--with-systemd=${placeholder "out"}/etc/systemd/system"
+ "--enable-libmount-mount"
+ "--with-pluginpath=${placeholder "lib"}/lib/libnfsidmap" # this installs libnfsidmap
+ "--with-rpcgen=${rpcsvc-proto}/bin/rpcgen"
+ ];
+
+ patches = lib.optionals stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/alpinelinux/aports/cb880042d48d77af412d4688f24b8310ae44f55f/main/nfs-utils/0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch";
+ sha256 = "0rrddrykz8prk0dcgfvmnz0vxn09dbgq8cb098yjjg19zz6d7vid";
+ })
+ # http://openwall.com/lists/musl/2015/08/18/10
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/alpinelinux/aports/cb880042d48d77af412d4688f24b8310ae44f55f/main/nfs-utils/musl-getservbyport.patch";
+ sha256 = "1fqws9dz8n1d9a418c54r11y3w330qgy2652dpwcy96cm44sqyhf";
+ })
+ ];
+
+ postPatch =
+ ''
+ patchShebangs tests
+ sed -i "s,/usr/sbin,$out/bin,g" utils/statd/statd.c
+ sed -i "s,^PATH=.*,PATH=$out/bin:${statdPath}," utils/statd/start-statd
+
+ configureFlags="--with-start-statd=$out/bin/start-statd $configureFlags"
+
+ substituteInPlace systemd/nfs-utils.service \
+ --replace "/bin/true" "${coreutils}/bin/true"
+
+ substituteInPlace utils/mount/Makefile.in \
+ --replace "chmod 4511" "chmod 0511"
+
+ sed '1i#include <stdint.h>' -i support/nsm/rpc.c
+ '';
+
+ makeFlags = [
+ "sbindir=$(out)/bin"
+ "generator_dir=$(out)/etc/systemd/system-generators"
+ ];
+
+ installFlags = [
+ "statedir=$(TMPDIR)"
+ "statdpath=$(TMPDIR)"
+ ];
+
+ stripDebugList = [ "lib" "libexec" "bin" "etc/systemd/system-generators" ];
+
+ postInstall =
+ ''
+ # Not used on NixOS
+ sed -i \
+ -e "s,/sbin/modprobe,${kmod}/bin/modprobe,g" \
+ -e "s,/usr/sbin,$out/bin,g" \
+ $out/etc/systemd/system/*
+ '' + lib.optionalString (!enablePython) ''
+ # Remove all scripts that require python (currently mountstats and nfsiostat)
+ grep -l /usr/bin/python $out/bin/* | xargs -I {} rm -v {}
+ '';
+
+ # One test fails on mips.
+ # doCheck = !stdenv.isMips;
+ # https://bugzilla.kernel.org/show_bug.cgi?id=203793
+ doCheck = false;
+
+ disallowedReferences = [ (lib.getDev kerberos) ];
+
+ passthru.tests = {
+ nfs3-simple = nixosTests.nfs3.simple;
+ nfs4-simple = nixosTests.nfs4.simple;
+ nfs4-kerberos = nixosTests.nfs4.kerberos;
+ };
+
+ meta = with stdenv.lib; {
+ description = "Linux user-space NFS utilities";
+
+ longDescription = ''
+ This package contains various Linux user-space Network File
+ System (NFS) utilities, including RPC `mount' and `nfs'
+ daemons.
+ '';
+
+ homepage = "https://linux-nfs.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nftables/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nftables/default.nix
new file mode 100644
index 000000000000..9ec42ad66b06
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nftables/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, pkgconfig, bison, file, flex
+, asciidoc, libxslt, findXMLCatalogs, docbook_xml_dtd_45, docbook_xsl
+, libmnl, libnftnl, libpcap
+, gmp, jansson, readline
+, withDebugSymbols ? false
+, withPython ? false , python3
+, withXtables ? false , iptables
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ version = "0.9.6";
+ pname = "nftables";
+
+ src = fetchurl {
+ url = "https://netfilter.org/projects/nftables/files/${pname}-${version}.tar.bz2";
+ sha256 = "0vmn6xwqa1nq6crfxshh049b199d0aj6hfgin7k068xhibzgvmk8";
+ };
+
+ nativeBuildInputs = [
+ pkgconfig bison file flex
+ asciidoc docbook_xml_dtd_45 docbook_xsl findXMLCatalogs libxslt
+ ];
+
+ buildInputs = [
+ libmnl libnftnl libpcap
+ gmp jansson readline
+ ] ++ optional withXtables iptables
+ ++ optional withPython python3;
+
+ preConfigure = ''
+ substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file
+ '';
+
+ configureFlags = [
+ "--with-json"
+ ] ++ optional (!withDebugSymbols) "--disable-debug"
+ ++ optional (!withPython) "--disable-python"
+ ++ optional withPython "--enable-python"
+ ++ optional withXtables "--with-xtables";
+
+ meta = {
+ description = "The project that aims to replace the existing {ip,ip6,arp,eb}tables framework";
+ homepage = "https://netfilter.org/projects/nftables/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nmon/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nmon/default.nix
new file mode 100644
index 000000000000..9de18401d7b2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nmon/default.nix
@@ -0,0 +1,27 @@
+{ fetchurl, stdenv, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "nmon";
+ version = "16m";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/nmon/lmon${version}.c";
+ sha256 = "1hazgrq3m01dzv05639yis1mypcp0jf167n9gqwd3wgxzm2lvv9b";
+ };
+
+ buildInputs = [ ncurses ];
+ dontUnpack = true;
+ buildPhase = "cc -o nmon ${src} -g -O2 -D JFS -D GETUSER -Wall -D LARGEMEM -lncurses -lm -g -D X86";
+ installPhase = ''
+ mkdir -p $out/bin
+ cp nmon $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "AIX & Linux Performance Monitoring tool";
+ homepage = "http://nmon.sourceforge.net";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ sveitser ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/crashes.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/crashes.patch
new file mode 100644
index 000000000000..48250141e82a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/crashes.patch
@@ -0,0 +1,104 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=488857
+
+
+Distinguish between contexts that are somewhat persistent and one-offs
+which are used to fulfill part of a larger request.
+
+diff -up nss_ldap-253/ldap-grp.c nss_ldap-253/ldap-grp.c
+--- nss_ldap-253/ldap-grp.c 2009-05-08 13:30:43.000000000 -0400
++++ nss_ldap-253/ldap-grp.c 2009-05-08 13:34:41.000000000 -0400
+@@ -857,7 +857,7 @@ ng_chase (const char *dn, ldap_initgroup
+ LA_STRING (a) = dn;
+ LA_TYPE (a) = LA_TYPE_STRING;
+
+- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
++ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
+ {
+ return NSS_UNAVAIL;
+ }
+@@ -930,7 +930,7 @@ ng_chase_backlink (const char ** members
+ LA_STRING_LIST (a) = filteredMembersOf;
+ LA_TYPE (a) = LA_TYPE_STRING_LIST_OR;
+
+- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
++ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
+ {
+ free (filteredMembersOf);
+ return NSS_UNAVAIL;
+diff -up nss_ldap-253/ldap-netgrp.c nss_ldap-253/ldap-netgrp.c
+--- nss_ldap-253/ldap-netgrp.c 2009-05-08 13:31:35.000000000 -0400
++++ nss_ldap-253/ldap-netgrp.c 2009-05-08 13:33:14.000000000 -0400
+@@ -691,7 +691,7 @@ do_innetgr_nested (ldap_innetgr_args_t *
+ LA_TYPE (a) = LA_TYPE_STRING;
+ LA_STRING (a) = nested; /* memberNisNetgroup */
+
+- if (_nss_ldap_ent_context_init_locked (&ctx) == NULL)
++ if (_nss_ldap_ent_context_init_internal_locked (&ctx) == NULL)
+ {
+ debug ("<== do_innetgr_nested: failed to initialize context");
+ return NSS_UNAVAIL;
+diff -up nss_ldap-253/ldap-nss.c nss_ldap-253/ldap-nss.c
+--- nss_ldap-253/ldap-nss.c 2009-05-08 13:27:17.000000000 -0400
++++ nss_ldap-253/ldap-nss.c 2009-05-08 14:05:51.000000000 -0400
+@@ -1961,6 +1961,7 @@ _nss_ldap_ent_context_init_locked (ent_c
+ debug ("<== _nss_ldap_ent_context_init_locked");
+ return NULL;
+ }
++ ctx->ec_internal = 0;
+ *pctx = ctx;
+ }
+ else
+@@ -1990,6 +1991,15 @@ _nss_ldap_ent_context_init_locked (ent_c
+
+ return ctx;
+ }
++ent_context_t *
++_nss_ldap_ent_context_init_internal_locked (ent_context_t ** pctx)
++{
++ ent_context_t *ctx;
++ ctx = _nss_ldap_ent_context_init_locked (pctx);
++ if (ctx != NULL)
++ ctx->ec_internal = 1;
++ return ctx;
++}
+
+ /*
+ * Clears a given context; we require the caller
+@@ -2031,7 +2041,8 @@ _nss_ldap_ent_context_release (ent_conte
+
+ LS_INIT (ctx->ec_state);
+
+- if (_nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT))
++ if (!ctx->ec_internal &&
++ _nss_ldap_test_config_flag (NSS_LDAP_FLAGS_CONNECT_POLICY_ONESHOT))
+ {
+ do_close ();
+ }
+diff -up nss_ldap-253/ldap-nss.h nss_ldap-253/ldap-nss.h
+--- nss_ldap-253/ldap-nss.h 2009-05-08 13:35:47.000000000 -0400
++++ nss_ldap-253/ldap-nss.h 2009-05-08 13:52:25.000000000 -0400
+@@ -560,6 +560,8 @@ struct ent_context
+ ldap_state_t ec_state; /* eg. for services */
+ int ec_msgid; /* message ID */
+ LDAPMessage *ec_res; /* result chain */
++ int ec_internal; /* this context is just a part of a larger
++ * query for information */
+ ldap_service_search_descriptor_t *ec_sd; /* current sd */
+ struct berval *ec_cookie; /* cookie for paged searches */
+ };
+@@ -744,6 +746,15 @@ ent_context_t *_nss_ldap_ent_context_ini
+ ent_context_t *_nss_ldap_ent_context_init_locked (ent_context_t **);
+
+ /*
++ * _nss_ldap_ent_context_init_internal_locked() has the same
++ * behaviour, except it marks the context as one that's being
++ * used to fetch additional data used in answering a request, i.e.
++ * that this isn't the "main" context
++ */
++
++ent_context_t *_nss_ldap_ent_context_init_internal_locked (ent_context_t **);
++
++/*
+ * _nss_ldap_ent_context_release() is used to manually free a context
+ */
+ void _nss_ldap_ent_context_release (ent_context_t *);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix
new file mode 100644
index 000000000000..74369060ba9f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix
@@ -0,0 +1,38 @@
+{stdenv, fetchurl, openldap, perl}:
+
+stdenv.mkDerivation {
+ name = "nss_ldap-265";
+
+ src = fetchurl {
+ url = "http://www.padl.com/download/nss_ldap-265.tar.gz";
+ sha256 = "1a16q9p97d2blrj0h6vl1xr7dg7i4s8x8namipr79mshby84vdbp";
+ };
+
+ preConfigure = ''
+ patchShebangs ./vers_string
+ sed -i s,vers_string,./vers_string, Makefile*
+ substituteInPlace vers_string --replace "cvslib.pl" "./cvslib.pl"
+ '';
+
+ patches = [ ./crashes.patch ];
+
+ postPatch = ''
+ patch -p0 < ${./nss_ldap-265-glibc-2.16.patch}
+ '';
+
+ preInstall = ''
+ installFlagsArray=(INST_UID=$(id -u) INST_GID=$(id -g) LIBC_VERS=2.5 NSS_VERS=2 NSS_LDAP_PATH_CONF=$out/etc/ldap.conf)
+ substituteInPlace Makefile \
+ --replace '/usr$(libdir)' $TMPDIR \
+ --replace 'install-data-local:' 'install-data-local-disabled:'
+ mkdir -p $out/etc
+ '';
+
+ buildInputs = [ openldap perl ];
+
+ meta = with stdenv.lib; {
+ description = "LDAP module for the Solaris Nameservice Switch (NSS)";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/nss_ldap-265-glibc-2.16.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/nss_ldap-265-glibc-2.16.patch
new file mode 100644
index 000000000000..8b0b9289327a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nss_ldap/nss_ldap-265-glibc-2.16.patch
@@ -0,0 +1,139 @@
+https://github.com/archlinuxarm/PKGBUILDs/issues/296
+
+Fixes the bug causing a segfault on nscd and sshd:
+symbol lookup error: /usr/lib/libnss_ldap.so.2: undefined symbol: __libc_lock_lock
+
+--- ldap-nss.c.orig 2012-10-17 12:32:03.908730283 +0000
++++ ldap-nss.c 2012-10-17 12:38:10.906767283 +0000
+@@ -148,7 +148,7 @@
+ */
+ static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED };
+
+-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
+ static pthread_once_t __once = PTHREAD_ONCE_INIT;
+ #endif
+
+@@ -168,7 +168,7 @@
+ static int __ssl_initialized = 0;
+ #endif /* HAVE_LDAPSSL_CLIENT_INIT */
+
+-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
+ /*
+ * Prepare for fork(); lock mutex.
+ */
+@@ -519,7 +519,7 @@
+ }
+ #endif /* HAVE_NSSWITCH_H */
+
+-#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
+ static void
+ do_atfork_prepare (void)
+ {
+@@ -553,7 +553,7 @@
+ #ifdef HAVE_PTHREAD_ATFORK
+ (void) pthread_atfork (do_atfork_prepare, do_atfork_parent,
+ do_atfork_child);
+-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#elif defined(HAVE___LIBC_ATFORK)
+ (void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child);
+ #endif
+
+@@ -1119,7 +1119,7 @@
+ }
+
+ #ifndef HAVE_PTHREAD_ATFORK
+-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#if defined(HAVE___LIBC_ONCE)
+ /*
+ * This bogosity is necessary because Linux uses different
+ * PIDs for different threads (like IRIX, which we don't
+@@ -1151,7 +1151,7 @@
+ pid = -1; /* linked against libpthreads, don't care */
+ #else
+ pid = getpid ();
+-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
++#endif /* HAVE___LIBC_ONCE */
+ #endif /* HAVE_PTHREAD_ATFORK */
+
+ euid = geteuid ();
+@@ -1161,7 +1161,7 @@
+ syslog (LOG_DEBUG,
+ "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i",
+ __session.ls_state, __session.ls_conn, __euid, euid);
+-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#elif defined(HAVE___LIBC_ONCE)
+ syslog (LOG_DEBUG,
+ "nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
+ ((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"),
+@@ -1185,11 +1185,11 @@
+ }
+ else
+ #ifndef HAVE_PTHREAD_ATFORK
+-#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#if defined(HAVE___LIBC_ONCE)
+ if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid)
+ #else
+ if (__pid != pid)
+-#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
++#endif /* HAVE___LIBC_ONCE */
+ {
+ do_close_no_unbind ();
+ }
+@@ -1250,9 +1250,9 @@
+ debug ("<== do_init (pthread_once failed)");
+ return NSS_UNAVAIL;
+ }
+-#elif defined(HAVE_PTHREAD_ATFORK) && ( defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) )
++#elif defined(HAVE_PTHREAD_ATFORK) && defined(HAVE___LIBC_ONCE)
+ __libc_once (__once, do_atfork_setup);
+-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#elif defined(HAVE___LIBC_ONCE)
+ /*
+ * Only install the pthread_atfork() handlers i
+ * we are linked against libpthreads. Otherwise,
+--- ldap-nss.h.orig 2012-10-17 12:33:05.681379283 +0000
++++ ldap-nss.h 2012-10-17 12:34:06.337050753 +0000
+@@ -671,7 +671,7 @@
+ #define NSS_LDAP_LOCK(m) mutex_lock(&m)
+ #define NSS_LDAP_UNLOCK(m) mutex_unlock(&m)
+ #define NSS_LDAP_DEFINE_LOCK(m) static mutex_t m = DEFAULTMUTEX
+-#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
++#elif defined(HAVE___LIBC_LOCK_LOCK) && defined(HAVE___LIBC_LOCK_UNLOCK)
+ #define NSS_LDAP_LOCK(m) __libc_lock_lock(m)
+ #define NSS_LDAP_UNLOCK(m) __libc_lock_unlock(m)
+ #define NSS_LDAP_DEFINE_LOCK(m) static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER
+--- ldap-nss.c.orig 2012-10-17 12:58:20.270783283 +0000
++++ ldap-nss.c 2012-10-17 12:58:43.699267283 +0000
+@@ -156,7 +156,7 @@
+ static FILE *__debugfile;
+ #endif /* LBER_OPT_LOG_PRINT_FILE */
+
+-#ifndef HAVE_PTHREAD_ATFORK
++#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE)
+ /*
+ * Process ID that opened the session.
+ */
+--- configure.in.orig 2012-10-17 12:59:31.707235283 +0000
++++ configure.in 2012-10-17 13:00:15.854289283 +0000
+@@ -255,6 +255,7 @@
+ AC_CHECK_FUNCS(pthread_once)
+ AC_CHECK_FUNCS(ether_aton)
+ AC_CHECK_FUNCS(ether_ntoa)
++AC_CHECK_FUNCS(__libc_once __libc_atfork __libc_lock_lock __libc_lock_unlock)
+
+ AC_MSG_CHECKING(for struct ether_addr)
+ AC_TRY_COMPILE([#include <sys/types.h>
+--- ldap-nss.c.orig 2012-10-17 13:02:01.418010283 +0000
++++ ldap-nss.c 2012-10-17 13:03:25.017240283 +0000
+@@ -1102,7 +1102,7 @@
+ do_init (void)
+ {
+ ldap_config_t *cfg;
+-#ifndef HAVE_PTHREAD_ATFORK
++#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE)
+ pid_t pid;
+ #endif
+ uid_t euid;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numactl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numactl/default.nix
new file mode 100644
index 000000000000..6e16ecabba2d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numactl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ pname = "numactl";
+ version = "2.0.14";
+
+ src = fetchFromGitHub {
+ owner = pname;
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "0hahpdp5xqy9cbg251bdxqkml341djn2h856g435h4ngz63sr9fs";
+ };
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ postPatch = ''
+ patchShebangs test
+ '';
+
+ # You probably shouldn't ever run these! They will reconfigure Linux
+ # NUMA settings, which on my build machine makes the rest of package
+ # building ~5% slower until reboot. Ugh!
+ doCheck = false; # never ever!
+
+ meta = with stdenv.lib; {
+ description = "Library and tools for non-uniform memory access (NUMA) machines";
+ homepage = "https://github.com/numactl/numactl";
+ license = with licenses; [ gpl2 lgpl21 ]; # libnuma is lgpl21
+ platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/default.nix
new file mode 100644
index 000000000000..47af20152db9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "numad-0.5";
+
+ src = fetchurl {
+ url = "https://git.fedorahosted.org/cgit/numad.git/snapshot/${name}.tar.xz";
+ sha256 = "08zd1yc3w00yv4mvvz5sq1gf91f6p2s9ljcd72m33xgnkglj60v4";
+ };
+
+ hardeningDisable = [ "format" ];
+
+ patches = [
+ ./numad-linker-flags.patch
+ ];
+ postPatch = ''
+ substituteInPlace Makefile --replace "install -m" "install -Dm"
+ '';
+
+ makeFlags = [ "prefix=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "A user-level daemon that monitors NUMA topology and processes resource consumption to facilitate good NUMA resource access";
+ homepage = "https://fedoraproject.org/wiki/Features/numad";
+ license = licenses.lgpl21;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ domenkozar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/numad-linker-flags.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/numad-linker-flags.patch
new file mode 100644
index 000000000000..97f3dc8b6cf7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numad/numad-linker-flags.patch
@@ -0,0 +1,33 @@
+From 9eb3cc5c51d846c8c8b750a4eb55545d7b5fea6c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 23 Apr 2014 15:41:26 -0400
+Subject: [PATCH] use LDLIBS for linker flags
+
+When you put -lfoo into the dependency line of make, it forces it to
+search /lib and /usr/lib for files to link against. This can cause
+problems when trying to cross-compile or build for different ABIs.
+Use the standard LDLIBS variable instead.
+
+URL: https://bugs.gentoo.org/505760
+Reported-by: Georgi Georgiev <chutzimir@gmail.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index f3838b4..f2e9a6e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -31,7 +31,8 @@ docdir := ${prefix}/share/doc
+
+ all: numad
+
+-numad: numad.o -lpthread
++LDLIBS := -lpthread
++numad: numad.o
+
+ AR ?= ar
+ RANLIB ?= ranlib
+--
+1.9.2
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numatop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numatop/default.nix
new file mode 100644
index 000000000000..57ee511bbadc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numatop/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, pkgconfig, numactl, ncurses, check }:
+
+stdenv.mkDerivation rec {
+ pname = "numatop";
+ version = "2.1";
+ src = fetchurl {
+ url = "https://github.com/intel/${pname}/releases/download/v${version}/${pname}-v${version}.tar.xz";
+ sha256 = "1s7psq1xyswj0lpx10zg5lnppav2xy9safkfx3rssrs9c2fp5d76";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ numactl ncurses ];
+ checkInputs = [ check ];
+
+ doCheck = true;
+
+ meta = with stdenv.lib; {
+ description = "Tool for runtime memory locality characterization and analysis of processes and threads on a NUMA system";
+ homepage = "https://01.org/numatop";
+ license = licenses.bsd3;
+ maintainers = with maintainers; [ dtzWill ];
+ platforms = [
+ { kernel.name = "linux"; cpu.family = "x86"; }
+ { kernel.name = "linux"; cpu.family = "power"; }
+ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/50-numworks-calculator.rules b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/50-numworks-calculator.rules
new file mode 100644
index 000000000000..ab07de99718b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/50-numworks-calculator.rules
@@ -0,0 +1,2 @@
+SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="a291", TAG+="uaccess"
+SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="df11", TAG+="uaccess"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/default.nix
new file mode 100644
index 000000000000..4a123b202730
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "numworks-udev-rules";
+ version = "unstable-2020-08-31";
+
+ udevRules = ./50-numworks-calculator.rules;
+ dontUnpack = true;
+
+ installPhase = ''
+ install -Dm 644 "${udevRules}" "$out/lib/udev/rules.d/50-numworks-calculator.rules"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Udev rules for Numworks calculators";
+ homepage = "https://numworks.com";
+ license = licenses.gpl3Plus;
+ maintainers = with maintainers; [ shamilton ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/update.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/update.sh
new file mode 100755
index 000000000000..3949f6fd8f41
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/numworks-udev-rules/update.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+wget -O 50-numworks-calculator.rules "https://workshop.numworks.com/files/drivers/linux/50-numworks-calculator.rules"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/builder.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/builder.sh
new file mode 100755
index 000000000000..dbe18ace40a2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/builder.sh
@@ -0,0 +1,180 @@
+source $stdenv/setup
+
+unpackManually() {
+ skip=$(sed 's/^skip=//; t; d' $src)
+ tail -n +$skip $src | xz -d | tar xvf -
+ sourceRoot=.
+}
+
+
+unpackFile() {
+ sh $src -x || unpackManually
+}
+
+
+buildPhase() {
+ if [ -n "$bin" ]; then
+ # Create the module.
+ echo "Building linux driver against kernel: $kernel";
+ cd kernel
+ sysSrc=$(echo $kernel/lib/modules/$kernelVersion/source)
+ sysOut=$(echo $kernel/lib/modules/$kernelVersion/build)
+ unset src # used by the nv makefile
+ make SYSSRC=$sysSrc SYSOUT=$sysOut module -j$NIX_BUILD_CORES
+
+ cd ..
+ fi
+}
+
+
+installPhase() {
+ # Install libGL and friends.
+
+ # since version 391, 32bit libraries are bundled in the 32/ sub-directory
+ if [ "$i686bundled" = "1" ]; then
+ mkdir -p "$lib32/lib"
+ cp -prd 32/*.so.* "$lib32/lib/"
+ if [ -d 32/tls ]; then
+ cp -prd 32/tls "$lib32/lib/"
+ fi
+ fi
+
+ mkdir -p "$out/lib"
+ cp -prd *.so.* "$out/lib/"
+ if [ -d tls ]; then
+ cp -prd tls "$out/lib/"
+ fi
+
+ # Install systemd power management executables
+ if [ -e nvidia-sleep.sh ]; then
+ sed -E 's#(PATH=).*#\1"$PATH"#' nvidia-sleep.sh > nvidia-sleep.sh.fixed
+ install -Dm755 nvidia-sleep.sh.fixed $out/bin/nvidia-sleep.sh
+ fi
+
+ if [ -e nvidia ]; then
+ sed -E "s#/usr(/bin/nvidia-sleep.sh)#$out\\1#" nvidia > nvidia.fixed
+ install -Dm755 nvidia.fixed $out/lib/systemd/system-sleep/nvidia
+ fi
+
+ for i in $lib32 $out; do
+ rm -f $i/lib/lib{glx,nvidia-wfb}.so.* # handled separately
+ rm -f $i/lib/libnvidia-gtk* # built from source
+ if [ "$useGLVND" = "1" ]; then
+ # Pre-built libglvnd
+ rm $i/lib/lib{GL,GLX,EGL,GLESv1_CM,GLESv2,OpenGL,GLdispatch}.so.*
+ fi
+ # Use ocl-icd instead
+ rm -f $i/lib/libOpenCL.so*
+ # Move VDPAU libraries to their place
+ mkdir $i/lib/vdpau
+ mv $i/lib/libvdpau* $i/lib/vdpau
+
+ # Install ICDs, make absolute paths.
+ # Be careful not to modify any original files because this runs twice.
+
+ # OpenCL
+ sed -E "s#(libnvidia-opencl)#$i/lib/\\1#" nvidia.icd > nvidia.icd.fixed
+ install -Dm644 nvidia.icd.fixed $i/etc/OpenCL/vendors/nvidia.icd
+
+ # Vulkan
+ if [ -e nvidia_icd.json.template ] || [ -e nvidia_icd.json ]; then
+ if [ -e nvidia_icd.json.template ]; then
+ # template patching for version < 435
+ sed "s#__NV_VK_ICD__#$i/lib/libGLX_nvidia.so#" nvidia_icd.json.template > nvidia_icd.json.fixed
+ else
+ sed -E "s#(libGLX_nvidia)#$i/lib/\\1#" nvidia_icd.json > nvidia_icd.json.fixed
+ fi
+ install -Dm644 nvidia_icd.json.fixed $i/share/vulkan/icd.d/nvidia.json
+ fi
+ if [ -e nvidia_layers.json ]; then
+ sed -E "s#(libGLX_nvidia)#$i/lib/\\1#" nvidia_layers.json > nvidia_layers.json.fixed
+ install -Dm644 nvidia_layers.json.fixed $i/share/vulkan/implicit_layer.d/nvidia_layers.json
+ fi
+
+ # EGL
+ if [ "$useGLVND" = "1" ]; then
+ sed -E "s#(libEGL_nvidia)#$i/lib/\\1#" 10_nvidia.json > 10_nvidia.json.fixed
+ sed -E "s#(libnvidia-egl-wayland)#$i/lib/\\1#" 10_nvidia_wayland.json > 10_nvidia_wayland.json.fixed
+
+ install -Dm644 10_nvidia.json.fixed $i/share/glvnd/egl_vendor.d/nvidia.json
+ install -Dm644 10_nvidia_wayland.json.fixed $i/share/glvnd/egl_vendor.d/nvidia_wayland.json
+ fi
+
+ done
+
+ if [ -n "$bin" ]; then
+ # Install the X drivers.
+ mkdir -p $bin/lib/xorg/modules
+ if [ -f libnvidia-wfb.so ]; then
+ cp -p libnvidia-wfb.* $bin/lib/xorg/modules/
+ fi
+ mkdir -p $bin/lib/xorg/modules/drivers
+ cp -p nvidia_drv.so $bin/lib/xorg/modules/drivers
+ mkdir -p $bin/lib/xorg/modules/extensions
+ cp -p libglx*.so* $bin/lib/xorg/modules/extensions
+
+ # Install the kernel module.
+ mkdir -p $bin/lib/modules/$kernelVersion/misc
+ for i in $(find ./kernel -name '*.ko'); do
+ nuke-refs $i
+ cp $i $bin/lib/modules/$kernelVersion/misc/
+ done
+
+ # Install application profiles.
+ if [ "$useProfiles" = "1" ]; then
+ mkdir -p $bin/share/nvidia
+ cp nvidia-application-profiles-*-rc $bin/share/nvidia/nvidia-application-profiles-rc
+ cp nvidia-application-profiles-*-key-documentation $bin/share/nvidia/nvidia-application-profiles-key-documentation
+ fi
+ fi
+
+ # All libs except GUI-only are installed now, so fixup them.
+ for libname in $(find "$out/lib/" $(test -n "$lib32" && echo "$lib32/lib/") $(test -n "$bin" && echo "$bin/lib/") -name '*.so.*')
+ do
+ # I'm lazy to differentiate needed libs per-library, as the closure is the same.
+ # Unfortunately --shrink-rpath would strip too much.
+ if [[ -n $lib32 && $libname == "$lib32/lib/"* ]]; then
+ patchelf --set-rpath "$lib32/lib:$libPath32" "$libname"
+ else
+ patchelf --set-rpath "$out/lib:$libPath" "$libname"
+ fi
+
+ libname_short=`echo -n "$libname" | sed 's/so\..*/so/'`
+
+ if [[ "$libname" != "$libname_short" ]]; then
+ ln -srnf "$libname" "$libname_short"
+ fi
+
+ if [[ $libname_short =~ libEGL.so || $libname_short =~ libEGL_nvidia.so || $libname_short =~ libGLX.so || $libname_short =~ libGLX_nvidia.so ]]; then
+ major=0
+ else
+ major=1
+ fi
+
+ if [[ "$libname" != "$libname_short.$major" ]]; then
+ ln -srnf "$libname" "$libname_short.$major"
+ fi
+ done
+
+ if [ -n "$bin" ]; then
+ # Install /share files.
+ mkdir -p $bin/share/man/man1
+ cp -p *.1.gz $bin/share/man/man1
+ rm -f $bin/share/man/man1/{nvidia-xconfig,nvidia-settings,nvidia-persistenced}.1.gz
+
+ # Install the programs.
+ for i in nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-smi nvidia-debugdump; do
+ if [ -e "$i" ]; then
+ install -Dm755 $i $bin/bin/$i
+ # unmodified binary backup for mounting in containers
+ install -Dm755 $i $bin/origBin/$i
+ patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+ --set-rpath $out/lib:$libPath $bin/bin/$i
+ fi
+ done
+ # FIXME: needs PATH and other fixes
+ # install -Dm755 nvidia-bug-report.sh $bin/bin/nvidia-bug-report.sh
+ fi
+}
+
+genericBuild
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix
new file mode 100644
index 000000000000..7c37fcf231fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -0,0 +1,93 @@
+{ lib, callPackage, fetchpatch, fetchurl, stdenv }:
+
+let
+
+generic = args:
+if ((!lib.versionOlder args.version "391")
+ && stdenv.hostPlatform.system != "x86_64-linux") then null
+ else callPackage (import ./generic.nix args) { };
+ kernel = callPackage # a hacky way of extracting parameters from callPackage
+ ({ kernel, libsOnly ? false }: if libsOnly then { } else kernel) { };
+
+ maybePatch_drm_legacy =
+ lib.optional (lib.versionOlder "4.14" (kernel.version or "0"))
+ (fetchurl {
+ url = "https://raw.githubusercontent.com/MilhouseVH/LibreELEC.tv/b5d2d6a1"
+ + "/packages/x11/driver/xf86-video-nvidia-legacy/patches/"
+ + "xf86-video-nvidia-legacy-0010-kernel-4.14.patch";
+ sha256 = "18clfpw03g8dxm61bmdkmccyaxir3gnq451z6xqa2ilm3j820aa5";
+ });
+in
+rec {
+ # Policy: use the highest stable version as the default (on our master).
+ stable = if stdenv.hostPlatform.system == "x86_64-linux"
+ then generic {
+ version = "450.66";
+ sha256_64bit = "1a6va0gvbzpkyza693v2ml1is4xbv8wxasqk0zd5y7rxin94c1ms";
+ settingsSha256 = "0mkgs91gx7xb7f24xkq9fl7i8d4l7s0wr9a44b1gm1vkw82fm7lj";
+ persistencedSha256 = "02id8cg8fba7c1j4m6vj4gp2mv39lz2k557kdjw8lszcpw6f1fhh";
+ }
+ else legacy_390;
+
+ # No active beta right now
+ beta = stable;
+
+ # Vulkan developer beta driver
+ vulkan_beta = generic {
+ version = "450.56.11";
+ persistencedVersion = "450.57";
+ settingsVersion = "450.57";
+ sha256_64bit = "1k64h8sp4rf6kc7liypznjgkmxi67njy1s8xy2r341fhl62pl010";
+ settingsSha256 = "1clbj9a3kv3j8jg35c197gd7b3f9f9f4h9ll5hlax95hdg12lgan";
+ persistencedSha256 = "17747z1fsbiznfsmahxmz8kmhwwcjanpfih60v5mwzk63gy4i3d5";
+ url = "https://developer.nvidia.com/vulkan-beta-4505611-linux";
+ };
+
+ # Last one supporting x86
+ legacy_390 = generic {
+ version = "390.138";
+ sha256_32bit = "0y3qjygl0kfz9qs0rp9scn1k3l8ym9dib7wpkyh5gs4klcip7xkv";
+ sha256_64bit = "0rnnb5l4i8s76vlg6yvlrxhm2x9wdqw7k5hgf4fyaa3cr3k1kysz";
+ settingsSha256 = "0ad6hwl56nvbdv9g85lw7ywadqvc2gaq9x6d2vjcia9kg4vrmfqx";
+ persistencedSha256 = "15jciyq6i3pz1g67xzqlwmc62v3xswzhjcqmfcdndvlvhcibsimr";
+ };
+
+ legacy_340 = generic {
+ version = "340.108";
+ sha256_32bit = "1jkwa1phf0x4sgw8pvr9d6krmmr3wkgwyygrxhdazwyr2bbalci0";
+ sha256_64bit = "06xp6c0sa7v1b82gf0pq0i5p0vdhmm3v964v0ypw36y0nzqx8wf6";
+ settingsSha256 = "0zm29jcf0mp1nykcravnzb5isypm8l8mg2gpsvwxipb7nk1ivy34";
+ persistencedSha256 = "1ax4xn3nmxg1y6immq933cqzw6cj04x93saiasdc0kjlv0pvvnkn";
+ useGLVND = false;
+
+ patches = [ ./vm_operations_struct-fault.patch ];
+ };
+
+ legacy_304 = generic {
+ version = "304.137";
+ sha256_32bit = "1y34c2gvmmacxk2c72d4hsysszncgfndc4s1nzldy2q9qagkg66a";
+ sha256_64bit = "1qp3jv6279k83k3z96p6vg3dd35y9bhmlyyyrkii7sib7bdmc7zb";
+ settingsSha256 = "129f0j0hxzjd7g67qwxn463rxp295fsq8lycwm6272qykmab46cj";
+ persistencedSha256 = null;
+ useGLVND = false;
+ useProfiles = false;
+ settings32Bit = true;
+
+ prePatch = let
+ debPatches = fetchurl {
+ url = "mirror://debian/pool/non-free/n/nvidia-graphics-drivers-legacy-304xx/"
+ + "nvidia-graphics-drivers-legacy-304xx_304.137-5.debian.tar.xz";
+ sha256 = "0n8512mfcnvklfbg8gv4lzbkm3z6nncwj6ix2b8ngdkmc04f3b6l";
+ };
+ prefix = "debian/module/debian/patches";
+ applyPatches = pnames: if pnames == [] then null else
+ ''
+ tar xf '${debPatches}'
+ sed 's|^\([+-]\{3\} [ab]\)/|\1/kernel/|' -i ${prefix}/*.patch
+ patches="$patches ${lib.concatMapStringsSep " " (pname: "${prefix}/${pname}.patch") pnames}"
+ '';
+ in applyPatches [ "fix-typos" ];
+ patches = maybePatch_drm_legacy;
+ broken = stdenv.lib.versionAtLeast kernel.version "4.18";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix
new file mode 100644
index 000000000000..8a9e340a20a2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -0,0 +1,109 @@
+{ version
+, url ? null
+, sha256_32bit ? null
+, sha256_64bit
+, settingsSha256
+, settingsVersion ? version
+, persistencedSha256
+, persistencedVersion ? version
+, useGLVND ? true
+, useProfiles ? true
+, preferGtk2 ? false
+, settings32Bit ? false
+
+, prePatch ? ""
+, patches ? []
+, broken ? false
+}@args:
+
+{ stdenv, callPackage, pkgs, pkgsi686Linux, fetchurl
+, kernel ? null, perl, nukeReferences
+, # Whether to build the libraries only (i.e. not the kernel module or
+ # nvidia-settings). Used to support 32-bit binaries on 64-bit
+ # Linux.
+ libsOnly ? false
+, # don't include the bundled 32-bit libraries on 64-bit platforms,
+ # even if it’s in downloaded binary
+ disable32Bit ? false
+}:
+
+with stdenv.lib;
+
+assert !libsOnly -> kernel != null;
+assert versionOlder version "391" -> sha256_32bit != null;
+assert ! versionOlder version "391" -> stdenv.hostPlatform.system == "x86_64-linux";
+
+let
+ nameSuffix = optionalString (!libsOnly) "-${kernel.version}";
+ pkgSuffix = optionalString (versionOlder version "304") "-pkg0";
+ i686bundled = versionAtLeast version "391" && !disable32Bit;
+
+ libPathFor = pkgs: pkgs.lib.makeLibraryPath [ pkgs.libdrm pkgs.xorg.libXext pkgs.xorg.libX11
+ pkgs.xorg.libXv pkgs.xorg.libXrandr pkgs.xorg.libxcb pkgs.zlib pkgs.stdenv.cc.cc ];
+
+ self = stdenv.mkDerivation {
+ name = "nvidia-x11-${version}${nameSuffix}";
+
+ builder = ./builder.sh;
+
+ src =
+ if stdenv.hostPlatform.system == "x86_64-linux" then
+ fetchurl {
+ url = args.url or "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run";
+ sha256 = sha256_64bit;
+ }
+ else if stdenv.hostPlatform.system == "i686-linux" then
+ fetchurl {
+ url = args.url or "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run";
+ sha256 = sha256_32bit;
+ }
+ else throw "nvidia-x11 does not support platform ${stdenv.hostPlatform.system}";
+
+ patches = if libsOnly then null else patches;
+ inherit prePatch;
+ inherit version useGLVND useProfiles;
+ inherit (stdenv.hostPlatform) system;
+ inherit i686bundled;
+
+ outputs = [ "out" ]
+ ++ optional i686bundled "lib32"
+ ++ optional (!libsOnly) "bin";
+ outputDev = if libsOnly then null else "bin";
+
+ kernel = if libsOnly then null else kernel.dev;
+ kernelVersion = if libsOnly then null else kernel.modDirVersion;
+
+ hardeningDisable = [ "pic" "format" ];
+
+ dontStrip = true;
+ dontPatchELF = true;
+
+ libPath = libPathFor pkgs;
+ libPath32 = optionalString i686bundled (libPathFor pkgsi686Linux);
+
+ nativeBuildInputs = [ perl nukeReferences ]
+ ++ optionals (!libsOnly) kernel.moduleBuildDependencies;
+
+ disallowedReferences = optional (!libsOnly) [ kernel.dev ];
+
+ passthru = {
+ settings = (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) {
+ withGtk2 = preferGtk2;
+ withGtk3 = !preferGtk2;
+ };
+ persistenced = mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256;
+ inherit persistencedVersion settingsVersion;
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.nvidia.com/object/unix.html";
+ description = "X.org driver and kernel module for NVIDIA graphics cards";
+ license = licenses.unfreeRedistributable;
+ platforms = [ "x86_64-linux" ] ++ optionals (!i686bundled) [ "i686-linux" ];
+ maintainers = with maintainers; [ baracoder ];
+ priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
+ inherit broken;
+ };
+ };
+
+in self
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/persistenced.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/persistenced.nix
new file mode 100644
index 000000000000..ff2792ac315d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/persistenced.nix
@@ -0,0 +1,37 @@
+nvidia_x11: sha256:
+
+{ stdenv, fetchFromGitHub, m4 }:
+
+stdenv.mkDerivation rec {
+ pname = "nvidia-persistenced";
+ version = nvidia_x11.persistencedVersion;
+
+ src = fetchFromGitHub {
+ owner = "NVIDIA";
+ repo = "nvidia-persistenced";
+ rev = nvidia_x11.persistencedVersion;
+ inherit sha256;
+ };
+
+ nativeBuildInputs = [ m4 ];
+
+ installFlags = [ "PREFIX=$(out)" ];
+
+ postFixup = ''
+ # Save a copy of persistenced for mounting in containers
+ mkdir $out/origBin
+ cp $out/{bin,origBin}/nvidia-persistenced
+ patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 $out/origBin/nvidia-persistenced
+
+ patchelf --set-rpath "$(patchelf --print-rpath $out/bin/nvidia-persistenced):${nvidia_x11}/lib" \
+ $out/bin/nvidia-persistenced
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.nvidia.com/object/unix.html";
+ description = "Settings application for NVIDIA graphics cards";
+ license = licenses.unfreeRedistributable;
+ platforms = nvidia_x11.meta.platforms;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/settings.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/settings.nix
new file mode 100644
index 000000000000..fbddd7b7fa21
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/settings.nix
@@ -0,0 +1,107 @@
+nvidia_x11: sha256:
+
+{ stdenv, lib, fetchFromGitHub, pkgconfig, m4, jansson, gtk2, dbus, gtk3, libXv, libXrandr, libXext, libXxf86vm, libvdpau
+, librsvg, wrapGAppsHook
+, withGtk2 ? false, withGtk3 ? true
+}:
+
+let
+ src = fetchFromGitHub {
+ owner = "NVIDIA";
+ repo = "nvidia-settings";
+ rev = nvidia_x11.settingsVersion;
+ inherit sha256;
+ };
+
+ libXNVCtrl = stdenv.mkDerivation {
+ pname = "libXNVCtrl";
+ version = nvidia_x11.settingsVersion;
+ inherit src;
+
+ buildInputs = [ libXrandr libXext ];
+
+ preBuild = ''
+ cd src/libXNVCtrl
+ '';
+
+ makeFlags = [
+ "OUTPUTDIR=." # src/libXNVCtrl
+ ];
+
+ installPhase = ''
+ mkdir -p $out/lib
+ mkdir -p $out/include/NVCtrl
+
+ cp libXNVCtrl.a $out/lib
+ cp NVCtrl.h $out/include/NVCtrl
+ cp NVCtrlLib.h $out/include/NVCtrl
+ '';
+ };
+
+in
+
+stdenv.mkDerivation {
+ pname = "nvidia-settings";
+ version = nvidia_x11.settingsVersion;
+ inherit src;
+
+ nativeBuildInputs = [ pkgconfig m4 ];
+
+ buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 gtk2 dbus ]
+ ++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
+
+ enableParallelBuilding = true;
+ makeFlags = [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
+ installFlags = [ "PREFIX=$(out)" ];
+
+ postPatch = lib.optionalString nvidia_x11.useProfiles ''
+ sed -i 's,/usr/share/nvidia/,${nvidia_x11.bin}/share/nvidia/,g' src/gtk+-2.x/ctkappprofile.c
+ '';
+
+ preBuild = ''
+ if [ -e src/libXNVCtrl/libXNVCtrl.a ]; then
+ ( cd src/libXNVCtrl
+ make
+ )
+ fi
+ '';
+
+ postInstall = ''
+ ${lib.optionalString (!withGtk2) ''
+ rm -f $out/lib/libnvidia-gtk2.so.*
+ ''}
+ ${lib.optionalString (!withGtk3) ''
+ rm -f $out/lib/libnvidia-gtk3.so.*
+ ''}
+
+ # Install the desktop file and icon.
+ # The template has substitution variables intended to be replaced resulting
+ # in absolute paths. Because absolute paths break after the desktop file is
+ # copied by a desktop environment, make Exec and Icon be just a name.
+ sed -i doc/nvidia-settings.desktop \
+ -e "s|^Exec=.*$|Exec=nvidia-settings|" \
+ -e "s|^Icon=.*$|Icon=nvidia-settings|" \
+ -e "s|__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__|Settings|g"
+ install doc/nvidia-settings.desktop -D -t $out/share/applications/
+ install doc/nvidia-settings.png -D -t $out/share/icons/hicolor/128x128/apps/
+ '';
+
+ binaryName = if withGtk3 then ".nvidia-settings-wrapped" else "nvidia-settings";
+
+ postFixup = ''
+ patchelf --set-rpath "$(patchelf --print-rpath $out/bin/$binaryName):$out/lib:${libXv}/lib" \
+ $out/bin/$binaryName
+ '';
+
+ passthru = {
+ inherit libXNVCtrl;
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.nvidia.com/object/unix.html";
+ description = "Settings application for NVIDIA graphics cards";
+ license = licenses.unfreeRedistributable;
+ platforms = nvidia_x11.meta.platforms;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/vm_operations_struct-fault.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/vm_operations_struct-fault.patch
new file mode 100644
index 000000000000..6ce5c1205e2d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidia-x11/vm_operations_struct-fault.patch
@@ -0,0 +1,31 @@
+https://devtalk.nvidia.com/default/topic/1025051/fully-working-patches-2-of-them-for-nvidia-driver-340-104-compiler-installer-file-and-linux-kernels-4-13-amp-4-14/?offset=5
+--- a/kernel/uvm/nvidia_uvm_lite.c
++++ b/kernel/uvm/nvidia_uvm_lite.c
+@@ -818,8 +818,15 @@ done:
+ }
+
+ #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++#else
++int _fault(struct vm_fault *vmf)
++#endif
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ struct vm_area_struct *vma = vmf->vma;
++#endif
+ #if defined(NV_VM_FAULT_HAS_ADDRESS)
+ unsigned long vaddr = vmf->address;
+ #else
+@@ -866,7 +873,11 @@ static struct vm_operations_struct uvmlite_vma_ops =
+ // it's dealing with anonymous mapping (see handle_pte_fault).
+ //
+ #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++#else
++int _sigbus_fault(struct vm_fault *vmf)
++#endif
+ {
+ vmf->page = NULL;
+ return VM_FAULT_SIGBUS;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidiabl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidiabl/default.nix
new file mode 100644
index 000000000000..f56e74eda042
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvidiabl/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ name = "nvidiabl-${version}-${kernel.version}";
+ version = "2020-10-01";
+
+ # We use a fork which adds support for newer kernels -- upstream has been abandoned.
+ src = fetchFromGitHub {
+ owner = "yorickvP";
+ repo = "nvidiabl";
+ rev = "9e21bdcb7efedf29450373a2e9ff2913d1b5e3ab";
+ sha256 = "1z57gbnayjid2jv782rpfpp13qdchmbr1vr35g995jfnj624nlgy";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ preConfigure = ''
+ sed -i 's|/sbin/depmod|#/sbin/depmod|' Makefile
+ '';
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "DESTDIR=$(out)"
+ "KVER=${kernel.modDirVersion}"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Linux driver for setting the backlight brightness on laptops using NVIDIA GPU";
+ homepage = "https://github.com/guillaumezin/nvidiabl";
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = with maintainers; [ yorickvp ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvme-cli/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvme-cli/default.nix
new file mode 100644
index 000000000000..80a00082b81a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/nvme-cli/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config }:
+
+stdenv.mkDerivation rec {
+ pname = "nvme-cli";
+ version = "1.12";
+
+ src = fetchFromGitHub {
+ owner = "linux-nvme";
+ repo = "nvme-cli";
+ rev = "v${version}";
+ sha256 = "0ldky34sn0m5c4hgiip0fkzm465nca69bhxicpd5dg8wxhzxqrp3";
+ };
+
+ nativeBuildInputs = [ pkg-config ];
+
+ makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
+ # To omit the hostnqn and hostid files that are impure and should be unique
+ # for each target host:
+ installTargets = [ "install-spec" ];
+
+ meta = with lib; {
+ inherit (src.meta) homepage; # https://nvmexpress.org/
+ description = "NVM-Express user space tooling for Linux";
+ longDescription = ''
+ NVM-Express is a fast, scalable host controller interface designed to
+ address the needs for not only PCI Express based solid state drives, but
+ also NVMe-oF(over fabrics).
+ This nvme program is a user space utility to provide standards compliant
+ tooling for NVM-Express drives. It was made specifically for Linux as it
+ relies on the IOCTLs defined by the mainline kernel driver.
+ '';
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ primeos tavyc ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/oci-seccomp-bpf-hook/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/oci-seccomp-bpf-hook/default.nix
new file mode 100644
index 000000000000..3247e8c4eda5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/oci-seccomp-bpf-hook/default.nix
@@ -0,0 +1,58 @@
+{ stdenv
+, buildGoModule
+, fetchFromGitHub
+, go-md2man
+, installShellFiles
+, pkg-config
+, bcc
+, libseccomp
+}:
+
+buildGoModule rec {
+ pname = "oci-seccomp-bpf-hook";
+ version = "1.2.0";
+ src = fetchFromGitHub {
+ owner = "containers";
+ repo = "oci-seccomp-bpf-hook";
+ rev = "v${version}";
+ sha256 = "143x4daixzhhhpli1l14r7dr7dn3q42w8dddr16jzhhwighsirqw";
+ };
+ vendorSha256 = null;
+ doCheck = false;
+
+ outputs = [ "out" "man" ];
+ nativeBuildInputs = [
+ go-md2man
+ installShellFiles
+ pkg-config
+ ];
+ buildInputs = [
+ bcc
+ libseccomp
+ ];
+
+ buildPhase = ''
+ make
+ '';
+
+ postBuild = ''
+ substituteInPlace oci-seccomp-bpf-hook.json --replace HOOK_BIN_DIR "$out/bin"
+ '';
+
+ installPhase = ''
+ install -Dm755 bin/* -t $out/bin
+ install -Dm644 oci-seccomp-bpf-hook.json -t $out
+ installManPage docs/*.[1-9]
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/containers/oci-seccomp-bpf-hook";
+ description = ''
+ OCI hook to trace syscalls and generate a seccomp profile
+ '';
+ license = licenses.asl20;
+ maintainers = with maintainers; [ saschagrunert ];
+ platforms = platforms.linux;
+ badPlatforms = [ "aarch64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/odp-dpdk/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/odp-dpdk/default.nix
new file mode 100644
index 000000000000..39bb2f3e411f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/odp-dpdk/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig
+, dpdk, libconfig, libpcap, numactl, openssl, zlib, libbsd, libelf, jansson
+}: let
+ dpdk_18_11 = dpdk.overrideAttrs (old: rec {
+ version = "18.11.5";
+ src = fetchurl {
+ url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
+ sha256 = "1n6nfaj7703l19jcw540lm8avni48hj9q1rq4mfp8b8gd4zjprj0";
+ };
+ });
+
+in stdenv.mkDerivation rec {
+ pname = "odp-dpdk";
+ version = "1.22.0.0_DPDK_18.11";
+
+ src = fetchurl {
+ url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz";
+ sha256 = "1m8xhmfjqlj2gkkigq5ka3yh0xgzrcpfpaxp1pnh8d1g99094vbx";
+ };
+
+ nativeBuildInputs = [
+ autoreconfHook
+ pkgconfig
+ ];
+ buildInputs = [
+ dpdk_18_11
+ libconfig
+ libpcap
+ numactl
+ openssl
+ zlib
+ libbsd
+ libelf
+ jansson
+ ];
+
+ NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
+
+ # for some reason, /build/odp-dpdk-1.22.0.0_DPDK_18.11/lib/.libs ends up in all binaries,
+ # while it should be $out/lib instead.
+ # prepend rpath with the proper location, the /build will get removed during rpath shrinking
+ preFixup = ''
+ for prog in $out/bin/*; do
+ patchelf --set-rpath $out/lib:`patchelf --print-rpath $prog` $prog
+ done
+ '';
+
+ # binaries will segfault otherwise
+ dontStrip = true;
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Open Data Plane optimized for DPDK";
+ homepage = "https://www.opendataplane.org";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.abuibrahim ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ofp/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ofp/default.nix
new file mode 100644
index 000000000000..7467f7d87137
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ofp/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook
+, openssl, libpcap, odp-dpdk, dpdk
+}:
+
+stdenv.mkDerivation rec {
+ pname = "ofp";
+ version = "2.0.0";
+
+ src = fetchFromGitHub {
+ owner = "OpenFastPath";
+ repo = "ofp";
+ rev = version;
+ sha256 = "05902593fycgkwzk5g7wzgk0k40nrrgybplkdka3rqnlj6aydhqf";
+ };
+
+ nativeBuildInputs = [ pkgconfig autoreconfHook ];
+ buildInputs = [ openssl libpcap odp-dpdk dpdk ];
+
+ dontDisableStatic = true;
+
+ postPatch = ''
+ substituteInPlace configure.ac --replace m4_esyscmd m4_esyscmd_s
+ substituteInPlace scripts/git_hash.sh --replace /bin/bash ${stdenv.shell}
+ echo ${version} > .scmversion
+ '';
+
+ configureFlags = [
+ "--with-odp=${odp-dpdk}"
+ "--with-odp-lib=odp-dpdk"
+ "--disable-shared"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "High performance TCP/IP stack";
+ homepage = "http://www.openfastpath.org";
+ license = licenses.bsd3;
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ maintainers.abuibrahim ];
+ broken = true;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-iscsi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-iscsi/default.nix
new file mode 100644
index 000000000000..01bbd9a9cc16
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-iscsi/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool, gettext
+, utillinux, openisns, openssl, kmod, perl, systemd, pkgconf
+}:
+
+stdenv.mkDerivation rec {
+ pname = "open-iscsi";
+ version = "2.1.2";
+
+ nativeBuildInputs = [ autoconf automake gettext libtool perl pkgconf ];
+ buildInputs = [ kmod openisns.lib openssl systemd utillinux ];
+
+ src = fetchFromGitHub {
+ owner = "open-iscsi";
+ repo = "open-iscsi";
+ rev = version;
+ sha256 = "0fazf2ighj0akrvcj3jm3kd6wl9lgznvr38g6icwfkqk7bykjkam";
+ };
+
+ DESTDIR = "$(out)";
+
+ NIX_LDFLAGS = "-lkmod -lsystemd";
+ NIX_CFLAGS_COMPILE = "-DUSE_KMOD";
+
+ preConfigure = ''
+ sed -i 's|/usr|/|' Makefile
+ '';
+
+ postInstall = ''
+ cp usr/iscsistart $out/sbin/
+ $out/sbin/iscsistart -v
+ '';
+
+ postFixup = ''
+ sed -i "s|/sbin/iscsiadm|$out/bin/iscsiadm|" $out/bin/iscsi_fw_login
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A high performance, transport independent, multi-platform implementation of RFC3720";
+ license = licenses.gpl2;
+ homepage = "https://www.open-iscsi.com";
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cleverca22 zaninime ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-isns/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-isns/default.nix
new file mode 100644
index 000000000000..1617696e00e5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/open-isns/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, openssl, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "open-isns";
+ version = "0.99";
+
+ src = fetchFromGitHub {
+ owner = "gonzoleeman";
+ repo = "open-isns";
+ rev = "v${version}";
+ sha256 = "0m294aiv80rkihacw5094093pc0kd5bkbxqgs6i32jsglxy33hvf";
+ };
+
+ propagatedBuildInputs = [ openssl ];
+ outputs = [ "out" "lib" ];
+ outputInclude = "lib";
+
+ configureFlags = [ "--enable-shared" ];
+
+ installFlags = [ "etcdir=$(out)/etc" "vardir=$(out)/var/lib/isns" ];
+ installTargets = [ "install" "install_hdrs" "install_lib" ];
+
+ meta = {
+ description = "iSNS server and client for Linux";
+ license = stdenv.lib.licenses.lgpl21;
+ homepage = "https://github.com/gonzoleeman/open-isns";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh
new file mode 100644
index 000000000000..cd21899e60e7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh
@@ -0,0 +1,16 @@
+source $stdenv/setup
+
+mkdir -p $out/lib
+
+ln -s /usr/lib/libGL.so.1 $out/lib/
+ln -s /usr/lib/libGLU.so.1 $out/lib/
+ln -s /usr/lib/libGLcore.so.1 $out/lib/
+ln -s /usr/lib/tls/libnvidia-tls.so.1 $out/lib/
+#ln -s /usr/lib/libdrm.so.2 $out/lib/
+
+for i in $neededLibs; do
+ ln -s $i/lib/*.so* $out/lib/
+done
+
+
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
new file mode 100644
index 000000000000..f4043f700306
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
@@ -0,0 +1,20 @@
+# This is a very dirty hack to allow hardware acceleration of OpenGL
+# applications for most (?) users. It will use the driver that your
+# Linux distribution installed in /usr/lib/libGL.so.1. Hopefully,
+# this driver uses hardware acceleration.
+#
+# Of course, use of the driver in /usr/lib is highly impure. But it
+# might actually work ;-)
+
+{stdenv, xorg, expat, libdrm}:
+
+stdenv.mkDerivation {
+ name = "xorg-sys-opengl-3";
+ builder = ./builder.sh;
+ neededLibs = map (p: p.out)
+ [xorg.libXxf86vm xorg.libXext expat libdrm stdenv.cc.cc];
+
+ meta = {
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openrazer/driver.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openrazer/driver.nix
new file mode 100644
index 000000000000..a6bf67db0980
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openrazer/driver.nix
@@ -0,0 +1,39 @@
+{ coreutils
+, fetchFromGitHub
+, kernel
+, stdenv
+, utillinux
+}:
+
+let
+ common = import ../../../development/python-modules/openrazer/common.nix { inherit stdenv fetchFromGitHub; };
+in
+stdenv.mkDerivation (common // {
+ name = "openrazer-${common.version}-${kernel.version}";
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildFlags = [
+ "KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ installPhase = ''
+ binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/hid"
+ mkdir -p "$binDir"
+ cp -v driver/*.ko "$binDir"
+ RAZER_MOUNT_OUT="$out/bin/razer_mount"
+ RAZER_RULES_OUT="$out/etc/udev/rules.d/99-razer.rules"
+ install -m 644 -v -D install_files/udev/99-razer.rules $RAZER_RULES_OUT
+ install -m 755 -v -D install_files/udev/razer_mount $RAZER_MOUNT_OUT
+ substituteInPlace $RAZER_RULES_OUT \
+ --replace razer_mount $RAZER_MOUNT_OUT
+ substituteInPlace $RAZER_MOUNT_OUT \
+ --replace /usr/bin/logger ${utillinux}/bin/logger \
+ --replace chgrp ${coreutils}/bin/chgrp \
+ --replace "PATH='/sbin:/bin:/usr/sbin:/usr/bin'" ""
+ '';
+
+ meta = common.meta // {
+ description = "An entirely open source Linux driver that allows you to manage your Razer peripherals on GNU/Linux";
+ };
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/default.nix
new file mode 100644
index 000000000000..33b252a02254
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchurl, makeWrapper, pkgconfig, utillinux, which
+, procps, libcap_ng, openssl, python3 , perl
+, kernel ? null }:
+
+with stdenv.lib;
+
+let
+ _kernel = kernel;
+ pythonEnv = python3.withPackages (ps: with ps; [ six ]);
+in stdenv.mkDerivation rec {
+ version = "2.14.0";
+ pname = "openvswitch";
+
+ src = fetchurl {
+ url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
+ sha256 = "0q52k6mq1jfsv0ix55mjd5ljlalhklhqfrma3l61dzhgihmfawa1";
+ };
+
+ kernel = optional (_kernel != null) _kernel.dev;
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ makeWrapper utillinux openssl libcap_ng pythonEnv
+ perl procps which ];
+
+ configureFlags = [
+ "--localstatedir=/var"
+ "--sharedstatedir=/var"
+ "--sbindir=$(out)/bin"
+ ] ++ (optionals (_kernel != null) ["--with-linux"]);
+
+ # Leave /var out of this!
+ installFlags = [
+ "LOGDIR=$(TMPDIR)/dummy"
+ "RUNDIR=$(TMPDIR)/dummy"
+ "PKIDIR=$(TMPDIR)/dummy"
+ ];
+
+ postBuild = ''
+ # fix tests
+ substituteInPlace xenserver/opt_xensource_libexec_interface-reconfigure --replace '/usr/bin/env python' '${pythonEnv.interpreter}'
+ substituteInPlace vtep/ovs-vtep --replace '/usr/bin/env python' '${pythonEnv.interpreter}'
+ '';
+
+ enableParallelBuilding = true;
+ doCheck = false; # bash-completion test fails with "compgen: command not found"
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ description = "A multilayer virtual switch";
+ longDescription =
+ ''
+ Open vSwitch is a production quality, multilayer virtual switch
+ licensed under the open source Apache 2.0 license. It is
+ designed to enable massive network automation through
+ programmatic extension, while still supporting standard
+ management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
+ RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
+ support distribution across multiple physical servers similar
+ to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
+ '';
+ homepage = "https://www.openvswitch.org/";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ netixx kmcopper ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/lts.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/lts.nix
new file mode 100644
index 000000000000..358a8b39917b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/lts.nix
@@ -0,0 +1,82 @@
+{ stdenv, fetchurl, makeWrapper, pkgconfig, utillinux, which
+, procps, libcap_ng, openssl, python2, iproute , perl
+, automake, autoconf, libtool, kernel ? null }:
+
+with stdenv.lib;
+
+let
+ _kernel = kernel;
+in stdenv.mkDerivation rec {
+ version = "2.5.9";
+ pname = "openvswitch";
+
+ src = fetchurl {
+ url = "https://www.openvswitch.org/releases/${pname}-${version}.tar.gz";
+ sha256 = "0iv0ncwl6s4qyyb655yj5xvqrjr1zbymmab96q259wa09xnyw7b7";
+ };
+
+ patches = [ ./patches/lts-ssl.patch ];
+
+ kernel = optional (_kernel != null) _kernel.dev;
+
+ nativeBuildInputs = [ autoconf libtool automake pkgconfig ];
+ buildInputs = [ makeWrapper utillinux openssl libcap_ng python2
+ perl procps which ];
+
+ preConfigure = "./boot.sh";
+
+ configureFlags = [
+ "--localstatedir=/var"
+ "--sharedstatedir=/var"
+ "--sbindir=$(out)/bin"
+ ] ++ (optionals (_kernel != null) ["--with-linux"]);
+
+ # Leave /var out of this!
+ installFlags = [
+ "LOGDIR=$(TMPDIR)/dummy"
+ "RUNDIR=$(TMPDIR)/dummy"
+ "PKIDIR=$(TMPDIR)/dummy"
+ ];
+
+ postBuild = ''
+ # fix tests
+ substituteInPlace xenserver/opt_xensource_libexec_interface-reconfigure --replace '/usr/bin/env python' '${python2.interpreter}'
+ substituteInPlace vtep/ovs-vtep --replace '/usr/bin/env python' '${python2.interpreter}'
+ '';
+
+ enableParallelBuilding = true;
+ doCheck = false; # bash-completion test fails with "compgen: command not found"
+
+ postInstall = ''
+ cp debian/ovs-monitor-ipsec $out/share/openvswitch/scripts
+ makeWrapper \
+ $out/share/openvswitch/scripts/ovs-monitor-ipsec \
+ $out/bin/ovs-monitor-ipsec \
+ --prefix PYTHONPATH : "$out/share/openvswitch/python"
+ substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
+ --replace "UnixctlServer.create(None)" "UnixctlServer.create(os.environ['UNIXCTLPATH'])"
+ substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
+ --replace "self.psk_file" "root_prefix + self.psk_file"
+ substituteInPlace $out/share/openvswitch/scripts/ovs-monitor-ipsec \
+ --replace "self.cert_dir" "root_prefix + self.cert_dir"
+ '';
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ description = "A multilayer virtual switch";
+ longDescription =
+ ''
+ Open vSwitch is a production quality, multilayer virtual switch
+ licensed under the open source Apache 2.0 license. It is
+ designed to enable massive network automation through
+ programmatic extension, while still supporting standard
+ management interfaces and protocols (e.g. NetFlow, sFlow, SPAN,
+ RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to
+ support distribution across multiple physical servers similar
+ to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.
+ '';
+ homepage = "https://www.openvswitch.org/";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ netixx kmcopper ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/patches/lts-ssl.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/patches/lts-ssl.patch
new file mode 100644
index 000000000000..0d8ff5b0d523
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/openvswitch/patches/lts-ssl.patch
@@ -0,0 +1,274 @@
+diff --git a/build-aux/automake.mk b/build-aux/automake.mk
+new file mode 100644
+index 000000000..5d2657fd6
+--- /dev/null
++++ b/build-aux/automake.mk
+@@ -0,0 +1,2 @@
++EXTRA_DIST += \
++ build-aux/generate-dhparams-c
+diff --git a/build-aux/generate-dhparams-c b/build-aux/generate-dhparams-c
+new file mode 100755
+index 000000000..bcd25e2d8
+--- /dev/null
++++ b/build-aux/generate-dhparams-c
+@@ -0,0 +1,33 @@
++#! /bin/sh -e
++
++cat <<'EOF'
++/* Generated automatically; do not modify! -*- buffer-read-only: t -*-
++ *
++ * If you do need to regenerate this file, run "make generate-dhparams-c". */
++
++#include <config.h>
++#include "lib/dhparams.h"
++#include "lib/util.h"
++
++static int
++my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
++{
++ ovs_assert(q == NULL);
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++ dh->p = p;
++ dh->g = g;
++ return 1;
++#else
++ return DH_set0_pqg(dh, p, NULL, g);
++#endif
++}
++EOF
++(openssl dhparam -C -in lib/dh1024.pem -noout &&
++openssl dhparam -C -in lib/dh2048.pem -noout &&
++openssl dhparam -C -in lib/dh4096.pem -noout) | sed '
++ s/^static DH/DH/
++ s/\(get_dh[0-9]*\)()/\1(void)/
++ s/\(DH_set0_pqg\)/my_\1/
++ s/[ ]*$//
++ s/ / /g
++'
+diff --git a/lib/automake.mk b/lib/automake.mk
+index 5387d519a..804a8b7d7 100644
+--- a/lib/automake.mk
++++ b/lib/automake.mk
+@@ -399,15 +399,16 @@ lib_libopenvswitch_la_SOURCES += \
+ lib/route-table-bsd.c
+ endif
+
++.PHONY: generate-dhparams-c
+ if HAVE_OPENSSL
+-lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
+-nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
+-lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
+- $(AM_V_GEN)(echo '#include "lib/dhparams.h"' && \
+- openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout && \
+- openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout && \
+- openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout) \
+- | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp && \
++lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c lib/dhparams.c
++
++# Manually regenerates lib/dhparams.c. Not normally necessary since
++# lib/dhparams.c is part of the repository and doesn't normally need
++# updates.
++generate-dhparams-c:
++ $(AM_V_GEN)cd $(srcdir) && \
++ build-aux/generate-dhparams-c > lib/dhparams.c.tmp && \
+ mv lib/dhparams.c.tmp lib/dhparams.c
+ else
+ lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
+diff --git a/lib/dhparams.c b/lib/dhparams.c
+new file mode 100644
+index 000000000..4e42efad2
+--- /dev/null
++++ b/lib/dhparams.c
+@@ -0,0 +1,192 @@
++/* Generated automatically; do not modify! -*- buffer-read-only: t -*-
++ *
++ * If you do need to regenerate this file, run "make generate-dhparams-c". */
++
++#include <config.h>
++#include "lib/dhparams.h"
++#include "lib/util.h"
++
++static int
++my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
++{
++ ovs_assert(q == NULL);
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
++ dh->p = p;
++ dh->g = g;
++ return 1;
++#else
++ return DH_set0_pqg(dh, p, NULL, g);
++#endif
++}
++#ifndef HEADER_DH_H
++# include <openssl/dh.h>
++#endif
++
++DH *get_dh1024(void)
++{
++ static unsigned char dhp_1024[] = {
++ 0xF4, 0x88, 0xFD, 0x58, 0x4E, 0x49, 0xDB, 0xCD, 0x20, 0xB4,
++ 0x9D, 0xE4, 0x91, 0x07, 0x36, 0x6B, 0x33, 0x6C, 0x38, 0x0D,
++ 0x45, 0x1D, 0x0F, 0x7C, 0x88, 0xB3, 0x1C, 0x7C, 0x5B, 0x2D,
++ 0x8E, 0xF6, 0xF3, 0xC9, 0x23, 0xC0, 0x43, 0xF0, 0xA5, 0x5B,
++ 0x18, 0x8D, 0x8E, 0xBB, 0x55, 0x8C, 0xB8, 0x5D, 0x38, 0xD3,
++ 0x34, 0xFD, 0x7C, 0x17, 0x57, 0x43, 0xA3, 0x1D, 0x18, 0x6C,
++ 0xDE, 0x33, 0x21, 0x2C, 0xB5, 0x2A, 0xFF, 0x3C, 0xE1, 0xB1,
++ 0x29, 0x40, 0x18, 0x11, 0x8D, 0x7C, 0x84, 0xA7, 0x0A, 0x72,
++ 0xD6, 0x86, 0xC4, 0x03, 0x19, 0xC8, 0x07, 0x29, 0x7A, 0xCA,
++ 0x95, 0x0C, 0xD9, 0x96, 0x9F, 0xAB, 0xD0, 0x0A, 0x50, 0x9B,
++ 0x02, 0x46, 0xD3, 0x08, 0x3D, 0x66, 0xA4, 0x5D, 0x41, 0x9F,
++ 0x9C, 0x7C, 0xBD, 0x89, 0x4B, 0x22, 0x19, 0x26, 0xBA, 0xAB,
++ 0xA2, 0x5E, 0xC3, 0x55, 0xE9, 0x2F, 0x78, 0xC7
++ };
++ static unsigned char dhg_1024[] = {
++ 0x02
++ };
++ DH *dh = DH_new();
++ BIGNUM *dhp_bn, *dhg_bn;
++
++ if (dh == NULL)
++ return NULL;
++ dhp_bn = BN_bin2bn(dhp_1024, sizeof (dhp_1024), NULL);
++ dhg_bn = BN_bin2bn(dhg_1024, sizeof (dhg_1024), NULL);
++ if (dhp_bn == NULL || dhg_bn == NULL
++ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
++ DH_free(dh);
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
++ return NULL;
++ }
++ return dh;
++}
++#ifndef HEADER_DH_H
++# include <openssl/dh.h>
++#endif
++
++DH *get_dh2048(void)
++{
++ static unsigned char dhp_2048[] = {
++ 0xF6, 0x42, 0x57, 0xB7, 0x08, 0x7F, 0x08, 0x17, 0x72, 0xA2,
++ 0xBA, 0xD6, 0xA9, 0x42, 0xF3, 0x05, 0xE8, 0xF9, 0x53, 0x11,
++ 0x39, 0x4F, 0xB6, 0xF1, 0x6E, 0xB9, 0x4B, 0x38, 0x20, 0xDA,
++ 0x01, 0xA7, 0x56, 0xA3, 0x14, 0xE9, 0x8F, 0x40, 0x55, 0xF3,
++ 0xD0, 0x07, 0xC6, 0xCB, 0x43, 0xA9, 0x94, 0xAD, 0xF7, 0x4C,
++ 0x64, 0x86, 0x49, 0xF8, 0x0C, 0x83, 0xBD, 0x65, 0xE9, 0x17,
++ 0xD4, 0xA1, 0xD3, 0x50, 0xF8, 0xF5, 0x59, 0x5F, 0xDC, 0x76,
++ 0x52, 0x4F, 0x3D, 0x3D, 0x8D, 0xDB, 0xCE, 0x99, 0xE1, 0x57,
++ 0x92, 0x59, 0xCD, 0xFD, 0xB8, 0xAE, 0x74, 0x4F, 0xC5, 0xFC,
++ 0x76, 0xBC, 0x83, 0xC5, 0x47, 0x30, 0x61, 0xCE, 0x7C, 0xC9,
++ 0x66, 0xFF, 0x15, 0xF9, 0xBB, 0xFD, 0x91, 0x5E, 0xC7, 0x01,
++ 0xAA, 0xD3, 0x5B, 0x9E, 0x8D, 0xA0, 0xA5, 0x72, 0x3A, 0xD4,
++ 0x1A, 0xF0, 0xBF, 0x46, 0x00, 0x58, 0x2B, 0xE5, 0xF4, 0x88,
++ 0xFD, 0x58, 0x4E, 0x49, 0xDB, 0xCD, 0x20, 0xB4, 0x9D, 0xE4,
++ 0x91, 0x07, 0x36, 0x6B, 0x33, 0x6C, 0x38, 0x0D, 0x45, 0x1D,
++ 0x0F, 0x7C, 0x88, 0xB3, 0x1C, 0x7C, 0x5B, 0x2D, 0x8E, 0xF6,
++ 0xF3, 0xC9, 0x23, 0xC0, 0x43, 0xF0, 0xA5, 0x5B, 0x18, 0x8D,
++ 0x8E, 0xBB, 0x55, 0x8C, 0xB8, 0x5D, 0x38, 0xD3, 0x34, 0xFD,
++ 0x7C, 0x17, 0x57, 0x43, 0xA3, 0x1D, 0x18, 0x6C, 0xDE, 0x33,
++ 0x21, 0x2C, 0xB5, 0x2A, 0xFF, 0x3C, 0xE1, 0xB1, 0x29, 0x40,
++ 0x18, 0x11, 0x8D, 0x7C, 0x84, 0xA7, 0x0A, 0x72, 0xD6, 0x86,
++ 0xC4, 0x03, 0x19, 0xC8, 0x07, 0x29, 0x7A, 0xCA, 0x95, 0x0C,
++ 0xD9, 0x96, 0x9F, 0xAB, 0xD0, 0x0A, 0x50, 0x9B, 0x02, 0x46,
++ 0xD3, 0x08, 0x3D, 0x66, 0xA4, 0x5D, 0x41, 0x9F, 0x9C, 0x7C,
++ 0xBD, 0x89, 0x4B, 0x22, 0x19, 0x26, 0xBA, 0xAB, 0xA2, 0x5E,
++ 0xC3, 0x55, 0xE9, 0x32, 0x0B, 0x3B
++ };
++ static unsigned char dhg_2048[] = {
++ 0x02
++ };
++ DH *dh = DH_new();
++ BIGNUM *dhp_bn, *dhg_bn;
++
++ if (dh == NULL)
++ return NULL;
++ dhp_bn = BN_bin2bn(dhp_2048, sizeof (dhp_2048), NULL);
++ dhg_bn = BN_bin2bn(dhg_2048, sizeof (dhg_2048), NULL);
++ if (dhp_bn == NULL || dhg_bn == NULL
++ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
++ DH_free(dh);
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
++ return NULL;
++ }
++ return dh;
++}
++#ifndef HEADER_DH_H
++# include <openssl/dh.h>
++#endif
++
++DH *get_dh4096(void)
++{
++ static unsigned char dhp_4096[] = {
++ 0xFA, 0x14, 0x72, 0x52, 0xC1, 0x4D, 0xE1, 0x5A, 0x49, 0xD4,
++ 0xEF, 0x09, 0x2D, 0xC0, 0xA8, 0xFD, 0x55, 0xAB, 0xD7, 0xD9,
++ 0x37, 0x04, 0x28, 0x09, 0xE2, 0xE9, 0x3E, 0x77, 0xE2, 0xA1,
++ 0x7A, 0x18, 0xDD, 0x46, 0xA3, 0x43, 0x37, 0x23, 0x90, 0x97,
++ 0xF3, 0x0E, 0xC9, 0x03, 0x50, 0x7D, 0x65, 0xCF, 0x78, 0x62,
++ 0xA6, 0x3A, 0x62, 0x22, 0x83, 0xA1, 0x2F, 0xFE, 0x79, 0xBA,
++ 0x35, 0xFF, 0x59, 0xD8, 0x1D, 0x61, 0xDD, 0x1E, 0x21, 0x13,
++ 0x17, 0xFE, 0xCD, 0x38, 0x87, 0x9E, 0xF5, 0x4F, 0x79, 0x10,
++ 0x61, 0x8D, 0xD4, 0x22, 0xF3, 0x5A, 0xED, 0x5D, 0xEA, 0x21,
++ 0xE9, 0x33, 0x6B, 0x48, 0x12, 0x0A, 0x20, 0x77, 0xD4, 0x25,
++ 0x60, 0x61, 0xDE, 0xF6, 0xB4, 0x4F, 0x1C, 0x63, 0x40, 0x8B,
++ 0x3A, 0x21, 0x93, 0x8B, 0x79, 0x53, 0x51, 0x2C, 0xCA, 0xB3,
++ 0x7B, 0x29, 0x56, 0xA8, 0xC7, 0xF8, 0xF4, 0x7B, 0x08, 0x5E,
++ 0xA6, 0xDC, 0xA2, 0x45, 0x12, 0x56, 0xDD, 0x41, 0x92, 0xF2,
++ 0xDD, 0x5B, 0x8F, 0x23, 0xF0, 0xF3, 0xEF, 0xE4, 0x3B, 0x0A,
++ 0x44, 0xDD, 0xED, 0x96, 0x84, 0xF1, 0xA8, 0x32, 0x46, 0xA3,
++ 0xDB, 0x4A, 0xBE, 0x3D, 0x45, 0xBA, 0x4E, 0xF8, 0x03, 0xE5,
++ 0xDD, 0x6B, 0x59, 0x0D, 0x84, 0x1E, 0xCA, 0x16, 0x5A, 0x8C,
++ 0xC8, 0xDF, 0x7C, 0x54, 0x44, 0xC4, 0x27, 0xA7, 0x3B, 0x2A,
++ 0x97, 0xCE, 0xA3, 0x7D, 0x26, 0x9C, 0xAD, 0xF4, 0xC2, 0xAC,
++ 0x37, 0x4B, 0xC3, 0xAD, 0x68, 0x84, 0x7F, 0x99, 0xA6, 0x17,
++ 0xEF, 0x6B, 0x46, 0x3A, 0x7A, 0x36, 0x7A, 0x11, 0x43, 0x92,
++ 0xAD, 0xE9, 0x9C, 0xFB, 0x44, 0x6C, 0x3D, 0x82, 0x49, 0xCC,
++ 0x5C, 0x6A, 0x52, 0x42, 0xF8, 0x42, 0xFB, 0x44, 0xF9, 0x39,
++ 0x73, 0xFB, 0x60, 0x79, 0x3B, 0xC2, 0x9E, 0x0B, 0xDC, 0xD4,
++ 0xA6, 0x67, 0xF7, 0x66, 0x3F, 0xFC, 0x42, 0x3B, 0x1B, 0xDB,
++ 0x4F, 0x66, 0xDC, 0xA5, 0x8F, 0x66, 0xF9, 0xEA, 0xC1, 0xED,
++ 0x31, 0xFB, 0x48, 0xA1, 0x82, 0x7D, 0xF8, 0xE0, 0xCC, 0xB1,
++ 0xC7, 0x03, 0xE4, 0xF8, 0xB3, 0xFE, 0xB7, 0xA3, 0x13, 0x73,
++ 0xA6, 0x7B, 0xC1, 0x0E, 0x39, 0xC7, 0x94, 0x48, 0x26, 0x00,
++ 0x85, 0x79, 0xFC, 0x6F, 0x7A, 0xAF, 0xC5, 0x52, 0x35, 0x75,
++ 0xD7, 0x75, 0xA4, 0x40, 0xFA, 0x14, 0x74, 0x61, 0x16, 0xF2,
++ 0xEB, 0x67, 0x11, 0x6F, 0x04, 0x43, 0x3D, 0x11, 0x14, 0x4C,
++ 0xA7, 0x94, 0x2A, 0x39, 0xA1, 0xC9, 0x90, 0xCF, 0x83, 0xC6,
++ 0xFF, 0x02, 0x8F, 0xA3, 0x2A, 0xAC, 0x26, 0xDF, 0x0B, 0x8B,
++ 0xBE, 0x64, 0x4A, 0xF1, 0xA1, 0xDC, 0xEE, 0xBA, 0xC8, 0x03,
++ 0x82, 0xF6, 0x62, 0x2C, 0x5D, 0xB6, 0xBB, 0x13, 0x19, 0x6E,
++ 0x86, 0xC5, 0x5B, 0x2B, 0x5E, 0x3A, 0xF3, 0xB3, 0x28, 0x6B,
++ 0x70, 0x71, 0x3A, 0x8E, 0xFF, 0x5C, 0x15, 0xE6, 0x02, 0xA4,
++ 0xCE, 0xED, 0x59, 0x56, 0xCC, 0x15, 0x51, 0x07, 0x79, 0x1A,
++ 0x0F, 0x25, 0x26, 0x27, 0x30, 0xA9, 0x15, 0xB2, 0xC8, 0xD4,
++ 0x5C, 0xCC, 0x30, 0xE8, 0x1B, 0xD8, 0xD5, 0x0F, 0x19, 0xA8,
++ 0x80, 0xA4, 0xC7, 0x01, 0xAA, 0x8B, 0xBA, 0x53, 0xBB, 0x47,
++ 0xC2, 0x1F, 0x6B, 0x54, 0xB0, 0x17, 0x60, 0xED, 0x79, 0x21,
++ 0x95, 0xB6, 0x05, 0x84, 0x37, 0xC8, 0x03, 0xA4, 0xDD, 0xD1,
++ 0x06, 0x69, 0x8F, 0x4C, 0x39, 0xE0, 0xC8, 0x5D, 0x83, 0x1D,
++ 0xBE, 0x6A, 0x9A, 0x99, 0xF3, 0x9F, 0x0B, 0x45, 0x29, 0xD4,
++ 0xCB, 0x29, 0x66, 0xEE, 0x1E, 0x7E, 0x3D, 0xD7, 0x13, 0x4E,
++ 0xDB, 0x90, 0x90, 0x58, 0xCB, 0x5E, 0x9B, 0xCD, 0x2E, 0x2B,
++ 0x0F, 0xA9, 0x4E, 0x78, 0xAC, 0x05, 0x11, 0x7F, 0xE3, 0x9E,
++ 0x27, 0xD4, 0x99, 0xE1, 0xB9, 0xBD, 0x78, 0xE1, 0x84, 0x41,
++ 0xA0, 0xDF
++ };
++ static unsigned char dhg_4096[] = {
++ 0x02
++ };
++ DH *dh = DH_new();
++ BIGNUM *dhp_bn, *dhg_bn;
++
++ if (dh == NULL)
++ return NULL;
++ dhp_bn = BN_bin2bn(dhp_4096, sizeof (dhp_4096), NULL);
++ dhg_bn = BN_bin2bn(dhg_4096, sizeof (dhg_4096), NULL);
++ if (dhp_bn == NULL || dhg_bn == NULL
++ || !my_DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
++ DH_free(dh);
++ BN_free(dhp_bn);
++ BN_free(dhg_bn);
++ return NULL;
++ }
++ return dh;
++}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/otpw/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/otpw/default.nix
new file mode 100644
index 000000000000..c9597ab0fe47
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/otpw/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pam }:
+
+stdenv.mkDerivation rec {
+ name = "otpw-1.3";
+
+ src = fetchurl {
+ url = "https://www.cl.cam.ac.uk/~mgk25/download/${name}.tar.gz";
+ sha256 = "1k3hc7xbxz6hkc55kvddi3cibafwf93ivn58sy1l888d3l5dwmrk";
+ };
+
+ patchPhase = ''
+ sed -i 's/^CFLAGS.*/CFLAGS=-O2 -fPIC/' Makefile
+ sed -i -e 's,PATH=.*;,,' conf.h
+ sed -i -e '/ENTROPY_ENV/d' otpw-gen.c
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin $out/lib/security $out/share/man/man{1,8}
+ cp pam_*.so $out/lib/security
+ cp otpw-gen $out/bin
+ cp *.1 $out/share/man/man1
+ cp *.8 $out/share/man/man8
+ '';
+
+ buildInputs = [ pam ];
+
+ hardeningDisable = [ "stackprotector" ];
+
+ meta = {
+ homepage = "http://www.cl.cam.ac.uk/~mgk25/otpw.html";
+ description = "A one-time password login package";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pagemon/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pagemon/default.nix
new file mode 100644
index 000000000000..64177fa5d00b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pagemon/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "pagemon";
+ version = "0.01.18";
+
+ src = fetchFromGitHub {
+ sha256 = "1aq1mq3k8n70h81s64w2zg4kksw1y05326bn4y8p94lpaypvxqfd";
+ rev = "V${version}";
+ repo = "pagemon";
+ owner = "ColinIanKing";
+ };
+
+ buildInputs = [ ncurses ];
+
+ makeFlags = [
+ "BINDIR=$(out)/bin"
+ "MANDIR=$(out)/share/man/man8"
+ ];
+
+ meta = with stdenv.lib; {
+ inherit (src.meta) homepage;
+ description = "Interactive memory/page monitor for Linux";
+ longDescription = ''
+ pagemon is an ncurses based interactive memory/page monitoring tool
+ allowing one to browse the memory map of an active running process
+ on Linux.
+ pagemon reads the PTEs of a given process and display the soft/dirty
+ activity in real time. The tool identifies the type of memory mapping
+ a page belongs to, so one can easily scan through memory looking at
+ pages of memory belonging data, code, heap, stack, anonymous mappings
+ or even swapped-out pages.
+ '';
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/default.nix
new file mode 100644
index 000000000000..fb969d7574a0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/default.nix
@@ -0,0 +1,72 @@
+{ stdenv, buildPackages, fetchurl, fetchpatch, flex, cracklib, db4 }:
+
+stdenv.mkDerivation rec {
+ pname = "linux-pam";
+ version = "1.3.1";
+
+ src = fetchurl {
+ url = "https://github.com/linux-pam/linux-pam/releases/download/v1.3.1/Linux-PAM-${version}.tar.xz";
+ sha256 = "1nyh9kdi3knhxcbv5v4snya0g3gff0m671lnvqcbygw3rm77mx7g";
+ };
+
+ patches = stdenv.lib.optionals (stdenv.hostPlatform.libc == "musl") [
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/aports/plain/main/linux-pam/fix-compat.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
+ sha256 = "1h5yp5h2mqp1fcwiwwklyfpa69a3i03ya32pivs60fd7g5bqa7sf";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/aports/plain/main/linux-pam/libpam-fix-build-with-eglibc-2.16.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
+ sha256 = "1ib6shhvgzinjsc603k2x1lxh9dic6qq449fnk110gc359m23j81";
+ })
+ # From adelie's package repo, using local copy since it seems to be currently offline.
+ # (we previously used similar patch from void, but stopped working with update to 1.3.1)
+ ./musl-fix-pam_exec.patch
+ ];
+
+ outputs = [ "out" "doc" "man" /* "modules" */ ];
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ flex ];
+
+ buildInputs = [ cracklib db4 ];
+
+ enableParallelBuilding = true;
+
+ postInstall = ''
+ mv -v $out/sbin/unix_chkpwd{,.orig}
+ ln -sv /run/wrappers/bin/unix_chkpwd $out/sbin/unix_chkpwd
+ ''; /*
+ rm -rf $out/etc
+ mkdir -p $modules/lib
+ mv $out/lib/security $modules/lib/
+ '';*/
+ # don't move modules, because libpam needs to (be able to) find them,
+ # which is done by dlopening $out/lib/security/pam_foo.so
+ # $out/etc was also missed: pam_env(login:session): Unable to open config file
+
+ preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+ # export ac_cv_search_crypt=no
+ # (taken from Alpine linux, apparently insecure but also doesn't build O:))
+ # disable insecure modules
+ # sed -e 's/pam_rhosts//g' -i modules/Makefile.am
+ sed -e 's/pam_rhosts//g' -i modules/Makefile.in
+ '';
+
+ configureFlags = [
+ "--includedir=${placeholder "out"}/include/security"
+ "--enable-sconfigdir=/etc/security"
+ ];
+
+ installFlags = [
+ "SCONFIGDIR=${placeholder "out"}/etc/security"
+ ];
+
+ doCheck = false; # fails
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.linux-pam.org/";
+ description = "Pluggable Authentication Modules, a flexible mechanism for authenticating user";
+ platforms = platforms.linux;
+ license = licenses.bsd3;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch
new file mode 100644
index 000000000000..194e47b9e5b0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam/musl-fix-pam_exec.patch
@@ -0,0 +1,33 @@
+--- ./modules/pam_exec/pam_exec.c.orig
++++ ./modules/pam_exec/pam_exec.c
+@@ -103,11 +103,14 @@
+ int optargc;
+ const char *logfile = NULL;
+ const char *authtok = NULL;
++ char authtok_buf[PAM_MAX_RESP_SIZE+1];
++
+ pid_t pid;
+ int fds[2];
+ int stdout_fds[2];
+ FILE *stdout_file = NULL;
+
++ memset(authtok_buf, 0, sizeof(authtok_buf));
+ if (argc < 1) {
+ pam_syslog (pamh, LOG_ERR,
+ "This module needs at least one argument");
+@@ -180,12 +183,12 @@
+ if (resp)
+ {
+ pam_set_item (pamh, PAM_AUTHTOK, resp);
+- authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
++ authtok = strncpy(authtok_buf, resp, sizeof(authtok_buf));
+ _pam_drop (resp);
+ }
+ }
+ else
+- authtok = strndupa (void_pass, PAM_MAX_RESP_SIZE);
++ authtok = strncpy(authtok_buf, void_pass, sizeof(authtok_buf));
+
+ if (pipe(fds) != 0)
+ {
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix
new file mode 100644
index 000000000000..c4abfe5c44cb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, pam, openssl, db}:
+
+stdenv.mkDerivation rec {
+ name = "pam_ccreds-10";
+
+ src = fetchurl {
+ url = "https://www.padl.com/download/${name}.tar.gz";
+ sha256 = "1h7zyg1b1h69civyvrj95w22dg0y7lgw3hq4gqkdcg35w1y76fhz";
+ };
+ patchPhase = ''
+ sed 's/-o root -g root//' -i Makefile.in
+ '';
+
+ buildInputs = [ pam openssl db ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.padl.com/OSS/pam_ccreds.html";
+ description = "PAM module to locally authenticate using an enterprise identity when the network is unavailable";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_gnupg/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_gnupg/default.nix
new file mode 100644
index 000000000000..84135f2492aa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_gnupg/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pam, gnupg }:
+
+stdenv.mkDerivation rec {
+ pname = "pam_gnupg";
+ version = "0.1";
+
+ src = fetchFromGitHub {
+ owner = "cruegge";
+ repo = "pam-gnupg";
+ rev = "v${version}";
+ sha256 = "0b70mazyvcbg6xyqllm62rwhbz0y94pcy202db1qyy4w8466bhsw";
+ };
+
+ configureFlags = [
+ "--with-moduledir=${placeholder "out"}/lib/security"
+ ];
+
+ buildInputs = [ pam gnupg ];
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ meta = with stdenv.lib; {
+ description = "Unlock GnuPG keys on login";
+ longDescription = ''
+ A PAM module that hands over your login password to gpg-agent. This can
+ be useful if you are using a GnuPG-based password manager like pass.
+ '';
+ homepage = "https://github.com/cruegge/pam-gnupg";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ mtreca ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix
new file mode 100644
index 000000000000..7a384c793d23
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, pam, kerberos }:
+
+stdenv.mkDerivation rec {
+ name = "pam-krb5-4.9";
+
+ src = fetchurl {
+ url = "https://archives.eyrie.org/software/kerberos/${name}.tar.gz";
+ sha256 = "0kzz6mjkzw571pkv684vyczhl874f6p7lih3dj7s764gxdxnv4y5";
+ };
+
+ buildInputs = [ pam kerberos ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.eyrie.org/~eagle/software/pam-krb5/";
+ description = "PAM module allowing PAM-aware applications to authenticate users by performing an AS exchange with a Kerberos KDC";
+ longDescription = ''
+ pam_krb5 can optionally convert Kerberos 5 credentials to Kerberos IV
+ credentials and/or use them to set up AFS tokens for a user's session.
+ '';
+ platforms = platforms.linux;
+ license = licenses.bsd3;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix
new file mode 100644
index 000000000000..e327a551b231
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pam, openldap, perl }:
+
+stdenv.mkDerivation rec {
+ name = "pam_ldap-186";
+
+ src = fetchurl {
+ url = "https://www.padl.com/download/${name}.tar.gz";
+ sha256 = "0lv4f7hc02jrd2l3gqxd247qq62z11sp3fafn8lgb8ymb7aj5zn8";
+ };
+
+ postPatch = ''
+ patchShebangs ./vers_string
+ substituteInPlace vers_string --replace "cvslib.pl" "./cvslib.pl"
+ '';
+
+ preInstall = "
+ substituteInPlace Makefile --replace '-o root -g root' ''
+ ";
+
+ nativeBuildInputs = [ perl ];
+ buildInputs = [ pam openldap ];
+
+ meta = {
+ homepage = "https://www.padl.com/OSS/pam_ldap.html";
+ description = "LDAP backend for PAM";
+ longDescription = ''
+ The pam_ldap module provides the means for Solaris and Linux servers and
+ workstations to authenticate against LDAP directories, and to change their
+ passwords in the directory.'';
+ license = "LGPL";
+ inherit (pam.meta) platforms;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix
new file mode 100644
index 000000000000..18bc84effa06
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, autoconf, automake, pkgconfig, libtool, pam, libHX, libxml2, pcre, perl, openssl, cryptsetup, utillinux }:
+
+stdenv.mkDerivation rec {
+ name = "pam_mount-2.16";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/pam-mount/pam_mount/2.16/${name}.tar.xz";
+ sha256 = "1rvi4irb7ylsbhvx1cr6islm2xxw1a4b19q6z4a9864ndkm0f0mf";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ autoconf automake libtool pam libHX utillinux libxml2 pcre perl openssl cryptsetup ];
+
+ patches = [ ./insert_utillinux_path_hooks.patch ];
+
+ preConfigure = ''
+ substituteInPlace src/mtcrypt.c --replace @@NIX_UTILLINUX@@ ${utillinux}/bin
+ sh autogen.sh --prefix=$out
+ '';
+
+ makeFlags = [ "DESTDIR=$(out)" ];
+
+ # Probably a hack, but using DESTDIR and PREFIX makes everything work!
+ postInstall = ''
+ mkdir -p $out
+ cp -r $out/$out/* $out
+ rm -r $out/nix
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://pam-mount.sourceforge.net/";
+ description = "PAM module to mount volumes for a user session";
+ maintainers = [ maintainers.tstrobel ];
+ license = with licenses; [ gpl2 gpl3 lgpl21 lgpl3 ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch
new file mode 100644
index 000000000000..6d9da05da295
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/insert_utillinux_path_hooks.patch
@@ -0,0 +1,30 @@
+diff -uNr pam_mount-2.15_old/src/mtcrypt.c pam_mount-2.15/src/mtcrypt.c
+--- pam_mount-2.15_old/src/mtcrypt.c 2015-07-04 16:00:12.917943336 +0200
++++ pam_mount-2.15/src/mtcrypt.c 2015-07-04 16:03:45.685302493 +0200
+@@ -534,7 +534,7 @@
+
+ /* candidate for replacement by some libmount calls, I guess. */
+ argk = 0;
+- mount_args[argk++] = "mount";
++ mount_args[argk++] = "@@NIX_UTILLINUX@@/mount";
+ if (opt->fstype != NULL) {
+ mount_args[argk++] = "-t";
+ mount_args[argk++] = opt->fstype;
+@@ -668,7 +668,7 @@
+
+ if (!opt->no_update)
+ pmt_smtab_remove(mntpt, SMTABF_MOUNTPOINT);
+- rmt_args[argk++] = "mount";
++ rmt_args[argk++] = "@@NIX_UTILLINUX@@/mount";
+ rmt_args[argk++] = "-o";
+ rmt_args[argk++] = opt->extra_opts;
+ rmt_args[argk++] = mntpt;
+@@ -749,7 +749,7 @@
+ pmt_smtab_remove(mountpoint, SMTABF_MOUNTPOINT);
+ pmt_cmtab_remove(mountpoint);
+
+- umount_args[argk++] = "umount";
++ umount_args[argk++] = "@@NIX_UTILLINUX@@/umount";
+ umount_args[argk++] = "-i";
+ umount_args[argk++] = mountpoint;
+ umount_args[argk] = NULL;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_p11/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_p11/default.nix
new file mode 100644
index 000000000000..d5336cc9f4ce
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_p11/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkg-config, openssl, libp11, pam }:
+
+stdenv.mkDerivation rec {
+ pname = "pam_p11";
+ version = "0.3.1";
+
+ src = fetchFromGitHub {
+ owner = "OpenSC";
+ repo = "pam_p11";
+ rev = "pam_p11-${version}";
+ sha256 = "1caidy18rq5zk82d51x8vwidmkhwmanf3qm25x1yrdlbhxv6m7lk";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkg-config ];
+ buildInputs = [ pam openssl libp11 ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/OpenSC/pam_p11";
+ description = "Authentication with PKCS#11 modules";
+ license = licenses.lgpl21Plus;
+ platforms = platforms.unix;
+ maintainers = with maintainers; [ sb0 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_pgsql/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_pgsql/default.nix
new file mode 100644
index 000000000000..6aa1c3be1e25
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_pgsql/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, postgresql, libgcrypt, pam }:
+
+stdenv.mkDerivation rec {
+ pname = "pam_pgsql";
+ version = "0.7.3.2";
+
+ src = fetchFromGitHub {
+ owner = "pam-pgsql";
+ repo = "pam-pgsql";
+ rev = "release-${version}";
+ sha256 = "1a68krq5m07zspdxwl1wmkr5j98zr9bdg4776kvplrsdcg97h4jk";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ libgcrypt pam postgresql ];
+
+ meta = with stdenv.lib; {
+ description = "Support to authenticate against PostgreSQL for PAM-enabled appliations";
+ homepage = "https://github.com/pam-pgsql/pam-pgsql";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/default.nix
new file mode 100644
index 000000000000..3ab1ae28a7b5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchpatch, fetchurl, pam, openssl, perl }:
+
+stdenv.mkDerivation rec {
+ name = "pam_ssh_agent_auth-0.10.3";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/pamsshagentauth/${name}.tar.bz2";
+ sha256 = "0qx78x7nvqdscyp04hfijl4rgyf64xy03prr28hipvgasrcd6lrw";
+ };
+
+ patches =
+ [ # Allow multiple colon-separated authorized keys files to be
+ # specified in the file= option.
+ ./multiple-key-files.patch
+ (fetchpatch {
+ name = "openssl-1.1.1-1.patch";
+ url = "https://sources.debian.org/data/main/p/pam-ssh-agent-auth/0.10.3-3/debian/patches/openssl-1.1.1-1.patch";
+ sha256 = "1ndp5j4xfhzshhnl345gb4mkldx6vjfa7284xgng6ikhzpc6y7pf";
+ })
+ (fetchpatch {
+ name = "openssl-1.1.1-2.patch";
+ url = "https://sources.debian.org/data/main/p/pam-ssh-agent-auth/0.10.3-3/debian/patches/openssl-1.1.1-2.patch";
+ sha256 = "0ksrs4xr417by8klf7862n3dircvnw30an1akq4pnsd3ichscmww";
+ })
+ ];
+
+ buildInputs = [ pam openssl perl ];
+
+ # It's not clear to me why this is necessary, but without it, you see:
+ #
+ # checking OpenSSL header version... 1010104f (OpenSSL 1.1.1d 10 Sep 2019)
+ # checking OpenSSL library version... 1010104f (OpenSSL 1.1.1d 10 Sep 2019)
+ # checking whether OpenSSL's headers match the library... no
+ # configure: WARNING: Your OpenSSL headers do not match your
+ # library. Check config.log for details.
+ #
+ # ...despite the fact that clearly the values match
+ configureFlags = [ "--without-openssl-header-check" ];
+
+ enableParallelBuilding = true;
+
+ meta = {
+ homepage = "http://pamsshagentauth.sourceforge.net/";
+ description = "PAM module for authentication through the SSH agent";
+ maintainers = [ stdenv.lib.maintainers.eelco ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/multiple-key-files.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/multiple-key-files.patch
new file mode 100644
index 000000000000..190325251c9a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_ssh_agent_auth/multiple-key-files.patch
@@ -0,0 +1,365 @@
+diff -u pam_ssh_agent_auth-0.10.3-orig/iterate_ssh_agent_keys.c pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c
+--- pam_ssh_agent_auth-0.10.3-orig/iterate_ssh_agent_keys.c 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.c 2017-03-02 23:47:18.012203283 -0800
+@@ -176,7 +176,7 @@
+ return;
+ }
+
+-int
++const char *
+ pamsshagentauth_find_authorized_keys(const char * user, const char * ruser, const char * servicename)
+ {
+ Buffer session_id2 = { 0 };
+@@ -184,7 +184,7 @@
+ Key *key;
+ AuthenticationConnection *ac;
+ char *comment;
+- uint8_t retval = 0;
++ const char *key_file = 0;
+ uid_t uid = getpwnam(ruser)->pw_uid;
+
+ OpenSSL_add_all_digests();
+@@ -199,13 +199,11 @@
+ id->key = key;
+ id->filename = comment;
+ id->ac = ac;
+- if(userauth_pubkey_from_id(ruser, id, &session_id2)) {
+- retval = 1;
+- }
++ key_file = userauth_pubkey_from_id(ruser, id, &session_id2);
+ pamsshagentauth_xfree(id->filename);
+ pamsshagentauth_key_free(id->key);
+ pamsshagentauth_xfree(id);
+- if(retval == 1)
++ if(key_file)
+ break;
+ }
+ }
+@@ -217,5 +215,5 @@
+ }
+ /* pamsshagentauth_xfree(session_id2); */
+ EVP_cleanup();
+- return retval;
++ return key_file;
+ }
+diff -u pam_ssh_agent_auth-0.10.3-orig/iterate_ssh_agent_keys.h pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.h
+--- pam_ssh_agent_auth-0.10.3-orig/iterate_ssh_agent_keys.h 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/iterate_ssh_agent_keys.h 2017-03-02 23:48:06.345803339 -0800
+@@ -31,6 +31,6 @@
+ #ifndef _ITERATE_SSH_AGENT_KEYS_H
+ #define _ITERATE_SSH_AGENT_KEYS_H
+
+-int pamsshagentauth_find_authorized_keys(const char * user, const char * ruser, const char * servicename);
++const char * pamsshagentauth_find_authorized_keys(const char * user, const char * ruser, const char * servicename);
+
+ #endif
+diff -u pam_ssh_agent_auth-0.10.3-orig/pam_ssh_agent_auth.c pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c
+--- pam_ssh_agent_auth-0.10.3-orig/pam_ssh_agent_auth.c 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.c 2017-03-02 23:51:57.642669946 -0800
+@@ -61,7 +61,6 @@
+ #define strncasecmp_literal(A,B) strncasecmp( A, B, sizeof(B) - 1)
+ #define UNUSED(expr) do { (void)(expr); } while (0)
+
+-char *authorized_keys_file = NULL;
+ uint8_t allow_user_owned_authorized_keys_file = 0;
+ char *authorized_keys_command = NULL;
+ char *authorized_keys_command_user = NULL;
+@@ -171,15 +170,13 @@
+ goto cleanexit;
+ }
+
+- if(authorized_keys_file_input && user) {
+- /*
+- * user is the name of the target-user, and so must be used for validating the authorized_keys file
+- */
+- parse_authorized_key_file(user, authorized_keys_file_input);
+- } else {
+- pamsshagentauth_verbose("Using default file=/etc/security/authorized_keys");
+- authorized_keys_file = pamsshagentauth_xstrdup("/etc/security/authorized_keys");
+- }
++ if (!authorized_keys_file_input || !user)
++ authorized_keys_file_input = "/etc/security/authorized_keys";
++
++ /*
++ * user is the name of the target-user, and so must be used for validating the authorized_keys file
++ */
++ parse_authorized_key_files(user, authorized_keys_file_input);
+
+ /*
+ * PAM_USER and PAM_RUSER do not necessarily have to get set by the calling application, and we may be unable to divine the latter.
+@@ -187,16 +184,17 @@
+ */
+
+ if(user && strlen(ruser) > 0) {
+- pamsshagentauth_verbose("Attempting authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
++ pamsshagentauth_verbose("Attempting authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file_input);
+
+ /*
+ * this pw_uid is used to validate the SSH_AUTH_SOCK, and so must be the uid of the ruser invoking the program, not the target-user
+ */
+- if(pamsshagentauth_find_authorized_keys(user, ruser, servicename)) { /* getpwnam(ruser)->pw_uid)) { */
+- pamsshagentauth_logit("Authenticated: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
++ const char *key_file;
++ if((key_file = pamsshagentauth_find_authorized_keys(user, ruser, servicename))) { /* getpwnam(ruser)->pw_uid)) { */
++ pamsshagentauth_logit("Authenticated: `%s' as `%s' using %s", ruser, user, key_file);
+ retval = PAM_SUCCESS;
+ } else {
+- pamsshagentauth_logit("Failed Authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file);
++ pamsshagentauth_logit("Failed Authentication: `%s' as `%s' using %s", ruser, user, authorized_keys_file_input);
+ }
+ } else {
+ pamsshagentauth_logit("No %s specified, cannot continue with this form of authentication", (user) ? "ruser" : "user" );
+@@ -208,7 +206,7 @@
+ free(__progname);
+ #endif
+
+- free(authorized_keys_file);
++ free_authorized_key_files();
+
+ return retval;
+ }
+diff -u pam_ssh_agent_auth-0.10.3-orig/pam_ssh_agent_auth.pod pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.pod
+--- pam_ssh_agent_auth-0.10.3-orig/pam_ssh_agent_auth.pod 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/pam_ssh_agent_auth.pod 2017-03-02 23:52:28.914857449 -0800
+@@ -31,7 +31,7 @@
+
+ =item file=<path to authorized_keys>
+
+-Specify the path to the authorized_keys file(s) you would like to use for authentication. Subject to tilde and % EXPANSIONS (below)
++Specify the path(s) to the authorized_keys file(s) you would like to use for authentication. Subject to tilde and % EXPANSIONS (below). Paths are separated using colons.
+
+ =item allow_user_owned_authorized_keys_file
+
+diff -u pam_ssh_agent_auth-0.10.3-orig/pam_user_authorized_keys.c pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c
+--- pam_ssh_agent_auth-0.10.3-orig/pam_user_authorized_keys.c 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.c 2017-03-03 00:07:45.201322570 -0800
+@@ -79,8 +79,12 @@
+
+ #include "identity.h"
+ #include "pam_user_key_allowed2.h"
++#include "pam_user_authorized_keys.h"
+
+-extern char *authorized_keys_file;
++#define MAX_AUTHORIZED_KEY_FILES 16
++
++char *authorized_keys_files[MAX_AUTHORIZED_KEY_FILES];
++unsigned int nr_authorized_keys_files = 0;
+
+ extern char *authorized_keys_command;
+
+@@ -91,79 +95,88 @@
+ uid_t authorized_keys_file_allowed_owner_uid;
+
+ void
+-parse_authorized_key_file(const char *user,
+- const char *authorized_keys_file_input)
++parse_authorized_key_files(const char *user,
++ const char *authorized_keys_file_input)
+ {
+- char fqdn[HOST_NAME_MAX] = "";
++ const char *pos = authorized_keys_file_input;
+ char hostname[HOST_NAME_MAX] = "";
+- char auth_keys_file_buf[4096] = "";
+- char *slash_ptr = NULL;
+- char owner_uname[128] = "";
+- size_t owner_uname_len = 0;
+-
+- /*
+- * temporary copy, so that both tilde expansion and percent expansion both
+- * get to apply to the path
+- */
+- strncat(auth_keys_file_buf, authorized_keys_file_input,
+- sizeof(auth_keys_file_buf) - 1);
++ char fqdn[HOST_NAME_MAX] = "";
+
+- if(allow_user_owned_authorized_keys_file)
+- authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++#if HAVE_GETHOSTNAME
++ *hostname = '\0';
++ gethostname(fqdn, HOST_NAME_MAX);
++ strncat(hostname, fqdn, strcspn(fqdn,"."));
++#endif
+
+- if(*auth_keys_file_buf == '~') {
+- if(*(auth_keys_file_buf + 1) == '/') {
+- authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++ while (pos) {
++ const char *colon = strchr(pos, ':');
++ char auth_keys_file_buf[4096] = "";
++ char *slash_ptr = NULL;
++ char owner_uname[128] = "";
++ size_t owner_uname_len = 0;
++
++ strncat(auth_keys_file_buf, pos, sizeof(auth_keys_file_buf) - 1);
++ if (colon) {
++ auth_keys_file_buf[colon - pos] = 0;
++ pos = colon + 1;
+ } else {
+- slash_ptr = strchr(auth_keys_file_buf, '/');
+- if(!slash_ptr)
+- pamsshagentauth_fatal
+- ("cannot expand tilde in path without a `/'");
+-
+- owner_uname_len = slash_ptr - auth_keys_file_buf - 1;
+- if(owner_uname_len > (sizeof(owner_uname) - 1))
+- pamsshagentauth_fatal("Username too long");
+-
+- strncat(owner_uname, auth_keys_file_buf + 1, owner_uname_len);
+- if(!authorized_keys_file_allowed_owner_uid)
+- authorized_keys_file_allowed_owner_uid =
+- getpwnam(owner_uname)->pw_uid;
++ pos = 0;
++ }
++
++ if(allow_user_owned_authorized_keys_file)
++ authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++
++ if(*auth_keys_file_buf == '~') {
++ if(*(auth_keys_file_buf+1) == '/') {
++ authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++ }
++ else {
++ slash_ptr = strchr(auth_keys_file_buf,'/');
++ if(!slash_ptr)
++ pamsshagentauth_fatal("cannot expand tilde in path without a `/'");
++
++ owner_uname_len = slash_ptr - auth_keys_file_buf - 1;
++ if(owner_uname_len > (sizeof(owner_uname) - 1) )
++ pamsshagentauth_fatal("Username too long");
++
++ strncat(owner_uname, auth_keys_file_buf + 1, owner_uname_len);
++ if(!authorized_keys_file_allowed_owner_uid)
++ authorized_keys_file_allowed_owner_uid = getpwnam(owner_uname)->pw_uid;
++ }
++ char *tmp = pamsshagentauth_tilde_expand_filename(auth_keys_file_buf, authorized_keys_file_allowed_owner_uid);
++ strncpy(auth_keys_file_buf, tmp, sizeof(auth_keys_file_buf) - 1 );
++ pamsshagentauth_xfree(tmp);
+ }
+- authorized_keys_file =
+- pamsshagentauth_tilde_expand_filename(auth_keys_file_buf,
+- authorized_keys_file_allowed_owner_uid);
+- strncpy(auth_keys_file_buf, authorized_keys_file,
+- sizeof(auth_keys_file_buf) - 1);
+- pamsshagentauth_xfree(authorized_keys_file) /* when we
+- percent_expand
+- later, we'd step
+- on this, so free
+- it immediately */ ;
+- }
+
+- if(strstr(auth_keys_file_buf, "%h")) {
+- authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++ if(strstr(auth_keys_file_buf, "%h")) {
++ authorized_keys_file_allowed_owner_uid = getpwnam(user)->pw_uid;
++ }
++
++ if (nr_authorized_keys_files >= MAX_AUTHORIZED_KEY_FILES)
++ pamsshagentauth_fatal("Too many authorized key files");
++ authorized_keys_files[nr_authorized_keys_files++] =
++ pamsshagentauth_percent_expand(auth_keys_file_buf, "h", getpwnam(user)->pw_dir, "H", hostname, "f", fqdn, "u", user, NULL);
+ }
+-#if HAVE_GETHOSTNAME
+- *hostname = '\0';
+- gethostname(fqdn, HOST_NAME_MAX);
+- strncat(hostname, fqdn, strcspn(fqdn, "."));
+-#endif
+- authorized_keys_file =
+- pamsshagentauth_percent_expand(auth_keys_file_buf, "h",
+- getpwnam(user)->pw_dir, "H", hostname,
+- "f", fqdn, "u", user, NULL);
+ }
+
+-int
++void
++free_authorized_key_files()
++{
++ unsigned int n;
++ for (n = 0; n < nr_authorized_keys_files; n++)
++ free(authorized_keys_files[n]);
++ nr_authorized_keys_files = 0;
++}
++
++const char *
+ pam_user_key_allowed(const char *ruser, Key * key)
+ {
+- return
+- pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
+- key, authorized_keys_file)
+- || pamsshagentauth_user_key_allowed2(getpwuid(0), key,
+- authorized_keys_file)
+- || pamsshagentauth_user_key_command_allowed2(authorized_keys_command,
+- authorized_keys_command_user,
+- getpwnam(ruser), key);
++ unsigned int n;
++ for (n = 0; n < nr_authorized_keys_files; n++) {
++ if (pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid), key, authorized_keys_files[n])
++ || pamsshagentauth_user_key_allowed2(getpwuid(0), key, authorized_keys_files[n])
++ || pamsshagentauth_user_key_command_allowed2(authorized_keys_command, authorized_keys_command_user, getpwnam(ruser), key))
++ return authorized_keys_files[n];
++ }
++ return 0;
+ }
+diff -u pam_ssh_agent_auth-0.10.3-orig/pam_user_authorized_keys.h pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h
+--- pam_ssh_agent_auth-0.10.3-orig/pam_user_authorized_keys.h 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/pam_user_authorized_keys.h 2017-03-03 00:09:17.256064914 -0800
+@@ -28,11 +28,12 @@
+ */
+
+
+-#ifndef _PAM_USER_KEY_ALLOWED_H
+-#define _PAM_USER_KEY_ALLOWED_H
++#ifndef _PAM_USER_AUTHORIZED_KEYS_H
++#define _PAM_USER_AUTHORIZED_KEYS_H
+
+ #include "identity.h"
+-int pam_user_key_allowed(const char *, Key *);
+-void parse_authorized_key_file(const char *, const char *);
++const char * pam_user_key_allowed(const char *, Key *);
++void parse_authorized_key_files(const char *, const char *);
++void free_authorized_key_files();
+
+ #endif
+diff -u pam_ssh_agent_auth-0.10.3-orig/userauth_pubkey_from_id.c pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c
+--- pam_ssh_agent_auth-0.10.3-orig/userauth_pubkey_from_id.c 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.c 2017-03-03 00:10:33.163545380 -0800
+@@ -52,7 +52,7 @@
+ extern uint8_t session_id_len;
+ */
+
+-int
++const char *
+ userauth_pubkey_from_id(const char *ruser, Identity * id, Buffer * session_id2)
+ {
+ Buffer b = { 0 };
+@@ -60,11 +60,12 @@
+ u_char *pkblob = NULL, *sig = NULL;
+ u_int blen = 0, slen = 0;
+ int authenticated = 0;
++ const char *key_file;
+
+ pkalg = (char *) key_ssh_name(id->key);
+
+ /* first test if this key is even allowed */
+- if(! pam_user_key_allowed(ruser, id->key))
++ if(!(key_file = pam_user_key_allowed(ruser, id->key)))
+ goto user_auth_clean_exit;
+
+ if(pamsshagentauth_key_to_blob(id->key, &pkblob, &blen) == 0)
+@@ -97,5 +98,5 @@
+ if(pkblob != NULL)
+ pamsshagentauth_xfree(pkblob);
+ CRYPTO_cleanup_all_ex_data();
+- return authenticated;
++ return authenticated ? key_file : 0;
+ }
+diff -u pam_ssh_agent_auth-0.10.3-orig/userauth_pubkey_from_id.h pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h
+--- pam_ssh_agent_auth-0.10.3-orig/userauth_pubkey_from_id.h 2016-11-12 19:24:32.000000000 -0800
++++ pam_ssh_agent_auth-0.10.3/userauth_pubkey_from_id.h 2017-03-03 00:10:59.067046872 -0800
+@@ -32,6 +32,6 @@
+ #define _USERAUTH_PUBKEY_FROM_ID_H
+
+ #include <identity.h>
+-int userauth_pubkey_from_id(const char *, Identity *, Buffer *);
++const char * userauth_pubkey_from_id(const char *, Identity *, Buffer *);
+
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_u2f/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_u2f/default.nix
new file mode 100644
index 000000000000..d8d9a96652c4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_u2f/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, pkgconfig, libfido2, pam, openssl }:
+
+stdenv.mkDerivation rec {
+ pname = "pam_u2f";
+ version = "1.1.0";
+
+ src = fetchurl {
+ url = "https://developers.yubico.com/pam-u2f/Releases/${pname}-${version}.tar.gz";
+ sha256 = "01fwbrfnjkv93vvqm54jywdcxa1p7d4r32azicwnx75nxfbbzhqd";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ libfido2 pam openssl ];
+
+ preConfigure = ''
+ configureFlagsArray+=("--with-pam-dir=$out/lib/security")
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://developers.yubico.com/pam-u2f/";
+ description = "A PAM module for allowing authentication with a U2F device";
+ license = licenses.bsd2;
+ platforms = platforms.unix;
+ maintainers = with maintainers; [ philandstuff ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix
new file mode 100644
index 000000000000..3e01b1bd4553
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchurl, makeWrapper, dbus, libxml2, pam, pkgconfig, pmount, pythonPackages, writeScript, runtimeShell }:
+
+let
+
+ # Search in the environment if the same program exists with a set uid or
+ # set gid bit. If it exists, run the first program found, otherwise run
+ # the default binary.
+ useSetUID = drv: path:
+ let
+ name = baseNameOf path;
+ bin = "${drv}${path}";
+ in assert name != "";
+ writeScript "setUID-${name}" ''
+ #!${runtimeShell}
+ inode=$(stat -Lc %i ${bin})
+ for file in $(type -ap ${name}); do
+ case $(stat -Lc %a $file) in
+ ([2-7][0-7][0-7][0-7])
+ if test -r "$file".real; then
+ orig=$(cat "$file".real)
+ if test $inode = $(stat -Lc %i "$orig"); then
+ exec "$file" "$@"
+ fi
+ fi;;
+ esac
+ done
+ exec ${bin} "$@"
+ '';
+
+ pmountBin = useSetUID pmount "/bin/pmount";
+ pumountBin = useSetUID pmount "/bin/pumount";
+ inherit (pythonPackages) python dbus-python;
+in
+
+stdenv.mkDerivation rec {
+ name = "pam_usb-0.5.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/pamusb/${name}.tar.gz";
+ sha256 = "1g1w0s9d8mfld8abrn405ll5grv3xgs0b0hsganrz6qafdq9j7q1";
+ };
+
+ buildInputs = [
+ makeWrapper
+ # pam_usb dependencies
+ dbus libxml2 pam pmount pkgconfig
+ # pam_usb's tools dependencies
+ python
+ # cElementTree is included with python 2.5 and later.
+ ];
+
+ preBuild = ''
+ makeFlagsArray=(DESTDIR=$out)
+ substituteInPlace ./src/volume.c \
+ --replace 'pmount' '${pmountBin}' \
+ --replace 'pumount' '${pumountBin}'
+ '';
+
+ # pmount is append to the PATH because pmounts binaries should have a set uid bit.
+ postInstall = ''
+ mv $out/usr/* $out/. # fix color */
+ rm -rf $out/usr
+ for prog in $out/bin/pamusb-conf $out/bin/pamusb-agent; do
+ substituteInPlace $prog --replace '/usr/bin/env python' '/bin/python'
+ wrapProgram $prog \
+ --prefix PYTHONPATH : "$(toPythonPath ${dbus-python})"
+ done
+ '';
+
+ meta = {
+ homepage = "http://pamusb.org/";
+ description = "Authentication using USB Flash Drives";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pax-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pax-utils/default.nix
new file mode 100644
index 000000000000..f69b2bd7fcec
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pax-utils/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "pax-utils";
+ version = "1.2.6";
+
+ src = fetchurl {
+ url = "http://distfiles.gentoo.org/distfiles/${pname}-${version}.tar.xz";
+ sha256 = "08bzvgv1z3371sqf7zlm9i0b1y3wdymj2dqdvzvf192k3nix4hlp";
+ };
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ meta = with lib; {
+ description = "ELF utils that can check files for security relevant properties";
+ longDescription = ''
+ A suite of ELF tools to aid auditing systems. Contains
+ various ELF related utils for ELF32, ELF64 binaries useful
+ for displaying PaX and security info on a large groups of
+ binary files.
+ '';
+ homepage = "https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities";
+ license = licenses.gpl2;
+ platforms = platforms.unix;
+ maintainers = with maintainers; [ thoughtpolice joachifm ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/default.nix
new file mode 100644
index 000000000000..754f6bcac333
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/default.nix
@@ -0,0 +1,34 @@
+{ fetchurl, stdenv, elf-header }:
+
+stdenv.mkDerivation rec {
+ pname = "paxctl";
+ version = "0.9";
+
+ src = fetchurl {
+ url = "https://pax.grsecurity.net/${pname}-${version}.tar.gz";
+ sha256 = "0biw882fp1lmgs6kpxznp1v6758r7dg9x8iv5a06k0b82bcdsc53";
+ };
+
+ buildInputs = [ elf-header ];
+
+ preBuild = ''
+ sed -i Makefile \
+ -e 's|--owner 0 --group 0||g' \
+ -e '/CC:=gcc/d'
+ '';
+
+ makeFlags = [
+ "DESTDIR=$(out)"
+ "MANDIR=share/man/man1"
+ ];
+
+ setupHook = ./setup-hook.sh;
+
+ meta = with stdenv.lib; {
+ description = "A tool for controlling PaX flags on a per binary basis";
+ homepage = "https://pax.grsecurity.net";
+ license = licenses.gpl2;
+ platforms = platforms.all;
+ maintainers = with maintainers; [ thoughtpolice ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/setup-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/setup-hook.sh
new file mode 100644
index 000000000000..11a6bb9910f9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxctl/setup-hook.sh
@@ -0,0 +1,8 @@
+# PaX-mark binaries.
+paxmark() {
+ local flags="$1"
+ shift
+
+ paxctl -c "$@"
+ paxctl -zex -${flags} "$@"
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxtest/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxtest/default.nix
new file mode 100644
index 000000000000..6bd59e1e7fd0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/paxtest/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, paxctl }:
+
+stdenv.mkDerivation rec {
+ pname = "paxtest";
+ version = "0.9.15";
+
+ src = fetchurl {
+ url = "https://www.grsecurity.net/~spender/${pname}-${version}.tar.gz";
+ sha256 = "0zv6vlaszlik98gj9200sv0irvfzrvjn46rnr2v2m37x66288lym";
+ };
+
+ enableParallelBuilding = true;
+
+ makefile = "Makefile.psm";
+ makeFlags = [ "PAXBIN=${paxctl}/bin/paxctl" "BINDIR=$(out)/bin" "RUNDIR=$(out)/lib/paxtest" ];
+ installFlags = [ "DESTDIR=\"\"" ];
+
+ meta = with stdenv.lib; {
+ description = "Test various memory protection measures";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ copumpkin joachifm ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcm/default.nix
new file mode 100644
index 000000000000..3c49e53d8008
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcm/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ version = "202008";
+ pname = "pcm";
+
+ src = fetchFromGitHub {
+ owner = "opcm";
+ repo = "pcm";
+ rev = version;
+ sha256 = "1paxwq0p39vp2ma0rg7dkalc3r28wzj77sm3alavvk2vxgvxi0ig";
+ };
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp pcm*.x $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Processor counter monitor";
+ homepage = "https://www.intel.com/software/pcm";
+ license = licenses.bsd3;
+ maintainers = with maintainers; [ roosemberth ];
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix
new file mode 100644
index 000000000000..820ef7f96127
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix
@@ -0,0 +1,55 @@
+{ config, lib, stdenv, fetchurl
+, yacc, flex
+, sysfsutils, kmod, udev
+, firmware ? config.pcmciaUtils.firmware or [] # Special pcmcia cards.
+, configOpts ? config.pcmciaUtils.config or null # Special hardware (map memory & port & irq)
+}: # used to generate postInstall script.
+
+# FIXME: should add an option to choose between hotplug and udev.
+stdenv.mkDerivation rec {
+ name = "pcmciautils-018";
+
+ src = fetchurl {
+ url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/${name}.tar.gz";
+ sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
+ };
+
+ buildInputs = [udev yacc sysfsutils kmod flex];
+
+ patchPhase = ''
+ sed -i "
+ s,/sbin/modprobe,${kmod}&,;
+ s,/lib/udev/,$out/sbin/,;
+ " udev/* # fix-color */
+ sed -i "
+ s,/lib/firmware,$out&,;
+ s,/etc/pcmcia,$out&,;
+ " src/{startup.c,pcmcia-check-broken-cis.c} # fix-color */
+ ''
+ + (if firmware == [] then ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'' else "")
+ + (if configOpts == null then "" else ''
+ ln -sf ${configOpts} ./config/config.opts'')
+ ;
+
+ makeFlags = [ "LEX=flex" ];
+ installFlags = [ "INSTALL=install" "DESTDIR=${placeholder "out"}" ];
+ postInstall =
+ lib.concatMapStrings (path: ''
+ for f in : $(find ${path} -type f); do
+ test "$f" == ":" && continue;
+ mkdir -p $(dirname $out/lib/firmware/$\{f#${path}});
+ ln -s $f $out/lib/firmware/$\{f#${path}};
+ done;
+ '') firmware;
+
+ meta = {
+ homepage = "https://www.kernel.org/pub/linux/utils/kernel/pcmcia/";
+ longDescription = "
+ PCMCIAutils contains the initialization tools necessary to allow
+ the PCMCIA subsystem to behave (almost) as every other
+ hotpluggable bus system.
+ ";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix
new file mode 100644
index 000000000000..1a18c6ea2721
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, perl }:
+
+stdenv.mkDerivation {
+ name = "perf-tools-20171219";
+
+ src = fetchFromGitHub {
+ owner = "brendangregg";
+ repo = "perf-tools";
+ rev = "98d42a2a1493d2d1c651a5c396e015d4f082eb20";
+ sha256 = "09qnss9pd4kr6qadvp62m2g8sfrj86fksi1rr8m8w4314pzfb93c";
+ };
+
+ buildInputs = [ perl ];
+
+ patchPhase =
+ ''
+ for i in execsnoop iolatency iosnoop kernel/funcslower killsnoop opensnoop; do
+ substituteInPlace $i \
+ --replace /usr/bin/gawk "$(type -p gawk)" \
+ --replace /usr/bin/mawk /no-such-path \
+ --replace /usr/bin/getconf "$(type -p getconf)" \
+ --replace awk=awk "awk=$(type -p gawk)"
+ done
+
+ rm -rf examples deprecated
+ '';
+
+ installPhase =
+ ''
+ d=$out/libexec/perf-tools
+ mkdir -p $d $out/share
+ cp -prvd . $d/
+ ln -s $d/bin $out/bin
+ mv $d/man $out/share/
+ '';
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ homepage = "https://github.com/brendangregg/perf-tools";
+ description = "Performance analysis tools based on Linux perf_events (aka perf) and ftrace";
+ maintainers = [ maintainers.eelco ];
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pflask/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pflask/default.nix
new file mode 100644
index 000000000000..f3e63133d1e1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pflask/default.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, fetchurl, python, wafHook }:
+
+stdenv.mkDerivation rec {
+ pname = "pflask";
+ version = "git-2015-12-17";
+ rev = "599418bb6453eaa0ccab493f9411f13726c1a636";
+
+ src = fetchurl {
+ url = "https://github.com/ghedo/pflask/archive/${rev}.tar.gz";
+ sha256 = "2545fca37f9da484b46b6fb5e3a9bbba6526a9725189fe4af5227ef6e6fca440";
+ };
+
+ nativeBuildInputs = [ wafHook ];
+ buildInputs = [ python ];
+
+ meta = {
+ description = "Lightweight process containers for Linux";
+ homepage = "https://ghedo.github.io/pflask/";
+ license = lib.licenses.bsd2;
+ platforms = lib.platforms.linux;
+ maintainers = with lib.maintainers; [ ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/phc-intel/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/phc-intel/default.nix
new file mode 100644
index 000000000000..2d5d149292cd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/phc-intel/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl, kernel, which }:
+
+# Don't bother with older versions, though some might even work:
+assert stdenv.lib.versionAtLeast kernel.version "4.10";
+
+let
+ release = "0.4.0";
+ revbump = "rev25"; # don't forget to change forum download id...
+in stdenv.mkDerivation rec {
+ name = "linux-phc-intel-${version}-${kernel.version}";
+ version = "${release}-${revbump}";
+
+ src = fetchurl {
+ sha256 = "1w91hpphd8i0br7g5qra26jdydqar45zqwq6jq8yyz6l0vb10zlz";
+ url = "http://www.linux-phc.org/forum/download/file.php?id=194";
+ name = "phc-intel-pack-${revbump}.tar.bz2";
+ };
+
+ nativeBuildInputs = [ which ] ++ kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ makeFlags = with kernel; [
+ "DESTDIR=$(out)"
+ "KERNELSRC=${dev}/lib/modules/${modDirVersion}/build"
+ ];
+
+ configurePhase = ''
+ make $makeFlags brave
+ '';
+
+ enableParallelBuilding = false;
+
+ installPhase = ''
+ install -m 755 -d $out/lib/modules/${kernel.modDirVersion}/extra/
+ install -m 644 *.ko $out/lib/modules/${kernel.modDirVersion}/extra/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Undervolting kernel driver for Intel processors";
+ longDescription = ''
+ PHC is a Linux kernel patch to undervolt processors. This can divide the
+ power consumption of the CPU by two or more, increasing battery life
+ while noticably reducing fan noise. This driver works only on supported
+ Intel architectures.
+ '';
+ homepage = "http://www.linux-phc.org/";
+ downloadPage = "http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267";
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ broken = stdenv.lib.versionAtLeast kernel.version "4.18";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/piper/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/piper/default.nix
new file mode 100644
index 000000000000..641c8b8ba81f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/piper/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, meson, ninja, pkgconfig, gettext, fetchFromGitHub, python3
+, wrapGAppsHook, gtk3, glib, desktop-file-utils, appstream-glib, gnome3
+, gobject-introspection }:
+
+python3.pkgs.buildPythonApplication rec {
+ pname = "piper";
+ version = "0.5.1";
+
+ format = "other";
+
+ src = fetchFromGitHub {
+ owner = "libratbag";
+ repo = "piper";
+ rev = version;
+ sha256 = "1nfjnsiwg2rs6gkjsxzhr2708i6di149dgwq3cf6l12rxqpb8arj";
+ };
+
+ nativeBuildInputs = [ meson ninja gettext pkgconfig wrapGAppsHook desktop-file-utils appstream-glib gobject-introspection ];
+ buildInputs = [
+ gtk3 glib gnome3.adwaita-icon-theme python3
+ ];
+ propagatedBuildInputs = with python3.pkgs; [ lxml evdev pygobject3 ] ++ [
+ gobject-introspection # fixes https://github.com/NixOS/nixpkgs/issues/56943 for now
+ ];
+
+ postPatch = ''
+ chmod +x meson_install.sh # patchShebangs requires executable file
+ patchShebangs meson_install.sh
+ '';
+
+ meta = with stdenv.lib; {
+ description = "GTK frontend for ratbagd mouse config daemon";
+ homepage = "https://github.com/libratbag/piper";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ mvnetbiz ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pipework/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pipework/default.nix
new file mode 100644
index 000000000000..14d1eb859980
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pipework/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper
+, bridge-utils, iproute, lxc, openvswitch, docker, busybox, dhcpcd, dhcp
+}:
+
+stdenv.mkDerivation {
+ pname = "pipework";
+ version = "2017-08-22";
+ src = fetchFromGitHub {
+ owner = "jpetazzo";
+ repo = "pipework";
+ rev = "ae42f1b5fef82b3bc23fe93c95c345e7af65fef3";
+ sha256 = "0c342m0bpq6ranr7dsxk9qi5mg3j5aw9wv85ql8gprdb2pz59qy8";
+ };
+ buildInputs = [ makeWrapper ];
+ installPhase = ''
+ install -D pipework $out/bin/pipework
+ wrapProgram $out/bin/pipework --prefix PATH : \
+ ${lib.makeBinPath [ bridge-utils iproute lxc openvswitch docker busybox dhcpcd dhcp ]};
+ '';
+ meta = with lib; {
+ description = "Software-Defined Networking tools for LXC";
+ homepage = "https://github.com/jpetazzo/pipework";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cstrahan ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch
new file mode 100644
index 000000000000..b4933313a51a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch
@@ -0,0 +1,17 @@
+1. librte_process_info does not exist.
+2. lua5.3 library is liblua.
+3. app/meson.build uses undeclared drivers_install_subdir.
+--- a/lib/common/meson.build
++++ b/lib/common/meson.build
+@@ -34,1 +34,1 @@
+-libs = ['eal', 'kvargs', 'cmdline', 'process_info']
++libs = ['eal', 'kvargs', 'cmdline']
+--- a/lib/lua/meson.build
++++ b/lib/lua/meson.build
+@@ -31 +31 @@ endforeach
+-ext_deps += cc.find_library('lua5.3', required: true)
++ext_deps += cc.find_library('lua', required: true)
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -0,0 +1,1 @@
++option('drivers_install_subdir', type: 'string', value: '')
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix
new file mode 100644
index 000000000000..41db6e936615
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, lib, fetchurl, meson, ninja, pkgconfig
+, dpdk, libbsd, libpcap, lua5_3, numactl, utillinux
+, gtk2, which, withGtk ? false
+}:
+
+stdenv.mkDerivation rec {
+ pname = "pktgen";
+ version = "19.12.0";
+
+ src = fetchurl {
+ url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/${pname}-${version}.tar.xz";
+ sha256 = "1clfviz1qa4hysslcg6i29vsxwl9f6j1y7zf9wwx9br3yq08x956";
+ };
+
+ nativeBuildInputs = [ meson ninja pkgconfig ];
+
+ buildInputs =
+ [ dpdk libbsd libpcap lua5_3 numactl which ]
+ ++ stdenv.lib.optionals withGtk [gtk2];
+
+ RTE_SDK = dpdk;
+ GUI = stdenv.lib.optionalString withGtk "true";
+
+ NIX_CFLAGS_COMPILE = "-msse3";
+
+ patches = [ ./configure.patch ];
+
+ postPatch = ''
+ substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${utillinux}/bin/lscpu
+ '';
+
+ postInstall = ''
+ # meson installs unneeded files with conflicting generic names, such as
+ # include/cli.h and lib/liblua.so.
+ rm -rf $out/include $out/lib
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Traffic generator powered by DPDK";
+ homepage = "http://dpdk.org/";
+ license = licenses.bsdOriginal;
+ platforms = [ "x86_64-linux" ];
+ maintainers = [ maintainers.abuibrahim ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ply/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ply/default.nix
new file mode 100644
index 000000000000..1d98cfb0cd18
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/ply/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, kernel, fetchFromGitHub, autoreconfHook, yacc, flex, p7zip, rsync }:
+
+assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "4.0";
+
+let
+ version = "1.0.beta1-9e810b1";
+in stdenv.mkDerivation {
+ pname = "ply";
+ inherit version;
+ nativeBuildInputs = [ autoreconfHook flex yacc p7zip rsync ];
+
+ src = fetchFromGitHub {
+ owner = "iovisor";
+ repo = "ply";
+ rev = "9e810b157ba079c32c430a7d4c6034826982056e";
+ sha256 = "15cp6iczawaqlhsa0af6i37zn5iq53kh6ya8s2hzd018yd7mhg50";
+ };
+
+ preAutoreconf = ''
+ # If kernel sources are a folder (i.e. fetched from git), we just copy them in
+ # Since they are owned by uid 0 and read-only, we need to fix permissions
+ if [ -d ${kernel.src} ]; then
+ cp -r ${kernel.src} linux-${kernel.version}
+ chown -R $(whoami): linux-${kernel.version}
+ chmod -R a+w linux-${kernel.version}
+ else
+ # ply wants to install header files to its build directory
+ # use 7z to handle multiple archive formats transparently
+ 7z x ${kernel.src} -so | 7z x -aoa -si -ttar
+ fi
+
+ configureFlagsArray+=(--with-kerneldir=$(echo $(pwd)/linux-*))
+ ./autogen.sh --prefix=$out
+ '';
+
+ meta = with stdenv.lib; {
+ description = "dynamic Tracing in Linux";
+ homepage = "https://wkz.github.io/ply/";
+ license = [ licenses.gpl2 ];
+ maintainers = with maintainers; [ mic92 mbbx6spp ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/plymouth/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/plymouth/default.nix
new file mode 100644
index 000000000000..7a6c227f401f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/plymouth/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, libxslt, docbook_xsl
+, gtk3, udev, systemd, lib
+}:
+
+stdenv.mkDerivation rec {
+ pname = "plymouth";
+ version = "0.9.4";
+
+ src = fetchurl {
+ url = "https://www.freedesktop.org/software/plymouth/releases/${pname}-${version}.tar.xz";
+ sha256 = "0l8kg7b2vfxgz9gnrn0v2w4jvysj2cirp0nxads5sy05397pl6aa";
+ };
+
+ nativeBuildInputs = [
+ autoreconfHook pkgconfig libxslt docbook_xsl
+ ];
+
+ buildInputs = [
+ gtk3 udev systemd
+ ];
+
+ postPatch = ''
+ sed -i \
+ -e "s#\$(\$PKG_CONFIG --variable=systemdsystemunitdir systemd)#$out/etc/systemd/system#g" \
+ -e "s#plymouthplugindir=.*#plymouthplugindir=/etc/plymouth/plugins/#" \
+ -e "s#plymouththemedir=.*#plymouththemedir=/etc/plymouth/themes#" \
+ -e "s#plymouthpolicydir=.*#plymouthpolicydir=/etc/plymouth/#" \
+ configure.ac
+ '';
+
+ configureFlags = [
+ "--sysconfdir=/etc"
+ "--with-systemdunitdir=${placeholder "out"}/etc/systemd/system"
+ "--localstatedir=/var"
+ "--with-logo=/etc/plymouth/logo.png"
+ "--with-background-color=0x000000"
+ "--with-background-start-color-stop=0x000000"
+ "--with-background-end-color-stop=0x000000"
+ "--with-release-file=/etc/os-release"
+ "--without-system-root-install"
+ "--without-rhgb-compat-link"
+ "--enable-tracing"
+ "--enable-systemd-integration"
+ "--enable-pango"
+ "--enable-gdm-transition"
+ "--enable-gtk"
+ "ac_cv_path_SYSTEMD_ASK_PASSWORD_AGENT=${lib.getBin systemd}/bin/systemd-tty-ask-password-agent"
+ ];
+
+ configurePlatforms = [ "host" ];
+
+ installFlags = [
+ "plymouthd_defaultsdir=$(out)/share/plymouth"
+ "plymouthd_confdir=$(out)/etc/plymouth"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.freedesktop.org/wiki/Software/Plymouth";
+ description = "A graphical boot animation";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix
new file mode 100644
index 000000000000..1d8314923d37
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, coreutils, gnugrep, utillinux, kmod
+, procps, kbd, dbus }:
+
+let
+
+ binPath = stdenv.lib.makeBinPath
+ [ coreutils gnugrep utillinux kmod procps kbd dbus ];
+
+ sbinPath = stdenv.lib.makeSearchPathOutput "bin" "sbin"
+ [ procps ];
+
+in
+
+stdenv.mkDerivation rec {
+ name = "pm-utils-1.4.1";
+
+ src = fetchurl {
+ url = "https://pm-utils.freedesktop.org/releases/${name}.tar.gz";
+ sha256 = "02qc6zaf7ams6qcc470fwb6jvr4abv3lrlx16clqpn36501rkn4f";
+ };
+
+ configureFlags = [ "--sysconfdir=/etc" ];
+
+ preConfigure =
+ ''
+ # Install the manpages (xmlto isn't really needed).
+ substituteInPlace man/Makefile.in --replace '@HAVE_XMLTO_TRUE@' ""
+
+ # Set the PATH properly.
+ substituteInPlace pm/pm-functions.in --replace '/sbin:/usr/sbin:/bin:/usr/bin' '$PATH:${binPath}:${sbinPath}'
+
+ substituteInPlace src/pm-action.in --replace 'tr ' '${coreutils}/bin/tr '
+
+ substituteInPlace pm/sleep.d/00logging --replace /bin/uname "$(type -P uname)"
+
+ substituteInPlace pm/sleep.d/90clock --replace /sbin/hwclock hwclock
+ '';
+
+ postInstall =
+ ''
+ # Remove some hooks that have doubtful usefulness. See
+ # http://zinc.canonical.com/~cking/power-benchmarking/pm-utils-results/results.txt.
+ # In particular, journal-commit breaks things if you have
+ # read-only bind mounts, since it ends up remounting the
+ # underlying filesystem read-only.
+ rm $out/lib/pm-utils/power.d/{journal-commit,readahead}
+ '';
+
+ meta = {
+ homepage = "https://pm-utils.freedesktop.org/wiki/";
+ description = "A small collection of scripts that handle suspend and resume on behalf of HAL";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pmount/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pmount/default.nix
new file mode 100644
index 000000000000..63d0c88c1f8e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pmount/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, intltool, ntfs3g, utillinux
+, mediaDir ? "/media/"
+, lockDir ? "/var/lock/pmount"
+, whiteList ? "/etc/pmount.allow"
+}:
+
+# constraint mention in the configure.ac
+assert stdenv.lib.hasSuffix "/" mediaDir;
+
+stdenv.mkDerivation rec {
+ pname = "pmount";
+ version = "0.9.23";
+
+ src = fetchurl {
+ url = "mirror://debian/pool/main/p/pmount/pmount_${version}.orig.tar.bz2";
+ sha256 = "db38fc290b710e8e9e9d442da2fb627d41e13b3ee80326c15cc2595ba00ea036";
+ };
+
+ buildInputs = [ intltool utillinux ];
+
+ configureFlags = [
+ "--with-media-dir=${mediaDir}"
+ "--with-lock-dir=${lockDir}"
+ "--with-whitelist=${whiteList}"
+ "--with-mount-prog=${utillinux}/bin/mount"
+ "--with-umount-prog=${utillinux}/bin/umount"
+ "--with-mount-ntfs3g=${ntfs3g}/sbin/mount.ntfs-3g"
+ ];
+
+ postConfigure = ''
+ # etc/Mafile.am is hardcoded and it does not respect the --prefix option.
+ substituteInPlace ./etc/Makefile --replace DESTDIR prefix
+ # Do not change ownership & Do not add the set user ID bit
+ substituteInPlace ./src/Makefile --replace '-o root -g root -m 4755 ' '-m 755 '
+ '';
+
+ doCheck = false; # fails 1 out of 1 tests with "Error: could not open fstab-type file: No such file or directory"
+
+ meta = {
+ homepage = "https://bazaar.launchpad.net/~fourmond/pmount/main/files";
+ description = "Mount removable devices as normal user";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/policycoreutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/policycoreutils/default.nix
new file mode 100644
index 000000000000..f9e3a7fb5d4f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/policycoreutils/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, gettext, libsepol, libselinux, libsemanage }:
+
+stdenv.mkDerivation rec {
+ pname = "policycoreutils";
+ version = "2.9";
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/policycoreutils-${version}.tar.gz";
+ sha256 = "0yqg5ws5gbl1cbn8msxdk1c3ilmmx58qg5dx883kqyq0517k8g65";
+ };
+
+ postPatch = ''
+ # Fix install references
+ substituteInPlace po/Makefile \
+ --replace /usr/bin/install install --replace /usr/share /share
+ substituteInPlace newrole/Makefile --replace /usr/share /share
+
+ sed -i -e '39i#include <crypt.h>' run_init/run_init.c
+ '';
+
+ nativeBuildInputs = [ gettext ];
+ buildInputs = [ libsepol libselinux libsemanage ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "SBINDIR=$(out)/sbin"
+ "ETCDIR=$(out)/etc"
+ "BASHCOMPLETIONDIR=$out/share/bash-completion/completions"
+ "LOCALEDIR=$(out)/share/locale"
+ "MAN5DIR=$(out)/share/man/man5"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "SELinux policy core utilities";
+ license = licenses.gpl2;
+ inherit (libsepol.meta) homepage platforms maintainers;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pommed-light/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pommed-light/default.nix
new file mode 100644
index 000000000000..31697823e524
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pommed-light/default.nix
@@ -0,0 +1,65 @@
+{ stdenv
+, fetchFromGitHub
+, pciutils
+, libconfuse
+, alsaLib
+, audiofile
+, pkgconfig
+, zlib
+, eject
+}:
+
+stdenv.mkDerivation rec {
+ pkgname = "pommed-light";
+ version = "1.51lw";
+ name = "${pkgname}-${version}";
+
+ src = fetchFromGitHub {
+ owner = "bytbox";
+ repo = pkgname;
+ rev = "v${version}";
+ sha256 = "18fvdwwhcl6s4bpf2f2i389s71c8k4g0yb81am9rdddqmzaw27iy";
+ };
+
+ postPatch = ''
+ substituteInPlace pommed.conf.mactel --replace /usr $out
+ substituteInPlace pommed.conf.pmac --replace /usr $out
+ substituteInPlace pommed/beep.h --replace /usr $out
+ substituteInPlace pommed/cd_eject.c --replace /usr/bin/eject ${eject}/bin/eject
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [
+ pciutils
+ libconfuse
+ alsaLib
+ audiofile
+ zlib
+ eject
+ ];
+
+ installPhase = ''
+ install -Dm755 pommed/pommed $out/bin/pommed
+ install -Dm644 pommed.conf.mactel $out/etc/pommed.conf.mactel
+ install -Dm644 pommed.conf.pmac $out/etc/pommed.conf.pmac
+
+ # Man page
+ install -Dm644 pommed.1 $out/share/man/man1/pommed.1
+
+ # Sounds
+ install -Dm644 pommed/data/goutte.wav $out/share/pommed/goutte.wav
+ install -Dm644 pommed/data/click.wav $out/share/pommed/click.wav
+ '';
+
+ meta = {
+ description = "A trimmed version of the pommed hotkey handler for MacBooks";
+ longDescription = ''
+ This is a stripped-down version of pommed with client, dbus, and
+ ambient light sensor support removed, optimized for use with dwm
+ and the like.
+ '';
+ homepage = "https://github.com/bytbox/pommed-light";
+ platforms = [ "x86_64-linux" ];
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/power-calibrate/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/power-calibrate/default.nix
new file mode 100644
index 000000000000..d62990ed4ffd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/power-calibrate/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "power-calibrate";
+ version = "0.01.29";
+
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/${pname}/${pname}-${version}.tar.gz";
+ sha256 = "1v8wvhjqglkvk9cl2b48lkcwhbc6nsdi3hjd7sap4hyvd6703pgs";
+ };
+
+ installFlags = [
+ "BINDIR=${placeholder "out"}/bin"
+ "MANDIR=${placeholder "out"}/share/man/man8"
+ ];
+
+ meta = with lib; {
+ description = "Tool to calibrate power consumption";
+ homepage = "https://kernel.ubuntu.com/~cking/power-calibrate/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ dtzWill ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powerstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powerstat/default.nix
new file mode 100644
index 000000000000..6020139ad4b4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powerstat/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "powerstat";
+ version = "0.02.24";
+
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/${pname}/${pname}-${version}.tar.gz";
+ sha256 = "0yrc1xi9flxn2mvmzp0b0vd0md5z4p8fd4y8bszc67xy12qiqy0j";
+ };
+
+ installFlags = [ "DESTDIR=${placeholder "out"}" ];
+
+ postInstall = ''
+ mv $out/usr/* $out
+ rm -r $out/usr
+ '';
+
+ meta = with lib; {
+ description = "Laptop power measuring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/powerstat/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ womfoo ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powertop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powertop/default.nix
new file mode 100644
index 000000000000..4bf318d743ea
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/powertop/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, fetchpatch, gettext, libnl, ncurses, pciutils, pkgconfig, zlib }:
+
+stdenv.mkDerivation rec {
+ pname = "powertop";
+ version = "2.13";
+
+ src = fetchurl {
+ url = "https://01.org/sites/default/files/downloads/${pname}-${version}.tar.gz";
+ sha256 = "0y1ixw8v17fdb1ima0zshrd0rh4zxdh10r93nrrvq6d4lhn9jpx6";
+ };
+
+ outputs = [ "out" "man" ];
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ gettext libnl ncurses pciutils zlib ];
+
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl (
+ fetchpatch {
+ name = "strerror_r.patch";
+ url = "https://git.alpinelinux.org/aports/plain/main/powertop/strerror_r.patch?id=3b9214d436f1611f297b01f72469d66bfe729d6e";
+ sha256 = "1kzddhcrb0n2iah4lhgxwwy4mkhq09ch25jjngyq6pdj6pmfkpfw";
+ }
+ );
+
+ postPatch = ''
+ substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
+ substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "xset"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Analyze power consumption on Intel-based laptops";
+ homepage = "https://01.org/powertop";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ fpletz ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pps-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pps-tools/default.nix
new file mode 100644
index 000000000000..fd5225c5cfe0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pps-tools/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ baseName = "pps-tools";
+ version = "1.0.2";
+ name = "${baseName}-${version}";
+
+ src = fetchFromGitHub {
+ owner = "redlab-i";
+ repo = baseName;
+ rev = "v${version}";
+ sha256 = "1yh9g0l59dkq4ci0wbb03qin3c3cizfngmn9jy1vwm5zm6axlxhf";
+ };
+
+ outputs = [ "out" "dev" ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $dev/include
+ mkdir -p $out/{usr/bin,usr/include/sys}
+ make install DESTDIR=$out
+ mv $out/usr/bin/* $out/bin
+ mv $out/usr/include/* $dev/include/
+ rm -rf $out/usr/
+ '';
+
+ meta = with stdenv.lib;{
+ description = "User-space tools for LinuxPPS";
+ homepage = "http://linuxpps.org/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ sorki ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/autostart.desktop b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/autostart.desktop
new file mode 100644
index 000000000000..b8eb27fdd992
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/autostart.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=@version@
+Encoding=UTF-8
+Name=@description@
+Type=Application
+Exec=@exec@
+X-KDE-autostart-phase=1
+GenericName[en_US]=
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/default.nix
new file mode 100644
index 000000000000..e71dcb497a26
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/prl-tools/default.nix
@@ -0,0 +1,168 @@
+{ stdenv, lib, makeWrapper, p7zip
+, gawk, utillinux, xorg, glib, dbus-glib, zlib
+, kernel ? null, libsOnly ? false
+, undmg, fetchurl
+}:
+
+assert (!libsOnly) -> kernel != null;
+
+let xorgFullVer = lib.getVersion xorg.xorgserver;
+ xorgVer = lib.versions.majorMinor xorgFullVer;
+ x64 = if stdenv.hostPlatform.system == "x86_64-linux" then true
+ else if stdenv.hostPlatform.system == "i686-linux" then false
+ else throw "Parallels Tools for Linux only support {x86-64,i686}-linux targets";
+in
+stdenv.mkDerivation rec {
+ version = "${prl_major}.2.1-41615";
+ prl_major = "12";
+ pname = "prl-tools";
+
+ # We download the full distribution to extract prl-tools-lin.iso from
+ # => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
+ src = fetchurl {
+ url = "https://download.parallels.com/desktop/v${prl_major}/${version}/ParallelsDesktop-${version}.dmg";
+ sha256 = "1jwzwif69qlhmfky9kigjaxpxfj0lyrl1iyrpqy4iwqvajdgbbym";
+ };
+
+ hardeningDisable = [ "pic" "format" ];
+
+ # also maybe python2 to generate xorg.conf
+ nativeBuildInputs = [ p7zip undmg ] ++ lib.optionals (!libsOnly) [ makeWrapper ] ++ kernel.moduleBuildDependencies;
+
+ inherit libsOnly;
+
+ unpackPhase = ''
+ undmg < "${src}"
+
+ export sourceRoot=prl-tools-build
+ 7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso" -o$sourceRoot
+ if test -z "$libsOnly"; then
+ ( cd $sourceRoot/kmods; tar -xaf prl_mod.tar.gz )
+ fi
+ ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
+ '';
+
+ kernelVersion = if libsOnly then "" else lib.getName kernel.name;
+ kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}";
+ scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]);
+
+ buildPhase = ''
+ if test -z "$libsOnly"; then
+ ( # kernel modules
+ cd kmods
+ make -f Makefile.kmods \
+ KSRC=$kernelDir/source \
+ HEADERS_CHECK_DIR=$kernelDir/source \
+ KERNEL_DIR=$kernelDir/build \
+ SRC=$kernelDir/build \
+ KVER=$kernelVersion
+ )
+
+ # Xorg config (maybe would be useful for other versions)
+ #python2 installer/xserver-config.py xorg ${xorgVer} /dev/null parallels.conf
+ fi
+ '';
+
+ libPath = with xorg;
+ stdenv.lib.makeLibraryPath ([ stdenv.cc.cc libXrandr libXext libX11 libXcomposite libXinerama ]
+ ++ lib.optionals (!libsOnly) [ libXi glib dbus-glib zlib ]);
+
+
+ installPhase = ''
+ if test -z "$libsOnly"; then
+ ( # kernel modules
+ cd kmods
+ mkdir -p $out/lib/modules/${kernelVersion}/extra
+ cp prl_eth/pvmnet/prl_eth.ko $out/lib/modules/${kernelVersion}/extra
+ cp prl_tg/Toolgate/Guest/Linux/prl_tg/prl_tg.ko $out/lib/modules/${kernelVersion}/extra
+ cp prl_fs/SharedFolders/Guest/Linux/prl_fs/prl_fs.ko $out/lib/modules/${kernelVersion}/extra
+ cp prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze/prl_fs_freeze.ko $out/lib/modules/${kernelVersion}/extra
+ )
+ fi
+
+ ( # tools
+ cd tools
+ mkdir -p $out/lib
+
+ if test -z "$libsOnly"; then
+ # install binaries
+ for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do
+ install -Dm755 $i $out/$i
+ done
+ # other binaries
+ for i in xorg.7.1/usr/bin/*; do
+ cp $i $out/bin
+ done
+
+ for i in $out/bin/* $out/sbin/*; do
+ patchelf \
+ --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+ --set-rpath "$out/lib:$libPath" \
+ $i || true
+ done
+
+ mkdir -p $out/bin
+ install -Dm755 ../installer/prlfsmountd.sh $out/sbin/prlfsmountd
+ wrapProgram $out/sbin/prlfsmountd \
+ --prefix PATH ':' "$scriptPath"
+
+ for i in lib/*.a; do
+ cp $i $out/lib
+ done
+
+ for i in xorg.7.1/usr/lib/libprl_wmouse_watcher.*; do
+ cp $i $out/lib
+ done
+
+ mkdir -p $out/lib/udev/rules.d
+ for i in *.rules; do
+ sed 's,/bin/bash,${stdenv.shell},g' $i > $out/lib/udev/rules.d/$i
+ done
+
+ (
+ cd xorg.${xorgVer}
+ # Install the X modules.
+ (
+ cd x-server/modules
+ for i in */*; do
+ install -Dm755 $i $out/lib/xorg/modules/$i
+ done
+ )
+ (
+ cd usr/lib
+ libGLXname=$(echo libglx.so*)
+ install -Dm755 $libGLXname $out/lib/xorg/modules/extensions/$libGLXname
+ ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so
+ ln -s $libGLXname $out/lib/xorg/modules/extensions/libglx.so.1
+ )
+ )
+ fi
+
+ for i in xorg.7.1/usr/lib/libGL.*; do
+ cp $i $out/lib
+ done
+
+ cd $out
+ find -name \*.so\* -type f -exec \
+ patchelf --set-rpath "$out/lib:$libPath" {} \;
+
+ cd lib
+ libGLname=$(echo libGL.so*)
+ ln -s $libGLname libGL.so
+ ln -s $libGLname libGL.so.1
+ )
+ '';
+
+ dontStrip = true;
+ dontPatchELF = true;
+
+ meta = with stdenv.lib; {
+ description = "Parallels Tools for Linux guests";
+ homepage = "https://parallels.com";
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ license = licenses.unfree;
+ # I was making this package blindly and requesting testing from the real user,
+ # so I can't even test it by myself and won't provide future updates.
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procdump/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procdump/default.nix
new file mode 100644
index 000000000000..74ee1533e461
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procdump/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub, bash, coreutils, gdb, zlib }:
+
+stdenv.mkDerivation rec {
+ pname = "procdump";
+ version = "1.1.1";
+
+ src = fetchFromGitHub {
+ owner = "Microsoft";
+ repo = "ProcDump-for-Linux";
+ rev = version;
+ sha256 = "0h5fhk39d10kjbinzw1yp6nr8w8l300mn9qxrkpivdkyfn6bpq2f";
+ };
+
+ nativeBuildInputs = [ zlib ];
+ buildInputs = [ bash coreutils gdb ];
+
+ postPatch = ''
+ substituteInPlace src/CoreDumpWriter.c \
+ --replace '"gcore ' '"${gdb}/bin/gcore ' \
+ --replace '"rm ' '"${coreutils}/bin/rm ' \
+ --replace '/bin/bash' '${bash}/bin/bash'
+ '';
+
+ makeFlags = [
+ "DESTDIR=${placeholder "out"}"
+ "INSTALLDIR=/bin"
+ "MANDIR=/share/man/man1"
+ ];
+
+ doCheck = false; # needs sudo root
+
+ doInstallCheck = true;
+ installCheckPhase = ''
+ runHook preInstallCheck
+ set +o pipefail
+ ($out/bin/procdump -h | grep "ProcDump v${version}") ||
+ (echo "ERROR: ProcDump is not the expected version or does not run properly" ; exit 1)
+ set -o pipefail
+ runHook postInstallCheck
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A Linux version of the ProcDump Sysinternals tool";
+ homepage = "https://github.com/Microsoft/ProcDump-for-Linux";
+ license = licenses.mit;
+ maintainers = with maintainers; [ c0bw3b ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procps-ng/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procps-ng/default.nix
new file mode 100644
index 000000000000..466e66a8713c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/procps-ng/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchurl, ncurses, pkgconfig
+
+# `ps` with systemd support is able to properly report different
+# attributes like unit name, so we want to have it on linux.
+, withSystemd ? stdenv.isLinux
+, systemd ? null
+
+# procps is mostly Linux-only. Most commands require a running Linux
+# system (or very similar like that found in Cygwin). The one
+# exception is ‘watch’ which is portable enough to run on pretty much
+# any UNIX-compatible system.
+, watchOnly ? !(stdenv.isLinux || stdenv.isCygwin)
+}:
+
+stdenv.mkDerivation rec {
+ pname = "procps";
+ version = "3.3.16";
+
+ # The project's releases are on SF, but git repo on gitlab.
+ src = fetchurl {
+ url = "mirror://sourceforge/procps-ng/procps-ng-${version}.tar.xz";
+ sha256 = "1br0g93ysqhlv13i1k4lfbimsgxnpy5rgs4lxfc9rkzdbpbaqplj";
+ };
+
+ buildInputs = [ ncurses ]
+ ++ lib.optional withSystemd systemd;
+ nativeBuildInputs = [ pkgconfig ];
+
+ makeFlags = [ "usrbin_execdir=$(out)/bin" ]
+ ++ lib.optionals watchOnly [ "watch" "PKG_LDFLAGS="];
+
+ enableParallelBuilding = true;
+
+ # Too red
+ configureFlags = [ "--disable-modern-top" ]
+ ++ lib.optional withSystemd "--with-systemd"
+ ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform)
+ [ "ac_cv_func_malloc_0_nonnull=yes"
+ "ac_cv_func_realloc_0_nonnull=yes" ];
+
+ installPhase = if watchOnly then ''
+ install -m 0755 -D watch $out/bin/watch
+ install -m 0644 -D watch.1 $out/share/man/man1/watch.1
+ '' else null;
+
+ meta = {
+ homepage = "https://gitlab.com/procps-ng/procps";
+ description = "Utilities that give information about processes using the /proc filesystem";
+ priority = 11; # less than coreutils, which also provides "kill" and "uptime"
+ license = lib.licenses.gpl2;
+ platforms = lib.platforms.unix;
+ maintainers = [ lib.maintainers.typetetris ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pscircle/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pscircle/default.nix
new file mode 100644
index 000000000000..9dd4ba6cd373
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pscircle/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitLab, meson, pkgconfig, ninja, cairo }:
+
+stdenv.mkDerivation rec {
+ pname = "pscircle";
+ version = "1.3.1";
+
+ src = fetchFromGitLab {
+ owner = "mildlyparallel";
+ repo = "pscircle";
+ rev = "v${version}";
+ sha256 = "1sm99423hh90kr4wdjqi9sdrrpk65j2vz2hzj65zcxfxyr6khjci";
+ };
+
+ buildInputs = [
+ meson
+ pkgconfig
+ cairo
+ ninja
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://gitlab.com/mildlyparallel/pscircle";
+ description = "Visualize Linux processes in a form of a radial tree";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.ldesgoui ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psftools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psftools/default.nix
new file mode 100644
index 000000000000..a71e7ef0dcc9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psftools/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl }:
+stdenv.mkDerivation rec {
+ pname = "psftools";
+ version = "1.0.13";
+ src = fetchurl {
+ url = "https://www.seasip.info/Unix/PSF/${pname}-${version}.tar.gz";
+ sha256 = "0rgg1lhryqi6sgm4afhw0z6pjivdw4hyhpxanj8rabyabn4fcqcw";
+ };
+ outputs = ["out" "man" "dev" "lib"];
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.seasip.info/Unix/PSF";
+ description = "Conversion tools for .PSF fonts";
+ longDescription = ''
+ The PSFTOOLS are designed to manipulate fixed-width bitmap fonts,
+ such as DOS or Linux console fonts. Both the PSF1 (8 pixels wide)
+ and PSF2 (any width) formats are supported; the default output
+ format is PSF2.
+ '';
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ kaction ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psmisc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psmisc/default.nix
new file mode 100644
index 000000000000..4379ee3ae49f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/psmisc/default.nix
@@ -0,0 +1,33 @@
+{stdenv, fetchFromGitLab, autoconf, automake, gettext, ncurses}:
+
+stdenv.mkDerivation rec {
+ pname = "psmisc";
+ version = "23.3";
+
+ src = fetchFromGitLab {
+ owner = pname;
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1132xvrldv0dar2mf221mv5kvajq0v6yrq8k3nl0wslnh5baa0r0";
+ };
+
+ nativeBuildInputs = [ autoconf automake gettext ];
+ buildInputs = [ ncurses ];
+
+ preConfigure = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ # Goes past the rpl_malloc linking failure
+ export ac_cv_func_malloc_0_nonnull=yes
+ export ac_cv_func_realloc_0_nonnull=yes
+ '' + ''
+ echo $version > .tarball-version
+ ./autogen.sh
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://gitlab.com/psmisc/psmisc";
+ description = "A set of small useful utilities that use the proc filesystem (such as fuser, killall and pstree)";
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ ryantm ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8125/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8125/default.nix
new file mode 100644
index 000000000000..8cdf11f80add
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8125/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ pname = "r8125";
+ # On update please verify (using `diff -r`) that the source matches the
+ # realtek version.
+ version = "9.003.05";
+
+ # This is a mirror. The original website[1] doesn't allow non-interactive
+ # downloads, instead emailing you a download link.
+ # [1] https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
+ src = fetchFromGitHub {
+ owner = "ibmibmibm";
+ repo = "r8125";
+ rev = version;
+ sha256 = "016vh997xjs01si0zzs572vgflq3czxd0v4m7h1m3qxcv2cvq7i0";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ preBuild = ''
+ substituteInPlace src/Makefile --replace "BASEDIR :=" "BASEDIR ?="
+ substituteInPlace src/Makefile --replace "modules_install" "INSTALL_MOD_PATH=$out modules_install"
+ '';
+
+ makeFlags = [
+ "BASEDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
+ ];
+
+ buildFlags = [ "modules" ];
+
+ meta = with lib; {
+ homepage = "https://github.com/ibmibmibm/r8125";
+ downloadPage = "https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software";
+ description = "Realtek r8125 driver";
+ longDescription = ''
+ A kernel module for Realtek 8125 2.5G network cards.
+ '';
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ peelz ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8168/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8168/default.nix
new file mode 100644
index 000000000000..b3d8965704fd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/r8168/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+
+let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8168";
+
+in stdenv.mkDerivation rec {
+ name = "r8168-${kernel.version}-${version}";
+ # on update please verify that the source matches the realtek version
+ version = "8.047.04";
+
+ # This is a mirror. The original website[1] doesn't allow non-interactive
+ # downloads, instead emailing you a download link.
+ # [1] http://www.realtek.com.tw/downloads/downloadsView.aspx?PFid=5&Level=5&Conn=4&DownTypeID=3
+ # I've verified manually (`diff -r`) that the source code for version 8.046.00
+ # is the same as the one available on the realtek website.
+ src = fetchFromGitHub {
+ owner = "mtorromeo";
+ repo = "r8168";
+ rev = version;
+ sha256 = "1rni8jimwdhyx75603mdcylrdxgfwfpyprf1lf5x5cli2i4bbijg";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ # avoid using the Makefile directly -- it doesn't understand
+ # any kernel but the current.
+ # based on the ArchLinux pkgbuild: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/r8168
+ preBuild = ''
+ makeFlagsArray+=("-C${kernel.dev}/lib/modules/${kernel.modDirVersion}/build")
+ makeFlagsArray+=("SUBDIRS=$PWD/src")
+ makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN")
+ makeFlagsArray+=("modules")
+ '';
+
+ enableParallelBuilding = true;
+
+ installPhase = ''
+ mkdir -p ${modDestDir}
+ find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \;
+ find ${modDestDir} -name '*.ko' -exec xz -f '{}' \;
+ '';
+
+ meta = with lib; {
+ description = "Realtek r8168 driver";
+ longDescription = ''
+ A kernel module for Realtek 8168 network cards.
+ If you want to use this driver, you might need to blacklist the r8169 driver
+ by adding "r8169" to boot.blacklistedKernelModules.
+ '';
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ timokau ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontools/default.nix
new file mode 100644
index 000000000000..d2c3c11c9390
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontools/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl
+, autoreconfHook
+, pciutils
+, pkgconfig
+, xorg
+}:
+
+stdenv.mkDerivation rec {
+ pname = "radeontool";
+ version = "1.6.3";
+
+ src = fetchurl {
+ url = "https://people.freedesktop.org/~airlied/radeontool/${pname}-${version}.tar.gz";
+ sha256 = "0mjk9wr9rsb17yy92j6yi16hfpa6v5r1dbyiy60zp4r125wr63za";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ xorg.libpciaccess ];
+
+ meta = with stdenv.lib; {
+ description = "Lowlevel tools to tweak register and dump state on radeon GPUs";
+ homepage = "https://airlied.livejournal.com/";
+ license = licenses.zlib;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontop/default.nix
new file mode 100644
index 000000000000..3d26914d4f9d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/radeontop/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, pkgconfig, gettext, makeWrapper
+, ncurses, libdrm, libpciaccess, libxcb }:
+
+stdenv.mkDerivation rec {
+ pname = "radeontop";
+ version = "2019-06-03";
+
+ src = fetchFromGitHub {
+ sha256 = "1b1m30r2nfwqkajqw6m01xmfhlq83z1qylyijxg7962mp9x2k0gw";
+ rev = "v1.2";
+ repo = "radeontop";
+ owner = "clbr";
+ };
+
+ buildInputs = [ ncurses libdrm libpciaccess libxcb ];
+ nativeBuildInputs = [ pkgconfig gettext makeWrapper ];
+
+ enableParallelBuilding = true;
+
+ patchPhase = ''
+ substituteInPlace getver.sh --replace ver=unknown ver=${version}
+ '';
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ postInstall = ''
+ wrapProgram $out/sbin/radeontop \
+ --prefix LD_LIBRARY_PATH : $out/lib
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Top-like tool for viewing AMD Radeon GPU utilization";
+ longDescription = ''
+ View GPU utilization, both for the total activity percent and individual
+ blocks. Supports R600 and later cards: even Southern Islands should work.
+ Works with both the open drivers and AMD Catalyst. Total GPU utilization
+ is also valid for OpenCL loads; the other blocks are only useful for GL
+ loads. Requires root rights or other permissions to read /dev/mem.
+ '';
+ homepage = "https://github.com/clbr/radeontop";
+ platforms = platforms.linux;
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ rycee ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rdma-core/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rdma-core/default.nix
new file mode 100644
index 000000000000..59a7125aad6d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rdma-core/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, docutils
+, pandoc, ethtool, iproute, libnl, udev, python, perl
+, makeWrapper
+} :
+
+let
+ version = "31.0";
+
+in stdenv.mkDerivation {
+ pname = "rdma-core";
+ inherit version;
+
+ src = fetchFromGitHub {
+ owner = "linux-rdma";
+ repo = "rdma-core";
+ rev = "v${version}";
+ sha256 = "0qr8a25ylmkwfgyj519zvl74q16bhf4895xjich2r98rl2yg0qdl";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig pandoc docutils makeWrapper ];
+ buildInputs = [ libnl ethtool iproute udev python perl ];
+
+ cmakeFlags = [
+ "-DCMAKE_INSTALL_RUNDIR=/run"
+ "-DCMAKE_INSTALL_SHAREDSTATEDIR=/var/lib"
+ ];
+
+ postPatch = ''
+ substituteInPlace srp_daemon/srp_daemon.sh.in \
+ --replace /bin/rm rm
+ '';
+
+ postInstall = ''
+ # cmake script is buggy, move file manually
+ mkdir -p $out/${perl.libPrefix}
+ mv $out/share/perl5/* $out/${perl.libPrefix}
+ '';
+
+ postFixup = ''
+ for pls in $out/bin/{ibfindnodesusing.pl,ibidsverify.pl}; do
+ echo "wrapping $pls"
+ wrapProgram $pls --prefix PERL5LIB : "$out/${perl.libPrefix}"
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "RDMA Core Userspace Libraries and Daemons";
+ homepage = "https://github.com/linux-rdma/rdma-core";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ markuskowa ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/read-edid/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/read-edid/default.nix
new file mode 100644
index 000000000000..36020d831aca
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/read-edid/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fetchurl, cmake, libx86 }:
+
+stdenv.mkDerivation rec {
+ pname = "read-edid";
+ version = "3.0.2";
+
+ src = fetchurl {
+ url = "http://www.polypux.org/projects/read-edid/${pname}-${version}.tar.gz";
+ sha256 = "0vqqmwsgh2gchw7qmpqk6idgzcm5rqf2fab84y7gk42v1x2diin7";
+ };
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = lib.optional (stdenv.isi686 || stdenv.isx86_64) libx86;
+
+ cmakeFlags = [ "-DCLASSICBUILD=${if stdenv.isi686 || stdenv.isx86_64 then "ON" else "OFF"}" ];
+
+ patchPhase = ''
+ substituteInPlace CMakeLists.txt --replace 'COPYING' 'LICENSE'
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Tool for reading and parsing EDID data from monitors";
+ homepage = "http://www.polypux.org/projects/read-edid/";
+ license = licenses.bsd2; # Quoted: "This is an unofficial license. Let's call it BSD-like."
+ maintainers = [ maintainers.dezgeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/regionset/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/regionset/default.nix
new file mode 100644
index 000000000000..15030d1b19a2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/regionset/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+let version = "0.2"; in
+stdenv.mkDerivation {
+ pname = "regionset";
+ inherit version;
+
+ src = fetchurl {
+ url = "http://linvdr.org/download/regionset/regionset-${version}.tar.gz";
+ sha256 = "1fgps85dmjvj41a5bkira43vs2aiivzhqwzdvvpw5dpvdrjqcp0d";
+ };
+
+ installPhase = ''
+ install -Dm755 {.,$out/bin}/regionset
+ install -Dm644 {.,$out/share/man/man8}/regionset.8
+ '';
+
+ meta = with stdenv.lib; {
+ inherit version;
+ homepage = "http://linvdr.org/projects/regionset/";
+ description = "Tool for changing the region code setting of DVD players";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/reptyr/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/reptyr/default.nix
new file mode 100644
index 000000000000..0e635583d644
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/reptyr/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, python2 }:
+
+stdenv.mkDerivation rec {
+ version = "0.7.0";
+ pname = "reptyr";
+
+ src = fetchFromGitHub {
+ owner = "nelhage";
+ repo = "reptyr";
+ rev = "reptyr-${version}";
+ sha256 = "1hnijfz1ab34j2h2cxc3f43rmbclyihgn9x9wxa7jqqgb2xm71hj";
+ };
+
+ patches = [
+ # Fix tests hanging
+ (fetchpatch {
+ url = "https://github.com/nelhage/reptyr/commit/bca3070ac0f3888b5d37ee162505be81b3b496ff.patch";
+ sha256 = "0w6rpv9k4a80q0ijzdq5hlpr37ncr284piqjv5agy8diniwlilab";
+ })
+ ];
+
+ makeFlags = [ "PREFIX=" "DESTDIR=$(out)" ];
+
+ checkInputs = [ (python2.withPackages (p: [ p.pexpect ])) ];
+ doCheck = true;
+
+ meta = {
+ platforms = [
+ "i686-linux"
+ "x86_64-linux"
+ "i686-freebsd"
+ "x86_64-freebsd"
+ "armv5tel-linux"
+ "armv6l-linux"
+ "armv7l-linux"
+ "aarch64-linux"
+ ];
+ maintainers = with lib.maintainers; [raskin];
+ license = lib.licenses.mit;
+ description = "Reparent a running program to a new terminal";
+ homepage = "https://github.com/nelhage/reptyr";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rewritefs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rewritefs/default.nix
new file mode 100644
index 000000000000..a852e43b38f8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rewritefs/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, pkgconfig, fuse, pcre }:
+
+stdenv.mkDerivation {
+ pname = "rewritefs";
+ version = "2017-08-14";
+
+ src = fetchFromGitHub {
+ owner = "sloonz";
+ repo = "rewritefs";
+ rev = "33fb844d8e8ff441a3fc80d2715e8c64f8563d81";
+ sha256 = "15bcxprkxf0xqxljsqhb0jpi7p1vwqcb00sjs7nzrj7vh2p7mqla";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ fuse pcre ];
+
+ prePatch = ''
+ # do not set sticky bit in nix store
+ substituteInPlace Makefile --replace 6755 0755
+ '';
+
+ preConfigure = "substituteInPlace Makefile --replace /usr/local $out";
+
+ meta = with stdenv.lib; {
+ description = ''A FUSE filesystem intended to be used
+ like Apache mod_rewrite'';
+ homepage = "https://github.com/sloonz/rewritefs";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ rnhmjoj ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh
new file mode 100755
index 000000000000..75716e40daee
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh
@@ -0,0 +1,19 @@
+#!@shell@
+
+# Executes a hook in case of a change to the
+# rfkill state. The hook can be passed as
+# environment variable, or present as executable
+# file.
+
+if [ -z "$RFKILL_STATE" ]; then
+ echo "rfkill-hook: error: RFKILL_STATE variable not set"
+ exit 1
+fi
+
+if [ -x /run/current-system/etc/rfkill.hook ]; then
+ exec /run/current-system/etc/rfkill.hook
+elif [ ! -z "$RFKILL_HOOK" ]; then
+ exec $RFKILL_HOOK
+else
+ echo "rfkill-hook: $RFKILL_STATE"
+fi
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/udev.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/udev.nix
new file mode 100644
index 000000000000..a24c947673de
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rfkill/udev.nix
@@ -0,0 +1,56 @@
+{ stdenv, substituteAll }:
+
+# Provides a facility to hook into rfkill changes.
+#
+# Exemplary usage:
+#
+# Add this package to udev.packages, e.g.:
+# udev.packages = [ pkgs.rfkill_udev ];
+#
+# Add a hook script in the managed etc directory, e.g.:
+# etc."rfkill.hook" = {
+# mode = "0755";
+# text = ''
+# #!${pkgs.runtimeShell}
+#
+# if [ "$RFKILL_STATE" -eq "1" ]; then
+# exec ${config.system.build.upstart}/sbin/initctl emit -n antenna-on
+# else
+# exec ${config.system.build.upstart}/sbin/initctl emit -n antenna-off
+# fi
+# '';
+# }
+
+# Note: this package does not need the binaries
+# in the rfkill package.
+
+let
+ rfkillHook =
+ substituteAll {
+ inherit (stdenv) shell;
+ isExecutable = true;
+ src = ./rfkill-hook.sh;
+ };
+in stdenv.mkDerivation {
+ name = "rfkill-udev";
+
+ dontUnpack = true;
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir -p "$out/etc/udev/rules.d/";
+ cat > "$out/etc/udev/rules.d/90-rfkill.rules" << EOF
+ SUBSYSTEM=="rfkill", ATTR{type}=="wlan", RUN+="$out/bin/rfkill-hook.sh"
+ EOF
+
+ mkdir -p "$out/bin/";
+ cp ${rfkillHook} "$out/bin/rfkill-hook.sh"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://wireless.kernel.org/en/users/Documentation/rfkill";
+ description = "Rules+hook for udev to catch rfkill state changes";
+ platforms = platforms.linux;
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/roccat-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/roccat-tools/default.nix
new file mode 100644
index 000000000000..f8a1b836a6c6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/roccat-tools/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, cmake, pkgconfig, gettext
+, dbus, dbus-glib, libgaminggear, libgudev, lua
+, harfbuzz
+}:
+
+stdenv.mkDerivation rec {
+ pname = "roccat-tools";
+ version = "5.9.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/roccat/${pname}-${version}.tar.bz2";
+ sha256 = "12j02rzbz3iqxprz8cj4kcfcdgnqlva142ci177axqmckcq6crvg";
+ };
+
+ postPatch = ''
+ sed -i -re 's,/(etc/xdg),\1,' roccateventhandler/CMakeLists.txt
+
+ sed -i -e '/roccat_profile_dir(void).*{/,/}/ {
+ /return/c \
+ return g_build_path("/", g_get_user_data_dir(), "roccat", NULL);
+ }' libroccat/roccat_helper.c
+ '';
+
+ nativeBuildInputs = [ cmake pkgconfig gettext ];
+ buildInputs = [ dbus dbus-glib libgaminggear libgudev lua ];
+
+ enableParallelBuilding = true;
+
+ cmakeFlags = [
+ "-DUDEVDIR=\${out}/lib/udev/rules.d"
+ "-DCMAKE_MODULE_PATH=${libgaminggear.dev}/lib/cmake"
+ "-DWITH_LUA=${lua.luaversion}"
+ "-DLIBDIR=lib"
+ ];
+
+ NIX_CFLAGS_COMPILE = [ "-I${harfbuzz.dev}/include/harfbuzz" ];
+
+ meta = {
+ description = "Tools to configure ROCCAT devices";
+ homepage = "http://roccat.sourceforge.net/";
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtkit/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtkit/default.nix
new file mode 100644
index 000000000000..b3f73e6c3bba
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtkit/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchFromGitHub, fetchpatch
+, meson, ninja, pkgconfig, unixtools
+, dbus, libcap, polkit, systemd
+}:
+
+stdenv.mkDerivation rec {
+ pname = "rtkit";
+ version = "0.13";
+
+ src = fetchFromGitHub {
+ owner = "heftig";
+ repo = "rtkit";
+ rev = "c295fa849f52b487be6433e69e08b46251950399";
+ sha256 = "0yfsgi3pvg6dkizrww1jxpkvcbhzyw9110n1dypmzq0c5hlzjxcd";
+ };
+
+ patches = [
+ (fetchpatch {
+ url = "https://github.com/heftig/rtkit/commit/7d62095b94f8df3891c984a1535026d2658bb177.patch";
+ sha256 = "17acv549zqcgh7sgprfagbf6drqsr0zdwvf1dsqda7wlqc2h9zn7";
+ })
+
+ (fetchpatch {
+ url = "https://github.com/heftig/rtkit/commit/98f70edd8f534c371cb4308b9720739c5178918d.patch";
+ sha256 = "18mnjjsdjfr184nkzi01xyphpdngi31ry4bmkv9ysjxf9wilv4nl";
+ })
+ ];
+
+ nativeBuildInputs = [ meson ninja pkgconfig unixtools.xxd ];
+ buildInputs = [ dbus libcap polkit systemd ];
+
+ mesonFlags = [
+ "-Dinstalled_tests=false"
+
+ "-Ddbus_systemservicedir=${placeholder "out"}/share/dbus-1/system-services"
+ "-Ddbus_interfacedir=${placeholder "out"}/share/dbus-1/interfaces"
+ "-Ddbus_rulesdir=${placeholder "out"}/etc/dbus-1/system.d"
+ "-Dpolkit_actiondir=${placeholder "out"}/share/polkit-1/actions"
+ "-Dsystemd_systemunitdir=${placeholder "out"}/etc/systemd/system"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/heftig/rtkit";
+ description = "A daemon that hands out real-time priority to processes";
+ license = with licenses; [ gpl3 bsd0 ]; # lib is bsd license
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8192eu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8192eu/default.nix
new file mode 100644
index 000000000000..c6527ac285d2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8192eu/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, lib, fetchFromGitHub, kernel, bc }:
+
+with lib;
+
+let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/rtl8192eu";
+
+in stdenv.mkDerivation rec {
+ name = "rtl8192eu-${kernel.version}-${version}";
+ version = "4.4.1.20200620";
+
+ src = fetchFromGitHub {
+ owner = "Mange";
+ repo = "rtl8192eu-linux-driver";
+ rev = "925ac2be34dd608a7ca42daebf9713f0c1bcec74";
+ sha256 = "159vg0scq47wnn600karpgzx3naaiyl1rg8608c8d28nhm62gvjz";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildInputs = [ bc ];
+
+ makeFlags = [ "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];
+
+ enableParallelBuilding = true;
+
+ installPhase = ''
+ mkdir -p ${modDestDir}
+ find . -name '*.ko' -exec cp --parents {} ${modDestDir} \;
+ find ${modDestDir} -name '*.ko' -exec xz -f {} \;
+ '';
+
+ meta = {
+ description = "Realtek rtl8192eu driver";
+ homepage = "https://github.com/Mange/rtl8192eu-linux-driver";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with maintainers; [ troydm ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8723bs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8723bs/default.nix
new file mode 100644
index 000000000000..323d6a820739
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8723bs/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, nukeReferences, kernel }:
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ name = "rtl8723bs-${kernel.version}-${version}";
+ version = "2017-04-06";
+
+ src = fetchFromGitHub {
+ owner = "hadess";
+ repo = "rtl8723bs";
+ rev = "db2c4f61d48fe3b47c167c8bcd722ce83c24aca5";
+ sha256 = "0pxqya14a61vv2v5ky1ldybc0mjfin9mpvmajlmv0lls904rph7g";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ buildInputs = [ nukeReferences ];
+
+ makeFlags = [
+ "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way.
+ "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us.
+ ];
+
+ enableParallelBuilding = true;
+
+ # The Makefile doesn't use env-vars well, so install manually:
+ installPhase = ''
+ mkdir -p $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless
+ cp r8723bs.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless
+
+ nuke-refs $(find $out -name "*.ko")
+ '';
+
+ meta = {
+ description = "Realtek SDIO Wi-Fi driver";
+ homepage = "https://github.com/hadess/rtl8723bs";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ broken = (! versionOlder kernel.version "4.12"); # Now in kernel staging drivers
+ maintainers = with maintainers; [ elitak ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix
new file mode 100644
index 000000000000..9b2bcf3b91ce
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchFromGitHub, kernel, bc, nukeReferences }:
+
+stdenv.mkDerivation rec {
+ name = "rtl8812au-${kernel.version}-${version}";
+ version = "5.6.4.2_35491.20200702";
+
+ src = fetchFromGitHub {
+ owner = "gordboy";
+ repo = "rtl8812au-5.6.4.2";
+ rev = "3110ad65d0f03532bd97b1017cae67ca86dd34f6";
+ sha256 = "0p0cv67dfr41npxn0c1frr0k9wiv0pdbvlzlmclgixn39xc6n5qz";
+ };
+
+ nativeBuildInputs = [ bc nukeReferences ];
+ buildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" "format" ];
+
+ prePatch = ''
+ substituteInPlace ./Makefile --replace /lib/modules/ "${kernel.dev}/lib/modules/"
+ substituteInPlace ./Makefile --replace '$(shell uname -r)' "${kernel.modDirVersion}"
+ substituteInPlace ./Makefile --replace /sbin/depmod \#
+ substituteInPlace ./Makefile --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ makeFlags = [
+ "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n"))
+ ("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+ ];
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ postInstall = ''
+ nuke-refs $out/lib/modules/*/kernel/net/wireless/*.ko
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Driver for Realtek 802.11ac, rtl8812au, provides the 8812au mod";
+ homepage = "https://github.com/gordboy/rtl8812au-5.6.4.2";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ danielfullmer ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8814au/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8814au/default.nix
new file mode 100644
index 000000000000..99d22e2f9998
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8814au/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ name = "rtl8814au-${kernel.version}-${version}";
+ version = "4.3.21";
+
+ src = fetchFromGitHub {
+ owner = "zebulon2";
+ repo = "rtl8814au";
+ rev = "a58c56a5a6cb99ffb872f07cb67b68197911854f";
+ sha256 = "1ffm67da183nz009gm5v9w1bab081hrm113kk8knl9s5qbqnn13q";
+ };
+
+ buildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ NIX_CFLAGS_COMPILE="-Wno-error=incompatible-pointer-types";
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Realtek 8814AU USB WiFi driver";
+ homepage = "https://github.com/zebulon2/rtl8814au";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.lassulus ];
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821au/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821au/default.nix
new file mode 100644
index 000000000000..f3d68cf79194
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821au/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, kernel, bc, nukeReferences }:
+
+stdenv.mkDerivation rec {
+ name = "rtl8821au-${kernel.version}-${version}";
+ version = "5.1.5+41";
+
+ src = fetchFromGitHub {
+ owner = "zebulon2";
+ repo = "rtl8812au";
+ rev = "ecd3494c327c54110d21346ca335ef9e351cb0be";
+ sha256 = "1kmdxgbh0s0v9809kdsi39p0jbm5cf10ivy40h8qj9hn70g1gw8q";
+ };
+
+ nativeBuildInputs = [ bc nukeReferences ];
+ buildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" "format" ];
+
+ NIX_CFLAGS_COMPILE="-Wno-error=incompatible-pointer-types";
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ postInstall = ''
+ nuke-refs $out/lib/modules/*/kernel/net/wireless/*.ko
+ '';
+
+ meta = with stdenv.lib; {
+ description = "rtl8821AU, rtl8812AU and rtl8811AU chipset driver with firmware";
+ homepage = "https://github.com/zebulon2/rtl8812au";
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = with maintainers; [ plchldr ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821ce/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821ce/default.nix
new file mode 100644
index 000000000000..ae6586262a5c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821ce/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, kernel, bc }:
+stdenv.mkDerivation rec {
+ name = "rtl8821ce-${kernel.version}-${version}";
+ version = "5.5.2_34066.20200325";
+
+ src = fetchFromGitHub {
+ owner = "tomaspinho";
+ repo = "rtl8821ce";
+ rev = "8d7edbe6a78fd79cfab85d599dad9dc34138abd1";
+ sha256 = "1hsf8lqjnkrkvk0gps8yb3lx72mvws6xbgkbdmgdkz7qdxmha8bp";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = [ bc ];
+ buildInputs = kernel.moduleBuildDependencies;
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Realtek rtl8821ce driver";
+ homepage = "https://github.com/tomaspinho/rtl8821ce";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ hhm samuelgrf ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821cu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821cu/default.nix
new file mode 100644
index 000000000000..e45c70993a6d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl8821cu/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, kernel, bc }:
+stdenv.mkDerivation rec {
+ name = "rtl8821cu-${kernel.version}-${version}";
+ version = "unstable-2020-08-21";
+
+ src = fetchFromGitHub {
+ owner = "brektrou";
+ repo = "rtl8821cu";
+ rev = "45a8b4393e3281b969822c81bd93bdb731d58472";
+ sha256 = "1995zs1hvlxjhbh2w7zkwr824z19cgc91s00g7yhm5d7zjav14rd";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = [ bc ];
+ buildInputs = kernel.moduleBuildDependencies;
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Realtek rtl8821cu driver";
+ homepage = "https://github.com/brektrou/rtl8821CU";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.contrun ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88x2bu/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88x2bu/default.nix
new file mode 100644
index 000000000000..c2b5eb1cdb4c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88x2bu/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchFromGitHub, fetchpatch, kernel, bc }:
+
+stdenv.mkDerivation rec {
+ name = "rtl88x2bu-${kernel.version}-${version}";
+ version = "unstable-2020-08-20";
+
+ src = fetchFromGitHub {
+ owner = "cilynx";
+ repo = "rtl88x2BU";
+ rev = "a1c53f43fb9995fbe3ad26567079d6384626d350";
+ sha256 = "1cby66jg511zxs1i535mflafhryla9764mnrzacxppimxpancv3s";
+ };
+
+ patches = [
+ # https://github.com/cilynx/rtl88x2bu/pull/58
+ (fetchpatch {
+ url = "https://github.com/cilynx/rtl88x2bu/pull/58.patch";
+ sha256 = "0md9cv61nx85pk3v60y9wviyb9fgj54q9m26wiv3dc7smr70h8l6";
+ })
+ ];
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = [ bc ];
+ buildInputs = kernel.moduleBuildDependencies;
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Realtek rtl88x2bu driver";
+ homepage = "https://github.com/cilynx/rtl88x2bu";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.ralith ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88xxau-aircrack/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88xxau-aircrack/default.nix
new file mode 100644
index 000000000000..a86d76a3be59
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtl88xxau-aircrack/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, kernel }:
+
+stdenv.mkDerivation rec {
+ name = "rtl88xxau-aircrack-${kernel.version}-${version}";
+ rev = "fc0194c1d90453bf4943089ca237159ef19a7374";
+ version = "${builtins.substring 0 6 rev}";
+
+ src = fetchFromGitHub {
+ owner = "aircrack-ng";
+ repo = "rtl8812au";
+ inherit rev;
+ sha256 = "0hf7mrvxaskc6qcjar5w81y9xc7s2rlsxp34achyqly2hjg7fgmy";
+ };
+
+ buildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ NIX_CFLAGS_COMPILE="-Wno-error=incompatible-pointer-types";
+
+ prePatch = ''
+ substituteInPlace ./Makefile \
+ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \
+ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
+ --replace /sbin/depmod \# \
+ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ preInstall = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Aircrack-ng kernel module for Realtek 88XXau network cards\n(8811au, 8812au, 8814au and 8821au chipsets) with monitor mode and injection support.";
+ homepage = "https://github.com/aircrack-ng/rtl8812au";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.jethro ];
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtlwifi_new/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtlwifi_new/default.nix
new file mode 100644
index 000000000000..78e5510ad17e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/rtlwifi_new/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+with lib;
+
+let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/rtlwifi";
+
+in stdenv.mkDerivation rec {
+ pname = "rtlwifi_new";
+ version = "2019-08-21";
+ # When updating see https://github.com/lwfinger/rtl8723be/issues/17#issuecomment-657326751
+
+ src = fetchFromGitHub {
+ owner = "rtlwifi-linux";
+ repo = "rtlwifi_new";
+ rev = "a108e3de87c2ed30b71c3c4595b79ab7a2f9e348";
+ sha256 = "15kjs9i9vvmn1cdzccd5cljf3m45r4ssm65klkj2fdkf3kljj38k";
+ };
+
+ hardeningDisable = [ "pic" "format" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ makeFlags = [ "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];
+
+ enableParallelBuilding = true;
+
+ installPhase = ''
+ mkdir -p ${modDestDir}
+ find . -name '*.ko' -exec cp --parents {} ${modDestDir} \;
+ find ${modDestDir} -name '*.ko' -exec xz -f {} \;
+ '';
+
+ meta = {
+ description = "The newest Realtek rtlwifi codes";
+ inherit (src.meta) homepage;
+ license = stdenv.lib.licenses.gpl2;
+ platforms = with platforms; linux;
+ maintainers = with maintainers; [ tvorog ];
+ priority = -1;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/s6-linux-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/s6-linux-utils/default.nix
new file mode 100644
index 000000000000..74bf913df982
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/s6-linux-utils/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, skawarePackages }:
+
+with skawarePackages;
+
+buildPackage {
+ pname = "s6-linux-utils";
+ version = "2.5.1.2";
+ sha256 = "0w4jms9qyb5kx9zcyd3gzri60rrii2rbmh08s59ckg4awy27py86";
+
+ description = "A set of minimalistic Linux-specific system utilities";
+ platforms = stdenv.lib.platforms.linux;
+
+ outputs = [ "bin" "dev" "doc" "out" ];
+
+ # TODO: nsss support
+ configureFlags = [
+ "--bindir=\${bin}/bin"
+ "--includedir=\${dev}/include"
+ "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
+ "--with-include=${skalibs.dev}/include"
+ "--with-lib=${skalibs.lib}/lib"
+ "--with-dynlib=${skalibs.lib}/lib"
+ ];
+
+ postInstall = ''
+ # remove all s6 executables from build directory
+ rm $(find -name "s6-*" -type f -mindepth 1 -maxdepth 1 -executable)
+
+ mv doc $doc/share/doc/s6-linux-utils/html
+ '';
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix
new file mode 100644
index 000000000000..ef2ebaa03620
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, lib, fetchFromGitHub, kernel }:
+
+assert stdenv.lib.versionAtLeast kernel.version "4.4";
+
+stdenv.mkDerivation {
+ name = "sch_cake-2017-07-16";
+
+ src = fetchFromGitHub {
+ owner = "dtaht";
+ repo = "sch_cake";
+ rev = "e641a56f27b6848736028f87eda65ac3df9f99f7";
+ sha256 = "08582jy01j32b3mj8hf6m8687qrcz64zv2m236j24inlkmd94q21";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ makeFlags = [
+ "KERNEL_VERSION=${kernel.version}"
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ installPhase = ''
+ install -v -m 644 -D sch_cake.ko \
+ $out/lib/modules/${kernel.modDirVersion}/kernel/net/sched/sch_cake.ko
+ '';
+
+ meta = with lib; {
+ description = "The cake qdisc scheduler";
+ homepage = "https://www.bufferbloat.net/projects/codel/wiki/Cake/";
+ license = with licenses; [ bsd3 gpl2 ];
+ maintainers = with maintainers; [ fpletz ];
+ platforms = platforms.linux;
+ broken = !stdenv.lib.versionOlder kernel.version "4.13";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/schedtool/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/schedtool/default.nix
new file mode 100644
index 000000000000..98663a5ab41e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/schedtool/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "schedtool";
+ version = "1.3.0";
+
+ src = fetchFromGitHub {
+ owner = "freequaos";
+ repo = "schedtool";
+ rev = "${pname}-${version}";
+ sha256 = "1wdw6fnf9a01xfjhdah3mn8bp1bvahf2lfq74i6hk5b2cagkppyp";
+ };
+
+ makeFlags = [ "DESTDIR=$(out)" "DESTPREFIX=" ];
+
+ meta = with stdenv.lib; {
+ description = "Query or alter a process' scheduling policy under Linux";
+ homepage = "https://freequaos.host.sk/schedtool/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ abbradar ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sd-switch/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sd-switch/default.nix
new file mode 100644
index 000000000000..7cbad8d6df3b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sd-switch/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitLab, rustPlatform, pkg-config, dbus }:
+
+rustPlatform.buildRustPackage rec {
+ pname = "sd-switch";
+ version = "0.2.0";
+
+ src = fetchFromGitLab {
+ owner = "rycee";
+ repo = pname;
+ rev = version;
+ sha256 = "1bhks4ma3sn95bsszs6lj9cwfr8zgmja0hqfp8xr5iq77ww2p6k3";
+ };
+
+ cargoSha256 = "0lskxakzh3yji0rzk8jcfz1sv4j19b5kmdsaj7401m5w84s1cbjw";
+
+ nativeBuildInputs = [ pkg-config ];
+ buildInputs = [ dbus ];
+
+ meta = with stdenv.lib; {
+ description = "A systemd unit switcher for Home Manager";
+ homepage = "https://gitlab.com/rycee/sd-switch";
+ license = licenses.gpl3Plus;
+ maintainers = with maintainers; [ rycee ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/default.nix
new file mode 100644
index 000000000000..cf09f0476767
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/default.nix
@@ -0,0 +1,37 @@
+{ lib, runCommandCC, skawarePackages }:
+
+with skawarePackages;
+
+let
+ # From https://skarnet.org/software/misc/sdnotify-wrapper.c,
+ # which is unversioned.
+ src = ./sdnotify-wrapper.c;
+
+in runCommandCC "sdnotify-wrapper" {
+
+ outputs = [ "bin" "doc" "out" ];
+
+ meta = {
+ homepage = "https://skarnet.org/software/misc/sdnotify-wrapper.c";
+ description = "Use systemd sd_notify without having to link against libsystemd";
+ platforms = lib.platforms.all;
+ license = lib.licenses.isc;
+ maintainers = with lib.maintainers; [ Profpatsch ];
+ };
+
+} ''
+ mkdir -p $bin/bin
+ mkdir $out
+
+ # the -lskarnet has to come at the end to support static builds
+ $CC \
+ -o $bin/bin/sdnotify-wrapper \
+ -I${skalibs.dev}/include \
+ -L${skalibs.lib}/lib \
+ ${src} \
+ -lskarnet
+
+ mkdir -p $doc/share/doc/sdnotify-wrapper
+ # copy the documentation comment
+ sed -ne '/Usage:/,/*\//p' ${src} > $doc/share/doc/sdnotify-wrapper/README
+''
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/sdnotify-wrapper.c b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/sdnotify-wrapper.c
new file mode 100644
index 000000000000..0d1ae96068a4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/sdnotify-wrapper.c
@@ -0,0 +1,172 @@
+/*
+ Copyright: (C)2015-2017 Laurent Bercot. http://skarnet.org/
+ ISC license. See http://opensource.org/licenses/ISC
+
+ Build-time requirements: skalibs. http://skarnet.org/software/skalibs/
+ Run-time requirements: none, if you link skalibs statically.
+
+ Compilation:
+ gcc -o sdnotify-wrapper -L/usr/lib/skalibs sdnotify-wrapper.c -lskarnet
+ Use /usr/lib/skalibs/libskarnet.a instead of -lskarnet to link statically.
+ Adapt gcc's -I and -L options to your skalibs installation paths.
+
+ Usage: if a daemon would be launched by systemd as "foobard args...",
+ launch it as "sdnotify-wrapper foobard args..." instead, and you can now
+ tell systemd that this daemon supports readiness notification.
+
+ Instead of using sd_notify() and having to link against the systemd
+ library, the daemon notifies readiness by writing whatever it wants
+ to a file descriptor (by default: stdout), then a newline. (Then it
+ should close that file descriptor.) The simplest way is something like
+ int notify_readiness() { write(1, "\n", 1) ; close(1) ; }
+ This mechanism is understandable by any notification readiness framework.
+
+ Readiness notification occurs when the newline is written, not when
+ the descriptor is closed; but since sdnotify-wrapper stops reading
+ after the first newline and will exit, any subsequent writes will
+ fail and it's best to simply close the descriptor right away.
+
+ sdnotify-wrapper sees the notification when it occurs and sends it
+ to systemd using the sd_notify format.
+
+ Options:
+ -d fd: the daemon will write its notification on descriptor fd.
+ Default is 1.
+ -f: do not doublefork. Use if the daemon waits for children it does
+ not know it has (for instance, superservers do this). When in doubt,
+ do not use that option, or you may have a zombie hanging around.
+ -t timeout: if the daemon has not sent a notification after timeout
+ milliseconds, give up and exit; systemd will not be notified.
+ -k: keep the NOTIFY_SOCKET environment variable when execing into the
+ daemon. By default, the variable is unset: the daemon should not need it.
+
+ Notes:
+ sdnotify-wrapper does not change the daemon's pid. It runs as a
+ (grand)child of the daemon.
+ If the NOTIFY_SOCKET environment variable is not set, sdnotify-wrapper
+ does nothing - it only execs into the daemon.
+ sdnotify-wrapper is more liberal than sd_notify(). It will accept
+ a relative path in NOTIFY_SOCKET.
+*/
+
+
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <skalibs/uint64.h>
+#include <skalibs/types.h>
+#include <skalibs/bytestr.h>
+#include <skalibs/sgetopt.h>
+#include <skalibs/strerr2.h>
+#include <skalibs/env.h>
+#include <skalibs/allreadwrite.h>
+#include <skalibs/tai.h>
+#include <skalibs/iopause.h>
+#include <skalibs/djbunix.h>
+#include <skalibs/webipc.h>
+
+#define USAGE "sdnotify-wrapper [ -d fd ] [ -f ] [ -t timeout ] [ -k ] prog..."
+#define dieusage() strerr_dieusage(100, USAGE)
+
+#define VAR "NOTIFY_SOCKET"
+
+static inline int ipc_sendto (int fd, char const *s, size_t len, char const *path)
+{
+ struct sockaddr_un sa ;
+ size_t l = strlen(path) ;
+ if (l > IPCPATH_MAX) return (errno = ENAMETOOLONG, 0) ;
+ memset(&sa, 0, sizeof sa) ;
+ sa.sun_family = AF_UNIX ;
+ memcpy(sa.sun_path, path, l+1) ;
+ if (path[0] == '@') sa.sun_path[0] = 0 ;
+ return sendto(fd, s, len, MSG_NOSIGNAL, (struct sockaddr *)&sa, sizeof sa) >= 0 ;
+}
+
+static inline void notify_systemd (pid_t pid, char const *socketpath)
+{
+ size_t n = 16 ;
+ char fmt[16 + PID_FMT] = "READY=1\nMAINPID=" ;
+ int fd = ipc_datagram_b() ;
+ if (fd < 0) strerr_diefu1sys(111, "create socket") ;
+ n += pid_fmt(fmt + n, pid) ;
+ fmt[n++] = '\n' ;
+ if (!ipc_sendto(fd, fmt, n, socketpath))
+ strerr_diefu2sys(111, "send notification message to ", socketpath) ;
+ close(fd) ;
+}
+
+static inline int run_child (int fd, unsigned int timeout, pid_t pid, char const *s)
+{
+ char dummy[4096] ;
+ iopause_fd x = { .fd = fd, .events = IOPAUSE_READ } ;
+ tain_t deadline ;
+ tain_now_g() ;
+ if (timeout) tain_from_millisecs(&deadline, timeout) ;
+ else deadline = tain_infinite_relative ;
+ tain_add_g(&deadline, &deadline) ;
+ for (;;)
+ {
+ int r = iopause_g(&x, 1, &deadline) ;
+ if (r < 0) strerr_diefu1sys(111, "iopause") ;
+ if (!r) return 99 ;
+ r = sanitize_read(fd_read(fd, dummy, 4096)) ;
+ if (r < 0)
+ if (errno == EPIPE) return 1 ;
+ else strerr_diefu1sys(111, "read from parent") ;
+ else if (r && memchr(dummy, '\n', r)) break ;
+ }
+ close(fd) ;
+ notify_systemd(pid, s) ;
+ return 0 ;
+}
+
+int main (int argc, char const *const *argv, char const *const *envp)
+{
+ char const *s = env_get2(envp, VAR) ;
+ unsigned int fd = 1 ;
+ unsigned int timeout = 0 ;
+ int df = 1, keep = 0 ;
+ PROG = "sdnotify-wrapper" ;
+ {
+ subgetopt_t l = SUBGETOPT_ZERO ;
+ for (;;)
+ {
+ register int opt = subgetopt_r(argc, argv, "d:ft:k", &l) ;
+ if (opt == -1) break ;
+ switch (opt)
+ {
+ case 'd' : if (!uint0_scan(l.arg, &fd)) dieusage() ; break ;
+ case 'f' : df = 0 ; break ;
+ case 't' : if (!uint0_scan(l.arg, &timeout)) dieusage() ; break ;
+ case 'k' : keep = 1 ; break ;
+ default : dieusage() ;
+ }
+ }
+ argc -= l.ind ; argv += l.ind ;
+ }
+ if (!argc) dieusage() ;
+
+ if (!s) xpathexec_run(argv[0], argv, envp) ;
+ else
+ {
+ pid_t parent = getpid() ;
+ pid_t child ;
+ int p[2] ;
+ if (pipe(p) < 0) strerr_diefu1sys(111, "pipe") ;
+ child = df ? doublefork() : fork() ;
+ if (child < 0) strerr_diefu1sys(111, df ? "doublefork" : "fork") ;
+ else if (!child)
+ {
+ PROG = "sdnotify-wrapper (child)" ;
+ close(p[1]) ;
+ return run_child(p[0], timeout, parent, s) ;
+ }
+ close(p[0]) ;
+ if (fd_move((int)fd, p[1]) < 0) strerr_diefu1sys(111, "move descriptor") ;
+ if (keep) xpathexec_run(argv[0], argv, envp) ;
+ else xpathexec_r(argv, envp, env_len(envp), VAR, sizeof(VAR)) ;
+ }
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix
new file mode 100644
index 000000000000..e0392e442bf5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+ pname = "sdparm";
+ version = "1.11";
+
+ src = fetchurl {
+ url = "http://sg.danny.cz/sg/p/${pname}-${version}.tar.xz";
+ sha256 = "1nqjc4w2w47zavcbf5xmm53x1zbwgljaw1lpajcdi537cgy32fa8";
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "http://sg.danny.cz/sg/sdparm.html";
+ description = "A utility to access SCSI device parameters";
+ license = licenses.bsd3;
+ platforms = with platforms; linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-python/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-python/default.nix
new file mode 100644
index 000000000000..57aa5d49facf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-python/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, python3
+, libselinux, libsemanage, libsepol, setools }:
+
+# this is python3 only because setools only supports python3
+
+with stdenv.lib;
+with python3.pkgs;
+
+stdenv.mkDerivation rec {
+ pname = "selinux-python";
+ version = "2.9";
+
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/selinux-python-${version}.tar.gz";
+ sha256 = "1pjzsyay5535cxcjag7y7k193ajry0s0xc3dqv5905qd7cwval1n";
+ };
+
+ nativeBuildInputs = [ wrapPython ];
+ buildInputs = [ libsepol python3 ];
+ propagatedBuildInputs = [ libselinux libsemanage setools ipy ];
+
+ postPatch = ''
+ substituteInPlace sepolicy/Makefile --replace "echo --root" "echo --prefix"
+ substituteInPlace sepolgen/src/share/Makefile --replace "/var/lib/sepolgen" \
+ "\$PREFIX/var/lib/sepolgen"
+ '';
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "LOCALEDIR=$(out)/share/locale"
+ "BASHCOMPLETIONDIR=$(out)/share/bash-completion/completions"
+ "PYTHON=python"
+ "PYTHONLIBDIR=$(out)/${python.sitePackages}"
+ "LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a"
+ ];
+
+
+ postFixup = ''
+ wrapPythonPrograms
+ '';
+
+ meta = {
+ description = "SELinux policy core utilities written in Python";
+ license = licenses.gpl2;
+ homepage = "https://selinuxproject.org";
+ platforms = platforms.linux;
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-sandbox/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-sandbox/default.nix
new file mode 100644
index 000000000000..387db08e1d60
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/selinux-sandbox/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, bash, coreutils, python3
+, libcap_ng, policycoreutils, selinux-python, dbus
+, xorgserver, openbox, xmodmap }:
+
+# this is python3 only as it depends on selinux-python
+
+with stdenv.lib;
+with python3.pkgs;
+
+stdenv.mkDerivation rec {
+ pname = "selinux-sandbox";
+ version = "2.9";
+ inherit (policycoreutils) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/selinux-sandbox-${version}.tar.gz";
+ sha256 = "0qj20jyi8v1653xdqj5yak3wwbvg5bw8f2jmx8fpahl6y1bmz481";
+ };
+
+ nativeBuildInputs = [ wrapPython ];
+ buildInputs = [ bash coreutils libcap_ng policycoreutils python3 xorgserver openbox xmodmap dbus ];
+ propagatedBuildInputs = [ pygobject3 selinux-python ];
+
+ postPatch = ''
+ # Fix setuid install
+ substituteInPlace Makefile --replace "-m 4755" "-m 755"
+ substituteInPlace sandboxX.sh \
+ --replace "#!/bin/sh" "#!${bash}/bin/sh" \
+ --replace "/usr/share/sandbox/start" "${placeholder "out"}/share/sandbox/start" \
+ --replace "/usr/bin/cut" "${coreutils}/bin/cut" \
+ --replace "/usr/bin/Xephyr" "${xorgserver}/bin/Xepyhr" \
+ --replace "secon" "${policycoreutils}/bin/secon"
+ substituteInPlace sandbox \
+ --replace "/usr/sbin/seunshare" "$out/bin/seunshare" \
+ --replace "/usr/share/sandbox" "$out/share/sandbox" \
+ --replace "/usr/share/locale" "${policycoreutils}/share/locale" \
+ --replace "/usr/bin/openbox" "${openbox}/bin/openbox" \
+ --replace "#!/bin/sh" "#!${bash}/bin/sh" \
+ --replace "dbus-" "${dbus}/bin/dbus-" \
+ --replace "/usr/bin/xmodmap" "${xmodmap}/bin/xmodmap" \
+ --replace "/usr/bin/shred" "${coreutils}/bin/shred" \
+ --replace "/usr/bin/test" "${coreutils}/bin/test" \
+ '';
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "SYSCONFDIR=$(out)/etc/sysconfig"
+ ];
+
+ postFixup = ''
+ wrapPythonPrograms
+ '';
+
+ meta = {
+ description = "SELinux sandbox utility";
+ license = licenses.gpl2;
+ homepage = "https://selinuxproject.org";
+ platforms = platforms.linux;
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/semodule-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/semodule-utils/default.nix
new file mode 100644
index 000000000000..bf1f36835b47
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/semodule-utils/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, libsepol }:
+
+stdenv.mkDerivation rec {
+ pname = "semodule-utils";
+ version = "2.9";
+
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/${pname}-${version}.tar.gz";
+ sha256 = "01yrwnd3calmw6r8kdh8ld7i7fb250n2yqqqk9p0ymrlwsg6g0w0";
+ };
+
+ buildInputs = [ libsepol ];
+
+ makeFlags = [
+ "PREFIX=$(out)"
+ "LIBSEPOLA=${stdenv.lib.getLib libsepol}/lib/libsepol.a"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "SELinux policy core utilities (packaging additions)";
+ license = licenses.gpl2;
+ inherit (libsepol.meta) homepage platforms;
+ maintainers = [ maintainers.e-user ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sepolgen/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sepolgen/default.nix
new file mode 100644
index 000000000000..53250b345e83
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sepolgen/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, libsepol, python }:
+
+stdenv.mkDerivation rec {
+ pname = "sepolgen";
+ version = "1.2.2";
+ inherit (libsepol) se_release se_url;
+
+ src = fetchurl {
+ url = "${se_url}/${se_release}/sepolgen-${version}.tar.gz";
+ sha256 = "09139kspr41zgksayi4dh982p8080lrfl96p4dld51nknbpaigdy";
+ };
+
+ preBuild = ''
+ makeFlagsArray+=("PREFIX=$out")
+ makeFlagsArray+=("DESTDIR=$out")
+ makeFlagsArray+=("PYTHONLIBDIR=lib/${python.libPrefix}/site-packages")
+ '';
+
+ meta = with stdenv.lib; {
+ inherit (libsepol.meta) homepage platforms maintainers;
+ description = "SELinux policy generation library";
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/default.nix
new file mode 100644
index 000000000000..150262158da4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, runCommand, substituteAll, coreutils }:
+
+let
+ name = "service-wrapper-${version}";
+ version = "19.04"; # Akin to Ubuntu Release
+in
+runCommand name {
+ script = substituteAll {
+ src = ./service-wrapper.sh;
+ isExecutable = true;
+ inherit (stdenv) shell;
+ inherit coreutils;
+ };
+
+ meta = with stdenv.lib; {
+ description = "A convenient wrapper for the systemctl commands, borrow from Ubuntu";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ DerTim1 ];
+ # Shellscript has been modified but upstream source is: https://git.launchpad.net/ubuntu/+source/init-system-helpers
+ };
+}
+''
+ mkdir -p $out/bin
+ ln -s $out/bin $out/sbin
+ cp $script $out/bin/service
+ chmod a+x $out/bin/service
+''
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh
new file mode 100755
index 000000000000..a7c3bc9758b1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh
@@ -0,0 +1,224 @@
+#!@shell@
+
+###########################################################################
+# /usr/bin/service
+#
+# A convenient wrapper for the /etc/init.d init scripts.
+#
+# This script is a modified version of the /sbin/service utility found on
+# Red Hat/Fedora systems (licensed GPLv2+).
+#
+# Copyright (C) 2006 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008 Canonical Ltd.
+# * August 2008 - Dustin Kirkland <kirkland@canonical.com>
+# Copyright (C) 2013 Michael Stapelberg <stapelberg@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# On Debian GNU/Linux systems, the complete text of the GNU General
+# Public License can be found in `/usr/share/common-licenses/GPL-2'.
+###########################################################################
+
+
+is_ignored_file() {
+ case "$1" in
+ skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+VERSION=$(@coreutils@/bin/basename $0)" ver. 19-04"
+USAGE="Usage: "$(@coreutils@/bin/basename $0)" < option > | --status-all | \
+[ service_name [ command | --full-restart ] ]"
+SERVICE=
+ACTION=
+SERVICEDIR="/etc/init.d"
+OPTIONS=
+is_systemd=
+
+
+if [ $# -eq 0 ]; then
+ echo "${USAGE}" >&2
+ exit 1
+fi
+
+if [ -d /run/systemd/system ]; then
+ is_systemd=1
+fi
+
+cd /
+while [ $# -gt 0 ]; do
+ case "${1}" in
+ --help | -h | --h* )
+ echo "${USAGE}" >&2
+ exit 0
+ ;;
+ --version | -V )
+ echo "${VERSION}" >&2
+ exit 0
+ ;;
+ *)
+ if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
+ if [ -d "${SERVICEDIR}" ]; then
+ cd ${SERVICEDIR}
+ for SERVICE in * ; do
+ case "${SERVICE}" in
+ functions | halt | killall | single| linuxconf| kudzu)
+ ;;
+ *)
+ if ! is_ignored_file "${SERVICE}" \
+ && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ out=$(env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
+ retval=$?
+ if echo "$out" | egrep -iq "usage:"; then
+ #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
+ echo " [ ? ] $SERVICE" 1>&2
+ continue
+ else
+ if [ "$retval" = "0" -a -n "$out" ]; then
+ #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
+ echo " [ + ] $SERVICE"
+ continue
+ else
+ #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
+ echo " [ - ] $SERVICE"
+ continue
+ fi
+ fi
+ #env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status
+ fi
+ ;;
+ esac
+ done
+ else
+ systemctl $sctl_args list-units
+ fi
+ exit 0
+ elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
+ SERVICE="${1}"
+ # On systems using systemd, we just perform a normal restart:
+ # A restart with systemd is already a full restart.
+ if [ -n "$is_systemd" ]; then
+ ACTION="restart"
+ else
+ if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" stop
+ env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" start
+ exit $?
+ fi
+ fi
+ elif [ -z "${SERVICE}" ]; then
+ SERVICE="${1}"
+ elif [ -z "${ACTION}" ]; then
+ ACTION="${1}"
+ else
+ OPTIONS="${OPTIONS} ${1}"
+ fi
+ shift
+ ;;
+ esac
+done
+
+run_via_sysvinit() {
+ # Otherwise, use the traditional sysvinit
+ if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ exec env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${ACTION} ${OPTIONS}
+ else
+ echo "${SERVICE}: unrecognized service" >&2
+ exit 1
+ fi
+}
+
+update_openrc_started_symlinks() {
+ # maintain the symlinks of /run/openrc/started so that
+ # rc-status works with the service command as well
+ if [ -d /run/openrc/started ] ; then
+ case "${ACTION}" in
+ start)
+ if [ ! -h /run/openrc/started/$SERVICE ] ; then
+ ln -s $SERVICEDIR/$SERVICE /run/openrc/started/$SERVICE || true
+ fi
+ ;;
+ stop)
+ rm /run/openrc/started/$SERVICE || true
+ ;;
+ esac
+ fi
+}
+
+# When this machine is running systemd, standard service calls are turned into
+# systemctl calls.
+if [ -n "$is_systemd" ]
+then
+ UNIT="${SERVICE%.sh}.service"
+ # avoid deadlocks during bootup and shutdown from units/hooks
+ # which call "invoke-rc.d service reload" and similar, since
+ # the synchronous wait plus systemd's normal behaviour of
+ # transactionally processing all dependencies first easily
+ # causes dependency loops
+ if ! systemctl --quiet is-active multi-user.target; then
+ sctl_args="--job-mode=ignore-dependencies"
+ fi
+
+ case "${ACTION}" in
+ restart|status|try-restart)
+ exec systemctl $sctl_args ${ACTION} ${UNIT}
+ ;;
+ start|stop)
+ # Follow the principle of least surprise for SysV people:
+ # When running "service foo stop" and foo happens to be a service that
+ # has one or more .socket files, we also stop the .socket units.
+ # Users who need more control will use systemctl directly.
+ for unit in $(systemctl list-unit-files --full --type=socket 2>/dev/null | sed -ne 's/\.socket\s*[a-z]*\s*$/.socket/p'); do
+ if [ "$(systemctl -p Triggers show $unit)" = "Triggers=${UNIT}" ]; then
+ systemctl $sctl_args ${ACTION} $unit
+ fi
+ done
+ exec systemctl $sctl_args ${ACTION} ${UNIT}
+ ;;
+ reload)
+ _canreload="$(systemctl -p CanReload show ${UNIT} 2>/dev/null)"
+ if [ "$_canreload" = "CanReload=no" ]; then
+ # The reload action falls back to the sysv init script just in case
+ # the systemd service file does not (yet) support reload for a
+ # specific service.
+ run_via_sysvinit
+ else
+ exec systemctl $sctl_args reload "${UNIT}"
+ fi
+ ;;
+ force-stop)
+ exec systemctl --signal=KILL kill "${UNIT}"
+ ;;
+ force-reload)
+ _canreload="$(systemctl -p CanReload show ${UNIT} 2>/dev/null)"
+ if [ "$_canreload" = "CanReload=no" ]; then
+ exec systemctl $sctl_args restart "${UNIT}"
+ else
+ exec systemctl $sctl_args reload "${UNIT}"
+ fi
+ ;;
+ *)
+ # We try to run non-standard actions by running
+ # the init script directly.
+ run_via_sysvinit
+ ;;
+ esac
+fi
+
+update_openrc_started_symlinks
+run_via_sysvinit
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/setools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/setools/default.nix
new file mode 100644
index 000000000000..c0ed4102aaf1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/setools/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchFromGitHub, python3
+, libsepol, libselinux, checkpolicy
+, withGraphics ? false
+}:
+
+with stdenv.lib;
+with python3.pkgs;
+
+buildPythonApplication rec {
+ pname = "setools";
+ version = "4.3.0";
+
+ src = fetchFromGitHub {
+ owner = "SELinuxProject";
+ repo = pname;
+ rev = version;
+ sha256 = "0vr20bi8w147z5lclqz1l0j1b34137zg2r04pkafkgqqk7qbyjk6";
+ };
+
+ nativeBuildInputs = [ cython ];
+ buildInputs = [ libsepol ];
+ propagatedBuildInputs = [ enum34 libselinux networkx ]
+ ++ optionals withGraphics [ pyqt5 ];
+
+ checkInputs = [ tox checkpolicy ];
+ preCheck = ''
+ export CHECKPOLICY=${checkpolicy}/bin/checkpolicy
+ '';
+
+ setupPyBuildFlags = [ "-i" ];
+
+ preBuild = ''
+ export SEPOL="${stdenv.lib.getLib libsepol}/lib/libsepol.a"
+ '';
+
+ meta = {
+ description = "SELinux Policy Analysis Tools";
+ homepage = "https://github.com/SELinuxProject/setools";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/seturgent/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/seturgent/default.nix
new file mode 100644
index 000000000000..8cfc9d35940f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/seturgent/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, libX11, xorgproto, unzip }:
+
+stdenv.mkDerivation {
+ name = "seturgent-2012-08-17";
+
+ src = fetchurl {
+ url = "https://github.com/hiltjo/seturgent/archive/ada70dcb15865391e5cdcab27a0739a304a17e03.zip";
+ sha256 = "0q1sr6aljkw2jr9b4xxzbc01qvnd5vk3pxrypif9yd8xjw4wqwri";
+ };
+
+ buildInputs = [
+ libX11 xorgproto unzip
+ ];
+
+ installPhase = ''
+ mkdir -pv $out/bin
+ mv seturgent $out/bin
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.linux;
+ description = "Set an application's urgency hint (or not)";
+ maintainers = [ stdenv.lib.maintainers.yarr ];
+ homepage = "https://github.com/hiltjo/seturgent";
+ license = stdenv.lib.licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/default.nix
new file mode 100644
index 000000000000..7399ac90586c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/default.nix
@@ -0,0 +1,90 @@
+{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, libxslt, libxml2
+, docbook_xml_dtd_45, docbook_xsl, itstool, flex, bison
+, pam ? null, glibcCross ? null
+}:
+
+let
+
+ glibc =
+ if stdenv.hostPlatform != stdenv.buildPlatform
+ then glibcCross
+ else assert stdenv.hostPlatform.libc == "glibc"; stdenv.cc.libc;
+
+ dots_in_usernames = fetchpatch {
+ url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/shadow/files/shadow-4.1.3-dots-in-usernames.patch";
+ sha256 = "1fj3rg6x3jppm5jvi9y7fhd2djbi4nc5pgwisw00xlh4qapgz692";
+ };
+
+in
+
+stdenv.mkDerivation rec {
+ pname = "shadow";
+ version = "4.8.1";
+
+ src = fetchFromGitHub {
+ owner = "shadow-maint";
+ repo = "shadow";
+ rev = version;
+ sha256 = "13407r6qwss00504qy740jghb2dzd561la7dhp47rg8w3g8jarpn";
+ };
+
+ buildInputs = stdenv.lib.optional (pam != null && stdenv.isLinux) pam;
+ nativeBuildInputs = [autoreconfHook libxslt libxml2
+ docbook_xml_dtd_45 docbook_xsl flex bison itstool
+ ];
+
+ patches =
+ [ ./keep-path.patch
+ # Obtain XML resources from XML catalog (patch adapted from gtk-doc)
+ ./respect-xml-catalog-files-var.patch
+ dots_in_usernames
+ ];
+
+ # The nix daemon often forbids even creating set[ug]id files.
+ postPatch =
+ ''sed 's/^\(s[ug]idperms\) = [0-9]755/\1 = 0755/' -i src/Makefile.am
+ '';
+
+ outputs = [ "out" "su" "man" ];
+
+ enableParallelBuilding = true;
+
+ # Assume System V `setpgrp (void)', which is the default on GNU variants
+ # (`AC_FUNC_SETPGRP' is not cross-compilation capable.)
+ preConfigure = ''
+ export ac_cv_func_setpgrp_void=yes
+ export shadow_cv_logdir=/var/log
+ '';
+
+ configureFlags = [
+ "--enable-man"
+ "--with-group-name-max-length=32"
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform.libc != "glibc") "--disable-nscd";
+
+ preBuild = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "glibc")
+ ''
+ substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd
+ '';
+
+ postInstall =
+ ''
+ # Don't install ‘groups’, since coreutils already provides it.
+ rm $out/bin/groups
+ rm $man/share/man/man1/groups.*
+
+ # Move the su binary into the su package
+ mkdir -p $su/bin
+ mv $out/bin/su $su/bin
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/shadow-maint";
+ description = "Suite containing authentication-related tools such as passwd and su";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+
+ passthru = {
+ shellPath = "/bin/nologin";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/keep-path.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/keep-path.patch
new file mode 100644
index 000000000000..99fd17c27bc9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/keep-path.patch
@@ -0,0 +1,19 @@
+diff -ru shadow-4.1.5.1-orig/src/su.c shadow-4.1.5.1/src/su.c
+--- shadow-4.1.5.1-orig/src/su.c 2012-05-25 07:51:55.000000000 -0400
++++ shadow-4.1.5.1/src/su.c 2012-07-25 17:22:57.013547930 -0400
+@@ -879,6 +879,7 @@
+ }
+ }
+
++#if 0
+ cp = getdef_str ((pw->pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
+ if (NULL == cp) {
+ addenv ((pw->pw_uid == 0) ? "PATH=/sbin:/bin:/usr/sbin:/usr/bin" : "PATH=/bin:/usr/bin", NULL);
+@@ -887,6 +888,7 @@
+ } else {
+ addenv ("PATH", cp);
+ }
++#endif
+
+ if (getenv ("IFS") != NULL) { /* don't export user IFS ... */
+ addenv ("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/respect-xml-catalog-files-var.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/respect-xml-catalog-files-var.patch
new file mode 100644
index 000000000000..7d922eae71fc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/shadow/respect-xml-catalog-files-var.patch
@@ -0,0 +1,30 @@
+diff --git a/acinclude.m4 b/acinclude.m4
+index dd01f165..e23160ee 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -46,9 +46,21 @@ AC_DEFUN([JH_CHECK_XML_CATALOG],
+ ifelse([$3],,,[$3
+ ])dnl
+ else
+- AC_MSG_RESULT([not found])
+- ifelse([$4],,
+- [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
+- [$4])
++ jh_check_xml_catalog_saved_ifs="$IFS"
++ IFS=' '
++ for f in $XML_CATALOG_FILES; do
++ if [[ -f "$f" ]] && \
++ AC_RUN_LOG([$XMLCATALOG --noout "$f" "$1" >&2]); then
++ jh_found_xmlcatalog=true
++ AC_MSG_RESULT([found])
++ ifelse([$3],,,[$3])
++ break
++ fi
++ done
++ IFS="$jh_check_xml_catalog_saved_ifs"
++ if ! $jh_found_xmlcatalog; then
++ AC_MSG_RESULT([not found])
++ ifelse([$4],,[AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],[$4])
++ fi
+ fi
+ ])
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sinit/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sinit/default.nix
new file mode 100644
index 000000000000..71bd887535be
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sinit/default.nix
@@ -0,0 +1,37 @@
+{stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null}:
+let
+ s = # Generated upstream information
+ rec {
+ baseName="sinit";
+ version="1.0";
+ name="${baseName}-${version}";
+ url="https://git.suckless.org/sinit/";
+ sha256="0cf8yylgrrj1wxm5v6jdlbnxpx97m38yxrc9nmv1l8hldjqsj9pc";
+ rev = "refs/tags/v${version}";
+ };
+ buildInputs = [
+ (stdenv.lib.getOutput "static" stdenv.cc.libc)
+ ];
+in
+stdenv.mkDerivation {
+ inherit (s) name version;
+ inherit buildInputs;
+ src = fetchgit {
+ inherit (s) url sha256 rev;
+ };
+ makeFlags = ["PREFIX=$(out)"];
+ preConfigure = ""
+ + (stdenv.lib.optionalString (rcinit != null) ''sed -re 's@(rcinitcmd[^"]*")[^"]*"@\1${rcinit}"@' -i config.def.h; '')
+ + (stdenv.lib.optionalString (rcshutdown != null) ''sed -re 's@(rc(reboot|poweroff)cmd[^"]*")[^"]*"@\1${rcshutdown}"@' -i config.def.h; '')
+ + (stdenv.lib.optionalString (rcreboot != null) ''sed -re 's@(rc(reboot)cmd[^"]*")[^"]*"@\1${rcreboot}"@' -i config.def.h; '')
+ ;
+ meta = {
+ inherit (s) version;
+ description = ''A very minimal Linux init implementation from suckless.org'';
+ license = stdenv.lib.licenses.mit ;
+ maintainers = [stdenv.lib.maintainers.raskin];
+ platforms = stdenv.lib.platforms.linux;
+ homepage = "https://tools.suckless.org/sinit";
+ downloadPage = "https://git.suckless.org/sinit";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smem/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smem/default.nix
new file mode 100644
index 000000000000..cace3e22ae7d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smem/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchurl, python }:
+
+stdenv.mkDerivation rec {
+ pname = "smem";
+ version = "1.5";
+
+ src = fetchurl {
+ url = "https://selenic.com/repo/smem/archive/${version}.tar.bz2";
+ sha256 = "19ibv1byxf2b68186ysrgrhy5shkc5mc69abark1h18yigp3j34m";
+ };
+
+ buildInputs = [ python ];
+
+ makeFlags = [ "smemcap" ];
+
+ installPhase =
+ ''
+ install -Dm555 -t $out/bin/ smem smemcap
+ install -Dm444 -t $out/share/man/man8/ smem.8
+ '';
+
+ meta = {
+ homepage = "https://www.selenic.com/smem/";
+ description = "A memory usage reporting tool that takes shared memory into account";
+ platforms = lib.platforms.linux;
+ maintainers = [ lib.maintainers.eelco ];
+ license = lib.licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix
new file mode 100644
index 000000000000..64525052af20
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+ pname = "smemstat";
+ version = "0.02.08";
+ src = fetchurl {
+ url = "https://kernel.ubuntu.com/~cking/tarballs/smemstat/smemstat-${version}.tar.xz";
+ sha256 = "1agigvkv1868cskivzrwyiixl658x5bv7xpz4xjc8mlii4maivpp";
+ };
+ buildInputs = [ ncurses ];
+ installFlags = [ "DESTDIR=$(out)" ];
+ postInstall = ''
+ mv $out/usr/* $out
+ rm -r $out/usr
+ '';
+ meta = with lib; {
+ description = "Memory usage monitoring tool";
+ homepage = "https://kernel.ubuntu.com/~cking/smemstat/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ womfoo ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/speedometer/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/speedometer/default.nix
new file mode 100644
index 000000000000..e4d374b0c41f
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/speedometer/default.nix
@@ -0,0 +1,26 @@
+{ lib, fetchurl, pythonPackages }:
+
+pythonPackages.buildPythonApplication rec {
+ pname = "speedometer";
+ version = "2.8";
+
+ src = fetchurl {
+ url = "http://excess.org/speedometer/speedometer-${version}.tar.gz";
+ sha256 = "060bikv3gwr203jbdmvawsfhc0yq0bg1m42dk8czx1nqvwvgv6fm";
+ };
+
+ propagatedBuildInputs = [ pythonPackages.urwid ];
+
+ postPatch = ''
+ sed -i "/'entry_points': {/d" setup.py
+ sed -i "/'console_scripts': \['speedometer = speedometer:console'\],},/d" setup.py
+ '';
+
+ meta = with lib; {
+ description = "Measure and display the rate of data across a network connection or data being stored in a file";
+ homepage = "http://excess.org/speedometer/";
+ license = licenses.lgpl21Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ Baughn ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sssd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sssd/default.nix
new file mode 100644
index 000000000000..22e2da79c8cd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sssd/default.nix
@@ -0,0 +1,98 @@
+{ stdenv, fetchurl, fetchpatch, glibc, augeas, dnsutils, c-ares, curl,
+ cyrus_sasl, ding-libs, libnl, libunistring, nss, samba, nfs-utils, doxygen,
+ python, python3, pam, popt, talloc, tdb, tevent, pkgconfig, ldb, openldap,
+ pcre, kerberos, cifs-utils, glib, keyutils, dbus, fakeroot, libxslt, libxml2,
+ libuuid, ldap, systemd, nspr, check, cmocka, uid_wrapper,
+ nss_wrapper, ncurses, Po4a, http-parser, jansson,
+ docbook_xsl, docbook_xml_dtd_44,
+ withSudo ? false }:
+
+let
+ docbookFiles = "${docbook_xsl}/share/xml/docbook-xsl/catalog.xml:${docbook_xml_dtd_44}/xml/dtd/docbook/catalog.xml";
+in
+stdenv.mkDerivation rec {
+ pname = "sssd";
+ version = "1.16.4";
+
+ src = fetchurl {
+ url = "https://fedorahosted.org/released/sssd/${pname}-${version}.tar.gz";
+ sha256 = "0ngr7cgimyjc6flqkm7psxagp1m4jlzpqkn28pliifbmdg6i5ckb";
+ };
+ patches = [
+ # Fix build failure against samba 4.12.0rc1
+ (fetchpatch {
+ url = "https://github.com/SSSD/sssd/commit/bc56b10aea999284458dcc293b54cf65288e325d.patch";
+ sha256 = "0q74sx5n41srq3kdn55l5j1sq4xrjsnl5y4v8yh5mwsijj74yh4g";
+ })
+ ];
+
+ # Something is looking for <libxml/foo.h> instead of <libxml2/libxml/foo.h>
+ NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
+
+ preConfigure = ''
+ export SGML_CATALOG_FILES="${docbookFiles}"
+ export PYTHONPATH=${ldap}/lib/python2.7/site-packages
+ export PATH=$PATH:${openldap}/libexec
+
+ configureFlagsArray=(
+ --prefix=$out
+ --sysconfdir=/etc
+ --localstatedir=/var
+ --enable-pammoddir=$out/lib/security
+ --with-os=fedora
+ --with-pid-path=/run
+ --with-python2-bindings
+ --with-python3-bindings
+ --with-syslog=journald
+ --without-selinux
+ --without-semanage
+ --with-xml-catalog-path=''${SGML_CATALOG_FILES%%:*}
+ --with-ldb-lib-dir=$out/modules/ldb
+ --with-nscd=${glibc.bin}/sbin/nscd
+ )
+ '' + stdenv.lib.optionalString withSudo ''
+ configureFlagsArray+=("--with-sudo")
+ '';
+
+ enableParallelBuilding = true;
+ buildInputs = [ augeas dnsutils c-ares curl cyrus_sasl ding-libs libnl libunistring nss
+ samba nfs-utils doxygen python python3 popt
+ talloc tdb tevent pkgconfig ldb pam openldap pcre kerberos
+ cifs-utils glib keyutils dbus fakeroot libxslt libxml2
+ libuuid ldap systemd nspr check cmocka uid_wrapper
+ nss_wrapper ncurses Po4a http-parser jansson ];
+
+ makeFlags = [
+ "SGML_CATALOG_FILES=${docbookFiles}"
+ ];
+
+ installFlags = [
+ "sysconfdir=$(out)/etc"
+ "localstatedir=$(out)/var"
+ "pidpath=$(out)/run"
+ "sss_statedir=$(out)/var/lib/sss"
+ "logpath=$(out)/var/log/sssd"
+ "pubconfpath=$(out)/var/lib/sss/pubconf"
+ "dbpath=$(out)/var/lib/sss/db"
+ "mcpath=$(out)/var/lib/sss/mc"
+ "pipepath=$(out)/var/lib/sss/pipes"
+ "gpocachepath=$(out)/var/lib/sss/gpo_cache"
+ "secdbpath=$(out)/var/lib/sss/secrets"
+ "initdir=$(out)/rc.d/init"
+ ];
+
+ postInstall = ''
+ rm -rf "$out"/run
+ rm -rf "$out"/rc.d
+ rm -f "$out"/modules/ldb/memberof.la
+ find "$out" -depth -type d -exec rmdir --ignore-fail-on-non-empty {} \;
+ '';
+
+ meta = with stdenv.lib; {
+ description = "System Security Services Daemon";
+ homepage = "https://fedorahosted.org/sssd/";
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.e-user ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/statifier/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/statifier/default.nix
new file mode 100644
index 000000000000..376ae47ffbe0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/statifier/default.nix
@@ -0,0 +1,24 @@
+{ multiStdenv, fetchurl }:
+
+let version = "1.7.4"; in
+multiStdenv.mkDerivation {
+ name = "statifier-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/statifier/statifier-${version}.tar.gz";
+ sha256 = "03lzkla6knjhh186b43cac410x2fmhi28pkmzb3d211n3zp5i9y8";
+ };
+
+ phaseNames = [ "patchPhase" "installPhase" ];
+
+ postPatch = ''
+ sed -e s@/usr/@"$out/"@g -i */Makefile src/statifier
+ sed -e s@/bin/bash@"${multiStdenv.shell}"@g -i src/*.sh
+ '';
+
+ meta = with multiStdenv.lib; {
+ description = "Tool for creating static Linux binaries";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syscall_limiter/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syscall_limiter/default.nix
new file mode 100644
index 000000000000..0354abf46e1a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syscall_limiter/default.nix
@@ -0,0 +1,37 @@
+{ stdenv
+, fetchFromGitHub
+, libseccomp
+, perl
+, which
+}:
+
+stdenv.mkDerivation {
+ pname = "syscall_limiter";
+ version = "2017-01-23";
+
+ src = fetchFromGitHub {
+ owner = "vi";
+ repo = "syscall_limiter";
+ rev = "481c8c883f2e1260ebc83b352b63bf61a930a341";
+ sha256 = "0z5arj1kq1xczgrbw1b8m9kicbv3vs9bd32wvgfr4r6ndingsp5m";
+ };
+
+ buildInputs = [ libseccomp ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp -v limit_syscalls $out/bin
+ cp -v monitor.sh $out/bin/limit_syscalls_monitor.sh
+ substituteInPlace $out/bin/limit_syscalls_monitor.sh \
+ --replace perl ${perl}/bin/perl \
+ --replace which ${which}/bin/which
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Start Linux programs with only selected syscalls enabled";
+ homepage = "https://github.com/vi/syscall_limiter";
+ license = licenses.mit;
+ maintainers = with maintainers; [ obadz ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.nix
new file mode 100644
index 000000000000..bef9231385a0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchFromGitHub, cmake, kernel
+, luajit, zlib, ncurses, perl, jsoncpp, libb64, openssl, curl, jq, gcc, elfutils, tbb, c-ares, protobuf, grpc
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ pname = "sysdig";
+ version = "0.27.0";
+
+ src = fetchFromGitHub {
+ owner = "draios";
+ repo = "sysdig";
+ rev = version;
+ sha256 = "0lpp271g0749sx7qgpwl6myi0kgfpsxk1kc4yp3r9k1pynv8bq1b";
+ };
+
+ nativeBuildInputs = [ cmake perl ];
+ buildInputs = [
+ zlib luajit ncurses jsoncpp libb64 openssl curl jq gcc elfutils tbb c-ares protobuf grpc
+ ] ++ optionals (kernel != null) kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ cmakeFlags = [
+ "-DUSE_BUNDLED_DEPS=OFF"
+ "-DSYSDIG_VERSION=${version}"
+ "-DCREATE_TEST_TARGETS=OFF"
+ ] ++ optional (kernel == null) "-DBUILD_DRIVER=OFF";
+
+ # needed since luajit-2.1.0-beta3
+ NIX_CFLAGS_COMPILE = "-DluaL_reg=luaL_Reg -DluaL_getn(L,i)=((int)lua_objlen(L,i))";
+
+ preConfigure = ''
+ cmakeFlagsArray+=(-DCMAKE_EXE_LINKER_FLAGS="-ltbb -lcurl")
+
+ export INSTALL_MOD_PATH="$out"
+ '' + optionalString (kernel != null) ''
+ export KERNELDIR="${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ '';
+
+ postInstall = optionalString (kernel != null) ''
+ make install_driver
+ kernel_dev=${kernel.dev}
+ kernel_dev=''${kernel_dev#/nix/store/}
+ kernel_dev=''${kernel_dev%%-linux*dev*}
+ if test -f "$out/lib/modules/${kernel.modDirVersion}/extra/sysdig-probe.ko"; then
+ sed -i "s#$kernel_dev#................................#g" $out/lib/modules/${kernel.modDirVersion}/extra/sysdig-probe.ko
+ else
+ xz -d $out/lib/modules/${kernel.modDirVersion}/extra/sysdig-probe.ko.xz
+ sed -i "s#$kernel_dev#................................#g" $out/lib/modules/${kernel.modDirVersion}/extra/sysdig-probe.ko
+ xz $out/lib/modules/${kernel.modDirVersion}/extra/sysdig-probe.ko
+ fi
+ '';
+
+ meta = {
+ description = "A tracepoint-based system tracing tool for Linux (with clients for other OSes)";
+ license = with licenses; [ asl20 gpl2 mit ];
+ maintainers = [maintainers.raskin];
+ platforms = ["x86_64-linux"] ++ platforms.darwin;
+ broken = kernel != null && versionOlder kernel.version "4.14";
+ homepage = "https://sysdig.com/opensource/";
+ downloadPage = "https://github.com/draios/sysdig/releases";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.upstream b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.upstream
new file mode 100644
index 000000000000..485de5741d79
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysdig/default.upstream
@@ -0,0 +1,8 @@
+url https://github.com/draios/sysdig/releases
+ensure_choice
+version '.*/([0-9.]+)[.]tar[.].*' '\1'
+do_overwrite () {
+ ensure_hash
+ set_var_value sha256 $CURRENT_HASH
+ set_var_value version $CURRENT_VERSION
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix
new file mode 100644
index 000000000000..3b2d54bc83ad
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "sysfsutils-2.1.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/linux-diag/${name}.tar.gz";
+ sha256 = "e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a";
+ };
+
+ meta = {
+ homepage = "http://linux-diag.sourceforge.net/Sysfsutils.html";
+ longDescription =
+ ''
+ These are a set of utilites built upon sysfs, a new virtual
+ filesystem in Linux kernel versions 2.5+ that exposes a system's
+ device tree.
+ '';
+ license = with stdenv.lib.licenses; [ gpl2 lgpl21 ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix
new file mode 100644
index 000000000000..f93e9012e05d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+ name = "sysklogd-1.5.1";
+
+ src = fetchurl {
+ url = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.5.1.tar.gz";
+ sha256 = "00f2wy6f0qng7qzga4iicyzl9j8b7mp6mrpfky5jxj93ms2w2rji";
+ };
+
+ patches = [ ./systemd.patch ./union-wait.patch ];
+
+ NIX_CFLAGS_COMPILE = "-DSYSV";
+
+ installFlags = [ "BINDIR=$(out)/sbin" "MANDIR=$(out)/share/man" "INSTALL=install" ];
+
+ preConfigure =
+ ''
+ sed -e 's@-o \''${MAN_USER} -g \''${MAN_GROUP} -m \''${MAN_PERMS} @@' -i Makefile
+ '';
+
+ preInstall = "mkdir -p $out/share/man/man5/ $out/share/man/man8/ $out/sbin";
+
+ meta = with stdenv.lib; {
+ description = "A system logging daemon";
+ platforms = platforms.linux;
+ license = licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/systemd.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/systemd.patch
new file mode 100644
index 000000000000..0a7fb166bd75
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/systemd.patch
@@ -0,0 +1,845 @@
+Based on http://ftp.free.org/mirrors/rsync.frugalware.org/frugalware-testing/source/apps-extra/sysklogd/sysklogd-1.5-systemd.diff
+
+diff -ruN -x '*~' sysklogd-1.5-old/Makefile sysklogd-1.5/Makefile
+--- sysklogd-1.5-old/Makefile 2007-05-30 17:28:48.000000000 +0200
++++ sysklogd-1.5/Makefile 2013-05-09 16:01:14.428638113 +0200
+@@ -20,7 +20,7 @@
+ CC= gcc
+ #SKFLAGS= -g -DSYSV -Wall
+ #LDFLAGS= -g
+-SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
++SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -I.
+ # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+ # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+ # $(shell getconf LFS_SKFLAGS)
+@@ -79,8 +79,8 @@
+
+ install: install_man install_exec
+
+-syslogd: syslogd.o pidfile.o
+- ${CC} ${LDFLAGS} -o syslogd syslogd.o pidfile.o ${LIBS}
++syslogd: syslogd.o pidfile.o sd-daemon.o
++ ${CC} ${LDFLAGS} -o syslogd syslogd.o pidfile.o sd-daemon.o ${LIBS}
+
+ klogd: klogd.o syslog.o pidfile.o ksym.o ksym_mod.o
+ ${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o \
+@@ -101,6 +101,9 @@
+ syslog.o: syslog.c
+ ${CC} ${SKFLAGS} ${SYSLOG_FLAGS} -c syslog.c
+
++sd-daemon.o: sd-daemon.c sd-daemon.h
++ ${CC} ${SKFLAGS} ${SYSLOG_FLAGS} -c sd-daemon.c
++
+ klogd.o: klogd.c klogd.h version.h
+ ${CC} ${SKFLAGS} ${KLOGD_FLAGS} $(DEB) -c klogd.c
+
+diff -ruN -x '*~' sysklogd-1.5-old/sd-daemon.c sysklogd-1.5/sd-daemon.c
+--- sysklogd-1.5-old/sd-daemon.c 1970-01-01 01:00:00.000000000 +0100
++++ sysklogd-1.5/sd-daemon.c 2013-05-09 16:01:14.429638107 +0200
+@@ -0,0 +1,436 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ Copyright 2010 Lennart Poettering
++
++ Permission is hereby granted, free of charge, to any person
++ obtaining a copy of this software and associated documentation files
++ (the "Software"), to deal in the Software without restriction,
++ including without limitation the rights to use, copy, modify, merge,
++ publish, distribute, sublicense, and/or sell copies of the Software,
++ and to permit persons to whom the Software is furnished to do so,
++ subject to the following conditions:
++
++ The above copyright notice and this permission notice shall be
++ included in all copies or substantial portions of the Software.
++
++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ SOFTWARE.
++***/
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE
++#endif
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/socket.h>
++#include <sys/un.h>
++#include <sys/fcntl.h>
++#include <netinet/in.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <unistd.h>
++#include <string.h>
++#include <stdarg.h>
++#include <stdio.h>
++#include <stddef.h>
++
++#include "sd-daemon.h"
++
++int sd_listen_fds(int unset_environment) {
++
++#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
++ return 0;
++#else
++ int r, fd;
++ const char *e;
++ char *p = NULL;
++ unsigned long l;
++
++ if (!(e = getenv("LISTEN_PID"))) {
++ r = 0;
++ goto finish;
++ }
++
++ errno = 0;
++ l = strtoul(e, &p, 10);
++
++ if (errno != 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (!p || *p || l <= 0) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ /* Is this for us? */
++ if (getpid() != (pid_t) l) {
++ r = 0;
++ goto finish;
++ }
++
++ if (!(e = getenv("LISTEN_FDS"))) {
++ r = 0;
++ goto finish;
++ }
++
++ errno = 0;
++ l = strtoul(e, &p, 10);
++
++ if (errno != 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (!p || *p) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
++ int flags;
++
++ if ((flags = fcntl(fd, F_GETFD)) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ if (flags & FD_CLOEXEC)
++ continue;
++
++ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
++ r = -errno;
++ goto finish;
++ }
++ }
++
++ r = (int) l;
++
++finish:
++ if (unset_environment) {
++ unsetenv("LISTEN_PID");
++ unsetenv("LISTEN_FDS");
++ }
++
++ return r;
++#endif
++}
++
++int sd_is_fifo(int fd, const char *path) {
++ struct stat st_fd;
++
++ if (fd < 0)
++ return -EINVAL;
++
++ memset(&st_fd, 0, sizeof(st_fd));
++ if (fstat(fd, &st_fd) < 0)
++ return -errno;
++
++ if (!S_ISFIFO(st_fd.st_mode))
++ return 0;
++
++ if (path) {
++ struct stat st_path;
++
++ memset(&st_path, 0, sizeof(st_path));
++ if (stat(path, &st_path) < 0) {
++
++ if (errno == ENOENT || errno == ENOTDIR)
++ return 0;
++
++ return -errno;
++ }
++
++ return
++ st_path.st_dev == st_fd.st_dev &&
++ st_path.st_ino == st_fd.st_ino;
++ }
++
++ return 1;
++}
++
++static int sd_is_socket_internal(int fd, int type, int listening) {
++ struct stat st_fd;
++
++ if (fd < 0 || type < 0)
++ return -EINVAL;
++
++ if (fstat(fd, &st_fd) < 0)
++ return -errno;
++
++ if (!S_ISSOCK(st_fd.st_mode))
++ return 0;
++
++ if (type != 0) {
++ int other_type = 0;
++ socklen_t l = sizeof(other_type);
++
++ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
++ return -errno;
++
++ if (l != sizeof(other_type))
++ return -EINVAL;
++
++ if (other_type != type)
++ return 0;
++ }
++
++ if (listening >= 0) {
++ int accepting = 0;
++ socklen_t l = sizeof(accepting);
++
++ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
++ return -errno;
++
++ if (l != sizeof(accepting))
++ return -EINVAL;
++
++ if (!accepting != !listening)
++ return 0;
++ }
++
++ return 1;
++}
++
++union sockaddr_union {
++ struct sockaddr sa;
++ struct sockaddr_in in4;
++ struct sockaddr_in6 in6;
++ struct sockaddr_un un;
++ struct sockaddr_storage storage;
++};
++
++int sd_is_socket(int fd, int family, int type, int listening) {
++ int r;
++
++ if (family < 0)
++ return -EINVAL;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ if (family > 0) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ return sockaddr.sa.sa_family == family;
++ }
++
++ return 1;
++}
++
++int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++ int r;
++
++ if (family != 0 && family != AF_INET && family != AF_INET6)
++ return -EINVAL;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ if (sockaddr.sa.sa_family != AF_INET &&
++ sockaddr.sa.sa_family != AF_INET6)
++ return 0;
++
++ if (family > 0)
++ if (sockaddr.sa.sa_family != family)
++ return 0;
++
++ if (port > 0) {
++ if (sockaddr.sa.sa_family == AF_INET) {
++ if (l < sizeof(struct sockaddr_in))
++ return -EINVAL;
++
++ return htons(port) == sockaddr.in4.sin_port;
++ } else {
++ if (l < sizeof(struct sockaddr_in6))
++ return -EINVAL;
++
++ return htons(port) == sockaddr.in6.sin6_port;
++ }
++ }
++
++ return 1;
++}
++
++int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
++ union sockaddr_union sockaddr;
++ socklen_t l;
++ int r;
++
++ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
++ return r;
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ l = sizeof(sockaddr);
++
++ if (getsockname(fd, &sockaddr.sa, &l) < 0)
++ return -errno;
++
++ if (l < sizeof(sa_family_t))
++ return -EINVAL;
++
++ if (sockaddr.sa.sa_family != AF_UNIX)
++ return 0;
++
++ if (path) {
++ if (length <= 0)
++ length = strlen(path);
++
++ if (length <= 0)
++ /* Unnamed socket */
++ return l == offsetof(struct sockaddr_un, sun_path);
++
++ if (path[0])
++ /* Normal path socket */
++ return
++ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
++ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
++ else
++ /* Abstract namespace socket */
++ return
++ (l == offsetof(struct sockaddr_un, sun_path) + length) &&
++ memcmp(path, sockaddr.un.sun_path, length) == 0;
++ }
++
++ return 1;
++}
++
++int sd_notify(int unset_environment, const char *state) {
++#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
++ return 0;
++#else
++ int fd = -1, r;
++ struct msghdr msghdr;
++ struct iovec iovec;
++ union sockaddr_union sockaddr;
++ const char *e;
++
++ if (!state) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ if (!(e = getenv("NOTIFY_SOCKET")))
++ return 0;
++
++ /* Must be an abstract socket, or an absolute path */
++ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
++ r = -EINVAL;
++ goto finish;
++ }
++
++ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ memset(&sockaddr, 0, sizeof(sockaddr));
++ sockaddr.sa.sa_family = AF_UNIX;
++ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
++
++ if (sockaddr.un.sun_path[0] == '@')
++ sockaddr.un.sun_path[0] = 0;
++
++ memset(&iovec, 0, sizeof(iovec));
++ iovec.iov_base = (char*) state;
++ iovec.iov_len = strlen(state);
++
++ memset(&msghdr, 0, sizeof(msghdr));
++ msghdr.msg_name = &sockaddr;
++ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
++
++ if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
++ msghdr.msg_namelen = sizeof(struct sockaddr_un);
++
++ msghdr.msg_iov = &iovec;
++ msghdr.msg_iovlen = 1;
++
++ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
++ r = -errno;
++ goto finish;
++ }
++
++ r = 1;
++
++finish:
++ if (unset_environment)
++ unsetenv("NOTIFY_SOCKET");
++
++ if (fd >= 0)
++ close(fd);
++
++ return r;
++#endif
++}
++
++int sd_notifyf(int unset_environment, const char *format, ...) {
++#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
++ return 0;
++#else
++ va_list ap;
++ char *p = NULL;
++ int r;
++
++ va_start(ap, format);
++ r = vasprintf(&p, format, ap);
++ va_end(ap);
++
++ if (r < 0 || !p)
++ return -ENOMEM;
++
++ r = sd_notify(unset_environment, p);
++ free(p);
++
++ return r;
++#endif
++}
++
++int sd_booted(void) {
++#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
++ return 0;
++#else
++
++ struct stat a, b;
++
++ /* We simply test whether the systemd cgroup hierarchy is
++ * mounted */
++
++ if (lstat("/sys/fs/cgroup", &a) < 0)
++ return 0;
++
++ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
++ return 0;
++
++ return a.st_dev != b.st_dev;
++#endif
++}
+diff -ruN -x '*~' sysklogd-1.5-old/sd-daemon.h sysklogd-1.5/sd-daemon.h
+--- sysklogd-1.5-old/sd-daemon.h 1970-01-01 01:00:00.000000000 +0100
++++ sysklogd-1.5/sd-daemon.h 2013-05-09 16:01:14.429638107 +0200
+@@ -0,0 +1,265 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++#ifndef foosddaemonhfoo
++#define foosddaemonhfoo
++
++/***
++ Copyright 2010 Lennart Poettering
++
++ Permission is hereby granted, free of charge, to any person
++ obtaining a copy of this software and associated documentation files
++ (the "Software"), to deal in the Software without restriction,
++ including without limitation the rights to use, copy, modify, merge,
++ publish, distribute, sublicense, and/or sell copies of the Software,
++ and to permit persons to whom the Software is furnished to do so,
++ subject to the following conditions:
++
++ The above copyright notice and this permission notice shall be
++ included in all copies or substantial portions of the Software.
++
++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ SOFTWARE.
++***/
++
++#include <sys/types.h>
++#include <inttypes.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++ Reference implementation of a few systemd related interfaces for
++ writing daemons. These interfaces are trivial to implement. To
++ simplify porting we provide this reference implementation.
++ Applications are welcome to reimplement the algorithms described
++ here if they do not want to include these two source files.
++
++ The following functionality is provided:
++
++ - Support for logging with log levels on stderr
++ - File descriptor passing for socket-based activation
++ - Daemon startup and status notification
++ - Detection of systemd boots
++
++ You may compile this with -DDISABLE_SYSTEMD to disable systemd
++ support. This makes all those calls NOPs that are directly related to
++ systemd (i.e. only sd_is_xxx() will stay useful).
++
++ Since this is drop-in code we don't want any of our symbols to be
++ exported in any case. Hence we declare hidden visibility for all of
++ them.
++
++ You may find an up-to-date version of these source files online:
++
++ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h
++ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c
++
++ This should compile on non-Linux systems, too, but with the
++ exception of the sd_is_xxx() calls all functions will become NOPs.
++
++ See sd-daemon(7) for more information.
++*/
++
++#ifndef _sd_printf_attr_
++#if __GNUC__ >= 4
++#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
++#else
++#define _sd_printf_attr_(a,b)
++#endif
++#endif
++
++#ifndef _sd_hidden_
++#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS)
++#define _sd_hidden_ __attribute__ ((visibility("hidden")))
++#else
++#define _sd_hidden_
++#endif
++#endif
++
++/*
++ Log levels for usage on stderr:
++
++ fprintf(stderr, SD_NOTICE "Hello World!\n");
++
++ This is similar to printk() usage in the kernel.
++*/
++#define SD_EMERG "<0>" /* system is unusable */
++#define SD_ALERT "<1>" /* action must be taken immediately */
++#define SD_CRIT "<2>" /* critical conditions */
++#define SD_ERR "<3>" /* error conditions */
++#define SD_WARNING "<4>" /* warning conditions */
++#define SD_NOTICE "<5>" /* normal but significant condition */
++#define SD_INFO "<6>" /* informational */
++#define SD_DEBUG "<7>" /* debug-level messages */
++
++/* The first passed file descriptor is fd 3 */
++#define SD_LISTEN_FDS_START 3
++
++/*
++ Returns how many file descriptors have been passed, or a negative
++ errno code on failure. Optionally, removes the $LISTEN_FDS and
++ $LISTEN_PID file descriptors from the environment (recommended, but
++ problematic in threaded environments). If r is the return value of
++ this function you'll find the file descriptors passed as fds
++ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
++ errno style error code on failure. This function call ensures that
++ the FD_CLOEXEC flag is set for the passed file descriptors, to make
++ sure they are not passed on to child processes. If FD_CLOEXEC shall
++ not be set, the caller needs to unset it after this call for all file
++ descriptors that are used.
++
++ See sd_listen_fds(3) for more information.
++*/
++int sd_listen_fds(int unset_environment) _sd_hidden_;
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is a FIFO in the file system stored under the
++ specified path, 0 otherwise. If path is NULL a path name check will
++ not be done and the call only verifies if the file descriptor
++ refers to a FIFO. Returns a negative errno style error code on
++ failure.
++
++ See sd_is_fifo(3) for more information.
++*/
++int sd_is_fifo(int fd, const char *path) _sd_hidden_;
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is a socket of the specified family (AF_INET,
++ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
++ family is 0 a socket family check will not be done. If type is 0 a
++ socket type check will not be done and the call only verifies if
++ the file descriptor refers to a socket. If listening is > 0 it is
++ verified that the socket is in listening mode. (i.e. listen() has
++ been called) If listening is == 0 it is verified that the socket is
++ not in listening mode. If listening is < 0 no listening mode check
++ is done. Returns a negative errno style error code on failure.
++
++ See sd_is_socket(3) for more information.
++*/
++int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_;
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is an Internet socket, of the specified family
++ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
++ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
++ check is not done. If type is 0 a socket type check will not be
++ done. If port is 0 a socket port check will not be done. The
++ listening flag is used the same way as in sd_is_socket(). Returns a
++ negative errno style error code on failure.
++
++ See sd_is_socket_inet(3) for more information.
++*/
++int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) _sd_hidden_;
++
++/*
++ Helper call for identifying a passed file descriptor. Returns 1 if
++ the file descriptor is an AF_UNIX socket of the specified type
++ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
++ a socket type check will not be done. If path is NULL a socket path
++ check will not be done. For normal AF_UNIX sockets set length to
++ 0. For abstract namespace sockets set length to the length of the
++ socket name (including the initial 0 byte), and pass the full
++ socket path in path (including the initial 0 byte). The listening
++ flag is used the same way as in sd_is_socket(). Returns a negative
++ errno style error code on failure.
++
++ See sd_is_socket_unix(3) for more information.
++*/
++int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) _sd_hidden_;
++
++/*
++ Informs systemd about changed daemon state. This takes a number of
++ newline separated environment-style variable assignments in a
++ string. The following variables are known:
++
++ READY=1 Tells systemd that daemon startup is finished (only
++ relevant for services of Type=notify). The passed
++ argument is a boolean "1" or "0". Since there is
++ little value in signalling non-readiness the only
++ value daemons should send is "READY=1".
++
++ STATUS=... Passes a single-line status string back to systemd
++ that describes the daemon state. This is free-from
++ and can be used for various purposes: general state
++ feedback, fsck-like programs could pass completion
++ percentages and failing programs could pass a human
++ readable error message. Example: "STATUS=Completed
++ 66% of file system check..."
++
++ ERRNO=... If a daemon fails, the errno-style error code,
++ formatted as string. Example: "ERRNO=2" for ENOENT.
++
++ BUSERROR=... If a daemon fails, the D-Bus error-style error
++ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
++
++ MAINPID=... The main pid of a daemon, in case systemd did not
++ fork off the process itself. Example: "MAINPID=4711"
++
++ Daemons can choose to send additional variables. However, it is
++ recommened to prefix variable names not listed above with X_.
++
++ Returns a negative errno-style error code on failure. Returns > 0
++ if systemd could be notified, 0 if it couldn't possibly because
++ systemd is not running.
++
++ Example: When a daemon finished starting up, it could issue this
++ call to notify systemd about it:
++
++ sd_notify(0, "READY=1");
++
++ See sd_notifyf() for more complete examples.
++
++ See sd_notify(3) for more information.
++*/
++int sd_notify(int unset_environment, const char *state) _sd_hidden_;
++
++/*
++ Similar to sd_notify() but takes a format string.
++
++ Example 1: A daemon could send the following after initialization:
++
++ sd_notifyf(0, "READY=1\n"
++ "STATUS=Processing requests...\n"
++ "MAINPID=%lu",
++ (unsigned long) getpid());
++
++ Example 2: A daemon could send the following shortly before
++ exiting, on failure:
++
++ sd_notifyf(0, "STATUS=Failed to start up: %s\n"
++ "ERRNO=%i",
++ strerror(errno),
++ errno);
++
++ See sd_notifyf(3) for more information.
++*/
++int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_;
++
++/*
++ Returns > 0 if the system was booted with systemd. Returns < 0 on
++ error. Returns 0 if the system was not booted with systemd. Note
++ that all of the functions above handle non-systemd boots just
++ fine. You should NOT protect them with a call to this function. Also
++ note that this function checks whether the system, not the user
++ session is controlled by systemd. However the functions above work
++ for both user and system services.
++
++ See sd_booted(3) for more information.
++*/
++int sd_booted(void) _sd_hidden_;
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff -ruN -x '*~' sysklogd-1.5-old/syslogd.c sysklogd-1.5/syslogd.c
+--- sysklogd-1.5-old/syslogd.c 2007-07-04 21:04:01.000000000 +0200
++++ sysklogd-1.5/syslogd.c 2013-05-09 16:04:32.106602589 +0200
+@@ -551,6 +551,7 @@
+
+ #if defined(__linux__)
+ #include <paths.h>
++#include <sd-daemon.h>
+ #endif
+
+ #ifndef UTMP_FILE
+@@ -965,8 +966,11 @@
+ }
+ signal (SIGTERM, SIG_DFL);
+ num_fds = getdtablesize();
+- for (i= 0; i < num_fds; i++)
+- (void) close(i);
++#if defined(__linux__)
++ if (sd_listen_fds(0) <= 0)
++#endif
++ for (i = 0; i < num_fds; i++)
++ (void) close(i);
+ untty();
+ }
+ else
+@@ -1253,6 +1257,60 @@
+ if (path[0] == '\0')
+ return -1;
+
++#if defined(__linux__)
++ if (strcmp(path, _PATH_LOG) == 0) {
++ int r;
++
++ /* Check whether an FD was passed in from systemd. If
++ * so, it's the /dev/log socket, so use it. */
++
++ r = sd_listen_fds(0);
++ if (r < 0) {
++ logerror("Failed to acquire systemd socket");
++#ifndef SYSV
++ dienow();
++#else
++ return -1;
++#endif
++ }
++
++
++ if (r > 1) {
++ logerror("Wrong number of systemd sockets passed");
++#ifndef SYSV
++ dienow();
++#else
++ return -1;
++#endif
++ }
++
++ if (r == 1) {
++ fd = SD_LISTEN_FDS_START;
++ r = sd_is_socket_unix(fd, SOCK_DGRAM, -1, "/run/systemd/journal/syslog", 0);
++ if (r < 0) {
++ logerror("Failed to verify systemd socket type");
++#ifndef SYSV
++ dienow();
++#else
++ return -1;
++#endif
++ }
++
++ if (!r) {
++ logerror("Passed systemd socket of wrong type");
++#ifndef SYSV
++ dienow();
++#else
++ return -1;
++#endif
++ }
++
++ dprintf("Using systemd socket (%d).\n", fd);
++ return fd;
++ }
++ }
++#endif
++
+ (void) unlink(path);
+
+ memset(&sunx, 0, sizeof(sunx));
+@@ -2254,9 +2312,11 @@
+ if (InetInuse) close(inetm);
+
+ /* Clean-up files. */
+- for (i = 0; i < nfunix; i++)
+- if (funixn[i] && funix[i] != -1)
+- (void)unlink(funixn[i]);
++ i = 0;
++#if defined(__linux__)
++ if (sd_listen_fds(0) > 0)
++ i = 1;
++#endif
+ #ifndef TESTING
+ (void) remove_pid(PidFile);
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/union-wait.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/union-wait.patch
new file mode 100644
index 000000000000..e4bffa5d6953
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysklogd/union-wait.patch
@@ -0,0 +1,11 @@
+--- sysklogd-1.5-old/syslogd.c 2016-08-30 22:50:59.812926945 +0100
++++ sysklogd-1.5/syslogd.c 2016-08-30 22:51:12.008842890 +0100
+@@ -2094,7 +2094,7 @@
+ (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
+ wait ((int *)0);
+ #else
+- union wait status;
++ int status;
+
+ while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
+ ;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syslinux/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syslinux/default.nix
new file mode 100644
index 000000000000..28681aed5640
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/syslinux/default.nix
@@ -0,0 +1,100 @@
+{ stdenv, fetchgit, fetchurl, fetchpatch, nasm, perl, python3, libuuid, mtools, makeWrapper }:
+
+stdenv.mkDerivation {
+ pname = "syslinux";
+ version = "unstable-20190207";
+
+ # This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run.
+ # Same issue here https://www.syslinux.org/archives/2019-February/026330.html
+ src = fetchgit {
+ url = "https://repo.or.cz/syslinux";
+ rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7";
+ sha256 = "1acf6byx7i6vz8hq6mra526g8mf7fmfhid211y8nq0v6px7d3aqs";
+ fetchSubmodules = true;
+ };
+
+ patches = let
+ mkURL = commit: patchName:
+ "https://salsa.debian.org/images-team/syslinux/raw/${commit}/debian/patches/"
+ + patchName;
+ in [
+ (fetchurl {
+ url = mkURL "fa1349f1" "0002-gfxboot-menu-label.patch";
+ sha256 = "06ifgzbpjj4picpj17zgprsfi501zf4pp85qjjgn29i5rs291zni";
+ })
+ (fetchurl {
+ url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/0005-gnu-efi-version-compatibility.patch?id=821c3da473d1399d930d5b4a086e46a4179eaa45";
+ name = "0005-gnu-efi-version-compatibility.patch";
+ sha256 = "1mz2idg8cwn0mvd3jixxynhkn7rhmi5fp8cc8zznh5f0ysfra446";
+ })
+ (fetchurl {
+ url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/0025-reproducible-build.patch?id=821c3da473d1399d930d5b4a086e46a4179eaa45";
+ name = "0025-reproducible-build.patch";
+ sha256 = "0qk6wc6z3648828y3961pn4pi7xhd20a6fqn6z1mnj22bbvzcxls";
+ })
+ (fetchurl {
+ # mbr.bin: too big (452 > 440)
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
+ url = mkURL "7468ef0e38c43" "0016-strip-gnu-property.patch";
+ sha256 = "17n63b8wz6szv8npla1234g1ip7lqgzx2whrpv358ppf67lq8vwm";
+ })
+ (fetchurl {
+ # mbr.bin: too big (452 > 440)
+ url = mkURL "012e1dd312eb" "0017-single-load-segment.patch";
+ sha256 = "0azqzicsjw47b9ppyikhzaqmjl4lrvkxris1356bkmgcaiv6d98b";
+ })
+ (fetchurl {
+ url = mkURL "26f0e7b2" "0018-prevent-pow-optimization.patch";
+ sha256 = "1c8g0jz5yj9a0rsmryx9vdjsw4hw8mjfcg05c9pmyjg85w3dfp3m";
+ })
+ ];
+
+ postPatch = ''
+ substituteInPlace Makefile --replace /bin/pwd $(type -P pwd)
+ substituteInPlace utils/ppmtolss16 --replace /usr/bin/perl $(type -P perl)
+
+ # fix tests
+ substituteInPlace tests/unittest/include/unittest/unittest.h \
+ --replace /usr/include/ ""
+
+ # Hack to get `gcc -m32' to work without having 32-bit Glibc headers.
+ mkdir gnu-efi/inc/ia32/gnu
+ touch gnu-efi/inc/ia32/gnu/stubs-32.h
+ '';
+
+ nativeBuildInputs = [ nasm perl python3 ];
+ buildInputs = [ libuuid makeWrapper ];
+
+ enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...'
+ hardeningDisable = [ "pic" "stackprotector" "fortify" ];
+
+ stripDebugList = [ "bin" "sbin" "share/syslinux/com32" ];
+
+ makeFlags = [
+ "BINDIR=$(out)/bin"
+ "SBINDIR=$(out)/sbin"
+ "DATADIR=$(out)/share"
+ "MANDIR=$(out)/share/man"
+ "PERL=perl"
+ "HEXDATE=0x00000000"
+ ]
+ ++ stdenv.lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ];
+
+ doCheck = false; # fails. some fail in a sandbox, others require qemu
+
+ postInstall = ''
+ wrapProgram $out/bin/syslinux \
+ --prefix PATH : "${mtools}/bin"
+
+ # Delete com32 headers to save space, nobody seems to be using them
+ rm -rf $out/share/syslinux/com32
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.syslinux.org/";
+ description = "A lightweight bootloader";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.samueldr ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix
new file mode 100644
index 000000000000..258da07c40b6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, gettext, bzip2 }:
+
+stdenv.mkDerivation rec {
+ name = "sysstat-12.3.2";
+
+ src = fetchurl {
+ url = "http://pagesperso-orange.fr/sebastien.godard/${name}.tar.xz";
+ sha256 = "0gaas16q2f7qmrv4sbqk2l2mrc7yr64s33bzw4094p59fkylm7k4";
+ };
+
+ buildInputs = [ gettext ];
+
+ preConfigure = ''
+ export PATH_CP=$(type -tp cp)
+ export PATH_CHKCONFIG=/no-such-program
+ export BZIP=${bzip2.bin}/bin/bzip2
+ export SYSTEMCTL=systemctl
+ '';
+
+ makeFlags = [ "SYSCONFIG_DIR=$(out)/etc" "IGNORE_FILE_ATTRIBUTES=y" "CHOWN=true" ];
+ installTargets = [ "install_base" "install_nls" "install_man" ];
+
+ patches = [ ./install.patch ];
+
+ meta = {
+ homepage = "http://sebastien.godard.pagesperso-orange.fr/";
+ description = "A collection of performance monitoring tools for Linux (such as sar, iostat and pidstat)";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.eelco ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/install.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/install.patch
new file mode 100644
index 000000000000..473fa30b98b4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysstat/install.patch
@@ -0,0 +1,13 @@
+diff -rc sysstat-11.0.1/Makefile.in sysstat-11.0.1-new/Makefile.in
+*** sysstat-11.0.1/Makefile.in 2014-08-30 15:38:39.000000000 +0200
+--- sysstat-11.0.1-new/Makefile.in 2014-12-18 14:40:45.466349009 +0100
+***************
+*** 331,337 ****
+ install_base: all sa1 sa2 sysstat.sysconfig install_man install_nls \
+ contrib/isag/isag
+ mkdir -p $(DESTDIR)$(SA_LIB_DIR)
+- mkdir -p $(DESTDIR)$(SA_DIR)
+ ifeq ($(CLEAN_SA_DIR),y)
+ find $(DESTDIR)$(SA_DIR) \( -name 'sar??' -o -name 'sa??' -o -name 'sar??.gz' -o -name 'sa??.gz' \) \
+ -exec rm -f {} \;
+--- 331,336 ----
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-acpi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-acpi/default.nix
new file mode 100644
index 000000000000..b7c0e27669da
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-acpi/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, kernel }:
+let
+ version = "1.0.1";
+ sha256 = "0jmm9h607f7k20yassm6af9mh5l00yih5248wwv4i05bd68yw3p5";
+in
+stdenv.mkDerivation {
+ name = "system76-acpi-module-${version}-${kernel.version}";
+
+ passthru.moduleName = "system76_acpi";
+
+ src = fetchFromGitHub {
+ owner = "pop-os";
+ repo = "system76-acpi-dkms";
+ rev = version;
+ inherit sha256;
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildFlags = [
+ "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ installPhase = ''
+ install -D system76_acpi.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76_acpi.ko
+ mkdir -p $out/lib/udev/hwdb.d
+ mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.khumba ];
+ license = [ licenses.gpl2Only ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ broken = versionOlder kernel.version "4.14";
+ description = "System76 ACPI Driver (DKMS)";
+ homepage = "https://github.com/pop-os/system76-acpi-dkms";
+ longDescription = ''
+ This provides the system76_acpi in-tree driver for systems missing it.
+ '';
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-io/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-io/default.nix
new file mode 100644
index 000000000000..dac1e2db1e38
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76-io/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, kernel }:
+let
+ version = "1.0.1";
+ sha256 = "0qkgkkjy1isv6ws6hrcal75dxjz98rpnvqbm7agdcc6yv0c17wwh";
+in
+stdenv.mkDerivation {
+ name = "system76-io-module-${version}-${kernel.version}";
+
+ passthru.moduleName = "system76_io";
+
+ src = fetchFromGitHub {
+ owner = "pop-os";
+ repo = "system76-io-dkms";
+ rev = version;
+ inherit sha256;
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildFlags = [
+ "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ installPhase = ''
+ install -D system76-io.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76-io.ko
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.khumba ];
+ license = [ licenses.gpl2Plus ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ broken = versionOlder kernel.version "4.14";
+ description = "DKMS module for controlling System76 I/O board";
+ homepage = "https://github.com/pop-os/system76-io-dkms";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76/default.nix
new file mode 100644
index 000000000000..02eca1d5bbd5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/system76/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, kernel }:
+let
+ version = "1.0.9";
+ sha256 = "0i4825y2vd679kdjv30ifzj1i1066d3x37z4lgk39hx16993k162";
+in
+stdenv.mkDerivation {
+ name = "system76-module-${version}-${kernel.version}";
+
+ passthru.moduleName = "system76";
+
+ src = fetchFromGitHub {
+ owner = "pop-os";
+ repo = "system76-dkms";
+ rev = version;
+ inherit sha256;
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ buildFlags = [
+ "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ installPhase = ''
+ install -D system76.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76.ko
+ mkdir -p $out/lib/udev/hwdb.d
+ mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
+ '';
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.khumba ];
+ license = [ licenses.gpl2Plus ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ broken = versionOlder kernel.version "4.14";
+ description = "System76 DKMS driver";
+ homepage = "https://github.com/pop-os/system76-dkms";
+ longDescription = ''
+ The System76 DKMS driver. On newer System76 laptops, this driver controls
+ some of the hotkeys and allows for custom fan control.
+ '';
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd-wait/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd-wait/default.nix
new file mode 100644
index 000000000000..348549a1bc64
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd-wait/default.nix
@@ -0,0 +1,25 @@
+{ python3Packages, fetchFromGitHub, lib }:
+
+python3Packages.buildPythonApplication rec {
+ pname = "systemd-wait";
+ version = "0.1+2018-10-05";
+
+ src = fetchFromGitHub {
+ owner = "Stebalien";
+ repo = pname;
+ rev = "bbb58dd4584cc08ad20c3888edb7628f28aee3c7";
+ sha256 = "1l8rd0wzf3m7fk0g1c8wc0csdisdfac0filhixpgp0ck9ignayq5";
+ };
+
+ propagatedBuildInputs = with python3Packages; [
+ dbus-python pygobject3
+ ];
+
+ meta = {
+ homepage = "https://github.com/Stebalien/systemd-wait";
+ license = lib.licenses.gpl3;
+ description = "Wait for a systemd unit to enter a specific state";
+ maintainers = [ lib.maintainers.benley ];
+ platforms = lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch
new file mode 100644
index 000000000000..1f75fc63ffe7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch
@@ -0,0 +1,32 @@
+From 46c8ccfeb61253cd3dff5f34013670c7e3366ef5 Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Tue, 8 Jan 2013 15:46:30 +0100
+Subject: [PATCH 01/18] Start device units for uninitialised encrypted devices
+
+This is necessary because the NixOS service that initialises the
+filesystem depends on the appearance of the device unit. Also, this
+makes more sense to me: the device is ready; it's the filesystem
+that's not, but taking care of that is the responsibility of the mount
+unit. (However, this ignores the fsck unit, so it's not perfect...)
+---
+ rules.d/99-systemd.rules.in | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/rules.d/99-systemd.rules.in b/rules.d/99-systemd.rules.in
+index 1c60eec587..b2486da130 100644
+--- a/rules.d/99-systemd.rules.in
++++ b/rules.d/99-systemd.rules.in
+@@ -17,10 +17,6 @@ SUBSYSTEM=="ubi", TAG+="systemd"
+ SUBSYSTEM=="block", TAG+="systemd"
+ SUBSYSTEM=="block", ACTION=="add", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
+
+-# Ignore encrypted devices with no identified superblock on it, since
+-# we are probably still calling mke2fs or mkswap on it.
+-SUBSYSTEM=="block", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
+-
+ # add symlink to GPT root disk
+ SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root"
+ SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks"
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch
new file mode 100644
index 000000000000..7c025cbb7d79
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch
@@ -0,0 +1,42 @@
+From 139c420de62e078182eaf48b541c4b912d445fd9 Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Fri, 12 Apr 2013 13:16:57 +0200
+Subject: [PATCH 02/18] Don't try to unmount /nix or /nix/store
+
+They'll still be remounted read-only.
+
+https://github.com/NixOS/nixos/issues/126
+---
+ src/shared/fstab-util.c | 2 ++
+ src/shutdown/umount.c | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
+index 806dda8475..0220741c91 100644
+--- a/src/shared/fstab-util.c
++++ b/src/shared/fstab-util.c
+@@ -40,6 +40,8 @@ bool fstab_is_extrinsic(const char *mount, const char *opts) {
+ /* Don't bother with the OS data itself */
+ if (PATH_IN_SET(mount,
+ "/",
++ "/nix",
++ "/nix/store",
+ "/usr",
+ "/etc"))
+ return true;
+diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
+index 8a5e80eeaa..fab35ed6f3 100644
+--- a/src/shutdown/umount.c
++++ b/src/shutdown/umount.c
+@@ -414,6 +414,8 @@ static int delete_dm(dev_t devnum) {
+
+ static bool nonunmountable_path(const char *path) {
+ return path_equal(path, "/")
++ || path_equal(path, "/nix")
++ || path_equal(path, "/nix/store")
+ #if ! HAVE_SPLIT_USR
+ || path_equal(path, "/usr")
+ #endif
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch
new file mode 100644
index 000000000000..1f0b8aaf38b3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch
@@ -0,0 +1,34 @@
+From a889dbe796cd72425f38dec3d2aaab44a914ac60 Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Wed, 16 Apr 2014 10:59:28 +0200
+Subject: [PATCH 03/18] Fix NixOS containers
+
+In NixOS containers, the init script is bind-mounted into the
+container, so checking early whether it exists will fail.
+---
+ src/nspawn/nspawn.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index 43712565c2..07f294c78a 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -5122,6 +5122,7 @@ static int run(int argc, char *argv[]) {
+ goto finish;
+ }
+ } else {
++#if 0
+ const char *p, *q;
+
+ if (arg_pivot_root_new)
+@@ -5136,6 +5137,7 @@ static int run(int argc, char *argv[]) {
+ r = -EINVAL;
+ goto finish;
+ }
++#endif
+ }
+
+ } else {
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch
new file mode 100644
index 000000000000..f9e7bc9d8766
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch
@@ -0,0 +1,25 @@
+From 5098b1aad07356e04fcd12f2c77ea4fd17460411 Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Thu, 1 May 2014 14:10:10 +0200
+Subject: [PATCH 04/18] Look for fsck in the right place
+
+---
+ src/fsck/fsck.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
+index 80f7107b9d..74e48a385f 100644
+--- a/src/fsck/fsck.c
++++ b/src/fsck/fsck.c
+@@ -370,7 +370,7 @@ static int run(int argc, char *argv[]) {
+ } else
+ dash_c[0] = 0;
+
+- cmdline[i++] = "/sbin/fsck";
++ cmdline[i++] = "/run/current-system/sw/bin/fsck";
+ cmdline[i++] = arg_repair;
+ cmdline[i++] = "-T";
+
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
new file mode 100644
index 000000000000..91d6fbf41d62
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
@@ -0,0 +1,124 @@
+From b46f1b20e990f01af4bdf3dd6fef45f5b4a5993e Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Fri, 19 Dec 2014 14:46:17 +0100
+Subject: [PATCH 05/18] Add some NixOS-specific unit directories
+
+Look in `/nix/var/nix/profiles/default/lib/systemd` for units provided
+by packages installed into the default profile via
+`nix-env -iA nixos.$package`, and into `/etc/systemd-mutable/system` for
+persistent, mutable units (used for Dysnomia).
+
+Also, remove /usr and /lib as these don't exist on NixOS.
+---
+ src/basic/path-lookup.c | 20 +++++---------------
+ src/core/systemd.pc.in | 5 +++--
+ 2 files changed, 8 insertions(+), 17 deletions(-)
+
+diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
+index 52968dee34..bba2eb09b8 100644
+--- a/src/basic/path-lookup.c
++++ b/src/basic/path-lookup.c
+@@ -94,17 +94,14 @@ int xdg_user_data_dir(char **ret, const char *suffix) {
+ }
+
+ static const char* const user_data_unit_paths[] = {
+- "/usr/local/lib/systemd/user",
+- "/usr/local/share/systemd/user",
+ USER_DATA_UNIT_DIR,
+- "/usr/lib/systemd/user",
+- "/usr/share/systemd/user",
+ NULL
+ };
+
+ static const char* const user_config_unit_paths[] = {
+ USER_CONFIG_UNIT_DIR,
+ "/etc/systemd/user",
++ "/etc/systemd-mutable/user",
+ NULL
+ };
+
+@@ -616,15 +613,14 @@ int lookup_paths_init(
+ persistent_config,
+ SYSTEM_CONFIG_UNIT_DIR,
+ "/etc/systemd/system",
++ "/etc/systemd-mutable/system",
++ "/nix/var/nix/profiles/default/lib/systemd/system",
+ STRV_IFNOTNULL(persistent_attached),
+ runtime_config,
+ "/run/systemd/system",
+ STRV_IFNOTNULL(runtime_attached),
+ STRV_IFNOTNULL(generator),
+- "/usr/local/lib/systemd/system",
+ SYSTEM_DATA_UNIT_PATH,
+- "/usr/lib/systemd/system",
+- STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
+ STRV_IFNOTNULL(generator_late));
+ break;
+
+@@ -640,14 +636,12 @@ int lookup_paths_init(
+ persistent_config,
+ USER_CONFIG_UNIT_DIR,
+ "/etc/systemd/user",
++ "/etc/systemd-mutable/user",
++ "/nix/var/nix/profiles/default/lib/systemd/user",
+ runtime_config,
+ "/run/systemd/user",
+ STRV_IFNOTNULL(generator),
+- "/usr/local/share/systemd/user",
+- "/usr/share/systemd/user",
+- "/usr/local/lib/systemd/user",
+ USER_DATA_UNIT_DIR,
+- "/usr/lib/systemd/user",
+ STRV_IFNOTNULL(generator_late));
+ break;
+
+@@ -797,7 +791,6 @@ char **generator_binary_paths(UnitFileScope scope) {
+ case UNIT_FILE_SYSTEM:
+ add = strv_new("/run/systemd/system-generators",
+ "/etc/systemd/system-generators",
+- "/usr/local/lib/systemd/system-generators",
+ SYSTEM_GENERATOR_DIR);
+ break;
+
+@@ -805,7 +798,6 @@ char **generator_binary_paths(UnitFileScope scope) {
+ case UNIT_FILE_USER:
+ add = strv_new("/run/systemd/user-generators",
+ "/etc/systemd/user-generators",
+- "/usr/local/lib/systemd/user-generators",
+ USER_GENERATOR_DIR);
+ break;
+
+@@ -844,12 +836,10 @@ char **env_generator_binary_paths(bool is_system) {
+ if (is_system)
+ add = strv_new("/run/systemd/system-environment-generators",
+ "/etc/systemd/system-environment-generators",
+- "/usr/local/lib/systemd/system-environment-generators",
+ SYSTEM_ENV_GENERATOR_DIR);
+ else
+ add = strv_new("/run/systemd/user-environment-generators",
+ "/etc/systemd/user-environment-generators",
+- "/usr/local/lib/systemd/user-environment-generators",
+ USER_ENV_GENERATOR_DIR);
+
+ if (!add)
+diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
+index 8424837824..b1c541bc52 100644
+--- a/src/core/systemd.pc.in
++++ b/src/core/systemd.pc.in
+@@ -38,10 +38,11 @@ systemdsystemconfdir=${systemd_system_conf_dir}
+ systemd_user_conf_dir=${sysconfdir}/systemd/user
+ systemduserconfdir=${systemd_user_conf_dir}
+
+-systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemd_system_unit_dir}:/usr/lib/systemd/system:/lib/systemd/system
++systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/etc/systemd-mutable/system:/nix/var/nix/profiles/default/lib/systemd/system:/run/systemd/system:${systemdsystemunitdir}
+ systemdsystemunitpath=${systemd_system_unit_path}
+
+-systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemd_user_unit_dir}:/usr/lib/systemd/user:/usr/share/systemd/user
++systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/etc/systemd-mutable/user:/nix/var/nix/profiles/default/lib/systemd/user:/run/systemd/user:${systemduserunitdir}
++
+ systemduserunitpath=${systemd_user_unit_path}
+
+ systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch
new file mode 100644
index 000000000000..8021472ea339
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch
@@ -0,0 +1,31 @@
+From 4c9f9d192182f1051dba1c547e182e7c8f549b0f Mon Sep 17 00:00:00 2001
+From: Eelco Dolstra <eelco.dolstra@logicblox.com>
+Date: Mon, 11 May 2015 15:39:38 +0200
+Subject: [PATCH 06/18] Get rid of a useless message in user sessions
+
+Namely lots of variants of
+
+ Unit nix-var-nix-db.mount is bound to inactive unit dev-disk-by\x2dlabel-nixos.device. Stopping, too.
+
+in containers.
+---
+ src/core/unit.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/core/unit.c b/src/core/unit.c
+index 1bda568560..5b44970763 100644
+--- a/src/core/unit.c
++++ b/src/core/unit.c
+@@ -2150,7 +2150,8 @@ static void unit_check_binds_to(Unit *u) {
+ }
+
+ assert(other);
+- log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
++ if (u->type != UNIT_MOUNT || detect_container() <= 0)
++ log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
+
+ /* A unit we need to run is gone. Sniff. Let's stop this. */
+ r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, NULL, &error, NULL);
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
new file mode 100644
index 000000000000..6c24821c2a0d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
@@ -0,0 +1,108 @@
+From 539f3af04963a6826d2b2d0ba2095af99a7a6294 Mon Sep 17 00:00:00 2001
+From: Gabriel Ebner <gebner@gebner.org>
+Date: Sun, 6 Dec 2015 14:26:36 +0100
+Subject: [PATCH 07/18] hostnamed, localed, timedated: disable methods that
+ change system settings.
+
+---
+ src/hostname/hostnamed.c | 6 ++++++
+ src/locale/localed.c | 9 +++++++++
+ src/timedate/timedated.c | 10 ++++++++++
+ 3 files changed, 25 insertions(+)
+
+diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
+index 7f6607a527..b5a9388916 100644
+--- a/src/hostname/hostnamed.c
++++ b/src/hostname/hostnamed.c
+@@ -626,6 +626,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ name = empty_to_null(name);
+
+ context_read_etc_hostname(c);
+@@ -685,6 +688,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ name = empty_to_null(name);
+
+ context_read_machine_info(c);
+diff --git a/src/locale/localed.c b/src/locale/localed.c
+index 715ce5cac7..014f7dcf6c 100644
+--- a/src/locale/localed.c
++++ b/src/locale/localed.c
+@@ -317,6 +317,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ /* If single locale without variable name is provided, then we assume it is LANG=. */
+ if (strv_length(l) == 1 && !strchr(l[0], '=')) {
+ if (!locale_is_valid(l[0]))
+@@ -432,6 +435,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ keymap = empty_to_null(keymap);
+ keymap_toggle = empty_to_null(keymap_toggle);
+
+@@ -606,6 +612,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ layout = empty_to_null(layout);
+ model = empty_to_null(model);
+ variant = empty_to_null(variant);
+diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
+index c467b85477..3e78b2f575 100644
+--- a/src/timedate/timedated.c
++++ b/src/timedate/timedated.c
+@@ -646,6 +646,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
+ if (r < 0)
+ return r;
+
++ if (getenv("NIXOS_STATIC_TIMEZONE"))
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing timezone via systemd is not supported when it is set in NixOS configuration.");
++
+ if (!timezone_is_valid(z, LOG_DEBUG))
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid or not installed time zone '%s'", z);
+
+@@ -725,6 +729,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ if (lrtc == c->local_rtc)
+ return sd_bus_reply_method_return(m, NULL);
+
+@@ -917,6 +924,9 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error
+ if (r < 0)
+ return r;
+
++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
++ "Changing system settings via systemd is not supported on NixOS.");
++
+ r = context_update_ntp_status(c, bus, m);
+ if (r < 0)
+ return r;
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch
new file mode 100644
index 000000000000..7b17c3bcb2ba
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch
@@ -0,0 +1,32 @@
+From 5c2a1a6d33f7cdbcb8ddcc70b91ba4c7f3c383b3 Mon Sep 17 00:00:00 2001
+From: Nikolay Amiantov <ab@fmap.me>
+Date: Thu, 7 Jul 2016 02:47:13 +0300
+Subject: [PATCH 08/18] Fix hwdb paths
+
+Patch by vcunat.
+---
+ src/libsystemd/sd-hwdb/sd-hwdb.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c
+index b3febdbb31..eba00a5bc7 100644
+--- a/src/libsystemd/sd-hwdb/sd-hwdb.c
++++ b/src/libsystemd/sd-hwdb/sd-hwdb.c
+@@ -297,13 +297,8 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
+ }
+
+ static const char hwdb_bin_paths[] =
+- "/etc/systemd/hwdb/hwdb.bin\0"
+ "/etc/udev/hwdb.bin\0"
+- "/usr/lib/systemd/hwdb/hwdb.bin\0"
+-#if HAVE_SPLIT_USR
+- "/lib/systemd/hwdb/hwdb.bin\0"
+-#endif
+- UDEVLIBEXECDIR "/hwdb.bin\0";
++ ;
+
+ _public_ int sd_hwdb_new(sd_hwdb **ret) {
+ _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
new file mode 100644
index 000000000000..e0fab399febf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
@@ -0,0 +1,132 @@
+From a8ccba372d865429b578e72fd104a693b96101b3 Mon Sep 17 00:00:00 2001
+From: Nikolay Amiantov <ab@fmap.me>
+Date: Tue, 11 Oct 2016 13:12:08 +0300
+Subject: [PATCH 09/18] Change /usr/share/zoneinfo to /etc/zoneinfo
+
+NixOS uses this path.
+---
+ man/localtime.xml | 4 ++--
+ src/basic/time-util.c | 6 +++---
+ src/firstboot/firstboot.c | 2 +-
+ src/nspawn/nspawn.c | 4 ++--
+ src/timedate/timedated.c | 8 ++++----
+ 5 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/man/localtime.xml b/man/localtime.xml
+index 0f1652ee2e..71c4f95c2e 100644
+--- a/man/localtime.xml
++++ b/man/localtime.xml
+@@ -20,7 +20,7 @@
+ </refnamediv>
+
+ <refsynopsisdiv>
+- <para><filename>/etc/localtime</filename> -&gt; <filename>../usr/share/zoneinfo/…</filename></para>
++ <para><filename>/etc/localtime</filename> -&gt; <filename>zoneinfo/…</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+@@ -30,7 +30,7 @@
+ system-wide timezone of the local system that is used by
+ applications for presentation to the user. It should be an
+ absolute or relative symbolic link pointing to
+- <filename>/usr/share/zoneinfo/</filename>, followed by a timezone
++ <filename>/etc/zoneinfo/</filename>, followed by a timezone
+ identifier such as <literal>Europe/Berlin</literal> or
+ <literal>Etc/UTC</literal>. The resulting link should lead to the
+ corresponding binary
+diff --git a/src/basic/time-util.c b/src/basic/time-util.c
+index 15cc1b8851..d0abde5933 100644
+--- a/src/basic/time-util.c
++++ b/src/basic/time-util.c
+@@ -1259,7 +1259,7 @@ int get_timezones(char ***ret) {
+ n_allocated = 2;
+ n_zones = 1;
+
+- f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
++ f = fopen("/etc/zoneinfo/zone1970.tab", "re");
+ if (f) {
+ for (;;) {
+ _cleanup_free_ char *line = NULL;
+@@ -1354,7 +1354,7 @@ bool timezone_is_valid(const char *name, int log_level) {
+ if (p - name >= PATH_MAX)
+ return false;
+
+- t = strjoina("/usr/share/zoneinfo/", name);
++ t = strjoina("/etc/zoneinfo/", name);
+
+ fd = open(t, O_RDONLY|O_CLOEXEC);
+ if (fd < 0) {
+@@ -1452,7 +1452,7 @@ int get_timezone(char **ret) {
+ if (r < 0)
+ return r; /* returns EINVAL if not a symlink */
+
+- e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/");
++ e = PATH_STARTSWITH_SET(t, "/etc/zoneinfo/", "../etc/zoneinfo/");
+ if (!e)
+ return -EINVAL;
+
+diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
+index c9fc8dd5cd..44fc04dc88 100644
+--- a/src/firstboot/firstboot.c
++++ b/src/firstboot/firstboot.c
+@@ -460,7 +460,7 @@ static int process_timezone(void) {
+ if (isempty(arg_timezone))
+ return 0;
+
+- e = strjoina("../usr/share/zoneinfo/", arg_timezone);
++ e = strjoina("zoneinfo/", arg_timezone);
+
+ (void) mkdir_parents(etc_localtime, 0755);
+ if (symlink(e, etc_localtime) < 0)
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index 07f294c78a..cf86d1f494 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -1699,8 +1699,8 @@ static int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t u
+ static const char *timezone_from_path(const char *path) {
+ return PATH_STARTSWITH_SET(
+ path,
+- "../usr/share/zoneinfo/",
+- "/usr/share/zoneinfo/");
++ "../etc/zoneinfo/",
++ "/etc/zoneinfo/");
+ }
+
+ static bool etc_writable(void) {
+diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
+index 3e78b2f575..de5477a08f 100644
+--- a/src/timedate/timedated.c
++++ b/src/timedate/timedated.c
+@@ -269,7 +269,7 @@ static int context_read_data(Context *c) {
+
+ r = get_timezone(&t);
+ if (r == -EINVAL)
+- log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.");
++ log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /etc/zoneinfo/.");
+ else if (r < 0)
+ log_warning_errno(r, "Failed to get target of /etc/localtime: %m");
+
+@@ -293,7 +293,7 @@ static int context_write_data_timezone(Context *c) {
+
+ if (isempty(c->zone) || streq(c->zone, "UTC")) {
+
+- if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) {
++ if (access("/etc/zoneinfo/UTC", F_OK) < 0) {
+
+ if (unlink("/etc/localtime") < 0 && errno != ENOENT)
+ return -errno;
+@@ -301,9 +301,9 @@ static int context_write_data_timezone(Context *c) {
+ return 0;
+ }
+
+- source = "../usr/share/zoneinfo/UTC";
++ source = "../etc/zoneinfo/UTC";
+ } else {
+- p = path_join("../usr/share/zoneinfo", c->zone);
++ p = path_join("../etc/zoneinfo", c->zone);
+ if (!p)
+ return -ENOMEM;
+
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch
new file mode 100644
index 000000000000..44ed04d9e7ea
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch
@@ -0,0 +1,27 @@
+From 84a2d35d4e75295edf7e190a94dfaf65db4973b6 Mon Sep 17 00:00:00 2001
+From: Imuli <i@imu.li>
+Date: Wed, 19 Oct 2016 08:46:47 -0400
+Subject: [PATCH 10/18] localectl: use /etc/X11/xkb for list-x11-*
+
+NixOS has an option to link the xkb data files to /etc/X11, but not to
+/usr/share/X11.
+---
+ src/locale/localectl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/locale/localectl.c b/src/locale/localectl.c
+index e0664de826..c521f33a2a 100644
+--- a/src/locale/localectl.c
++++ b/src/locale/localectl.c
+@@ -277,7 +277,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
+ } state = NONE, look_for;
+ int r;
+
+- f = fopen("/usr/share/X11/xkb/rules/base.lst", "re");
++ f = fopen("/etc/X11/xkb/rules/base.lst", "re");
+ if (!f)
+ return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
+
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
new file mode 100644
index 000000000000..e5d4f1701ba5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
@@ -0,0 +1,26 @@
+From 81ee9b5cd46f78de139c39e2a18f39e658c60169 Mon Sep 17 00:00:00 2001
+From: Franz Pletz <fpletz@fnordicwalking.de>
+Date: Sun, 11 Feb 2018 04:37:44 +0100
+Subject: [PATCH 11/18] build: don't create statedir and don't touch prefixdir
+
+---
+ meson.build | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index ba9e7afe53..2ef9d4d770 100644
+--- a/meson.build
++++ b/meson.build
+@@ -3371,9 +3371,6 @@ install_data('LICENSE.GPL2',
+ 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
+ install_dir : docdir)
+
+-meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
+-meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
+-
+ ############################################################
+
+ check_help = find_program('tools/check-help.sh')
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch
new file mode 100644
index 000000000000..d1961d32f9fb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch
@@ -0,0 +1,314 @@
+From 7dbe84b7c43669dccd90db8ac33c38a70e6b6914 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Mon, 26 Feb 2018 14:25:57 +0000
+Subject: [PATCH 12/18] Install default configuration into $out/share/factory
+
+By default systemd should read all its configuration from /etc. Therefor
+we rely on -Dsysconfdir=/etc in meson as default value. Unfortunately
+this would also lead to installation of systemd's own configuration
+files to `/etc` whereas we are limited to /nix/store. To counter that
+this commit introduces two new configuration variables `factoryconfdir`
+and `factorypkgconfdir` to install systemd's own configuration into nix
+store again, while having executables looking up files in /etc.
+---
+ hwdb.d/meson.build | 2 +-
+ meson.build | 11 +++++++----
+ network/meson.build | 2 +-
+ src/core/meson.build | 10 +++++-----
+ src/coredump/meson.build | 2 +-
+ src/journal-remote/meson.build | 4 ++--
+ src/journal/meson.build | 2 +-
+ src/kernel-install/meson.build | 2 +-
+ src/login/meson.build | 2 +-
+ src/network/meson.build | 2 +-
+ src/pstore/meson.build | 2 +-
+ src/resolve/meson.build | 2 +-
+ src/timesync/meson.build | 2 +-
+ src/udev/meson.build | 4 ++--
+ sysctl.d/meson.build | 2 +-
+ tmpfiles.d/meson.build | 2 +-
+ units/meson.build | 2 +-
+ 17 files changed, 29 insertions(+), 26 deletions(-)
+
+diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build
+index 5c77387a26..6404bc01ba 100644
+--- a/hwdb.d/meson.build
++++ b/hwdb.d/meson.build
+@@ -43,7 +43,7 @@ if conf.get('ENABLE_HWDB') == 1
+ install_dir : udevhwdbdir)
+
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'udev/hwdb.d')))
+
+ meson.add_install_script('sh', '-c',
+ 'test -n "$DESTDIR" || @0@/systemd-hwdb update'
+diff --git a/meson.build b/meson.build
+index 2ef9d4d770..ae7acbd769 100644
+--- a/meson.build
++++ b/meson.build
+@@ -163,6 +163,9 @@ udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
+ catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
+ kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
+ factorydir = join_paths(datadir, 'factory')
++factoryconfdir = join_paths(datadir, 'factory/etc')
++factorypkgconfdir = join_paths(datadir, 'factory/etc/systemd')
++factoryxinitrcdir = join_paths(datadir, 'factory/etc/X11/xinit/xinitrc.d')
+ bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
+ testsdir = join_paths(prefixdir, 'lib/systemd/tests')
+ systemdstatedir = join_paths(localstatedir, 'lib/systemd')
+@@ -2653,7 +2656,7 @@ if conf.get('ENABLE_BINFMT') == 1
+ meson.add_install_script('sh', '-c',
+ mkdir_p.format(binfmtdir))
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'binfmt.d')))
+ endif
+
+ if conf.get('ENABLE_REPART') == 1
+@@ -2769,7 +2772,7 @@ executable(
+ install_dir : rootlibexecdir)
+
+ install_data('src/sleep/sleep.conf',
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ public_programs += executable(
+ 'systemd-sysctl',
+@@ -3103,7 +3106,7 @@ if conf.get('HAVE_KMOD') == 1
+ meson.add_install_script('sh', '-c',
+ mkdir_p.format(modulesloaddir))
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'modules-load.d')))
+ endif
+
+ public_programs += executable(
+@@ -3354,7 +3357,7 @@ install_subdir('factory/etc',
+ install_dir : factorydir)
+
+ install_data('xorg/50-systemd-user.sh',
+- install_dir : xinitrcdir)
++ install_dir : factoryxinitrcdir)
+ install_data('modprobe.d/systemd.conf',
+ install_dir : modprobedir)
+ install_data('LICENSE.GPL2',
+diff --git a/network/meson.build b/network/meson.build
+index 99a650eac3..8105a4e48d 100644
+--- a/network/meson.build
++++ b/network/meson.build
+@@ -11,7 +11,7 @@ if conf.get('ENABLE_NETWORKD') == 1
+ install_dir : networkdir)
+
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'systemd/network')))
++ mkdir_p.format(join_paths(factoryconfdir, 'systemd/network')))
+ endif
+
+ install_data('99-default.link',
+diff --git a/src/core/meson.build b/src/core/meson.build
+index fa95108523..60ee0e31c1 100644
+--- a/src/core/meson.build
++++ b/src/core/meson.build
+@@ -183,8 +183,8 @@ libcore = static_library(
+ systemd_sources = files('main.c')
+
+ in_files = [['macros.systemd', rpmmacrosdir],
+- ['system.conf', pkgsysconfdir],
+- ['user.conf', pkgsysconfdir],
++ ['system.conf', factorypkgconfdir],
++ ['user.conf', factorypkgconfdir],
+ ['systemd.pc', pkgconfigdatadir],
+ ['triggers.systemd', '']]
+
+@@ -216,6 +216,6 @@ meson.add_install_script('sh', '-c', mkdir_p.format(systemsleepdir))
+ meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir))
+ meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir))
+
+-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system')))
+-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user')))
+-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd')))
++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'system')))
++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'user')))
++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'xdg/systemd')))
+diff --git a/src/coredump/meson.build b/src/coredump/meson.build
+index 7fa5942697..34c865dfa0 100644
+--- a/src/coredump/meson.build
++++ b/src/coredump/meson.build
+@@ -15,7 +15,7 @@ coredumpctl_sources = files('coredumpctl.c')
+
+ if conf.get('ENABLE_COREDUMP') == 1
+ install_data('coredump.conf',
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+ endif
+
+ tests += [
+diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build
+index 87b8ba6495..daff8ec967 100644
+--- a/src/journal-remote/meson.build
++++ b/src/journal-remote/meson.build
+@@ -49,7 +49,7 @@ if conf.get('ENABLE_REMOTE') ==1 and conf.get('HAVE_LIBCURL') == 1
+ output : 'journal-upload.conf',
+ configuration : substs)
+ install_data(journal_upload_conf,
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+ endif
+
+ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
+@@ -58,7 +58,7 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
+ output : 'journal-remote.conf',
+ configuration : substs)
+ install_data(journal_remote_conf,
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ install_data('browse.html',
+ install_dir : join_paths(pkgdatadir, 'gatewayd'))
+diff --git a/src/journal/meson.build b/src/journal/meson.build
+index 5796f77cac..75d975c260 100644
+--- a/src/journal/meson.build
++++ b/src/journal/meson.build
+@@ -109,7 +109,7 @@ if conf.get('HAVE_QRENCODE') == 1
+ endif
+
+ install_data('journald.conf',
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ if get_option('create-log-dirs')
+ meson.add_install_script(
+diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build
+index 9ae342dfba..65df666337 100644
+--- a/src/kernel-install/meson.build
++++ b/src/kernel-install/meson.build
+@@ -14,5 +14,5 @@ if want_kernel_install
+ install_dir : kernelinstalldir)
+
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'kernel/install.d')))
+ endif
+diff --git a/src/login/meson.build b/src/login/meson.build
+index 0a7d3d5440..ff90149c1c 100644
+--- a/src/login/meson.build
++++ b/src/login/meson.build
+@@ -75,7 +75,7 @@ if conf.get('ENABLE_LOGIND') == 1
+ output : 'logind.conf',
+ configuration : substs)
+ install_data(logind_conf,
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ install_data('org.freedesktop.login1.conf',
+ install_dir : dbuspolicydir)
+diff --git a/src/network/meson.build b/src/network/meson.build
+index b3a88d9910..be56d1e9d7 100644
+--- a/src/network/meson.build
++++ b/src/network/meson.build
+@@ -229,7 +229,7 @@ if conf.get('ENABLE_NETWORKD') == 1
+ endif
+
+ install_data('networkd.conf',
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ fuzzers += [
+ [['src/network/fuzz-netdev-parser.c',
+diff --git a/src/pstore/meson.build b/src/pstore/meson.build
+index adbac24b54..e9dc88dfa2 100644
+--- a/src/pstore/meson.build
++++ b/src/pstore/meson.build
+@@ -6,5 +6,5 @@ systemd_pstore_sources = files('''
+
+ if conf.get('ENABLE_PSTORE') == 1
+ install_data('pstore.conf',
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+ endif
+diff --git a/src/resolve/meson.build b/src/resolve/meson.build
+index 92b67b6333..ac5b9a0b0a 100644
+--- a/src/resolve/meson.build
++++ b/src/resolve/meson.build
+@@ -168,7 +168,7 @@ if conf.get('ENABLE_RESOLVE') == 1
+ output : 'resolved.conf',
+ configuration : substs)
+ install_data(resolved_conf,
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+
+ install_data('resolv.conf',
+ install_dir : rootlibexecdir)
+diff --git a/src/timesync/meson.build b/src/timesync/meson.build
+index e5c118c8db..19235df9ca 100644
+--- a/src/timesync/meson.build
++++ b/src/timesync/meson.build
+@@ -27,7 +27,7 @@ if conf.get('ENABLE_TIMESYNCD') == 1
+ output : 'timesyncd.conf',
+ configuration : substs)
+ install_data(timesyncd_conf,
+- install_dir : pkgsysconfdir)
++ install_dir : factorypkgconfdir)
+ install_data('org.freedesktop.timesync1.conf',
+ install_dir : dbuspolicydir)
+ install_data('org.freedesktop.timesync1.service',
+diff --git a/src/udev/meson.build b/src/udev/meson.build
+index aa23b07090..ad004d803a 100644
+--- a/src/udev/meson.build
++++ b/src/udev/meson.build
+@@ -186,7 +186,7 @@ foreach prog : [['ata_id/ata_id.c'],
+ endforeach
+
+ install_data('udev.conf',
+- install_dir : join_paths(sysconfdir, 'udev'))
++ install_dir : join_paths(factoryconfdir, 'udev'))
+
+ configure_file(
+ input : 'udev.pc.in',
+@@ -195,7 +195,7 @@ configure_file(
+ install_dir : pkgconfigdatadir == 'no' ? '' : pkgconfigdatadir)
+
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'udev/rules.d')))
+
+ fuzzers += [
+ [['src/udev/net/fuzz-link-parser.c',
+diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build
+index 3f072e3db7..bd9f843eba 100644
+--- a/sysctl.d/meson.build
++++ b/sysctl.d/meson.build
+@@ -27,4 +27,4 @@ foreach file : in_files
+ endforeach
+
+ meson.add_install_script('sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'sysctl.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'sysctl.d')))
+diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build
+index 0a9582d8b9..3c56ca7d83 100644
+--- a/tmpfiles.d/meson.build
++++ b/tmpfiles.d/meson.build
+@@ -58,5 +58,5 @@ endforeach
+ if enable_tmpfiles
+ meson.add_install_script(
+ 'sh', '-c',
+- mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d')))
++ mkdir_p.format(join_paths(factoryconfdir, 'tmpfiles.d')))
+ endif
+diff --git a/units/meson.build b/units/meson.build
+index 275daad3f4..491abd8eef 100644
+--- a/units/meson.build
++++ b/units/meson.build
+@@ -324,7 +324,7 @@ install_data('user-.slice.d/10-defaults.conf',
+
+ meson.add_install_script(meson_make_symlink,
+ join_paths(pkgsysconfdir, 'user'),
+- join_paths(sysconfdir, 'xdg/systemd/user'))
++ join_paths(factorypkgconfdir, 'xdg/systemd/user'))
+ meson.add_install_script(meson_make_symlink,
+ join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'),
+ join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service'))
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch
new file mode 100644
index 000000000000..8df92b3e14f9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch
@@ -0,0 +1,42 @@
+From 4cbc82570aa8671d260c37df58688cc07106e4b6 Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <andreas@rammhold.de>
+Date: Fri, 2 Nov 2018 21:15:42 +0100
+Subject: [PATCH 13/18] inherit systemd environment when calling generators.
+
+Systemd generators need access to the environment configured in
+stage-2-init.sh since it schedules fsck and mkfs executions based on
+being able to find an appropriate binary for the target filesystem.
+
+With this commit I am altering the systemd behaviour since upstream
+tries to gather environments with that they call
+"environment-generators" and then seems to pass that on to all the other
+executables that are being called from managers.
+---
+ src/core/manager.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 6b7908fc6c..dff265c76f 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -4098,9 +4098,14 @@ static int manager_run_generators(Manager *m) {
+ argv[4] = NULL;
+
+ RUN_WITH_UMASK(0022)
+- (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, NULL, NULL,
+- (char**) argv, m->transient_environment, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
+-
++ (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC,
++ // On NixOS we must propagate PATH to generators so they are
++ // able to find binaries such as `fsck.${fstype}` and
++ // `mkfs.${fstype}`. That is why the last argument of the
++ // function (envp) is set to NULL. This propagates systemd's
++ // environment (e.g. PATH) that was setup
++ // before calling systemd from stage-2-init.sh.
++ NULL, NULL, (char**) argv, /* NixOS: use inherited env */ NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
+ r = 0;
+
+ finish:
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch
new file mode 100644
index 000000000000..bb7a9f9474f1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch
@@ -0,0 +1,38 @@
+From 1f39dba787e07d0a6944416ec172ee5d7cc86acd Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <andreas@rammhold.de>
+Date: Thu, 9 May 2019 11:15:22 +0200
+Subject: [PATCH 14/18] add rootprefix to lookup dir paths
+
+systemd does not longer use the UDEVLIBEXEC directory as root for
+discovery default udev rules. By adding `$out/lib` to the lookup paths
+we should again be able to discover the udev rules amongst other default
+files that I might have missed.
+---
+ src/basic/def.h | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/basic/def.h b/src/basic/def.h
+index 970654a1ad..bb261040f8 100644
+--- a/src/basic/def.h
++++ b/src/basic/def.h
+@@ -39,13 +39,15 @@
+ "/run/" n "\0" \
+ "/usr/local/lib/" n "\0" \
+ "/usr/lib/" n "\0" \
+- _CONF_PATHS_SPLIT_USR_NULSTR(n)
++ _CONF_PATHS_SPLIT_USR_NULSTR(n) \
++ ROOTPREFIX "/lib/" n "\0"
+
+ #define CONF_PATHS_USR(n) \
+ "/etc/" n, \
+ "/run/" n, \
+ "/usr/local/lib/" n, \
+- "/usr/lib/" n
++ "/usr/lib/" n, \
++ ROOTPREFIX "/lib/" n
+
+ #define CONF_PATHS(n) \
+ CONF_PATHS_USR(n) \
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
new file mode 100644
index 000000000000..86ab43c19085
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
@@ -0,0 +1,27 @@
+From f7c462d37063b0077345395f54377c39d1ef0590 Mon Sep 17 00:00:00 2001
+From: Nikolay Amiantov <ab@fmap.me>
+Date: Thu, 25 Jul 2019 20:45:55 +0300
+Subject: [PATCH 15/18] systemd-shutdown: execute scripts in
+ /etc/systemd/system-shutdown
+
+This is needed for NixOS to use such scripts as systemd directory is immutable.
+---
+ src/shutdown/shutdown.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
+index 06c9710c6e..dadcc3117d 100644
+--- a/src/shutdown/shutdown.c
++++ b/src/shutdown/shutdown.c
+@@ -312,7 +312,7 @@ int main(int argc, char *argv[]) {
+ _cleanup_free_ char *cgroup = NULL;
+ char *arguments[3], *watchdog_device;
+ int cmd, r, umount_log_level = LOG_INFO;
+- static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, NULL};
++ static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, "/etc/systemd/system-shutdown", NULL};
+
+ /* The log target defaults to console, but the original systemd process will pass its log target in through a
+ * command line argument, which will override this default. Also, ensure we'll never log to the journal or
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
new file mode 100644
index 000000000000..8d20b3723af0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
@@ -0,0 +1,26 @@
+From ff7cfe2d112eb166cd1937c3cc8c25491e508313 Mon Sep 17 00:00:00 2001
+From: Nikolay Amiantov <ab@fmap.me>
+Date: Thu, 25 Jul 2019 20:46:58 +0300
+Subject: [PATCH 16/18] systemd-sleep: execute scripts in
+ /etc/systemd/system-sleep
+
+This is needed for NixOS to use such scripts as systemd directory is immutable.
+---
+ src/sleep/sleep.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
+index 600e9c23c0..66ef1a99e1 100644
+--- a/src/sleep/sleep.c
++++ b/src/sleep/sleep.c
+@@ -182,6 +182,7 @@ static int execute(char **modes, char **states) {
+ };
+ static const char* const dirs[] = {
+ SYSTEM_SLEEP_PATH,
++ "/etc/systemd/system-sleep",
+ NULL
+ };
+
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
new file mode 100644
index 000000000000..6dc33fd0341a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
@@ -0,0 +1,27 @@
+From 600ac2dd3fc15c5717fcdf8f37899fdabf97268c Mon Sep 17 00:00:00 2001
+From: Florian Klink <flokli@flokli.de>
+Date: Sat, 7 Mar 2020 22:40:27 +0100
+Subject: [PATCH 17/18] kmod-static-nodes.service: Update ConditionFileNotEmpty
+
+On NixOS, kernel modules of the currently booted systems are located at
+/run/booted-system/kernel-modules/lib/modules/%v/, not /lib/modules/%v/.
+---
+ units/kmod-static-nodes.service.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
+index 0971edf9ec..87105a87b9 100644
+--- a/units/kmod-static-nodes.service.in
++++ b/units/kmod-static-nodes.service.in
+@@ -12,7 +12,7 @@ Description=Create list of static device nodes for the current kernel
+ DefaultDependencies=no
+ Before=sysinit.target systemd-tmpfiles-setup-dev.service
+ ConditionCapability=CAP_SYS_MODULE
+-ConditionFileNotEmpty=/lib/modules/%v/modules.devname
++ConditionFileNotEmpty=/run/booted-system/kernel-modules/lib/modules/%v/modules.devname
+
+ [Service]
+ Type=oneshot
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
new file mode 100644
index 000000000000..bf011f701ec6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
@@ -0,0 +1,33 @@
+From 42419ff4dc7a36607189f8d3765aa836d5c5eaf9 Mon Sep 17 00:00:00 2001
+From: Florian Klink <flokli@flokli.de>
+Date: Sun, 8 Mar 2020 01:05:54 +0100
+Subject: [PATCH 18/18] path-util.h: add placeholder for DEFAULT_PATH_NORMAL
+
+This will be the $PATH used to lookup ExecStart= etc. options, which
+systemd itself uses extensively.
+---
+ src/basic/path-util.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/basic/path-util.h b/src/basic/path-util.h
+index 30031fca8e..d97145539a 100644
+--- a/src/basic/path-util.h
++++ b/src/basic/path-util.h
+@@ -24,11 +24,11 @@
+ # define PATH_SBIN_BIN_NULSTR(x) PATH_NORMAL_SBIN_BIN_NULSTR(x)
+ #endif
+
+-#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
+-#define DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/")
++#define DEFAULT_PATH_NORMAL "@defaultPathNormal@"
++#define DEFAULT_PATH_NORMAL_NULSTR "@defaultPathNormal@\0"
+ #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
+ #define DEFAULT_PATH_SPLIT_USR_NULSTR DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/")
+-#define DEFAULT_PATH_COMPAT PATH_SPLIT_SBIN_BIN("/usr/local/") ":" PATH_SPLIT_SBIN_BIN("/usr/") ":" PATH_SPLIT_SBIN_BIN("/")
++#define DEFAULT_PATH_COMPAT DEFAULT_PATH_NORMAL
+
+ #if HAVE_SPLIT_USR
+ # define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
+--
+2.28.0
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-revert-get-rid-of-seat_can_multi_session.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-revert-get-rid-of-seat_can_multi_session.patch
new file mode 100644
index 000000000000..6ed82a42e700
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-revert-get-rid-of-seat_can_multi_session.patch
@@ -0,0 +1,13 @@
+diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
+index a91765205c..742aeb1064 100644
+--- a/src/login/logind-seat-dbus.c
++++ b/src/login/logind-seat-dbus.c
+@@ -451,7 +451,7 @@ static const sd_bus_vtable seat_vtable[] = {
+
+ SD_BUS_PROPERTY("Id", "s", NULL, offsetof(Seat, id), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("ActiveSession", "(so)", property_get_active_session, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+- SD_BUS_PROPERTY("CanMultiSession", "b", property_get_const_true, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN),
++ SD_BUS_PROPERTY("CanMultiSession", "b", property_get_const_true, 0, SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("CanTTY", "b", property_get_can_tty, 0, SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("CanGraphical", "b", property_get_can_graphical, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+ SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, 0),
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix
new file mode 100644
index 000000000000..cef9d96ae6e1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix
@@ -0,0 +1,289 @@
+{ stdenv, lib, fetchFromGitHub, pkgconfig, intltool, gperf, libcap
+, curl, kmod, gnupg, gnutar, xz, pam, acl, libuuid, m4, e2fsprogs, utillinux, libffi
+, glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libidn2, libapparmor
+, audit, lz4, bzip2, pcre2
+, linuxHeaders ? stdenv.cc.libc.linuxHeaders
+, iptables, gnu-efi, bashInteractive
+, gettext, docbook_xsl, docbook_xml_dtd_42, docbook_xml_dtd_45
+, ninja, meson, python3Packages, glibcLocales
+, patchelf
+, substituteAll
+, getent
+, cryptsetup, lvm2
+, buildPackages
+, perl
+, withSelinux ? false, libselinux
+, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp
+, withKexectools ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) kexectools.meta.platforms, kexectools
+}:
+
+let
+ version = "246.6";
+in stdenv.mkDerivation {
+ inherit version;
+ pname = "systemd";
+
+ # We use systemd/systemd-stable for src, and ship NixOS-specific patches inside nixpkgs directly
+ # This has proven to be less error-prone than the previous systemd fork.
+ src = fetchFromGitHub {
+ owner = "systemd";
+ repo = "systemd-stable";
+ rev = "v${version}";
+ sha256 = "1yhj2jlighqqpw1xk9q52f3pncjn47ipi224k35d6syb94q2b988";
+ };
+
+ # If these need to be regenerated, `git am path/to/00*.patch` them into a
+ # systemd worktree, rebase to the more recent systemd version, and export the
+ # patches again via `git format-patch v${version}`.
+ patches = [
+ ./0001-Start-device-units-for-uninitialised-encrypted-devic.patch
+ ./0002-Don-t-try-to-unmount-nix-or-nix-store.patch
+ ./0003-Fix-NixOS-containers.patch
+ ./0004-Look-for-fsck-in-the-right-place.patch
+ ./0005-Add-some-NixOS-specific-unit-directories.patch
+ ./0006-Get-rid-of-a-useless-message-in-user-sessions.patch
+ ./0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
+ ./0008-Fix-hwdb-paths.patch
+ ./0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
+ ./0010-localectl-use-etc-X11-xkb-for-list-x11.patch
+ ./0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
+ ./0012-Install-default-configuration-into-out-share-factory.patch
+ ./0013-inherit-systemd-environment-when-calling-generators.patch
+ ./0014-add-rootprefix-to-lookup-dir-paths.patch
+ ./0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
+ ./0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
+ ./0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
+ ./0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
+ ./0019-revert-get-rid-of-seat_can_multi_session.patch
+ ];
+
+ postPatch = ''
+ substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/"
+ substituteInPlace src/boot/efi/meson.build \
+ --replace \
+ "find_program('ld'" \
+ "find_program('${stdenv.cc.bintools.targetPrefix}ld'" \
+ --replace \
+ "find_program('objcopy'" \
+ "find_program('${stdenv.cc.bintools.targetPrefix}objcopy'"
+ '';
+
+ outputs = [ "out" "man" "dev" ];
+
+ nativeBuildInputs =
+ [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45
+ ninja meson
+ coreutils # meson calls date, stat etc.
+ glibcLocales
+ patchelf getent m4
+ perl # to patch the libsystemd.so and remove dependencies on aarch64
+
+ (buildPackages.python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]))
+ ];
+ buildInputs =
+ [ linuxHeaders libcap curl.dev kmod xz pam acl
+ cryptsetup libuuid glib libgcrypt libgpgerror libidn2
+ pcre2 ] ++
+ stdenv.lib.optional withKexectools kexectools ++
+ stdenv.lib.optional withLibseccomp libseccomp ++
+ [ libffi audit lz4 bzip2 libapparmor
+ iptables gnu-efi
+ ] ++ stdenv.lib.optional withSelinux libselinux;
+
+ #dontAddPrefix = true;
+
+ mesonFlags = [
+ "-Ddbuspolicydir=${placeholder "out"}/share/dbus-1/system.d"
+ "-Ddbussessionservicedir=${placeholder "out"}/share/dbus-1/services"
+ "-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services"
+ "-Dpamconfdir=${placeholder "out"}/etc/pam.d"
+ "-Drootprefix=${placeholder "out"}"
+ "-Dpkgconfiglibdir=${placeholder "dev"}/lib/pkgconfig"
+ "-Dpkgconfigdatadir=${placeholder "dev"}/share/pkgconfig"
+ "-Dloadkeys-path=${kbd}/bin/loadkeys"
+ "-Dsetfont-path=${kbd}/bin/setfont"
+ "-Dtty-gid=3" # tty in NixOS has gid 3
+ "-Ddebug-shell=${bashInteractive}/bin/bash"
+ # while we do not run tests we should also not build them. Removes about 600 targets
+ "-Dtests=false"
+ "-Dimportd=true"
+ "-Dlz4=true"
+ "-Dhomed=false"
+ "-Dhostnamed=true"
+ "-Dnetworkd=true"
+ "-Dportabled=false"
+ "-Dremote=false"
+ "-Dsysusers=false"
+ "-Dtimedated=true"
+ "-Dtimesyncd=true"
+ "-Dfirstboot=false"
+ "-Dlocaled=true"
+ "-Dresolve=true"
+ "-Dsplit-usr=false"
+ "-Dlibcurl=true"
+ "-Dlibidn=false"
+ "-Dlibidn2=true"
+ "-Dquotacheck=false"
+ "-Dldconfig=false"
+ "-Dsmack=true"
+ "-Db_pie=true"
+ /*
+ As of now, systemd doesn't allow runtime configuration of these values. So
+ the settings in /etc/login.defs have no effect on it. Many people think this
+ should be supported however, see
+ - https://github.com/systemd/systemd/issues/3855
+ - https://github.com/systemd/systemd/issues/4850
+ - https://github.com/systemd/systemd/issues/9769
+ - https://github.com/systemd/systemd/issues/9843
+ - https://github.com/systemd/systemd/issues/10184
+ */
+ "-Dsystem-uid-max=999"
+ "-Dsystem-gid-max=999"
+ # "-Dtime-epoch=1"
+
+ (if !stdenv.hostPlatform.isEfi then "-Dgnu-efi=false" else "-Dgnu-efi=true")
+ "-Defi-libdir=${toString gnu-efi}/lib"
+ "-Defi-includedir=${toString gnu-efi}/include/efi"
+ "-Defi-ldsdir=${toString gnu-efi}/lib"
+
+ "-Dsysvinit-path="
+ "-Dsysvrcnd-path="
+
+ "-Dkill-path=${coreutils}/bin/kill"
+ "-Dkmod-path=${kmod}/bin/kmod"
+ "-Dsulogin-path=${utillinux}/bin/sulogin"
+ "-Dmount-path=${utillinux}/bin/mount"
+ "-Dumount-path=${utillinux}/bin/umount"
+ "-Dcreate-log-dirs=false"
+ # Upstream uses cgroupsv2 by default. To support docker and other
+ # container managers we still need v1.
+ "-Ddefault-hierarchy=hybrid"
+ # Upstream defaulted to disable manpages since they optimize for the much
+ # more frequent development builds
+ "-Dman=true"
+ ];
+
+ preConfigure = ''
+ mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org")
+ export LC_ALL="en_US.UTF-8";
+ # FIXME: patch this in systemd properly (and send upstream).
+ # already fixed in f00929ad622c978f8ad83590a15a765b4beecac9: (u)mount
+ for i in \
+ src/core/mount.c \
+ src/core/swap.c \
+ src/cryptsetup/cryptsetup-generator.c \
+ src/fsck/fsck.c \
+ src/journal/cat.c \
+ src/nspawn/nspawn.c \
+ src/remount-fs/remount-fs.c \
+ src/shared/generator.c \
+ src/shutdown/shutdown.c \
+ units/emergency.service.in \
+ units/rescue.service.in \
+ units/systemd-logind.service.in \
+ units/systemd-nspawn@.service.in; \
+ do
+ test -e $i
+ substituteInPlace $i \
+ --replace /usr/bin/getent ${getent}/bin/getent \
+ --replace /sbin/mkswap ${lib.getBin utillinux}/sbin/mkswap \
+ --replace /sbin/swapon ${lib.getBin utillinux}/sbin/swapon \
+ --replace /sbin/swapoff ${lib.getBin utillinux}/sbin/swapoff \
+ --replace /sbin/mke2fs ${lib.getBin e2fsprogs}/sbin/mke2fs \
+ --replace /sbin/fsck ${lib.getBin utillinux}/sbin/fsck \
+ --replace /bin/echo ${coreutils}/bin/echo \
+ --replace /bin/cat ${coreutils}/bin/cat \
+ --replace /sbin/sulogin ${lib.getBin utillinux}/sbin/sulogin \
+ --replace /sbin/modprobe ${lib.getBin kmod}/sbin/modprobe \
+ --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \
+ --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency
+ done
+
+ for dir in tools src/resolve test src/test; do
+ patchShebangs $dir
+ done
+
+ # absolute paths to gpg & tar
+ substituteInPlace src/import/pull-common.c \
+ --replace '"gpg"' '"${gnupg}/bin/gpg"'
+ for file in src/import/{{export,import,pull}-tar,import-common}.c; do
+ substituteInPlace $file \
+ --replace '"tar"' '"${gnutar}/bin/tar"'
+ done
+
+ substituteInPlace src/journal/catalog.c \
+ --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
+ '';
+
+ # These defines are overridden by CFLAGS and would trigger annoying
+ # warning messages
+ postConfigure = ''
+ substituteInPlace config.h \
+ --replace "POLKIT_AGENT_BINARY_PATH" "_POLKIT_AGENT_BINARY_PATH" \
+ --replace "SYSTEMD_BINARY_PATH" "_SYSTEMD_BINARY_PATH" \
+ --replace "SYSTEMD_CGROUP_AGENT_PATH" "_SYSTEMD_CGROUP_AGENT_PATH"
+ '';
+
+ NIX_CFLAGS_COMPILE = toString [
+ # Can't say ${polkit.bin}/bin/pkttyagent here because that would
+ # lead to a cyclic dependency.
+ "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\""
+
+ # Set the release_agent on /sys/fs/cgroup/systemd to the
+ # currently running systemd (/run/current-system/systemd) so
+ # that we don't use an obsolete/garbage-collected release agent.
+ "-USYSTEMD_CGROUP_AGENT_PATH" "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\""
+
+ "-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\""
+ ];
+
+ doCheck = false; # fails a bunch of tests
+
+ # trigger the test -n "$DESTDIR" || mutate in upstreams build system
+ preInstall = ''
+ export DESTDIR=/
+ '';
+
+ postInstall = ''
+ # sysinit.target: Don't depend on
+ # systemd-tmpfiles-setup.service. This interferes with NixOps's
+ # send-keys feature (since sshd.service depends indirectly on
+ # sysinit.target).
+ mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/
+
+ mkdir -p $out/example/systemd
+ mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
+ mv $out/lib/systemd/{system,user} $out/example/systemd
+
+ rm -rf $out/etc/systemd/system
+
+ # Fix reference to /bin/false in the D-Bus services.
+ for i in $out/share/dbus-1/system-services/*.service; do
+ substituteInPlace $i --replace /bin/false ${coreutils}/bin/false
+ done
+
+ rm -rf $out/etc/rpm
+
+ # "kernel-install" shouldn't be used on NixOS.
+ find $out -name "*kernel-install*" -exec rm {} \;
+ ''; # */
+
+ enableParallelBuilding = true;
+
+ # The interface version prevents NixOS from switching to an
+ # incompatible systemd at runtime. (Switching across reboots is
+ # fine, of course.) It should be increased whenever systemd changes
+ # in a backwards-incompatible way. If the interface version of two
+ # systemd builds is the same, then we can switch between them at
+ # runtime; otherwise we can't and we need to reboot.
+ passthru.interfaceVersion = 2;
+
+ meta = with stdenv.lib; {
+ homepage = "https://www.freedesktop.org/wiki/Software/systemd/";
+ description = "A system and service manager for Linux";
+ license = licenses.lgpl21Plus;
+ platforms = platforms.linux;
+ priority = 10;
+ maintainers = with maintainers; [ andir eelco flokli ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysvinit/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysvinit/default.nix
new file mode 100644
index 000000000000..5d081f2db825
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/sysvinit/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, withoutInitTools ? false }:
+
+let version = "2.97"; in
+
+stdenv.mkDerivation {
+ name = (if withoutInitTools then "sysvtools" else "sysvinit") + "-" + version;
+
+ src = fetchurl {
+ url = "mirror://savannah/sysvinit/sysvinit-${version}.tar.xz";
+ sha256 = "042iyayyh3j28vfbypzn822b73r3nfmyn79f9mixigqrfn2rcn9d";
+ };
+
+ prePatch = ''
+ # Patch some minimal hard references, so halt/shutdown work
+ sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h
+ '';
+
+ makeFlags = [ "SULOGINLIBS=-lcrypt" "ROOT=$(out)" "MANDIR=/share/man" ];
+
+ preInstall =
+ ''
+ substituteInPlace src/Makefile --replace /usr /
+ '';
+
+ postInstall = ''
+ mv $out/sbin/killall5 $out/bin
+ ln -sf killall5 $out/bin/pidof
+ ''
+ + stdenv.lib.optionalString withoutInitTools
+ ''
+ shopt -s extglob
+ rm -rf $out/sbin/!(sulogin)
+ rm -rf $out/include
+ rm -rf $out/share/man/man5
+ rm $(for i in $out/share/man/man8/*; do echo $i; done | grep -v 'pidof\|killall5')
+ rm $out/bin/wall $out/share/man/man1/wall.1
+ '';
+
+ meta = {
+ homepage = "https://www.nongnu.org/sysvinit/";
+ description = "Utilities related to booting and shutdown";
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/targetcli/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/targetcli/default.nix
new file mode 100644
index 000000000000..94920c4012a4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/targetcli/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, python3, fetchFromGitHub }:
+
+python3.pkgs.buildPythonApplication rec {
+ pname = "targetcli";
+ version = "2.1.53";
+
+ src = fetchFromGitHub {
+ owner = "open-iscsi";
+ repo = "${pname}-fb";
+ rev = "v${version}";
+ sha256 = "1qrq7y5hnghzbxgrxgl153n8jlhw31kqjbr93jsvlvhz5b3ci750";
+ };
+
+ propagatedBuildInputs = with python3.pkgs; [ configshell rtslib ];
+
+ postInstall = ''
+ install -D targetcli.8 -t $out/share/man/man8/
+ install -D targetclid.8 -t $out/share/man/man8/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A command shell for managing the Linux LIO kernel target";
+ homepage = "https://github.com/open-iscsi/targetcli-fb";
+ license = licenses.asl20;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tbs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
new file mode 100644
index 000000000000..6502cc9c38e0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, lib, fetchFromGitHub, kernel, kmod, perl, patchutils, perlPackages }:
+let
+
+ media = fetchFromGitHub rec {
+ name = repo;
+ owner = "tbsdtv";
+ repo = "linux_media";
+ rev = "efe31531b77efd3a4c94516504a5823d31cdc776";
+ sha256 = "1533qi3sb91v00289hl5zaj4l35r2sf9fqc6z5ky1vbb7byxgnlr";
+ };
+
+ build = fetchFromGitHub rec {
+ name = repo;
+ owner = "tbsdtv";
+ repo = "media_build";
+ rev = "a0d62eba4d429e0e9d2c2f910fb203e817cac84b";
+ sha256 = "1329s7w9xlqjqwkpaqsd6b5dmzhm97jw0c7c7zzmmbdkl289i4i4";
+ };
+
+in stdenv.mkDerivation {
+ name = "tbs-2018.04.18-${kernel.version}";
+
+ srcs = [ media build ];
+ sourceRoot = build.name;
+
+ preConfigure = ''
+ make dir DIR=../${media.name}
+ '';
+
+ postPatch = ''
+ patchShebangs .
+
+ sed -i v4l/Makefile \
+ -i v4l/scripts/make_makefile.pl \
+ -e 's,/sbin/depmod,${kmod}/bin/depmod,g' \
+ -e 's,/sbin/lsmod,${kmod}/bin/lsmod,g'
+
+ sed -i v4l/Makefile \
+ -e 's,^OUTDIR ?= /lib/modules,OUTDIR ?= ${kernel.dev}/lib/modules,' \
+ -e 's,^SRCDIR ?= /lib/modules,SRCDIR ?= ${kernel.dev}/lib/modules,'
+ '';
+
+ buildFlags = [ "VER=${kernel.modDirVersion}" ];
+ installFlags = [ "DESTDIR=$(out)" ];
+
+ hardeningDisable = [ "all" ];
+
+ nativeBuildInputs = [ patchutils kmod perl perlPackages.ProcProcessTable ]
+ ++ kernel.moduleBuildDependencies;
+
+ postInstall = ''
+ find $out/lib/modules/${kernel.modDirVersion} -name "*.ko" -exec xz {} \;
+ '';
+
+ meta = with lib; {
+ homepage = "https://www.tbsdtv.com/";
+ description = "Linux driver for TBSDTV cards";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ ck3d ];
+ priority = -1;
+ broken = stdenv.lib.versionAtLeast kernel.version "4.18";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/cdecls.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/cdecls.patch
new file mode 100644
index 000000000000..eee640e8a824
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/cdecls.patch
@@ -0,0 +1,31 @@
+__BEGIN_DECLS/__END_DECLS are BSD specific and not defined in musl
+glibc and uclibc had sys/cdefs.h doing it.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: tcp_wrappers_7.6/tcpd.h
+===================================================================
+--- tcp_wrappers_7.6.orig/tcpd.h
++++ tcp_wrappers_7.6/tcpd.h
+@@ -11,7 +11,9 @@
+ #include <netinet/in.h>
+ #include <stdio.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /* Structure to describe one communications endpoint. */
+
+@@ -252,6 +254,8 @@ extern char *fix_strtok();
+ extern char *my_strtok();
+ #endif
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/default.nix
new file mode 100644
index 000000000000..b3d59cf5a6ab
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/default.nix
@@ -0,0 +1,75 @@
+{ fetchurl, stdenv, libnsl }:
+
+let
+ vanillaVersion = "7.6.q";
+ patchLevel = "26";
+in stdenv.mkDerivation rec {
+ pname = "tcp-wrappers";
+ version = "${vanillaVersion}-${patchLevel}";
+
+ src = fetchurl {
+ url = "mirror://debian/pool/main/t/tcp-wrappers/tcp-wrappers_${vanillaVersion}.orig.tar.gz";
+ sha256 = "0p9ilj4v96q32klavx0phw9va21fjp8vpk11nbh6v2ppxnnxfhwm";
+ };
+
+ debian = fetchurl {
+ url = "mirror://debian/pool/main/t/tcp-wrappers/tcp-wrappers_${version}.debian.tar.xz";
+ sha256 = "1dcdhi9lwzv7g19ggwxms2msq9fy14rl09rjqb10hwv0jix7z8j8";
+ };
+
+ prePatch = ''
+ tar -xaf $debian
+ patches="$(cat debian/patches/series | sed 's,^,debian/patches/,') $patches"
+
+ substituteInPlace Makefile --replace STRINGS STRINGDEFS
+ substituteInPlace debian/patches/13_shlib_weaksym --replace STRINGS STRINGDEFS
+ '';
+
+ # Fix __BEGIN_DECLS usage (even if it wasn't non-standard, this doesn't include sys/cdefs.h)
+ patches = [ ./cdecls.patch ];
+
+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ substituteInPlace Makefile \
+ --replace '-DNETGROUP' '-DUSE_GETDOMAIN'
+ '';
+
+ buildInputs = [ libnsl ];
+
+ makeFlags = [ "REAL_DAEMON_DIR=$(out)/bin" "linux" "AR:=$(AR)" ];
+
+ installPhase = ''
+ mkdir -p "$out/bin"
+ cp -v safe_finger tcpd tcpdchk tcpdmatch try-from "$out/bin"
+
+ mkdir -p "$out/lib"
+ cp -v shared/lib*.so* "$out/lib"
+
+ mkdir -p "$out/include"
+ cp -v *.h "$out/include"
+
+ for i in 3 5 8;
+ do
+ mkdir -p "$out/man/man$i"
+ cp *.$i "$out/man/man$i" ;
+ done
+ '';
+
+ meta = {
+ description = "TCP Wrappers, a network logger, also known as TCPD or LOG_TCP";
+
+ longDescription = ''
+ Wietse Venema's network logger, also known as TCPD or LOG_TCP.
+ These programs log the client host name of incoming telnet, ftp,
+ rsh, rlogin, finger etc. requests. Security options are: access
+ control per host, domain and/or service; detection of host name
+ spoofing or host address spoofing; booby traps to implement an
+ early-warning system. The current version supports the System
+ V.4 TLI network programming interface (Solaris, DG/UX) in
+ addition to the traditional BSD sockets.
+ '';
+
+ homepage = "ftp://ftp.porcupine.org/pub/security/index.html";
+ license = "BSD-style";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/tcp-wrappers-7.6-headers.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/tcp-wrappers-7.6-headers.patch
new file mode 100644
index 000000000000..328a4a102618
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tcp-wrappers/tcp-wrappers-7.6-headers.patch
@@ -0,0 +1,295 @@
+--- a/options.c
++++ b/options.c
+@@ -34,6 +34,8 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+--- a/safe_finger.c
++++ b/safe_finger.c
+@@ -20,6 +20,11 @@
+
+ /* System libraries */
+
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdlib.h>
++#include <sys/wait.h>
++#include <grp.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <signal.h>
+@@ -27,7 +31,7 @@
+ #include <ctype.h>
+ #include <pwd.h>
+
+-extern void exit();
++int pipe_stdin(char **argv);
+
+ /* Local stuff */
+
+--- a/scaffold.c
++++ b/scaffold.c
+@@ -10,6 +10,7 @@
+
+ /* System libraries. */
+
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+@@ -27,7 +27,4 @@
+ #endif
+
+-#ifndef INET6
+-extern char *malloc();
+-#endif
+
+ /* Application-specific. */
+--- a/shell_cmd.c
++++ b/shell_cmd.c
+@@ -14,6 +14,10 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
++#include <stdlib.h>
++#include <fcntl.h>
++#include <sys/wait.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <signal.h>
+@@ -25,8 +25,6 @@
+ #include <syslog.h>
+ #include <string.h>
+
+-extern void exit();
+-
+ /* Local stuff. */
+
+ #include "tcpd.h"
+--- a/tcpdchk.c
++++ b/tcpdchk.c
+@@ -20,6 +20,8 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifdef INET6
+@@ -35,10 +36,7 @@
+ #include <netdb.h>
+ #include <string.h>
+
+-extern int errno;
+-extern void exit();
+-extern int optind;
+-extern char *optarg;
++int cidr_mask_addr(char *str);
+
+ #ifndef INADDR_NONE
+ #define INADDR_NONE (-1) /* XXX should be 0xffffffff */
+--- a/clean_exit.c
++++ b/clean_exit.c
+@@ -13,8 +13,8 @@
+ #endif
+
+ #include <stdio.h>
+-
+-extern void exit();
++#include <unistd.h>
++#include <stdlib.h>
+
+ #include "tcpd.h"
+
+--- a/hosts_access.c
++++ b/hosts_access.c
+@@ -23,6 +23,7 @@
+
+ /* System libraries. */
+
++#include <stdlib.h>
+ #include <sys/types.h>
+ #ifdef INT32_T
+ typedef uint32_t u_int32_t;
+@@ -43,8 +44,8 @@
+ #include <netdb.h>
+ #endif
+
+-extern char *fgets();
+-extern int errno;
++static int match_pattern_ylo(const char *s, const char *pattern);
++int cidr_mask_addr(char *str);
+
+ #ifndef INADDR_NONE
+ #define INADDR_NONE (-1) /* XXX should be 0xffffffff */
+--- a/inetcf.c
++++ b/inetcf.c
+@@ -9,15 +9,14 @@
+ static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:13:23";
+ #endif
+
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <stdio.h>
+ #include <errno.h>
+ #include <string.h>
+
+-extern int errno;
+-extern void exit();
+-
++#include "scaffold.h"
+ #include "tcpd.h"
+ #include "inetcf.h"
+
+--- a/percent_x.c
++++ b/percent_x.c
+@@ -16,12 +16,12 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
++#include <stdlib.h>
+ #include <stdio.h>
+ #include <syslog.h>
+ #include <string.h>
+
+-extern void exit();
+-
+ /* Local stuff. */
+
+ #include "tcpd.h"
+--- a/rfc931.c
++++ b/rfc931.c
+@@ -15,6 +15,7 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
+ #include <stdio.h>
+ #include <syslog.h>
+ #include <sys/types.h>
+--- a/tcpd.c
++++ b/tcpd.c
+@@ -16,6 +16,7 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+@@ -39,6 +39,8 @@
+ #include "patchlevel.h"
+ #include "tcpd.h"
+
++void fix_options(struct request_info *request);
++
+ int allow_severity = SEVERITY; /* run-time adjustable */
+ int deny_severity = LOG_WARNING; /* ditto */
+
+--- a/tcpdmatch.c
++++ b/tcpdmatch.c
+@@ -19,6 +19,8 @@
+
+ /* System libraries. */
+
++#include <unistd.h>
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+@@ -30,9 +32,6 @@
+ #include <setjmp.h>
+ #include <string.h>
+
+-extern void exit();
+-extern int optind;
+-extern char *optarg;
+
+ #ifndef INADDR_NONE
+ #define INADDR_NONE (-1) /* XXX should be 0xffffffff */
+--- a/update.c
++++ b/update.c
+@@ -19,6 +19,7 @@
+
+ /* System libraries */
+
++#include <unistd.h>
+ #include <stdio.h>
+ #include <syslog.h>
+ #include <string.h>
+--- a/misc.c
++++ b/misc.c
+@@ -14,11 +14,10 @@
+ #include <arpa/inet.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <stdlib.h>
+
+ #include "tcpd.h"
+
+-extern char *fgets();
+-
+ #ifndef INADDR_NONE
+ #define INADDR_NONE (-1) /* XXX should be 0xffffffff */
+ #endif
+--- a/fix_options.c
++++ b/fix_options.c
+@@ -32,6 +32,7 @@
+
+ /* fix_options - get rid of IP-level socket options */
+
++void
+ fix_options(request)
+ struct request_info *request;
+ {
+@@ -38,11 +38,8 @@
+ #ifdef IP_OPTIONS
+ unsigned char optbuf[BUFFER_SIZE / 3], *cp;
+ char lbuf[BUFFER_SIZE], *lp;
+-#ifdef __GLIBC__
+- size_t optsize = sizeof(optbuf), ipproto;
+-#else
+- int optsize = sizeof(optbuf), ipproto;
+-#endif
++ socklen_t optsize = sizeof(optbuf);
++ int ipproto;
+ struct protoent *ip;
+ int fd = request->fd;
+ unsigned int opt;
+--- a/socket.c
++++ b/socket.c
+@@ -95,11 +95,7 @@
+ static struct sockaddr_in client;
+ static struct sockaddr_in server;
+ #endif
+-#ifdef __GLIBC__
+- size_t len;
+-#else
+- int len;
+-#endif
++ socklen_t len;
+ char buf[BUFSIZ];
+ int fd = request->fd;
+
+@@ -430,11 +426,7 @@
+ #else
+ struct sockaddr_in sin;
+ #endif
+-#ifdef __GLIBC__
+- size_t size = sizeof(sin);
+-#else
+- int size = sizeof(sin);
+-#endif
++ socklen_t size;
+
+ /*
+ * Eat up the not-yet received datagram. Some systems insist on a
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/thunderbolt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/thunderbolt/default.nix
new file mode 100644
index 000000000000..d9817a6c04b6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/thunderbolt/default.nix
@@ -0,0 +1,34 @@
+{ stdenv
+, boost
+, cmake
+, fetchFromGitHub
+, pkgconfig
+, txt2tags
+}:
+
+stdenv.mkDerivation rec {
+ pname = "thunderbolt";
+ version = "0.9.3";
+ src = fetchFromGitHub {
+ owner = "01org";
+ repo = "thunderbolt-software-user-space";
+ rev = "v${version}";
+ sha256 = "02w1bfm7xvq0dzkhwqiq0camkzz9kvciyhnsis61c8vzp39cwx0x";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig txt2tags ];
+ buildInputs = [ boost ];
+
+ cmakeFlags = [
+ "-DUDEV_BIN_DIR=${placeholder "out"}/bin"
+ "-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
+ ];
+
+ meta = {
+ description = "Thunderbolt(TM) user-space components";
+ license = stdenv.lib.licenses.bsd3;
+ maintainers = [ stdenv.lib.maintainers.ryantrinkle ];
+ homepage = "https://01.org/thunderbolt-sw";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiptop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiptop/default.nix
new file mode 100644
index 000000000000..03db9e3bb0ee
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiptop/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, fetchpatch, libxml2, ncurses, bison, flex }:
+
+stdenv.mkDerivation rec {
+ pname = "tiptop";
+ version = "2.3.1";
+
+ src = fetchurl {
+ url = "${meta.homepage}/releases/${pname}-${version}.tar.gz";
+ sha256 = "10j1138y3cj3hsmfz4w0bmk90523b0prqwi9nhb4z8xvjnf49i2i";
+ };
+
+ patches = [(fetchpatch {
+ name = "reproducibility.patch";
+ url = "https://salsa.debian.org/debian/tiptop/raw/debian/2.3.1-1/debian/patches/0001-fix-reproducibility-of-build-process.patch";
+ sha256 = "116l7n3nl9lj691i7j8x0d0za1i6zpqgghw5d70qfpb17c04cblp";
+ })];
+
+ postPatch = ''
+ substituteInPlace ./configure --replace -lcurses -lncurses
+ '';
+
+ nativeBuildInputs = [ flex bison ];
+ buildInputs = [ libxml2 ncurses ];
+
+ NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
+
+ meta = with stdenv.lib; {
+ description = "Performance monitoring tool for Linux";
+ homepage = "http://tiptop.gforge.inria.fr";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.vcunat ];
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiscamera/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiscamera/default.nix
new file mode 100644
index 000000000000..f9196fc16864
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tiscamera/default.nix
@@ -0,0 +1,86 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, pkg-config
+, pcre
+, tinyxml
+, libusb1
+, libzip
+, glib
+, gobject-introspection
+, gst_all_1
+, libwebcam
+, libunwind
+, elfutils
+, orc
+, python3
+, libuuid
+}:
+
+stdenv.mkDerivation rec {
+ pname = "tiscamera";
+ version = "0.11.1";
+
+ src = fetchFromGitHub {
+ owner = "TheImagingSource";
+ repo = pname;
+ rev = "v-${pname}-${version}";
+ sha256 = "07vp6khgl6qd3a4519dmx1s5bfw7pld793p50pjn29fqh91fm93g";
+ };
+
+ nativeBuildInputs = [
+ cmake
+ pkg-config
+ ];
+
+ buildInputs = [
+ pcre
+ tinyxml
+ libusb1
+ libzip
+ glib
+ gobject-introspection
+ gst_all_1.gstreamer
+ gst_all_1.gst-plugins-base
+ libwebcam
+ libunwind
+ elfutils
+ orc
+ python3
+ libuuid
+ ];
+
+ cmakeFlags = [
+ "-DBUILD_ARAVIS=OFF" # For GigE support. Won't need it as our camera is usb.
+ "-DBUILD_GST_1_0=ON"
+ "-DBUILD_TOOLS=ON"
+ "-DBUILD_V4L2=ON"
+ "-DBUILD_LIBUSB=ON"
+ "-DTCAM_INSTALL_UDEV=${placeholder "out"}/lib/udev/rules.d"
+ "-DTCAM_INSTALL_UVCDYNCTRL=${placeholder "out"}/share/uvcdynctrl/data/199e"
+ "-DTCAM_INSTALL_GST_1_0=${placeholder "out"}/lib/gstreamer-1.0"
+ "-DTCAM_INSTALL_GIR=${placeholder "out"}/share/gir-1.0"
+ "-DTCAM_INSTALL_TYPELIB=${placeholder "out"}/lib/girepository-1.0"
+ "-DTCAM_INSTALL_SYSTEMD=${placeholder "out"}/etc/systemd/system"
+ # There are gobject introspection commands launched as part of the build. Those have a runtime
+ # dependency on `libtcam` (which itself is built as part of this build). In order to allow
+ # that, we set the dynamic linker's path to point on the build time location of the library.
+ "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+ ];
+
+ postPatch = ''
+ substituteInPlace ./src/BackendLoader.cpp \
+ --replace '"libtcam-v4l2.so"' "\"$out/lib/tcam-0/libtcam-v4l2.so\"" \
+ --replace '"libtcam-aravis.so"' "\"$out/lib/tcam-0/libtcam-aravis.so\"" \
+ --replace '"libtcam-libusb.so"' "\"$out/lib/tcam-0/libtcam-libusb.so\""
+ '';
+
+ meta = with lib; {
+ description = "The Linux sources and UVC firmwares for The Imaging Source cameras";
+ homepage = "https://github.com/TheImagingSource/tiscamera";
+ license = with licenses; [ asl20 ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ jraygauthier ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tmon/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tmon/default.nix
new file mode 100644
index 000000000000..f8438f8d40f0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tmon/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, kernel, ncurses }:
+
+stdenv.mkDerivation {
+ name = "tmon-${kernel.version}";
+
+ inherit (kernel) src;
+
+ buildInputs = [ ncurses ];
+
+ configurePhase = ''
+ cd tools/thermal/tmon
+ '';
+
+ makeFlags = kernel.makeFlags ++ [ "INSTALL_ROOT=\"$(out)\"" "BINDIR=bin" ];
+ NIX_CFLAGS_LINK = "-lgcc_s";
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Monitoring and Testing Tool for Linux kernel thermal subsystem";
+ homepage = "https://www.kernel.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tomb/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tomb/default.nix
new file mode 100644
index 000000000000..150c64a04514
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tomb/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper
+, gettext, zsh, pinentry, cryptsetup, gnupg, utillinux, e2fsprogs, sudo
+}:
+
+stdenv.mkDerivation rec {
+ pname = "tomb";
+ version = "2.7";
+
+ src = fetchFromGitHub {
+ owner = "dyne";
+ repo = "Tomb";
+ rev = "v${version}";
+ sha256 = "1vzkpzci6cp1r1q2n34pcgcns78i726k8d89dd6pibyj0vfnkl57";
+ };
+
+ buildInputs = [ sudo zsh pinentry ];
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ postPatch = ''
+ # if not, it shows .tomb-wrapped when running
+ substituteInPlace tomb \
+ --replace 'TOMBEXEC=$0' 'TOMBEXEC=tomb'
+ '';
+
+ doInstallCheck = true;
+ installCheckPhase = "$out/bin/tomb -h";
+
+ installPhase = ''
+ install -Dm755 tomb $out/bin/tomb
+ install -Dm644 doc/tomb.1 $out/share/man/man1/tomb.1
+
+ wrapProgram $out/bin/tomb \
+ --prefix PATH : $out/bin:${lib.makeBinPath [ cryptsetup gettext gnupg pinentry utillinux e2fsprogs ]}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "File encryption on GNU/Linux";
+ homepage = "https://www.dyne.org/software/tomb/";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ peterhoeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/default.nix
new file mode 100644
index 000000000000..5e0e9c539ea3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, lib, fetchFromGitHub, kernel, writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts, runtimeShell
+}:
+
+stdenv.mkDerivation rec {
+ name = "tp_smapi-${version}-${kernel.version}";
+ version = "0.43";
+
+ src = fetchFromGitHub {
+ owner = "evgeni";
+ repo = "tp_smapi";
+ rev = "tp-smapi/${version}";
+ sha256 = "1rjb0njckczc2mj05cagvj0lkyvmyk6bw7wkiinv81lw8m90g77g";
+ name = "tp-smapi-${version}";
+ };
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ hardeningDisable = [ "pic" ];
+
+ makeFlags = [
+ "KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
+ "SHELL=${stdenv.shell}"
+ "HDAPS=1"
+ ];
+
+ installPhase = ''
+ install -v -D -m 644 thinkpad_ec.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/thinkpad_ec.ko"
+ install -v -D -m 644 tp_smapi.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/tp_smapi.ko"
+ install -v -D -m 644 hdaps.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/hdapsd.ko"
+ '';
+
+ dontStrip = true;
+
+ enableParallelBuilding = true;
+
+ passthru.updateScript = import ./update.nix {
+ inherit lib writeScript coreutils gnugrep jq curl common-updater-scripts runtimeShell;
+ };
+
+ meta = {
+ description = "IBM ThinkPad hardware functions driver";
+ homepage = "https://github.com/evgeni/tp_smapi";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ ];
+ # driver is only ment for linux thinkpads i think bellow platforms should cover it.
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/update.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/update.nix
new file mode 100644
index 000000000000..65b557e45457
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tp_smapi/update.nix
@@ -0,0 +1,11 @@
+{ lib, writeScript, coreutils, curl, gnugrep, jq, common-updater-scripts, runtimeShell }:
+
+writeScript "update-tp_smapi" ''
+#!${runtimeShell}
+PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep jq ]}
+
+tags=`curl -s https://api.github.com/repos/evgeni/tp_smapi/tags`
+latest_tag=`echo $tags | jq -r '.[] | .name' | grep -oP "^tp-smapi/\K.*" | sort --version-sort | tail -1`
+
+update-source-version linuxPackages.tp_smapi "$latest_tag"
+''
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tpacpi-bat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tpacpi-bat/default.nix
new file mode 100644
index 000000000000..bb6d51669e6e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tpacpi-bat/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, perl, kmod, coreutils }:
+
+# Requires the acpi_call kernel module in order to run.
+stdenv.mkDerivation rec {
+ pname = "tpacpi-bat";
+ version = "3.1";
+
+ src = fetchFromGitHub {
+ owner = "teleshoes";
+ repo = "tpacpi-bat";
+ rev = "v${version}";
+ sha256 = "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5";
+ };
+
+ buildInputs = [ perl ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp tpacpi-bat $out/bin
+ '';
+
+ postPatch = ''
+ substituteInPlace tpacpi-bat \
+ --replace modprobe ${kmod}/bin/modprobe \
+ --replace cat ${coreutils}/bin/cat
+ '';
+
+ meta = {
+ maintainers = [stdenv.lib.maintainers.orbekk];
+ platforms = stdenv.lib.platforms.linux;
+ description = "Tool to set battery charging thesholds on Lenovo Thinkpad";
+ license = stdenv.lib.licenses.gpl3Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/default.nix
new file mode 100644
index 000000000000..a80635c53cef
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchgit, asciidoc, docbook_xsl, libxslt }:
+stdenv.mkDerivation {
+ pname = "trace-cmd";
+ version = "2.9-dev";
+
+ src = fetchgit (import ./src.nix);
+
+ patches = [ ./fix-Makefiles.patch ];
+
+ nativeBuildInputs = [ asciidoc libxslt ];
+
+ outputs = [ "out" "lib" "dev" "man" ];
+
+ MANPAGE_DOCBOOK_XSL="${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl";
+
+ dontConfigure = true;
+
+ buildPhase = "make trace-cmd libs doc";
+
+ installTargets = [ "install_cmd" "install_libs" "install_doc" ];
+ installFlags = [
+ "bindir=${placeholder "out"}/bin"
+ "man_dir=${placeholder "man"}/share/man"
+ "libdir=${placeholder "lib"}/lib"
+ "includedir=${placeholder "dev"}/include"
+ "BASH_COMPLETE_DIR=${placeholder "out"}/etc/bash_completion.d"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "User-space tools for the Linux kernel ftrace subsystem";
+ homepage = "https://kernelshark.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ thoughtpolice basvandijk ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch
new file mode 100644
index 000000000000..db194e16fdb6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/fix-Makefiles.patch
@@ -0,0 +1,35 @@
+diff --git a/Makefile b/Makefile
+index bbdf15e..deb8ef7 100644
+--- a/Makefile
++++ b/Makefile
+@@ -288,7 +288,7 @@ libtraceevent.a: $(LIBTRACEEVENT_STATIC)
+ libtracecmd.a: $(LIBTRACECMD_STATIC)
+ libtracecmd.so: $(LIBTRACECMD_SHARED)
+
+-libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED)
++libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC)
+
+ plugins: force $(obj)/lib/traceevent/plugins/traceevent_plugin_dir $(obj)/lib/traceevent/plugins/trace_python_dir
+ $(Q)$(MAKE) -C $(src)/lib/traceevent/plugins
+@@ -344,6 +344,8 @@ install_gui: install_cmd gui
+ install_libs: libs
+ $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
+ $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent)
++ $(Q)$(call do_install,$(LIBTRACECMD_STATIC),$(libdir_SQ)/trace-cmd)
++ $(Q)$(call do_install,$(LIBTRACEEVENT_STATIC),$(libdir_SQ)/traceevent)
+ $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent)
+ $(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
+ $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
+diff --git a/kernel-shark/src/CMakeLists.txt b/kernel-shark/src/CMakeLists.txt
+index e20a030..7fce165 100644
+--- a/kernel-shark/src/CMakeLists.txt
++++ b/kernel-shark/src/CMakeLists.txt
+@@ -93,7 +93,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
+ DESTINATION ${_INSTALL_PREFIX}/share/icons/${KS_APP_NAME})
+
+ install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
+- DESTINATION /usr/share/polkit-1/actions/)
++ DESTINATION ${_INSTALL_PREFIX}/share/polkit-1/actions/)
+
+ install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
+ DESTINATION ${_INSTALL_PREFIX}/bin/)
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/kernelshark.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/kernelshark.nix
new file mode 100644
index 000000000000..3a280b8af0be
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/kernelshark.nix
@@ -0,0 +1,40 @@
+{ stdenv, mkDerivation, fetchgit, qtbase, cmake, asciidoc, docbook_xsl, json_c, mesa_glu, freeglut, trace-cmd, pkg-config }:
+mkDerivation {
+ pname = "kernelshark";
+ version = "1.1.0";
+
+ src = fetchgit (import ./src.nix);
+
+ patches = [ ./fix-Makefiles.patch ];
+
+ outputs = [ "out" "doc" ];
+
+ preConfigure = "pushd kernel-shark";
+
+ nativeBuildInputs = [ pkg-config cmake asciidoc ];
+
+ buildInputs = [ qtbase json_c mesa_glu freeglut ];
+
+ cmakeFlags = [
+ "-D_INSTALL_PREFIX=${placeholder "out"}"
+ "-DTRACECMD_BIN_DIR=${trace-cmd}/bin"
+ "-DTRACECMD_INCLUDE_DIR=${trace-cmd.dev}/include"
+ "-DTRACECMD_LIBRARY=${trace-cmd.lib}/lib/trace-cmd/libtracecmd.a"
+ "-DTRACEEVENT_LIBRARY=${trace-cmd.lib}/lib/traceevent/libtraceevent.a"
+ ];
+
+ preInstall = ''
+ popd
+ make install_doc_gui prefix=$doc \
+ FIND_MANPAGE_DOCBOOK_XSL=${docbook_xsl}/share/xml/docbook-xsl-nons/manpages/docbook.xsl
+ pushd kernel-shark/build
+ '';
+
+ meta = with stdenv.lib; {
+ description = "GUI for trace-cmd which is an interface for the Linux kernel ftrace subsystem";
+ homepage = "https://kernelshark.org/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ basvandijk ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/src.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/src.nix
new file mode 100644
index 000000000000..47c1b82fdd46
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trace-cmd/src.nix
@@ -0,0 +1,5 @@
+{
+ url = "git://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/";
+ rev = "ab370b78b9278fe16657742d46cb95c0a65b47d5"; # branch: kernelshark-v1.1
+ sha256 = "0qngwc4qgadrkwlwpz73f12prdkx94kl0bg7g9hib95ipvsdmk1c";
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trezor-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trezor-udev-rules/default.nix
new file mode 100644
index 000000000000..c2be81373768
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trezor-udev-rules/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "trezor-udev-rules";
+ version = "unstable-2019-07-17";
+
+ udevRules = fetchurl {
+ # let's pin the latest commit in the repo which touched the udev rules file
+ url = "https://raw.githubusercontent.com/trezor/trezor-firmware/68a3094b0a8e36b588b1bcb58c34a2c9eafc0dca/common/udev/51-trezor.rules";
+ sha256 = "0vlxif89nsqpbnbz1vwfgpl1zayzmq87gw1snskn0qns6x2rpczk";
+ };
+
+ dontUnpack = true;
+
+ installPhase = ''
+ cp ${udevRules} 51-trezor.rules
+ mkdir -p $out/lib/udev/rules.d
+ # we use trezord group, not plugdev
+ # we don't need the udev-acl tag
+ substituteInPlace 51-trezor.rules \
+ --replace 'GROUP="plugdev"' 'GROUP="trezord"' \
+ --replace ', TAG+="udev-acl"' ""
+ cp 51-trezor.rules $out/lib/udev/rules.d/51-trezor.rules
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Udev rules for Trezor";
+ license = licenses.gpl3;
+ maintainers = with maintainers; [ prusnak ];
+ platforms = platforms.linux;
+ homepage = "https://github.com/trezor/trezor-firmware/tree/master/common/udev";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trinity/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trinity/default.nix
new file mode 100644
index 000000000000..6d9848ab7126
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/trinity/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ pname = "trinity";
+ version = "1.9";
+
+ src = fetchFromGitHub {
+ owner = "kernelslacker";
+ repo = "trinity";
+ rev = "v${version}";
+ sha256 = "0z1a7x727xacam74jccd223k303sllgwpq30lnq9b6xxy8b659bv";
+ };
+
+ postPatch = ''
+ patchShebangs configure
+ patchShebangs scripts
+ '';
+
+ enableParallelBuilding = true;
+
+ makeFlags = [ "DESTDIR=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "A Linux System call fuzz tester";
+ homepage = "https://codemonkey.org.uk/projects/trinity/";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.dezgeg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix
new file mode 100644
index 000000000000..c20c3e98f558
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+ name = "tunctl-1.5";
+ src = fetchurl {
+ url = "mirror://sourceforge/tunctl/tunctl-1.5.tar.gz";
+ sha256 = "aa2a6c4cc6bfacb11e0d9f62334a6638a0d435475c61230116f00b6af8b14fff";
+ };
+
+ makeFlags = [ "tunctl" ];
+ installPhase = ''
+ mkdir -p $out/bin
+ cp tunctl $out/bin
+ '';
+
+ meta = {
+ homepage = "http://tunctl.sourceforge.net/";
+ description = "Utility to set up and maintain TUN/TAP network interfaces";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/turbostat/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/turbostat/default.nix
new file mode 100644
index 000000000000..035dddcc4ec0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/turbostat/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, kernel, libcap }:
+
+stdenv.mkDerivation {
+ pname = "turbostat";
+ inherit (kernel) src version;
+
+ buildInputs = [ libcap ];
+ makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+ postPatch = ''
+ cd tools/power/x86/turbostat
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Report processor frequency and idle statistics";
+ homepage = "https://www.kernel.org/";
+ license = licenses.gpl2;
+ platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
+ };
+}
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tuxedo-keyboard/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tuxedo-keyboard/default.nix
new file mode 100644
index 000000000000..b67bf2d3dab6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/tuxedo-keyboard/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, kernel, kmod }:
+
+stdenv.mkDerivation rec {
+ pname = "tuxedo-keyboard-${kernel.version}";
+ version = "2019-08-26";
+
+ src = fetchFromGitHub {
+ owner = "tuxedocomputers";
+ repo = "tuxedo-keyboard";
+ rev = "d65e76e84cfd8169591fc2a0a7c9219fa19da1b5";
+ sha256 = "1s48qpwybwh5pwqas2d1v2a7x4r97sm4hr9i4902r1d7h384bv17";
+ };
+
+ makeFlags = [ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];
+
+ installPhase = ''
+ mkdir -p "$out/lib/modules/${kernel.modDirVersion}"
+ mv src/tuxedo_keyboard.ko $out/lib/modules/${kernel.modDirVersion}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Full color keyboard driver for tuxedo computers laptops";
+ homepage = "https://github.com/tuxedocomputers/tuxedo-keyboard/";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.blanky0230 ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uclibc/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uclibc/default.nix
new file mode 100644
index 000000000000..125a8608c153
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uclibc/default.nix
@@ -0,0 +1,114 @@
+{ stdenv, buildPackages
+, fetchurl, linuxHeaders, libiconvReal
+, extraConfig ? ""
+}:
+
+let
+ configParser = ''
+ function parseconfig {
+ set -x
+ while read LINE; do
+ NAME=`echo "$LINE" | cut -d \ -f 1`
+ OPTION=`echo "$LINE" | cut -d \ -f 2`
+
+ if test -z "$NAME"; then
+ continue
+ fi
+
+ echo "parseconfig: removing $NAME"
+ sed -i /^$NAME=/d .config
+
+ #if test "$OPTION" != n; then
+ echo "parseconfig: setting $NAME=$OPTION"
+ echo "$NAME=$OPTION" >> .config
+ #fi
+ done
+ set +x
+ }
+ '';
+
+ # UCLIBC_SUSV4_LEGACY defines 'tmpnam', needed for gcc libstdc++ builds.
+ nixConfig = ''
+ RUNTIME_PREFIX "/"
+ DEVEL_PREFIX "/"
+ UCLIBC_HAS_WCHAR y
+ UCLIBC_HAS_FTW y
+ UCLIBC_HAS_RPC y
+ DO_C99_MATH y
+ UCLIBC_HAS_PROGRAM_INVOCATION_NAME y
+ UCLIBC_SUSV4_LEGACY y
+ UCLIBC_HAS_THREADS_NATIVE y
+ KERNEL_HEADERS "${linuxHeaders}/include"
+ '' + stdenv.lib.optionalString (stdenv.isAarch32 && stdenv.buildPlatform != stdenv.hostPlatform) ''
+ CONFIG_ARM_EABI y
+ ARCH_WANTS_BIG_ENDIAN n
+ ARCH_BIG_ENDIAN n
+ ARCH_WANTS_LITTLE_ENDIAN y
+ ARCH_LITTLE_ENDIAN y
+ UCLIBC_HAS_FPU n
+ '';
+
+ version = "1.0.34";
+in
+
+stdenv.mkDerivation {
+ name = "uclibc-ng-${version}";
+ inherit version;
+
+ src = fetchurl {
+ url = "https://downloads.uclibc-ng.org/releases/${version}/uClibc-ng-${version}.tar.bz2";
+ # from "${url}.sha256";
+ sha256 = "025z0072inw1ibnrlwckslp9iayl9c35ysf0h7jjrxlzslzp4yjg";
+ };
+
+ # 'ftw' needed to build acl, a coreutils dependency
+ configurePhase = ''
+ make defconfig
+ ${configParser}
+ cat << EOF | parseconfig
+ ${nixConfig}
+ ${extraConfig}
+ ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""}
+ EOF
+ ( set +o pipefail; yes "" | make oldconfig )
+ '';
+
+ hardeningDisable = [ "stackprotector" ];
+
+ # Cross stripping hurts.
+ dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
+
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+ makeFlags = [
+ "ARCH=${stdenv.hostPlatform.parsed.cpu.name}"
+ "VERBOSE=1"
+ ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+ "CROSS=${stdenv.cc.targetPrefix}"
+ ];
+
+ # `make libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.h`:
+ # error: bits/sysnum.h: No such file or directory
+ enableParallelBuilding = false;
+
+ installPhase = ''
+ mkdir -p $out
+ make PREFIX=$out VERBOSE=1 install
+ (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .)
+ # libpthread.so may not exist, so I do || true
+ sed -i s@/lib/@$out/lib/@g $out/lib/libc.so $out/lib/libpthread.so || true
+ '';
+
+ passthru = {
+ # Derivations may check for the existance of this attribute, to know what to link to.
+ libiconv = libiconvReal;
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://uclibc-ng.org";
+ description = "A small implementation of the C library";
+ maintainers = with maintainers; [ rasendubi ];
+ license = licenses.lgpl2;
+ platforms = intersectLists platforms.linux platforms.x86; # fails to build on ARM
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks-glue/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks-glue/default.nix
new file mode 100644
index 000000000000..60a1f8a619d1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks-glue/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, pkgconfig, automake, autoconf, udisks1, dbus-glib, glib, libconfuse }:
+
+stdenv.mkDerivation {
+ name = "udisks-glue-1.3.5";
+
+ src = fetchurl {
+ url = "https://github.com/fernandotcl/udisks-glue/archive/release-1.3.5.tar.gz";
+ sha256 = "317d25bf249278dc8f6a5dcf18f760512427c772b9afe3cfe34e6e1baa258176";
+ };
+
+ nativeBuildInputs = [ pkgconfig automake autoconf ];
+ buildInputs = [ udisks1 dbus-glib glib libconfuse ];
+
+ preConfigure = "sh autogen.sh";
+
+ meta = {
+ homepage = "https://github.com/fernandotcl/udisks-glue";
+ description = "A tool to associate udisks events to user-defined actions";
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [pSub];
+ license = stdenv.lib.licenses.bsd2;
+ broken = true;
+ hydraPlatforms = [];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/1-default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/1-default.nix
new file mode 100644
index 000000000000..f8876e5d155a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/1-default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, pkgconfig, sg3_utils, udev, glib, dbus, dbus-glib
+, polkit, parted, lvm2, libatasmart, intltool, libuuid, mdadm
+, libxslt, docbook_xsl, utillinux, libgudev }:
+
+stdenv.mkDerivation rec {
+ name = "udisks-1.0.5";
+
+ src = fetchurl {
+ url = "https://hal.freedesktop.org/releases/${name}.tar.gz";
+ sha256 = "0wbg3jrv8limdgvcygf4dqin3y6d30y9pcmmk711vq571vmq5v7j";
+ };
+
+ patches = [ ./purity.patch ./no-pci-db.patch ./glibc.patch ];
+
+ preConfigure =
+ ''
+ configureFlagsArray+=(--with-systemdsystemunitdir=$out/lib/systemd/system)
+ '';
+
+ postPatch =
+ ''
+ sed -e 's,/sbin/mdadm,${mdadm}&,g' -e "s,@slashlibdir@,$out/lib,g" -i data/80-udisks.rules
+
+ substituteInPlace src/main.c --replace \
+ "/sbin:/bin:/usr/sbin:/usr/bin" \
+ "${utillinux}/bin:${mdadm}/sbin:/run/current-system/sw/bin:/run/current-system/sw/bin"
+ '';
+
+ buildInputs =
+ [ sg3_utils udev glib dbus dbus-glib polkit parted libgudev
+ lvm2 libatasmart intltool libuuid libxslt docbook_xsl
+ ];
+
+ nativeBuildInputs = [ pkgconfig ];
+
+ configureFlags = [ "--localstatedir=/var" "--enable-lvm2" ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.freedesktop.org/wiki/Software/udisks";
+ description = "A daemon and command-line utility for querying and manipulating storage devices";
+ platforms = platforms.linux;
+ license = with licenses; [ gpl2 lgpl2Plus ];
+ broken = true;
+ hydraPlatforms = [];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/2-default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/2-default.nix
new file mode 100644
index 000000000000..3b502dbe48f5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/2-default.nix
@@ -0,0 +1,89 @@
+{ stdenv, fetchFromGitHub, fetchpatch, substituteAll, libtool, pkgconfig, gettext, gnused
+, gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash, which
+, expat, libxslt, docbook_xsl, utillinux, mdadm, libgudev, libblockdev, parted
+, gobject-introspection, docbook_xml_dtd_412, docbook_xml_dtd_43, autoconf, automake
+, xfsprogs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, ntfs3g
+}:
+
+stdenv.mkDerivation rec {
+ pname = "udisks";
+ version = "2.8.4";
+
+ src = fetchFromGitHub {
+ owner = "storaged-project";
+ repo = "udisks";
+ rev = "${pname}-${version}";
+ sha256 = "01wx2x8xyal595dhdih7rva2bz7gqzgwdp56gi0ikjdzayx17wcf";
+ };
+
+ outputs = [ "out" "man" "dev" ] ++ stdenv.lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc";
+
+ patches = [
+ (substituteAll {
+ src = ./fix-paths.patch;
+ bash = "${bash}/bin/bash";
+ blkid = "${utillinux}/bin/blkid";
+ false = "${coreutils}/bin/false";
+ mdadm = "${mdadm}/bin/mdadm";
+ sed = "${gnused}/bin/sed";
+ sh = "${bash}/bin/sh";
+ sleep = "${coreutils}/bin/sleep";
+ true = "${coreutils}/bin/true";
+ })
+ (substituteAll {
+ src = ./force-path.patch;
+ path = stdenv.lib.makeBinPath [
+ btrfs-progs coreutils dosfstools e2fsprogs exfat f2fs-tools nilfs-utils
+ xfsprogs ntfs3g parted utillinux
+ ];
+ })
+
+ # Fix tests: https://github.com/storaged-project/udisks/issues/724
+ (fetchpatch {
+ url = "https://github.com/storaged-project/udisks/commit/60a0c1c967821d317046d9494e45b9a8e4e7a1c1.patch";
+ sha256 = "0rlgqsxn7rb074x6ivm0ya5lywc4llifj5br0zr31mwwckv7hsdm";
+ })
+ ];
+
+ nativeBuildInputs = [
+ autoconf automake pkgconfig libtool gettext which gobject-introspection
+ gtk-doc libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl
+ ];
+
+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ substituteInPlace udisks/udisksclient.c \
+ --replace 'defined( __GNUC_PREREQ)' 1 \
+ --replace '__GNUC_PREREQ(4,6)' 1
+ '';
+
+ buildInputs = [
+ expat libgudev libblockdev acl systemd glib libatasmart polkit
+ ];
+
+ preConfigure = "NOCONFIGURE=1 ./autogen.sh";
+
+ configureFlags = [
+ (stdenv.lib.enableFeature (stdenv.buildPlatform == stdenv.hostPlatform) "gtk-doc")
+ "--localstatedir=/var"
+ "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
+ "--with-udevdir=$(out)/lib/udev"
+ "--with-tmpfilesdir=no"
+ ];
+
+ makeFlags = [
+ "INTROSPECTION_GIRDIR=$(dev)/share/gir-1.0"
+ "INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0"
+ ];
+
+ enableParallelBuilding = true;
+
+ doCheck = true;
+
+ meta = with stdenv.lib; {
+ description = "A daemon, tools and libraries to access and manipulate disks, storage devices and technologies";
+ homepage = "https://www.freedesktop.org/wiki/Software/udisks/";
+ license = with licenses; [ lgpl2Plus gpl2Plus ]; # lgpl2Plus for the library, gpl2Plus for the tools & daemon
+ maintainers = with maintainers; [ johnazoidberg ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/fix-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/fix-paths.patch
new file mode 100644
index 000000000000..c2744c3b42e1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/fix-paths.patch
@@ -0,0 +1,131 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,6 +1,6 @@
+ ## Process this file with automake to produce Makefile.in
+
+-SHELL = /bin/bash
++SHELL = @bash@
+ .SHELLFLAGS = -o pipefail -c
+
+ PYTHON ?= python3
+--- a/data/80-udisks2.rules
++++ b/data/80-udisks2.rules
+@@ -17,9 +17,9 @@
+ #
+ # TODO: file bug against mdadm(8) to have --export-prefix option that can be used with e.g. UDISKS_MD_MEMBER
+ #
+-SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="/bin/sh -c '/sbin/mdadm --examine --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_MEMBER_/g'"
++SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="@sh@ -c '@mdadm@ --examine --export $tempnode | @sed@ s/^MD_/UDISKS_MD_MEMBER_/g'"
+
+-SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="/bin/sh -c '/sbin/mdadm --detail --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_/g'"
++SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="@sh@ -c '@mdadm@ --detail --export $tempnode | @sed@ s/^MD_/UDISKS_MD_/g'"
+
+ LABEL="udisks_probe_end"
+
+--- a/modules/zram/udiskslinuxmanagerzram.c
++++ b/modules/zram/udiskslinuxmanagerzram.c
+@@ -250,7 +250,7 @@
+
+ g_snprintf (tmp, 255, "zram%" G_GUINT64_FORMAT, i);
+ filename = g_build_filename (PACKAGE_ZRAMCONF_DIR, tmp, NULL);
+- contents = g_strdup_printf ("#!/bin/bash\n\n"
++ contents = g_strdup_printf ("#!@bash@\n\n"
+ "ZRAM_NUM_STR=%" G_GUINT64_FORMAT "\n"
+ "ZRAM_DEV_SIZE=%" G_GUINT64_FORMAT "\n"
+ "SWAP=n\n",
+--- a/src/tests/install-udisks/runtest.sh
++++ b/src/tests/install-udisks/runtest.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!@bash@
+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ #
+--- a/src/tests/integration-test
++++ b/src/tests/integration-test
+@@ -414,7 +414,7 @@
+ f.write('KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", '
+ 'ATTRS{model}=="scsi_debug*", '
+ 'ENV{ID_CDROM_MEDIA}=="?*", '
+- 'IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"\n')
++ 'IMPORT{program}="@blkid@ -o udev -p -u noraid $tempnode"\n')
+ # reload udev
+ subprocess.call('sync; pkill --signal HUP udevd || '
+ 'pkill --signal HUP systemd-udevd',
+@@ -1079,7 +1079,7 @@
+ self.assertFalse(os.access(f, os.X_OK))
+
+ f = os.path.join(mount_point, 'simple.exe')
+- shutil.copy('/bin/bash', f)
++ shutil.copy('@bash@', f)
+ self.assertTrue(os.access(f, os.R_OK))
+ self.assertTrue(os.access(f, os.W_OK))
+ self.assertTrue(os.access(f, os.X_OK))
+@@ -1092,7 +1092,7 @@
+ self.assertFalse(os.access(f, os.X_OK))
+
+ f = os.path.join(mount_point, 'subdir', 'subdir.exe')
+- shutil.copy('/bin/bash', f)
++ shutil.copy('@bash@', f)
+ self.assertTrue(os.access(f, os.R_OK))
+ self.assertTrue(os.access(f, os.W_OK))
+ self.assertTrue(os.access(f, os.X_OK))
+--- a/src/tests/storadectl/runtest.sh
++++ b/src/tests/storadectl/runtest.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!@bash@
+ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ #
+--- a/src/tests/test.c
++++ b/src/tests/test.c
+@@ -71,7 +71,7 @@
+ {
+ UDisksSpawnedJob *job;
+
+- job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, NULL);
++ job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, NULL);
+ udisks_spawned_job_start (job);
+ _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_success), NULL);
+ g_object_unref (job);
+@@ -84,10 +84,10 @@
+ {
+ UDisksSpawnedJob *job;
+
+- job = udisks_spawned_job_new ("/bin/false", NULL, getuid (), geteuid (), NULL, NULL);
++ job = udisks_spawned_job_new ("@false@", NULL, getuid (), geteuid (), NULL, NULL);
+ udisks_spawned_job_start (job);
+ _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
+- (gpointer) "Command-line `/bin/false' exited with non-zero exit status 1: ");
++ (gpointer) "Command-line `@false@' exited with non-zero exit status 1: ");
+ g_object_unref (job);
+ }
+
+@@ -119,7 +119,7 @@
+
+ cancellable = g_cancellable_new ();
+ g_cancellable_cancel (cancellable);
+- job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, cancellable);
++ job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, cancellable);
+ udisks_spawned_job_start (job);
+ _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
+ (gpointer) "Operation was cancelled (g-io-error-quark, 19)");
+@@ -145,7 +145,7 @@
+ GCancellable *cancellable;
+
+ cancellable = g_cancellable_new ();
+- job = udisks_spawned_job_new ("/bin/sleep 0.5", NULL, getuid (), geteuid (), NULL, cancellable);
++ job = udisks_spawned_job_new ("@sleep@ 0.5", NULL, getuid (), geteuid (), NULL, cancellable);
+ udisks_spawned_job_start (job);
+ g_timeout_add (10, on_timeout, cancellable); /* 10 msec */
+ g_main_loop_run (loop);
+@@ -199,7 +199,7 @@
+ {
+ UDisksSpawnedJob *job;
+
+- job = udisks_spawned_job_new ("/bin/sleep 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */);
++ job = udisks_spawned_job_new ("@sleep@ 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */);
+ udisks_spawned_job_start (job);
+ g_object_unref (job);
+ }
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/force-path.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/force-path.patch
new file mode 100644
index 000000000000..16c7ea5322fa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/force-path.patch
@@ -0,0 +1,13 @@
+diff -ruN udisks-2.1.0.orig/src/main.c udisks-2.1.0/src/main.c
+--- udisks-2.1.0.orig/src/main.c 2013-04-02 10:43:41.629332135 +0000
++++ udisks-2.1.0/src/main.c 2013-04-02 11:04:55.635342823 +0000
+@@ -140,8 +140,7 @@
+ }
+ }
+
+- if (g_getenv ("PATH") == NULL)
+- g_setenv ("PATH", "/usr/bin:/bin:/usr/sbin:/sbin", TRUE);
++ g_setenv ("PATH", "@path@", TRUE);
+
+ udisks_notice ("udisks daemon version %s starting", PACKAGE_VERSION);
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/glibc.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/glibc.patch
new file mode 100644
index 000000000000..85ef5208049d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/glibc.patch
@@ -0,0 +1,25 @@
+From 0aa652a7b257f98f9e8e7dc7b0ddc9bc62377d09 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Fri, 29 May 2015 21:09:39 -0400
+Subject: [PATCH] Bug 90778 - fix build with newer glibc versions
+
+https://bugs.freedesktop.org/show_bug.cgi?id=90778
+---
+ src/helpers/job-drive-detach.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/helpers/job-drive-detach.c b/src/helpers/job-drive-detach.c
+index eeafcab..d122a1f 100644
+--- a/src/helpers/job-drive-detach.c
++++ b/src/helpers/job-drive-detach.c
+@@ -18,6 +18,7 @@
+ *
+ */
+
++#include <sys/stat.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+--
+2.4.2
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/no-pci-db.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/no-pci-db.patch
new file mode 100644
index 000000000000..b323b515c40e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/no-pci-db.patch
@@ -0,0 +1,13 @@
+Systemd no longer has the pci-db program.
+
+diff -ru -x '*~' udisks-1.0.4-orig/data/80-udisks.rules udisks-1.0.4/data/80-udisks.rules
+--- udisks-1.0.4-orig/data/80-udisks.rules 2011-08-25 23:31:20.000000000 +0200
++++ udisks-1.0.4/data/80-udisks.rules 2012-12-13 13:06:52.189650854 +0100
+@@ -3,7 +3,6 @@
+
+ # import names for PCI storage controllers
+ #
+-SUBSYSTEM=="pci", ACTION=="add|change", ENV{ID_MODEL_FROM_DATABASE}=="", ATTR{class}=="0x01*", IMPORT{program}="pci-db %p"
+
+ # Set eSATA port type for known eSATA CardBus adapters - first we want to ensure
+ # the device is on a cardbus controller (upper PCI device) - then we check
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/purity.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/purity.patch
new file mode 100644
index 000000000000..bf1121ddb659
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/udisks/purity.patch
@@ -0,0 +1,57 @@
+diff --git a/data/80-udisks.rules b/data/80-udisks.rules
+index 6720394..60b67ed 100644
+--- a/data/80-udisks.rules
++++ b/data/80-udisks.rules
+@@ -23,7 +23,7 @@ LABEL="ata_port_cardbus_end"
+ # this is the case we can trigger a 'change' on the sas_expander device
+ # when the bsg device appears)
+ #
+-SUBSYSTEM=="sas_expander", ACTION=="add|change", IMPORT{program}="udisks-probe-sas-expander /sys/%p"
++SUBSYSTEM=="sas_expander", ACTION=="add|change", IMPORT{program}="@slashlibdir@/udev/udisks-probe-sas-expander /sys/%p"
+
+ ##############################################################################################################
+
+@@ -54,7 +54,7 @@ ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="udisks_end"
+ # import UDISKS_DM_* and UDISKS_LVM2_* properties - the long-term plan is to make the lvm2 and
+ # device-mapper packages provide this information
+ #
+-KERNEL=="dm-*", IMPORT{program}="udisks-dm-export %M %m"
++KERNEL=="dm-*", IMPORT{program}="@slashlibdir@/udev/udisks-dm-export %M %m"
+
+ # Make udevd synthesize a 'change' uevent when last opener of a rw-fd closes the fd - this
+ # should be part of the device-mapper rules
+@@ -63,7 +63,7 @@ KERNEL=="dm-*", OPTIONS+="watch"
+ ##############################################################################################################
+ # Probe LVM2 Physical Volumes - this will eventually be part of the LVM2 package
+
+-ENV{ID_FS_TYPE}=="LVM2_member", TEST=="/lib/udev/udisks-lvm-pv-export", IMPORT{program}="udisks-lvm-pv-export $env{ID_FS_UUID}"
++ENV{ID_FS_TYPE}=="LVM2_member", TEST=="@slashlibdir@/udev/udisks-lvm-pv-export", IMPORT{program}="@slashlibdir@/udev/udisks-lvm-pv-export $env{ID_FS_UUID}"
+
+ ##############################################################################################################
+
+@@ -85,7 +85,7 @@ KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="", GOTO="probe_parttable_e
+
+ # scan for partition tables both on whole-disk and partitions
+ #
+-IMPORT{program}="udisks-part-id $tempnode"
++IMPORT{program}="@slashlibdir@/udev/udisks-part-id $tempnode"
+
+ LABEL="probe_parttable_end"
+
+@@ -109,13 +109,13 @@ LABEL="md_end"
+ #
+
+ # USB ATA enclosures with a SAT layer
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+
+ # ATA disks driven by libata
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+
+ # ATA disks connected via SAS (not driven by libata)
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="scsi", ENV{DEVTYPE}=="disk", ENV{ID_VENDOR}=="ATA", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="scsi", ENV{DEVTYPE}=="disk", ENV{ID_VENDOR}=="ATA", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+
+
+ # Example rule for tagging a device with a specific media type. Where and
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/undervolt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/undervolt/default.nix
new file mode 100644
index 000000000000..2f03ee8c8201
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/undervolt/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+ version = "0.3.0";
+ pname = "undervolt";
+
+ src = fetchFromGitHub {
+ owner = "georgewhewell";
+ repo = "undervolt";
+ rev = version;
+ sha256 = "1aybk8vbb4745raz7rvpkk6b98xrdiwjhkpbv3kwsgsr9sj42lp0";
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/georgewhewell/undervolt/";
+ description = "A program for undervolting Intel CPUs on Linux";
+
+ longDescription = ''
+ Undervolt is a program for undervolting Intel CPUs under Linux. It works in a similar
+ manner to the Windows program ThrottleStop (i.e, MSR 0x150). You can apply a fixed
+ voltage offset to one of 5 voltage planes, and override your systems temperature
+ target (CPU will throttle when this temperature is reached).
+ '';
+ license = licenses.gpl2;
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/unstick/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/unstick/default.nix
new file mode 100644
index 000000000000..cca6e6210cb6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/unstick/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchFromGitHub, meson, ninja, pkgconfig, libseccomp }:
+
+stdenv.mkDerivation rec {
+ name = "unstick";
+ version = "0.1.0";
+
+ src = fetchFromGitHub {
+ owner = "kwohlfahrt";
+ repo = name;
+ rev = "effee9aa242ca12dc94cc6e96bc073f4cc9e8657";
+ sha256 = "08la3jmmzlf4pm48bf9zx4cqj9gbqalpqy0s57bh5vfsdk74nnhv";
+ };
+
+ sourceRoot = "source/src";
+
+ nativeBuildInputs = [ meson ninja pkgconfig ];
+ buildInputs = [ libseccomp ];
+
+ meta = {
+ homepage = "https://github.com/kwohlfahrt/unstick";
+ description = "Silently eats chmod commands forbidden by Nix";
+ license = lib.licenses.gpl3;
+ platforms = lib.platforms.linux;
+ maintainers = with lib.maintainers; [ kwohlfahrt ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/untie/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/untie/default.nix
new file mode 100644
index 000000000000..9ca1c37e11b4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/untie/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+ pname = "untie";
+ version = "0.3";
+ src = fetchurl {
+ url = "http://guichaz.free.fr/untie/files/${pname}-${version}.tar.bz2";
+ sha256 = "1334ngvbi4arcch462mzi5vxvxck4sy1nf0m58116d9xmx83ak0m";
+ };
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "A tool to run processes untied from some of the namespaces";
+ maintainers = with maintainers; [ raskin ];
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ };
+
+ passthru = {
+ updateInfo = {
+ downloadPage = "http://guichaz.free.fr/untie";
+ };
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/upower/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/upower/default.nix
new file mode 100644
index 000000000000..e9d9eff007cd
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/upower/default.nix
@@ -0,0 +1,71 @@
+{ stdenv
+, fetchurl
+, pkgconfig
+, libxslt
+, docbook_xsl
+, udev
+, libgudev
+, libusb1
+, glib
+, gobject-introspection
+, gettext
+, systemd
+, useIMobileDevice ? true
+, libimobiledevice
+}:
+
+stdenv.mkDerivation {
+ pname = "upower";
+ version = "0.99.11";
+
+ outputs = [ "out" "dev" ];
+
+ src = fetchurl {
+ url = "https://gitlab.freedesktop.org/upower/upower/uploads/93cfe7c8d66ed486001c4f3f55399b7a/upower-0.99.11.tar.xz";
+ sha256 = "1vxxvmz2cxb1qy6ibszaz5bskqdy9nd9fxspj9fv3gfmrjzzzdb4";
+ };
+
+ nativeBuildInputs = [
+ docbook_xsl
+ gettext
+ gobject-introspection
+ libxslt
+ pkgconfig
+ ];
+
+ buildInputs = [
+ libgudev
+ libusb1
+ udev
+ systemd
+ ]
+ ++ stdenv.lib.optional useIMobileDevice libimobiledevice
+ ;
+
+ propagatedBuildInputs = [
+ glib
+ ];
+
+ configureFlags = [
+ "--localstatedir=/var"
+ "--with-backend=linux"
+ "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
+ "--with-systemdutildir=${placeholder "out"}/lib/systemd"
+ "--with-udevrulesdir=${placeholder "out"}/lib/udev/rules.d"
+ "--sysconfdir=/etc"
+ ];
+
+ doCheck = false; # fails with "env: './linux/integration-test': No such file or directory"
+
+ installFlags = [
+ "historydir=$(TMPDIR)/foo"
+ "sysconfdir=${placeholder "out"}/etc"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://upower.freedesktop.org/";
+ description = "A D-Bus service for power management";
+ platforms = platforms.linux;
+ license = licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbguard/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbguard/default.nix
new file mode 100644
index 000000000000..0ece2f836006
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbguard/default.nix
@@ -0,0 +1,63 @@
+{
+ stdenv, fetchurl, lib,
+ pkgconfig, libxslt, libxml2, docbook_xml_dtd_45, docbook_xsl, asciidoc,
+ dbus-glib, libcap_ng, libqb, libseccomp, polkit, protobuf,
+ audit,
+ libgcrypt ? null,
+ libsodium ? null
+}:
+
+with stdenv.lib;
+
+assert libgcrypt != null -> libsodium == null;
+
+stdenv.mkDerivation rec {
+ version = "0.7.8";
+ pname = "usbguard";
+
+ repo = "https://github.com/USBGuard/usbguard";
+
+ src = fetchurl {
+ url = "${repo}/releases/download/${pname}-${version}/${pname}-${version}.tar.gz";
+ sha256 = "1il5immqfxh2cj8wn1bfk7l42inflzgjf07yqprpz7r3lalbxc25";
+ };
+
+ nativeBuildInputs = [
+ asciidoc
+ pkgconfig
+ libxslt # xsltproc
+ libxml2 # xmllint
+ docbook_xml_dtd_45
+ docbook_xsl
+ ];
+
+ buildInputs = [
+ dbus-glib
+ libcap_ng
+ libqb
+ libseccomp
+ polkit
+ protobuf
+ audit
+ ]
+ ++ (lib.optional (libgcrypt != null) libgcrypt)
+ ++ (lib.optional (libsodium != null) libsodium);
+
+ configureFlags = [
+ "--with-bundled-catch"
+ "--with-bundled-pegtl"
+ "--with-dbus"
+ "--with-polkit"
+ ]
+ ++ (lib.optional (libgcrypt != null) "--with-crypto-library=gcrypt")
+ ++ (lib.optional (libsodium != null) "--with-crypto-library=sodium");
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "The USBGuard software framework helps to protect your computer against BadUSB";
+ homepage = "https://usbguard.github.io/";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.tnias ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/default.nix
new file mode 100644
index 000000000000..ffd33b6ff854
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, kernel, udev, autoconf, automake, libtool }:
+
+stdenv.mkDerivation {
+ name = "usbip-${kernel.name}";
+
+ src = kernel.src;
+
+ patches = lib.optionals (lib.versionAtLeast "5.4" kernel.version) [
+ # fixes build with gcc8
+ ./fix-snprintf-truncation.patch
+ # fixes build with gcc9
+ ./fix-strncpy-truncation.patch
+ ];
+
+ nativeBuildInputs = [ autoconf automake libtool ];
+ buildInputs = [ udev ];
+
+ NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
+
+ preConfigure = ''
+ cd tools/usb/usbip
+ ./autogen.sh
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/torvalds/linux/tree/master/tools/usb/usbip";
+ description = "allows to pass USB device from server to client over the network";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
new file mode 100644
index 000000000000..63fca9ddbfe5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
@@ -0,0 +1,13 @@
+diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
+index 8159fd98680b..7d6eb3e3fe1e 100644
+--- a/tools/usb/usbip/libsrc/vhci_driver.c
++++ b/tools/usb/usbip/libsrc/vhci_driver.c
+@@ -111,7 +111,7 @@ static int parse_status(const char *value)
+ static int refresh_imported_device_list(void)
+ {
+ const char *attr_status;
+- char status[MAX_STATUS_NAME+1] = "status";
++ char status[MAX_STATUS_NAME+2] = "status";
+ int i, ret;
+
+ for (i = 0; i < vhci_driver->ncontrollers; i++) {
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
new file mode 100644
index 000000000000..a5c4c97bbc08
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
@@ -0,0 +1,37 @@
+diff --git a/tools/usb/usbip/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c
+index bb424638d75b..2fc5837e609a 100644
+--- a/tools/usb/usbip/libsrc/usbip_common.c
++++ b/tools/usb/usbip/libsrc/usbip_common.c
+@@ -226,8 +226,8 @@ int read_usb_device(struct udev_device *sdev, struct usbip_usb_device *udev)
+ path = udev_device_get_syspath(sdev);
+ name = udev_device_get_sysname(sdev);
+
+- strncpy(udev->path, path, SYSFS_PATH_MAX);
+- strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
++ strncpy(udev->path, path, SYSFS_PATH_MAX-1);
++ strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE-1);
+
+ sscanf(name, "%u-%u", &busnum, &devnum);
+ udev->busnum = busnum;
+diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
+index 5a3726eb44ab..95b416af8b99 100644
+--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
++++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
+@@ -91,7 +91,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
+ copy_descr_attr16(dev, &descr, idProduct);
+ copy_descr_attr16(dev, &descr, bcdDevice);
+
+- strncpy(dev->path, path, SYSFS_PATH_MAX);
++ strncpy(dev->path, path, SYSFS_PATH_MAX-1);
+
+ dev->speed = USB_SPEED_UNKNOWN;
+ speed = udev_device_get_sysattr_value(sdev, "current_speed");
+@@ -110,7 +110,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
+ dev->busnum = 0;
+
+ name = udev_device_get_sysname(plat);
+- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
++ strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE-1);
+ return 0;
+ err:
+ fclose(fd);
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbtop/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbtop/default.nix
new file mode 100644
index 000000000000..0ff8fcf0ddf7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbtop/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub
+, cmake
+, libpcap, boost }:
+
+stdenv.mkDerivation rec {
+ pname = "usbtop";
+ version = "1.0";
+
+ src = fetchFromGitHub {
+ owner = "aguinet";
+ repo = pname;
+ rev = "release-${version}";
+ sha256 = "0qbad0aq6j4jrh90l6a0akk71wdzhyzmy6q8wl138axyj2bp9kss";
+ };
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = [ libpcap boost ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/aguinet/usbtop";
+ description = "A top utility that shows an estimated instantaneous bandwidth on USB buses and devices";
+ maintainers = with maintainers; [ etu ];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/default.nix
new file mode 100644
index 000000000000..41db602bce50
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, substituteAll, autoreconfHook, pkgconfig, libusb1, hwdata , python3 }:
+
+stdenv.mkDerivation rec {
+ name = "usbutils-012";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/usb/usbutils/${name}.tar.xz";
+ sha256 = "0iiy0q7fzikavmdsjsb0sl9kp3gfh701qwyjjccvqh0qz4jlcqw8";
+ };
+
+ patches = [
+ (substituteAll {
+ src = ./fix-paths.patch;
+ inherit hwdata;
+ })
+ ];
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ libusb1 python3 ];
+
+ outputs = [ "out" "man" "python" ];
+ postInstall = ''
+ moveToOutput "bin/lsusb.py" "$python"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.linux-usb.org/";
+ description = "Tools for working with USB devices, such as lsusb";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/fix-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/fix-paths.patch
new file mode 100644
index 000000000000..d75c68505efc
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usbutils/fix-paths.patch
@@ -0,0 +1,16 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -51,11 +51,11 @@
+ usbreset.c
+
+ lsusb.py: $(srcdir)/lsusb.py.in
+- sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@
++ sed 's|VERSION|$(VERSION)|g;s|@usbids@|@hwdata@/share/hwdata/usb.ids|g' $< >$@
+ chmod 755 $@
+
+ lsusb.8: $(srcdir)/lsusb.8.in
+- sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@
++ sed 's|VERSION|$(VERSION)|g;s|@usbids@|@hwdata@/share/hwdata/usb.ids|g' $< >$@
+
+ usb-devices.1: $(srcdir)/usb-devices.1.in
+ sed 's|VERSION|$(VERSION)|g' $< >$@
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usermount/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usermount/default.nix
new file mode 100644
index 000000000000..85f769d9dbae
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/usermount/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchgit, pkgconfig, dbus, libnotify, udisks2, gdk-pixbuf }:
+
+stdenv.mkDerivation {
+ name = "usermount-0.1";
+
+ src = fetchgit {
+ url = "https://github.com/tom5760/usermount.git";
+ rev = "0d6aba3c1f8fec80de502f5b92fd8b28041cc8e4";
+ sha256 = "0gpp0vwiwr7kgbhh26jspv3255662mnvnav6g8i2h0qxar8hf8w2";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [ dbus libnotify udisks2 gdk-pixbuf ];
+
+ NIX_CFLAGS_COMPILE = "-DENABLE_NOTIFICATIONS";
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mv usermount $out/bin/
+ '';
+
+ meta = {
+ homepage = "https://github.com/tom5760/usermount";
+ description = "A simple tool to automatically mount removable drives using UDisks2 and D-Bus";
+ license = stdenv.lib.licenses.mit;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/default.nix
new file mode 100644
index 000000000000..ac6ad8a4bb76
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/default.nix
@@ -0,0 +1,73 @@
+{ lib, stdenv, fetchurl, pkgconfig, zlib, shadow
+, ncurses ? null, perl ? null, pam, systemd ? null, minimal ? false }:
+
+stdenv.mkDerivation rec {
+ pname = "util-linux";
+ version = "2.36";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+ sha256 = "1cg0m4psswg71v6wrqc2bngcw20fsp01vbijxdzvdf8kxdkiqjwy";
+ };
+
+ patches = [
+ ./rtcwake-search-PATH-for-shutdown.patch
+ ];
+
+ outputs = [ "bin" "dev" "out" "man" ];
+
+ postPatch = ''
+ patchShebangs tests/run.sh
+
+ substituteInPlace include/pathnames.h \
+ --replace "/bin/login" "${shadow}/bin/login"
+ substituteInPlace sys-utils/eject.c \
+ --replace "/bin/umount" "$bin/bin/umount"
+ '';
+
+ # !!! It would be better to obtain the path to the mount helpers
+ # (/sbin/mount.*) through an environment variable, but that's
+ # somewhat risky because we have to consider that mount can setuid
+ # root...
+ configureFlags = [
+ "--enable-write"
+ "--enable-last"
+ "--enable-mesg"
+ "--disable-use-tty-group"
+ "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin"
+ "--disable-makeinstall-setuid" "--disable-makeinstall-chown"
+ "--disable-su" # provided by shadow
+ (lib.withFeature (ncurses != null) "ncursesw")
+ (lib.withFeature (systemd != null) "systemd")
+ (lib.withFeatureAs (systemd != null)
+ "systemdsystemunitdir" "${placeholder "bin"}/lib/systemd/system/")
+ ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+ "scanf_cv_type_modifier=ms"
+ ;
+
+ makeFlags = [
+ "usrbin_execdir=${placeholder "bin"}/bin"
+ "usrsbin_execdir=${placeholder "bin"}/sbin"
+ ];
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs =
+ [ zlib pam ]
+ ++ lib.filter (p: p != null) [ ncurses systemd perl ];
+
+ doCheck = false; # "For development purpose only. Don't execute on production system!"
+
+ postInstall = lib.optionalString minimal ''
+ rm -rf $out/share/{locale,doc,bash-completion}
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with lib; {
+ homepage = "https://www.kernel.org/pub/linux/utils/util-linux/";
+ description = "A set of system utilities for Linux";
+ license = licenses.gpl2; # also contains parts under more permissive licenses
+ platforms = platforms.linux;
+ priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch
new file mode 100644
index 000000000000..52c970a18f3d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch
@@ -0,0 +1,69 @@
+Search $PATH for the shutdown binary instead of hard-coding /sbin/shutdown,
+which isn't valid on NixOS (and a compatibility link on most other modern
+distros anyway).
+
+--- a/include/pathnames.h
++++ b/include/pathnames.h
+@@ -50,8 +50,8 @@
+ #ifndef _PATH_LOGIN
+ # define _PATH_LOGIN "/bin/login"
+ #endif
+-#define _PATH_SHUTDOWN "/sbin/shutdown"
+-#define _PATH_POWEROFF "/sbin/poweroff"
++#define _PATH_SHUTDOWN "shutdown"
++#define _PATH_POWEROFF "poweroff"
+
+ #define _PATH_TERMCOLORS_DIRNAME "terminal-colors.d"
+ #define _PATH_TERMCOLORS_DIR "/etc/" _PATH_TERMCOLORS_DIRNAME
+--- a/sys-utils/rtcwake.c
++++ b/sys-utils/rtcwake.c
+@@ -587,29 +587,29 @@ int main(int argc, char **argv)
+ char *arg[5];
+ int i = 0;
+
+- if (!access(_PATH_SHUTDOWN, X_OK)) {
+- arg[i++] = _PATH_SHUTDOWN;
+- arg[i++] = "-h";
+- arg[i++] = "-P";
+- arg[i++] = "now";
+- arg[i] = NULL;
+- } else if (!access(_PATH_POWEROFF, X_OK)) {
+- arg[i++] = _PATH_POWEROFF;
+- arg[i] = NULL;
+- } else {
+- arg[i] = NULL;
+- }
++ arg[i++] = _PATH_SHUTDOWN;
++ arg[i++] = "-h";
++ arg[i++] = "-P";
++ arg[i++] = "now";
++ arg[i] = NULL;
+
+- if (arg[0]) {
+- if (ctl.verbose)
+- printf(_("suspend mode: off; executing %s\n"),
+- arg[0]);
+- if (!ctl.dryrun) {
+- execv(arg[0], arg);
++ if (ctl.verbose)
++ printf(_("suspend mode: off; executing %s\n"),
++ arg[0]);
++
++ if (!ctl.dryrun) {
++ execvp(arg[0], arg);
++ if (ctl.verbose) {
+ warn(_("failed to execute %s"), arg[0]);
+- rc = EX_EXEC_ENOENT;
++ // Reuse translations.
++ printf(_("suspend mode: off; executing %s\n"),
++ _PATH_POWEROFF);
+ }
+- } else {
++
++ i = 0;
++ arg[i++] = _PATH_POWEROFF;
++ arg[i] = NULL;
++ execvp(arg[0], arg);
+ /* Failed to find shutdown command */
+ warn(_("failed to find shutdown command"));
+ rc = EX_EXEC_ENOENT;
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uvcdynctrl/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uvcdynctrl/default.nix
new file mode 100644
index 000000000000..f022023fcbb0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/uvcdynctrl/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, libxml2 }:
+
+stdenv.mkDerivation {
+ version = "0.3.0";
+ pname = "uvcdynctrl";
+
+ src = fetchFromGitHub {
+ owner = "cshorler";
+ repo = "webcam-tools";
+ rev = "bee2ef3c9e350fd859f08cd0e6745871e5f55cb9";
+ sha256 = "0s15xxgdx8lnka7vi8llbf6b0j4rhbjl6yp0qxaihysf890xj73s";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+ buildInputs = [ libxml2 ];
+
+ prePatch = ''
+ local fixup_list=(
+ uvcdynctrl/CMakeLists.txt
+ uvcdynctrl/udev/rules/80-uvcdynctrl.rules
+ uvcdynctrl/udev/scripts/uvcdynctrl
+ )
+ for f in "''${fixup_list[@]}"; do
+ substituteInPlace "$f" \
+ --replace "/etc/udev" "$out/etc/udev" \
+ --replace "/lib/udev" "$out/lib/udev"
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A simple interface for devices supported by the linux UVC driver";
+ homepage = "http://guvcview.sourceforge.net";
+ license = licenses.gpl3Plus;
+ maintainers = [ maintainers.puffnfresh ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l-utils/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l-utils/default.nix
new file mode 100644
index 000000000000..2c9b395949aa
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l-utils/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, lib, fetchurl, pkgconfig, perl
+, libjpeg, udev
+, withUtils ? true
+, withGUI ? true, alsaLib, libX11, qtbase, libGLU, wrapQtAppsHook
+}:
+
+# See libv4l in all-packages.nix for the libs only (overrides alsa, libX11 & QT)
+
+let
+ withQt = withUtils && withGUI;
+
+# we need to use stdenv.mkDerivation in order not to pollute the libv4l’s closure with Qt
+in stdenv.mkDerivation rec {
+ pname = "v4l-utils";
+ version = "1.20.0";
+
+ src = fetchurl {
+ url = "https://linuxtv.org/downloads/${pname}/${pname}-${version}.tar.bz2";
+ sha256 = "1xr66y6w422hil6s7n8d61a2vhwh4im8l267amf41jvw7xqihqcm";
+ };
+
+ outputs = [ "out" ] ++ lib.optional withUtils "lib" ++ [ "dev" ];
+
+ configureFlags = (if withUtils then [
+ "--with-localedir=${placeholder "lib"}/share/locale"
+ "--with-udevdir=${placeholder "out"}/lib/udev"
+ ] else [
+ "--disable-v4l-utils"
+ ]);
+
+ postFixup = ''
+ # Create symlink for V4l1 compatibility
+ ln -s "$dev/include/libv4l1-videodev.h" "$dev/include/videodev.h"
+ '';
+
+ nativeBuildInputs = [ pkgconfig perl ] ++ lib.optional withQt wrapQtAppsHook;
+
+ buildInputs = [ udev ] ++ lib.optionals withQt [ alsaLib libX11 qtbase libGLU ];
+
+ propagatedBuildInputs = [ libjpeg ];
+
+ postPatch = ''
+ patchShebangs utils/cec-ctl/msg2ctl.pl
+ patchShebangs utils/libcecutil/cec-gen.pl
+ '';
+
+ meta = with stdenv.lib; {
+ description = "V4L utils and libv4l, provide common image formats regardless of the v4l device";
+ homepage = "https://linuxtv.org/projects.php";
+ license = licenses.lgpl21Plus;
+ maintainers = with maintainers; [ codyopel ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l2loopback/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l2loopback/default.nix
new file mode 100644
index 000000000000..32ae45fbb0ea
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v4l2loopback/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, kernel, kmod }:
+
+stdenv.mkDerivation rec {
+ name = "v4l2loopback-${version}-${kernel.version}";
+ version = "0.12.5";
+
+ src = fetchFromGitHub {
+ owner = "umlaeute";
+ repo = "v4l2loopback";
+ rev = "v${version}";
+ sha256 = "1qi4l6yam8nrlmc3zwkrz9vph0xsj1cgmkqci4652mbpbzigg7vn";
+ };
+
+ hardeningDisable = [ "format" "pic" ];
+
+ preBuild = ''
+ substituteInPlace Makefile --replace "modules_install" "INSTALL_MOD_PATH=$out modules_install"
+ sed -i '/depmod/d' Makefile
+ export PATH=${kmod}/sbin:$PATH
+ '';
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+ buildInputs = [ kmod ];
+
+ makeFlags = [
+ "KERNELRELEASE=${kernel.modDirVersion}"
+ "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A kernel module to create V4L2 loopback devices";
+ homepage = "https://github.com/umlaeute/v4l2loopback";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.domenkozar ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v86d/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v86d/default.nix
new file mode 100644
index 000000000000..ec0c318042a1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/v86d/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl
+, kernel, klibc
+}:
+
+stdenv.mkDerivation rec {
+ name = "v86d-${version}-${kernel.version}";
+ version = "0.1.10";
+
+ src = fetchurl {
+ url = "https://github.com/mjanusz/v86d/archive/v86d-${version}.tar.gz";
+ sha256 = "1flnpp8rc945cxr6jr9dlm8mi8gr181zrp2say4269602s1a4ymg";
+ };
+
+ patchPhase = ''
+ patchShebangs configure
+ '';
+
+ configureFlags = [ "--with-klibc" "--with-x86emu" ];
+
+ hardeningDisable = [ "stackprotector" ];
+
+ makeFlags = [
+ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
+ "DESTDIR=$(out)"
+ ];
+
+ configurePhase = ''
+ ./configure $configureFlags
+ '';
+
+ buildInputs = [ klibc ];
+
+ meta = with stdenv.lib; {
+ description = "A daemon to run x86 code in an emulated environment";
+ homepage = "https://github.com/mjanusz/v86d";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ codyopel ];
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/virtualbox/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/virtualbox/default.nix
new file mode 100644
index 000000000000..f795d36207a8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/virtualbox/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, virtualbox, kernel }:
+
+stdenv.mkDerivation {
+ name = "virtualbox-modules-${virtualbox.version}-${kernel.version}";
+ src = virtualbox.modsrc;
+ hardeningDisable = [
+ "fortify" "pic" "stackprotector"
+ ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
+
+ makeFlags = [ "INSTALL_MOD_PATH=$(out)" ];
+ installTargets = [ "install" ];
+
+ enableParallelBuilding = true;
+
+ meta = virtualbox.meta // {
+ description = virtualbox.meta.description + " (kernel modules)";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireguard/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireguard/default.nix
new file mode 100644
index 000000000000..b8b65fecafc2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireguard/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchzip, kernel, perl, wireguard-tools, bc }:
+
+# module requires Linux >= 3.10 https://www.wireguard.io/install/#kernel-requirements
+assert stdenv.lib.versionAtLeast kernel.version "3.10";
+# wireguard upstreamed since 5.6 https://lists.zx2c4.com/pipermail/wireguard/2019-December/004704.html
+assert stdenv.lib.versionOlder kernel.version "5.6";
+
+stdenv.mkDerivation rec {
+ pname = "wireguard";
+ version = "1.0.20200908";
+
+ src = fetchzip {
+ url = "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${version}.tar.xz";
+ sha256 = "1nd2kc3c62907kxm1084dw7krd8xsy3hxydmcpz4jvk03vm5dnkg";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
+
+ nativeBuildInputs = [ perl bc ] ++ kernel.moduleBuildDependencies;
+
+ preBuild = "cd src";
+ buildFlags = [ "module" ];
+
+ INSTALL_MOD_PATH = placeholder "out";
+ installFlags = [ "DEPMOD=true" ];
+ enableParallelBuilding = true;
+
+ passthru = {
+ # remove this when our kernel comes with native wireguard support
+ # and our tests no longer tests this package
+ inherit (wireguard-tools) tests;
+ };
+
+ meta = with stdenv.lib; {
+ inherit (wireguard-tools.meta) homepage license maintainers;
+ description = "Kernel module for the WireGuard secure network tunnel";
+ downloadPage = "https://git.zx2c4.com/wireguard-linux-compat/refs/";
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireless-tools/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireless-tools/default.nix
new file mode 100644
index 000000000000..687bb7647cf8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wireless-tools/default.nix
@@ -0,0 +1,24 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+ pname = "wireless-tools";
+ version = "30.pre9";
+
+ src = fetchurl {
+ url = "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.${version}.tar.gz";
+ sha256 = "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb";
+ };
+
+ makeFlags = [
+ "PREFIX=${placeholder "out"}"
+ "CC:=$(CC)"
+ "AR:=$(AR)"
+ "RANLIB:=$(RANLIB)"
+ "LDCONFIG=:"
+ ];
+
+ meta = {
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/default.nix
new file mode 100644
index 000000000000..0093603c250c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/default.nix
@@ -0,0 +1,23 @@
+{ stdenv }:
+
+stdenv.mkDerivation rec {
+ pname = "wooting-udev-rules";
+ version = "20190601";
+
+ # Source: https://wooting.helpscoutdocs.com/article/68-wootility-configuring-device-access-for-wootility-under-linux-udev-rules
+ src = [ ./wooting.rules ];
+
+ unpackPhase = ":";
+
+ installPhase = ''
+ install -Dpm644 $src $out/lib/udev/rules.d/70-wooting.rules
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://wooting.helpscoutdocs.com/article/34-linux-udev-rules";
+ description = "udev rules that give NixOS permission to communicate with Wooting keyboards";
+ platforms = platforms.linux;
+ license = "unknown";
+ maintainers = with maintainers; [ davidtwco ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules
new file mode 100644
index 000000000000..d906df3d4c6a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wooting-udev-rules/wooting.rules
@@ -0,0 +1,9 @@
+# Wooting One
+SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff01", MODE:="0660", GROUP="input"
+# Wooting One update mode
+SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2402", MODE:="0660", GROUP="input"
+
+# Wooting Two
+SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff02", MODE:="0660", GROUP="input"
+# Wooting Two update mode
+SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2403", MODE:="0660", GROUP="input"
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/default.nix
new file mode 100644
index 000000000000..5cd440bcdfc7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/default.nix
@@ -0,0 +1,114 @@
+{ stdenv, fetchurl, openssl, pkgconfig, libnl
+, dbus, readline ? null, pcsclite ? null
+}:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ version = "2.9";
+
+ pname = "wpa_supplicant";
+
+ src = fetchurl {
+ url = "https://w1.fi/releases/${pname}-${version}.tar.gz";
+ sha256 = "05qzak1mssnxcgdrafifxh9w86a4ha69qabkg4bsigk499xyxggw";
+ };
+
+ patches = [
+ (fetchurl {
+ name = "CVE-2019-16275.patch";
+ url = "https://w1.fi/security/2019-7/0001-AP-Silently-ignore-management-frame-from-unexpected-.patch";
+ sha256 = "15xjyy7crb557wxpx898b5lnyblxghlij0xby5lmj9hpwwss34dz";
+ })
+ ];
+
+ # TODO: Patch epoll so that the dbus actually responds
+ # TODO: Figure out how to get privsep working, currently getting SIGBUS
+ extraConfig = ''
+ CONFIG_AP=y
+ CONFIG_LIBNL32=y
+ CONFIG_EAP_FAST=y
+ CONFIG_EAP_PWD=y
+ CONFIG_EAP_PAX=y
+ CONFIG_EAP_SAKE=y
+ CONFIG_EAP_GPSK=y
+ CONFIG_EAP_GPSK_SHA256=y
+ CONFIG_WPS=y
+ CONFIG_WPS_ER=y
+ CONFIG_WPS_NFS=y
+ CONFIG_EAP_IKEV2=y
+ CONFIG_EAP_EKE=y
+ CONFIG_HT_OVERRIDES=y
+ CONFIG_VHT_OVERRIDES=y
+ CONFIG_ELOOP=eloop
+ #CONFIG_ELOOP_EPOLL=y
+ CONFIG_L2_PACKET=linux
+ CONFIG_IEEE80211W=y
+ CONFIG_TLS=openssl
+ CONFIG_TLSV11=y
+ #CONFIG_TLSV12=y see #8332
+ CONFIG_IEEE80211R=y
+ CONFIG_DEBUG_SYSLOG=y
+ #CONFIG_PRIVSEP=y
+ CONFIG_IEEE80211N=y
+ CONFIG_IEEE80211AC=y
+ CONFIG_INTERNETWORKING=y
+ CONFIG_HS20=y
+ CONFIG_P2P=y
+ CONFIG_TDLS=y
+ CONFIG_BGSCAN_SIMPLE=y
+ '' + optionalString (pcsclite != null) ''
+ CONFIG_EAP_SIM=y
+ CONFIG_EAP_AKA=y
+ CONFIG_EAP_AKA_PRIME=y
+ CONFIG_PCSC=y
+ '' + optionalString (dbus != null) ''
+ CONFIG_CTRL_IFACE_DBUS=y
+ CONFIG_CTRL_IFACE_DBUS_NEW=y
+ CONFIG_CTRL_IFACE_DBUS_INTRO=y
+ '' + (if readline != null then ''
+ CONFIG_READLINE=y
+ '' else ''
+ CONFIG_WPA_CLI_EDIT=y
+ '');
+
+ preBuild = ''
+ for manpage in wpa_supplicant/doc/docbook/wpa_supplicant.conf* ; do
+ substituteInPlace "$manpage" --replace /usr/share/doc $out/share/doc
+ done
+ cd wpa_supplicant
+ cp -v defconfig .config
+ echo "$extraConfig" >> .config
+ cat -n .config
+ substituteInPlace Makefile --replace /usr/local $out
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE \
+ -I$(echo "${stdenv.lib.getDev libnl}"/include/libnl*/) \
+ -I${stdenv.lib.getDev pcsclite}/include/PCSC/"
+ '';
+
+ buildInputs = [ openssl libnl dbus readline pcsclite ];
+
+ nativeBuildInputs = [ pkgconfig ];
+
+ postInstall = ''
+ mkdir -p $out/share/man/man5 $out/share/man/man8
+ cp -v "doc/docbook/"*.5 $out/share/man/man5/
+ cp -v "doc/docbook/"*.8 $out/share/man/man8/
+
+ mkdir -p $out/share/dbus-1/system.d $out/share/dbus-1/system-services $out/etc/systemd/system
+ cp -v "dbus/"*service $out/share/dbus-1/system-services
+ sed -e "s@/sbin/wpa_supplicant@$out&@" -i "$out/share/dbus-1/system-services/"*
+ cp -v dbus/dbus-wpa_supplicant.conf $out/share/dbus-1/system.d
+ cp -v "systemd/"*.service $out/etc/systemd/system
+
+ rm $out/share/man/man8/wpa_priv.8
+ install -Dm444 wpa_supplicant.conf $out/share/doc/wpa_supplicant/wpa_supplicant.conf.example
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = "https://hostap.epitest.fi/wpa_supplicant/";
+ description = "A tool for connecting to WPA and WPA2-protected wireless networks";
+ license = licenses.bsd3;
+ maintainers = with maintainers; [ marcweber ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/gui.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/gui.nix
new file mode 100644
index 000000000000..132cad4b6d29
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/wpa_supplicant/gui.nix
@@ -0,0 +1,41 @@
+{ stdenv, mkDerivation, fetchpatch, qtbase, qmake, inkscape, imagemagick, wpa_supplicant }:
+
+mkDerivation {
+ name = "wpa_gui-${wpa_supplicant.version}";
+
+ inherit (wpa_supplicant) src;
+
+ patches = [
+ # Fix build with Inkscape 1.0
+ # https://github.com/NixOS/nixpkgs/issues/86930
+ (fetchpatch {
+ url = "https://w1.fi/cgit/hostap/patch/?id=0388992905a5c2be5cba9497504eaea346474754";
+ sha256 = "05hs74qawa433adripzhycm45g7yvxr6074nd4zcl4gabzp9hd30";
+ })
+ ];
+
+ buildInputs = [ qtbase ];
+ nativeBuildInputs = [ qmake inkscape imagemagick ];
+
+ postPatch = ''
+ cd wpa_supplicant/wpa_gui-qt4
+ '';
+
+ postBuild = ''
+ make -C icons
+ '';
+
+ postInstall = ''
+ mkdir -pv $out/{bin,share/applications,share/icons}
+ cp -v wpa_gui $out/bin
+ cp -v wpa_gui.desktop $out/share/applications
+ cp -av icons/hicolor $out/share/icons
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Qt-based GUI for wpa_supplicant";
+ homepage = "https://hostap.epitest.fi/wpa_supplicant/";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix
new file mode 100644
index 000000000000..880456afbde2
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, kernel }:
+
+stdenv.mkDerivation {
+ name = "x86_energy_perf_policy-${kernel.version}";
+
+ src = kernel.src;
+
+ postPatch = ''
+ cd tools/power/x86/x86_energy_perf_policy
+ sed -i 's,/usr,,g' Makefile
+ '';
+
+ preInstall = ''
+ mkdir -p $out/bin $out/share/man/man8
+ '';
+
+ makeFlags = [ "DESTDIR=$(out)" ];
+
+ meta = with stdenv.lib; {
+ description = "Set the energy versus performance policy preference bias on recent X86 processors";
+ homepage = "https://www.kernel.org/";
+ license = licenses.gpl2;
+ platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86info/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86info/default.nix
new file mode 100644
index 000000000000..9b745315b1cf
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/x86info/default.nix
@@ -0,0 +1,40 @@
+{stdenv, fetchurl, pciutils, python}:
+
+stdenv.mkDerivation rec {
+ version = "1.30";
+ pname = "x86info";
+
+ src = fetchurl {
+ url = "http://codemonkey.org.uk/projects/x86info/${pname}-${version}.tgz";
+ sha256 = "0a4lzka46nabpsrg3n7akwr46q38f96zfszd73xcback1s2hjc7y";
+ };
+
+ preConfigure = ''
+ patchShebangs .
+
+ # ignore warnings
+ sed -i 's/-Werror -Wall//' Makefile
+ '';
+
+ buildInputs = [ pciutils python ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp x86info lsmsr $out/bin
+ '';
+
+ meta = {
+ description = "Identification utility for the x86 series of processors";
+ longDescription =
+ ''
+ x86info will identify all Intel/AMD/Centaur/Cyrix/VIA CPUs. It leverages
+ the cpuid kernel module where possible. it supports parsing model specific
+ registers (MSRs) via the msr kernel module. it will approximate processor
+ frequency, and identify the cache sizes and layout.
+ '';
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ license = stdenv.lib.licenses.gpl2;
+ homepage = "http://codemonkey.org.uk/projects/x86info/";
+ maintainers = with stdenv.lib.maintainers; [jcumming];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-cmt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-cmt/default.nix
new file mode 100644
index 000000000000..93fd7dd5b0e6
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-cmt/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, pkgconfig, xorgserver, xorgproto,
+ utilmacros, libgestures, libevdevc }:
+
+stdenv.mkDerivation rec {
+ pname = "xf86-input-cmt";
+ version = "2.0.2";
+ src = fetchFromGitHub {
+ owner = "hugegreenbug";
+ repo = "xf86-input-cmt";
+ rev = "v${version}";
+ sha256 = "1cnwf518nc0ybc1r3rsgc1gcql1k3785khffv0i4v3akrm9wdw98";
+ };
+
+ postPatch = ''
+ patchShebangs ./apply_patches.sh
+ ./apply_patches.sh
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [
+ xorgserver xorgproto utilmacros
+ libgestures libevdevc
+ ];
+
+ configureFlags = [
+ "--with-sdkdir=${placeholder "out"}"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Chromebook touchpad driver";
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ homepage = "https://www.github.com/hugegreenbug/xf86-input-cmt";
+ maintainers = with maintainers; [ kcalvinalvin ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-wacom/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-wacom/default.nix
new file mode 100644
index 000000000000..8a7541afa692
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-input-wacom/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl
+, xorgproto, libX11, libXext, libXi, libXrandr, libXrender
+, ncurses, pkgconfig, xorgserver, udev, libXinerama, pixman }:
+
+stdenv.mkDerivation rec {
+ name = "xf86-input-wacom-0.36.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/linuxwacom/${name}.tar.bz2";
+ sha256 = "1xi39hl8ddgj9m7m2k2ll2r3wh0k0aq45fvrsv43651bhz9cbrza";
+ };
+
+ buildInputs = [ xorgproto libX11 libXext libXi libXrandr libXrender
+ ncurses pkgconfig xorgserver udev libXinerama pixman ];
+
+ preConfigure = ''
+ mkdir -p $out/share/X11/xorg.conf.d
+ configureFlags="--with-xorg-module-dir=$out/lib/xorg/modules
+ --with-sdkdir=$out/include/xorg --with-xorg-conf-dir=$out/share/X11/xorg.conf.d"
+ '';
+
+ CFLAGS = "-I${pixman}/include/pixman-1";
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.goibhniu ];
+ description = "Wacom digitizer driver for X11";
+ homepage = "http://linuxwacom.sourceforge.net";
+ license = licenses.gpl2;
+ platforms = platforms.linux; # Probably, works with other unices as well
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix
new file mode 100644
index 000000000000..f86393cba84d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchgit, autoreconfHook, xorgproto, libX11, libXext
+, pixman, pkgconfig, utilmacros, xorgserver
+}:
+
+stdenv.mkDerivation {
+ name = "xf86-video-nested-2017-06-12";
+
+ src = fetchgit {
+ url = "git://anongit.freedesktop.org/xorg/driver/xf86-video-nested";
+ rev = "6a48b385c41ea89354d0b2ee7f4649a1d1d9ec70";
+ sha256 = "133rd2kvr2q2wmwpx82bb93qbi8wm8qp1vlmbhgc7aslz0j4cqqv";
+ };
+
+ buildInputs =
+ [ autoreconfHook xorgproto libX11 libXext pixman
+ pkgconfig utilmacros xorgserver
+ ];
+
+ hardeningDisable = [ "fortify" ];
+
+ CFLAGS = "-I${pixman}/include/pixman-1";
+
+ meta = with stdenv.lib; {
+ homepage = "https://cgit.freedesktop.org/xorg/driver/xf86-video-nested";
+ description = "A driver to run Xorg on top of Xorg or something else";
+ maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
+ license = licenses.mit;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xpadneo/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xpadneo/default.nix
new file mode 100644
index 000000000000..5f1018969212
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xpadneo/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, kernel, bluez }:
+
+stdenv.mkDerivation rec {
+ pname = "xpadneo";
+ version = "0.8.3";
+
+ src = fetchFromGitHub {
+ owner = "atar-axis";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1g3ml7vq0dzwl9815c3l0i0qz3a7v8c376c6dqbfkbj2f1d43vqs";
+ };
+
+ setSourceRoot = ''
+ export sourceRoot=$(pwd)/source/hid-xpadneo/src
+ '';
+
+ postPatch = ''
+ # Set kernel module version
+ substituteInPlace hid-xpadneo.c \
+ --subst-var-by DO_NOT_CHANGE ${version}
+ '';
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+ buildInputs = [ bluez ];
+
+ makeFlags = [
+ "-C"
+ "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ "M=$(sourceRoot)"
+ ];
+
+ buildFlags = [ "modules" ];
+ installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
+ installTargets = [ "modules_install" ];
+
+ meta = with stdenv.lib; {
+ description = "Advanced Linux driver for Xbox One wireless controllers";
+ homepage = "https://atar-axis.github.io/xpadneo";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/default.nix
new file mode 100644
index 000000000000..440a797a7232
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, lib, fetchurl, gtk2, pkgconfig, lm_sensors }:
+
+stdenv.mkDerivation rec {
+ pname = "xsensors";
+ version = "0.70";
+ src = fetchurl {
+ url = "http://www.linuxhardware.org/xsensors/xsensors-${version}.tar.gz";
+ sha256 = "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh";
+ };
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = [
+ gtk2 lm_sensors
+ ];
+ patches = [
+ ./remove-unused-variables.patch
+ ./replace-deprecated-gtk.patch
+ ];
+ meta = with lib; {
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cstrahan ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/remove-unused-variables.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/remove-unused-variables.patch
new file mode 100644
index 000000000000..7da97a0e56e8
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/remove-unused-variables.patch
@@ -0,0 +1,39 @@
+Author: Nanley Chery <nanleychery@gmail.com>
+From: Jean Delvare <khali@linux-fr.org>
+Subject: Remove declared, but unused variables
+Bug-Debian: http://bugs.debian.org/625435
+---
+--- a/src/gui.c
++++ b/src/gui.c
+@@ -257,10 +257,9 @@
+
+ /* Start the sensor info update timer. */
+ gint start_timer( GtkWidget *widget, gpointer data ) {
+- gint timer;
+
+ /* Setup timer for updates. */
+- timer = g_timeout_add( update_time * 1000,
++ g_timeout_add( update_time * 1000,
+ (GtkFunction) update_sensor_data,
+ (gpointer) data );
+
+@@ -287,7 +286,7 @@
+
+ /* feature data */
+ updates *head = NULL;
+- updates *current = NULL, *prev = NULL;
++ updates *current = NULL;
+
+ const sensors_feature *feature;
+
+@@ -347,10 +346,8 @@
+ new_node->pbar = featpbar;
+
+ if ( head == NULL ) {
+- prev = head;
+ head = current = new_node;
+ } else {
+- prev = current;
+ current = current->next = new_node;
+ }
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/replace-deprecated-gtk.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/replace-deprecated-gtk.patch
new file mode 100644
index 000000000000..fed4c7dc4c95
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/xsensors/replace-deprecated-gtk.patch
@@ -0,0 +1,168 @@
+Author: Nanley Chery <nanleychery@gmail.com>
+Subject: Update deprecated gtk casts and replace deprecated function calls with their analogous cairo counterparts.
+Bug-Debian: http://bugs.debian.org/622005
+Bug-Debian: http://bugs.debian.org/610321
+---
+--- a/src/gui.c
++++ b/src/gui.c
+@@ -27,10 +27,10 @@
+ GtkWidget *mainwindow = NULL;
+
+ GdkColor colorWhite = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
+-
+-GdkColormap *cmap = NULL;
+
+-GdkPixmap *theme = NULL;
++GdkPixbuf *theme = NULL;
++
++cairo_surface_t *surface = NULL;
+
+ /* Destroy the main window. */
+ gint destroy_gui( GtkWidget *widget, gpointer data ) {
+@@ -76,17 +76,16 @@
+ }
+ }
+
+-static void draw_digits( GtkWidget *widget, const gchar *digits, int highLow )
++static void draw_digits( GtkWidget *widget, cairo_t *cr, const gchar *digits, int highLow )
+ {
+ const gchar *digit = digits;
+ int pos = 0, x = 0, y = 0, w = 0;
+
+ while ( *digit ) {
+ get_pm_location( *digit, &x, &y, &w );
+- gdk_draw_drawable( widget->window,
+- widget->style->fg_gc[ GTK_WIDGET_STATE
+- (widget) ], theme, x, y + highLow,
+- pos, 0, w, 30 );
++ cairo_set_source_surface (cr, surface, pos-x, 0-(y + highLow));
++ cairo_rectangle(cr, pos, 0, w, 30);
++ cairo_fill(cr);
+ pos += w;
+ digit++;
+ }
+@@ -102,6 +101,8 @@
+
+ gchar result[7];
+
++ cairo_t *cr = gdk_cairo_create(widget->window);
++
+ #ifdef DEBUG_XSENSORS
+ printf( "area.width = %d, area.height = %d\n", event->area.width,
+ event->area.height );
+@@ -117,13 +118,11 @@
+
+ /* Display the digits */
+ if ( g_snprintf( result, 6, "%5.0f", current->curvalue ) >= 0 )
+- draw_digits( widget, result, highLow );
++ draw_digits( widget, cr, result, highLow );
+
+ /* Display RPM */
+- gdk_draw_drawable( widget->window,
+- widget->style->fg_gc[ GTK_WIDGET_STATE
+- (widget) ], theme, 0, 120 + highLow,
+- 90, 0, 57, 30 );
++ cairo_set_source_surface (cr, surface, 90-0, 0-(120 + highLow));
++ cairo_rectangle(cr, 90, 0, 57, 30);
+ break;
+ case TEMP:
+ if ( current->curvalue > current->curmax )
+@@ -134,17 +133,15 @@
+
+ /* Display the digits */
+ if ( g_snprintf( result, 7, "%6.1f", current->curvalue ) >= 0 )
+- draw_digits( widget, result, highLow );
++ draw_digits( widget, cr, result, highLow );
+
+ /* Display degree symbol */
+ if ( tf == FALSE )
+ x = 0;
+ else
+ x = 57;
+- gdk_draw_drawable( widget->window,
+- widget->style->fg_gc[ GTK_WIDGET_STATE
+- (widget) ], theme, x, 60 + highLow,
+- 96, 0, 57, 30 );
++ cairo_set_source_surface (cr, surface, 96-x, 0-(60 + highLow));
++ cairo_rectangle(cr, 96, 0, 57, 30);
+
+ break;
+ case VOLT:
+@@ -154,20 +151,17 @@
+
+ /* Display the digits */
+ if ( g_snprintf( result, 7, "%6.2f", current->curvalue ) >= 0 )
+- draw_digits( widget, result, highLow );
++ draw_digits( widget, cr, result, highLow );
+
+ /* Display V */
+- gdk_draw_drawable( widget->window,
+- widget->style->fg_gc[ GTK_WIDGET_STATE
+- (widget) ], theme, 114, 60 + highLow,
+- 96, 0, 57, 30 );
+-
+-
++ cairo_set_source_surface (cr, surface, 96-114, 0-(60 + highLow));
++ cairo_rectangle(cr, 96, 0, 57, 30);
+ break;
+ default:
+ break;
+ }
+-
++ cairo_fill(cr);
++ cairo_destroy(cr);
+ return TRUE;
+ }
+
+@@ -260,7 +254,7 @@
+
+ /* Setup timer for updates. */
+ g_timeout_add( update_time * 1000,
+- (GtkFunction) update_sensor_data,
++ (GSourceFunc) update_sensor_data,
+ (gpointer) data );
+
+ return SUCCESS;
+@@ -460,8 +454,6 @@
+ g_signal_connect( G_OBJECT (mainwindow), "delete_event",
+ G_CALLBACK (destroy_gui), NULL );
+
+- /* Graphics needed for drawing info. */
+- cmap = gtk_widget_get_colormap( mainwindow );
+
+ /* Set up the image file used for displaying characters. */
+ if ( imagefile == NULL ) {
+@@ -481,12 +473,10 @@
+ "Image file not found in either location! Exiting!\n" );
+ exit( 1 );
+ } else {
+- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
+- NULL, NULL, "./images/default.xpm" );
++ theme = gdk_pixbuf_new_from_file("./images/default.xpm", NULL );
+ }
+ } else {
+- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
+- NULL, NULL, imagefile );
++ theme = gdk_pixbuf_new_from_file(imagefile, NULL );
+ }
+ } else {
+ if ( stat( imagefile, &sbuf ) != 0 ) {
+@@ -495,11 +485,15 @@
+ "Image file not found in specified location! Exiting!\n" );
+ exit( 1 );
+ } else {
+- theme = gdk_pixmap_colormap_create_from_xpm( NULL, cmap,
+- NULL, NULL, imagefile );
++ theme = gdk_pixbuf_new_from_file(imagefile, NULL );
+ }
+ }
+-
++ surface = cairo_image_surface_create_for_data(gdk_pixbuf_get_pixels(theme),
++ CAIRO_FORMAT_RGB24,
++ gdk_pixbuf_get_width(theme),
++ gdk_pixbuf_get_height(theme),
++ gdk_pixbuf_get_rowstride(theme));
++
+ /* Create notebook for sensors. */
+ notebook = gtk_notebook_new( );
+ gtk_widget_modify_bg( notebook, GTK_STATE_NORMAL, &colorWhite );
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenmonitor/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenmonitor/default.nix
new file mode 100644
index 000000000000..23acaaa3e231
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenmonitor/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, pkgconfig, gtk3, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+ pname = "zenmonitor";
+ version = "1.4.2";
+
+ src = fetchFromGitHub {
+ owner = "ocerman";
+ repo = "zenmonitor";
+ rev = "v${version}";
+ sha256 = "0smv94vi36hziw42gasivyw25h5n1sgwwk1cv78id5g85w0kw246";
+ };
+
+ buildInputs = [ gtk3 ];
+ nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
+
+ makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
+ meta = with stdenv.lib; {
+ description = "Monitoring software for AMD Zen-based CPUs";
+ homepage = "https://github.com/ocerman/zenmonitor";
+ license = licenses.mit;
+ platforms = [ "i686-linux" "x86_64-linux" ];
+ maintainers = with maintainers; [ alexbakker ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenpower/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenpower/default.nix
new file mode 100644
index 000000000000..43885027d9e7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenpower/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, kernel, fetchFromGitHub, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ pname = "zenpower";
+ version = "0.1.12";
+
+ src = fetchFromGitHub {
+ owner = "ocerman";
+ repo = "zenpower";
+ rev = "v${version}";
+ sha256 = "116yrw4ygh3fqwhniaqq0nps29pq87mi2q1375f1ylkfiak8n63a";
+ };
+
+ hardeningDisable = [ "pic" ];
+
+ nativeBuildInputs = kernel.moduleBuildDependencies;
+
+ makeFlags = [ "KERNEL_BUILD=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ];
+
+ installPhase = ''
+ install -D zenpower.ko -t "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/hwmon/zenpower/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Linux kernel driver for reading temperature, voltage(SVI2), current(SVI2) and power(SVI2) for AMD Zen family CPUs.";
+ homepage = "https://github.com/ocerman/zenpower";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ alexbakker ];
+ platforms = [ "x86_64-linux" ];
+ broken = versionOlder kernel.version "4.14";
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenstates/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenstates/default.nix
new file mode 100644
index 000000000000..4ac77c00aa3b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zenstates/default.nix
@@ -0,0 +1,54 @@
+# Zenstates provides access to a variety of CPU tunables no Ryzen processors.
+#
+# In particular, I am adding Zenstates because I need it to disable the C6
+# sleep state to stabilize wake from sleep on my Lenovo x395 system. After
+# installing Zenstates, I need a before-sleep script like so:
+#
+# before-sleep = pkgs.writeScript "before-sleep" ''
+# #!${pkgs.bash}/bin/bash
+# ${pkgs.zenstates}/bin/zenstates --c6-disable
+# '';
+#
+# ...
+#
+# systemd.services.before-sleep = {
+# description = "Jobs to run before going to sleep";
+# serviceConfig = {
+# Type = "oneshot";
+# ExecStart = "${before-sleep}";
+# };
+# wantedBy = [ "sleep.target" ];
+# before = [ "sleep.target" ];
+# };
+
+{ stdenv, fetchFromGitHub, python3 }:
+stdenv.mkDerivation rec {
+ pname = "zenstates";
+ version = "0.0.1";
+
+ src = fetchFromGitHub {
+ owner = "r4m0n";
+ repo = "ZenStates-Linux";
+ rev = "0bc27f4740e382f2a2896dc1dabfec1d0ac96818";
+ sha256 = "1h1h2n50d2cwcyw3zp4lamfvrdjy1gjghffvl3qrp6arfsfa615y";
+ };
+
+ buildInputs = [ python3 ];
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp $src/zenstates.py $out/bin/zenstates
+ chmod +x $out/bin/zenstates
+ patchShebangs --build $out/bin/zenstates
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Linux utility for Ryzen processors and motherboards";
+ homepage = "https://github.com/r4m0n/ZenStates-Linux";
+ license = licenses.mit;
+ maintainers = with maintainers; [ savannidgerinel ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/BACKPORT-Linux-5.8-compat-__vmalloc.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/BACKPORT-Linux-5.8-compat-__vmalloc.patch
new file mode 100644
index 000000000000..780ce83d84f3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/BACKPORT-Linux-5.8-compat-__vmalloc.patch
@@ -0,0 +1,154 @@
+From 6cc95288ccea12ad7b67b2b5b3997dfad8e5b5c9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20Niew=C3=B6hner?=
+ <c0d3z3r0@users.noreply.github.com>
+Date: Tue, 9 Jun 2020 01:32:02 +0200
+Subject: [PATCH] BACKPORT: Linux 5.8 compat: __vmalloc()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The `pgprot` argument has been removed from `__vmalloc` in Linux 5.8,
+being `PAGE_KERNEL` always now [1].
+
+Detect this during configure and define a wrapper for older kernels.
+
+[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/mm/vmalloc.c?h=next-20200605&id=88dca4ca5a93d2c09e5bbc6a62fbfc3af83c4fca
+
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
+Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
+Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
+Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
+Closes #10422
+---
+ config/kernel-kmem.m4 | 26 ++++++++++++++++++++++++++
+ config/kernel.m4 | 2 ++
+ include/spl/sys/kmem.h | 9 +++++++++
+ module/spl/spl-kmem-cache.c | 4 ++--
+ module/spl/spl-kmem.c | 9 ++++-----
+ 5 files changed, 43 insertions(+), 7 deletions(-)
+
+diff --git a/config/kernel-kmem.m4 b/config/kernel-kmem.m4
+index cc055e530..f1c0d2412 100644
+--- a/config/kernel-kmem.m4
++++ b/config/kernel-kmem.m4
+@@ -56,3 +56,29 @@ AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
+ AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
+ AC_MSG_RESULT([$enable_debug_kmem_tracking])
+ ])
++
++dnl #
++dnl # 5.8 API,
++dnl # __vmalloc PAGE_KERNEL removal
++dnl #
++AC_DEFUN([ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL], [
++ ZFS_LINUX_TEST_SRC([__vmalloc], [
++ #include <linux/mm.h>
++ #include <linux/vmalloc.h>
++ ],[
++ void *p __attribute__ ((unused));
++
++ p = __vmalloc(0, GFP_KERNEL, PAGE_KERNEL);
++ ])
++])
++
++AC_DEFUN([ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL], [
++ AC_MSG_CHECKING([whether __vmalloc(ptr, flags, pageflags) is available])
++ ZFS_LINUX_TEST_RESULT([__vmalloc], [
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_VMALLOC_PAGE_KERNEL, 1, [__vmalloc page flags exists])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
++])
++-
+diff --git a/config/kernel.m4 b/config/kernel.m4
+index b67fcef8c..23edfdcd8 100644
+--- a/config/kernel.m4
++++ b/config/kernel.m4
+@@ -45,6 +45,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
+ ZFS_AC_KERNEL_SRC_SCHED
+ ZFS_AC_KERNEL_SRC_USLEEP_RANGE
+ ZFS_AC_KERNEL_SRC_KMEM_CACHE
++ ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL
+ ZFS_AC_KERNEL_SRC_WAIT
+ ZFS_AC_KERNEL_SRC_INODE_TIMES
+ ZFS_AC_KERNEL_SRC_INODE_LOCK
+@@ -163,6 +164,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
+ ZFS_AC_KERNEL_SCHED
+ ZFS_AC_KERNEL_USLEEP_RANGE
+ ZFS_AC_KERNEL_KMEM_CACHE
++ ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL
+ ZFS_AC_KERNEL_WAIT
+ ZFS_AC_KERNEL_INODE_TIMES
+ ZFS_AC_KERNEL_INODE_LOCK
+diff --git a/include/spl/sys/kmem.h b/include/spl/sys/kmem.h
+index 72d3a7765..ca15bfe7f 100644
+--- a/include/spl/sys/kmem.h
++++ b/include/spl/sys/kmem.h
+@@ -169,6 +169,15 @@ extern void *spl_kmem_alloc(size_t sz, int fl, const char *func, int line);
+ extern void *spl_kmem_zalloc(size_t sz, int fl, const char *func, int line);
+ extern void spl_kmem_free(const void *ptr, size_t sz);
+
++/*
++ * 5.8 API change, pgprot_t argument removed.
++ */
++#ifdef HAVE_VMALLOC_PAGE_KERNEL
++#define spl_vmalloc(size, flags) __vmalloc(size, flags, PAGE_KERNEL)
++#else
++#define spl_vmalloc(size, flags) __vmalloc(size, flags)
++#endif
++
+ /*
+ * The following functions are only available for internal use.
+ */
+diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c
+index d71b4b348..4866b2993 100644
+--- a/module/spl/spl-kmem-cache.c
++++ b/module/spl/spl-kmem-cache.c
+@@ -203,7 +203,7 @@ kv_alloc(spl_kmem_cache_t *skc, int size, int flags)
+ ASSERT(ISP2(size));
+ ptr = (void *)__get_free_pages(lflags, get_order(size));
+ } else {
+- ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL);
++ ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
+ }
+
+ /* Resulting allocated memory will be page aligned */
+@@ -1242,7 +1242,7 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj)
+ * allocation.
+ *
+ * However, this can't be applied to KVM_VMEM due to a bug that
+- * __vmalloc() doesn't honor gfp flags in page table allocation.
++ * spl_vmalloc() doesn't honor gfp flags in page table allocation.
+ */
+ if (!(skc->skc_flags & KMC_VMEM)) {
+ rc = __spl_cache_grow(skc, flags | KM_NOSLEEP);
+diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
+index cee69ad43..ca1fc145f 100644
+--- a/module/spl/spl-kmem.c
++++ b/module/spl/spl-kmem.c
+@@ -172,16 +172,15 @@ spl_kmem_alloc_impl(size_t size, int flags, int node)
+ * kmem_zalloc() callers.
+ *
+ * For vmem_alloc() and vmem_zalloc() callers it is permissible
+- * to use __vmalloc(). However, in general use of __vmalloc()
+- * is strongly discouraged because a global lock must be
+- * acquired. Contention on this lock can significantly
++ * to use spl_vmalloc(). However, in general use of
++ * spl_vmalloc() is strongly discouraged because a global lock
++ * must be acquired. Contention on this lock can significantly
+ * impact performance so frequently manipulating the virtual
+ * address space is strongly discouraged.
+ */
+ if ((size > spl_kmem_alloc_max) || use_vmem) {
+ if (flags & KM_VMEM) {
+- ptr = __vmalloc(size, lflags | __GFP_HIGHMEM,
+- PAGE_KERNEL);
++ ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
+ } else {
+ return (NULL);
+ }
+--
+2.25.1
+
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/default.nix
new file mode 100644
index 000000000000..14b0909a189e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/zfs/default.nix
@@ -0,0 +1,214 @@
+{ stdenv, fetchFromGitHub, fetchpatch
+, autoreconfHook, utillinux, nukeReferences, coreutils
+, perl, buildPackages
+, configFile ? "all"
+
+# Userspace dependencies
+, zlib, libuuid, python3, attr, openssl
+, libtirpc
+, nfs-utils
+, gawk, gnugrep, gnused, systemd
+, smartmontools, sysstat, sudo
+, pkgconfig
+
+# Kernel dependencies
+, kernel ? null
+, enablePython ? true
+}:
+
+with stdenv.lib;
+let
+ buildKernel = any (n: n == configFile) [ "kernel" "all" ];
+ buildUser = any (n: n == configFile) [ "user" "all" ];
+
+ common = { version
+ , sha256
+ , extraPatches ? []
+ , rev ? "zfs-${version}"
+ , isUnstable ? false
+ , incompatibleKernelVersion ? null }:
+ if buildKernel &&
+ (incompatibleKernelVersion != null) &&
+ versionAtLeast kernel.version incompatibleKernelVersion then
+ throw ''
+ Linux v${kernel.version} is not yet supported by zfsonlinux v${version}.
+ ${stdenv.lib.optionalString (!isUnstable) "Try zfsUnstable or set the NixOS option boot.zfs.enableUnstable."}
+ ''
+ else stdenv.mkDerivation {
+ name = "zfs-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
+
+ src = fetchFromGitHub {
+ owner = "zfsonlinux";
+ repo = "zfs";
+ inherit rev sha256;
+ };
+
+ patches = extraPatches;
+
+ postPatch = optionalString buildKernel ''
+ patchShebangs scripts
+ # The arrays must remain the same length, so we repeat a flag that is
+ # already part of the command and therefore has no effect.
+ substituteInPlace ./module/${optionalString isUnstable "os/linux/"}zfs/zfs_ctldir.c \
+ --replace '"/usr/bin/env", "umount"' '"${utillinux}/bin/umount", "-n"' \
+ --replace '"/usr/bin/env", "mount"' '"${utillinux}/bin/mount", "-n"'
+ '' + optionalString buildUser ''
+ substituteInPlace ./lib/libzfs/libzfs_mount.c --replace "/bin/umount" "${utillinux}/bin/umount" \
+ --replace "/bin/mount" "${utillinux}/bin/mount"
+ substituteInPlace ./lib/libshare/${optionalString isUnstable "os/linux/"}nfs.c --replace "/usr/sbin/exportfs" "${
+ # We don't *need* python support, but we set it like this to minimize closure size:
+ # If it's disabled by default, no need to enable it, even if we have python enabled
+ # And if it's enabled by default, only change that if we explicitly disable python to remove python from the closure
+ nfs-utils.override (old: { enablePython = old.enablePython or true && enablePython; })
+ }/bin/exportfs"
+ substituteInPlace ./config/user-systemd.m4 --replace "/usr/lib/modules-load.d" "$out/etc/modules-load.d"
+ substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" \
+ --replace "/etc/default" "$out/etc/default"
+ substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
+ substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
+
+ substituteInPlace ./contrib/initramfs/hooks/Makefile.am \
+ --replace "/usr/share/initramfs-tools/hooks" "$out/usr/share/initramfs-tools/hooks"
+ substituteInPlace ./contrib/initramfs/Makefile.am \
+ --replace "/usr/share/initramfs-tools" "$out/usr/share/initramfs-tools"
+ substituteInPlace ./contrib/initramfs/scripts/Makefile.am \
+ --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts"
+ substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \
+ --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top"
+ substituteInPlace ./contrib/initramfs/scripts/Makefile.am \
+ --replace "/usr/share/initramfs-tools/scripts" "$out/usr/share/initramfs-tools/scripts"
+ substituteInPlace ./contrib/initramfs/scripts/local-top/Makefile.am \
+ --replace "/usr/share/initramfs-tools/scripts/local-top" "$out/usr/share/initramfs-tools/scripts/local-top"
+ substituteInPlace ./etc/systemd/system/Makefile.am \
+ --replace '$(DESTDIR)$(systemdunitdir)' "$out"'$(DESTDIR)$(systemdunitdir)'
+
+ ${optionalString isUnstable ''
+ substituteInPlace ./contrib/initramfs/conf.d/Makefile.am \
+ --replace "/usr/share/initramfs-tools/conf.d" "$out/usr/share/initramfs-tools/conf.d"
+ substituteInPlace ./contrib/initramfs/conf-hooks.d/Makefile.am \
+ --replace "/usr/share/initramfs-tools/conf-hooks.d" "$out/usr/share/initramfs-tools/conf-hooks.d"
+ ''}
+
+ substituteInPlace ./etc/systemd/system/zfs-share.service.in \
+ --replace "/bin/rm " "${coreutils}/bin/rm "
+
+ substituteInPlace ./cmd/vdev_id/vdev_id \
+ --replace "PATH=/bin:/sbin:/usr/bin:/usr/sbin" \
+ "PATH=${makeBinPath [ coreutils gawk gnused gnugrep systemd ]}"
+ '';
+
+ nativeBuildInputs = [ autoreconfHook nukeReferences ]
+ ++ optionals buildKernel (kernel.moduleBuildDependencies ++ [ perl ])
+ ++ optional buildUser pkgconfig;
+ buildInputs = optionals buildUser [ zlib libuuid attr libtirpc ]
+ ++ optional buildUser openssl
+ ++ optional (buildUser && enablePython) python3;
+
+ # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
+ NIX_CFLAGS_LINK = "-lgcc_s";
+
+ hardeningDisable = [ "fortify" "stackprotector" "pic" ];
+
+ configureFlags = [
+ "--with-config=${configFile}"
+ "--with-tirpc=1"
+ (withFeatureAs (buildUser && enablePython) "python" python3.interpreter)
+ ] ++ optionals buildUser [
+ "--with-dracutdir=$(out)/lib/dracut"
+ "--with-udevdir=$(out)/lib/udev"
+ "--with-systemdunitdir=$(out)/etc/systemd/system"
+ "--with-systemdpresetdir=$(out)/etc/systemd/system-preset"
+ "--with-systemdgeneratordir=$(out)/lib/systemd/system-generator"
+ "--with-mounthelperdir=$(out)/bin"
+ "--libexecdir=$(out)/libexec"
+ "--sysconfdir=/etc"
+ "--localstatedir=/var"
+ "--enable-systemd"
+ ] ++ optionals buildKernel ([
+ "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
+ "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+ ] ++ kernel.makeFlags);
+
+ makeFlags = optionals buildKernel kernel.makeFlags;
+
+ enableParallelBuilding = true;
+
+ installFlags = [
+ "sysconfdir=\${out}/etc"
+ "DEFAULT_INITCONF_DIR=\${out}/default"
+ "INSTALL_MOD_PATH=\${out}"
+ ];
+
+ postInstall = optionalString buildKernel ''
+ # Add reference that cannot be detected due to compressed kernel module
+ mkdir -p "$out/nix-support"
+ echo "${utillinux}" >> "$out/nix-support/extra-refs"
+ '' + optionalString buildUser ''
+ # Remove provided services as they are buggy
+ rm $out/etc/systemd/system/zfs-import-*.service
+
+ sed -i '/zfs-import-scan.service/d' $out/etc/systemd/system/*
+
+ for i in $out/etc/systemd/system/*; do
+ substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target"
+ done
+
+ # Fix pkgconfig.
+ ln -s ../share/pkgconfig $out/lib/pkgconfig
+
+ # Remove tests because they add a runtime dependency on gcc
+ rm -rf $out/share/zfs/zfs-tests
+
+ # Add Bash completions.
+ install -v -m444 -D -t $out/share/bash-completion/completions contrib/bash_completion.d/zfs
+ (cd $out/share/bash-completion/completions; ln -s zfs zpool)
+ '';
+
+ postFixup = ''
+ path="PATH=${makeBinPath [ coreutils gawk gnused gnugrep utillinux smartmontools sysstat sudo ]}"
+ for i in $out/libexec/zfs/zpool.d/*; do
+ sed -i "2i$path" $i
+ done
+ '';
+
+ outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ];
+
+ meta = {
+ description = "ZFS Filesystem Linux Kernel module";
+ longDescription = ''
+ ZFS is a filesystem that combines a logical volume manager with a
+ Copy-On-Write filesystem with data integrity detection and repair,
+ snapshotting, cloning, block devices, deduplication, and more.
+ '';
+ homepage = "https://zfsonlinux.org/";
+ license = licenses.cddl;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ jcumming wizeman fpletz globin ];
+ };
+ };
+in {
+ # also check if kernel version constraints in
+ # ./nixos/modules/tasks/filesystems/zfs.nix needs
+ # to be adapted
+ zfsStable = common {
+ # comment/uncomment if breaking kernel versions are known
+ # incompatibleKernelVersion = "4.20";
+
+ # this package should point to the latest release.
+ version = "0.8.4";
+
+ sha256 = "1hl4n900d24gl4vd65qdzq4m62b7bpvckldazcbd1xqcn8xhi6wp";
+ extraPatches = [ ./BACKPORT-Linux-5.8-compat-__vmalloc.patch ];
+ };
+
+ zfsUnstable = common {
+ # comment/uncomment if breaking kernel versions are known
+ # incompatibleKernelVersion = "4.19";
+
+ # this package should point to a version / git revision compatible with the latest kernel release
+ version = "2.0.0-rc3";
+
+ sha256 = "00fljxs6vacfhzc13bgsrmq6p3agpzcq6waw4iv2m58dr90jhlcz";
+ isUnstable = true;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/solo5/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/solo5/default.nix
new file mode 100644
index 000000000000..283cceb12405
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/solo5/default.nix
@@ -0,0 +1,58 @@
+{ lib, stdenv, fetchurl, pkgconfig, libseccomp }:
+
+let version = "0.6.7";
+in stdenv.mkDerivation {
+ pname = "solo5";
+ inherit version;
+
+ nativeBuildInputs = [ pkgconfig ];
+ buildInputs = lib.optional (stdenv.hostPlatform.isLinux) libseccomp;
+
+ src = fetchurl {
+ url =
+ "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
+ sha256 = "05k9adg3440zk5baa6ry8z5dj8d8r8hvzafh2469pdgcnr6h45gr";
+ };
+
+ hardeningEnable = [ "pie" ];
+
+ configurePhase = ''
+ runHook preConfigure
+ sh configure.sh
+ runHook postConfigure
+ '';
+
+ enableParallelBuilding = true;
+
+ installPhase = ''
+ runHook preInstall
+ export DESTDIR=$out
+ export PREFIX=$out
+ make install-tools
+ ${lib.optionalString stdenv.hostPlatform.isLinux "make ${
+ (lib.concatMapStringsSep " " (x: "install-opam-${x}") [ "hvt" "spt" ])
+ }"}
+ runHook postInstall
+ '';
+
+ doCheck = true;
+ checkPhase = if stdenv.hostPlatform.isLinux then
+ ''
+ patchShebangs tests
+ ./tests/bats-core/bats ./tests/tests.bats
+ ''
+ else
+ null;
+
+ meta = with lib; {
+ description = "Sandboxed execution environment";
+ homepage = "https://github.com/solo5/solo5";
+ license = licenses.isc;
+ maintainers = [ maintainers.ehmry ];
+ platforms = lib.crossLists (arch: os: "${arch}-${os}") [
+ [ "aarch64" "x86_64" ]
+ [ "freebsd" "genode" "linux" "openbsd" ]
+ ];
+ };
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/cygwin-setup/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/cygwin-setup/default.nix
new file mode 100644
index 000000000000..16b07507695b
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/cygwin-setup/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchcvs, autoconf, automake, libtool, flex, bison, pkgconfig
+, zlib, bzip2, lzma, libgcrypt
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ pname = "cygwin-setup";
+ version = "20131101";
+
+ src = fetchcvs {
+ cvsRoot = ":pserver:anoncvs@cygwin.com:/cvs/cygwin-apps";
+ module = "setup";
+ date = version;
+ sha256 = "024wxaaxkf7p1i78bh5xrsqmfz7ss2amigbfl2r5w9h87zqn9aq3";
+ };
+
+ nativeBuildInputs = [ autoconf automake libtool flex bison pkgconfig ];
+
+ buildInputs = let
+ mkStatic = flip overrideDerivation (o: {
+ dontDisableStatic = true;
+ configureFlags = toList (o.configureFlags or []) ++ [ "--enable-static" ];
+ buildInputs = map mkStatic (o.buildInputs or []);
+ propagatedBuildInputs = map mkStatic (o.propagatedBuildInputs or []);
+ });
+ in map mkStatic [ zlib bzip2 lzma libgcrypt ];
+
+ configureFlags = [ "--disable-shared" ];
+
+ dontDisableStatic = true;
+
+ preConfigure = ''
+ autoreconf -vfi
+ '';
+
+ installPhase = ''
+ install -vD setup.exe "$out/bin/setup.exe"
+ '';
+
+ meta = {
+ homepage = "https://sourceware.org/cygwin-apps/setup.html";
+ description = "A tool for installing Cygwin";
+ license = licenses.gpl2Plus;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/default.nix
new file mode 100644
index 000000000000..7f1634d5c0b3
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, buildPackages
+, newScope, overrideCC, crossLibcStdenv, libcCross
+}:
+
+stdenv.lib.makeScope newScope (self: with self; {
+
+ cygwinSetup = callPackage ./cygwin-setup { };
+
+ jom = callPackage ./jom { };
+
+ w32api = callPackage ./w32api { };
+
+ mingwrt = callPackage ./mingwrt { };
+ mingw_runtime = mingwrt;
+
+ mingw_w64 = callPackage ./mingw-w64 {
+ stdenv = crossLibcStdenv;
+ };
+
+ crossThreadsStdenv = overrideCC crossLibcStdenv
+ (if stdenv.hostPlatform.useLLVM or false
+ then buildPackages.llvmPackages_8.lldClangNoLibcxx
+ else buildPackages.gccCrossStageStatic.override (old: {
+ bintools = old.bintools.override {
+ libc = libcCross;
+ };
+ libc = libcCross;
+ }));
+
+ mingw_w64_headers = callPackage ./mingw-w64/headers.nix { };
+
+ mingw_w64_pthreads = callPackage ./mingw-w64/pthreads.nix {
+ stdenv = crossThreadsStdenv;
+ };
+
+ mcfgthreads = callPackage ./mcfgthreads {
+ stdenv = crossThreadsStdenv;
+ };
+
+ pthreads = callPackage ./pthread-w32 { };
+
+ wxMSW = callPackage ./wxMSW-2.8 { };
+
+ libgnurx = callPackage ./libgnurx { };
+})
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/jom/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/jom/default.nix
new file mode 100644
index 000000000000..1f42330be35c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/jom/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchgit, qt48, qmake4Hook, flex }:
+
+# At the time of committing this, the expression fails for me to cross-build in
+# both mingw32 and mingw64.
+
+stdenv.mkDerivation {
+ name = "jom-1.0.11";
+
+ src = fetchgit {
+ url = "git://gitorious.org/qt-labs/jom.git";
+ rev = "c91a204b05f97eef3c73aaaba3036e20f79fd487";
+ sha256 = "6d3ac84f83bb045213903d9d5340c0447c8fe41671d1dcdeae5c40b66d62ccbf";
+ };
+
+ buildInputs = [ qt48 ];
+ nativeBuildInputs = [ flex qmake4Hook ];
+
+ QTDIR = qt48;
+
+ # cmakeFlags = [ "-DWIN32=1" "-DCMAKE_SYSTEM_NAME=Windows" "-DCMAKE_RC_COMPILER=${stdenv.cc.targetPrefix}windres" ];
+
+ preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+ export NIX_CROSS_CFLAGS_COMPILE=-fpermissive
+ '';
+
+ meta = {
+ homepage = "http://qt-project.org/wiki/jom";
+ description = "Clone of nmake supporting multiple independent commands in parallel";
+ license = stdenv.lib.licenses.gpl2Plus; # Explicitly, GPLv2 or GPLv3, but not later.
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/libgnurx/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/libgnurx/default.nix
new file mode 100644
index 000000000000..fedfea15ccb0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/libgnurx/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+let
+ version = "2.5.1";
+in stdenv.mkDerivation rec {
+ pname = "libgnurx";
+ inherit version;
+ src = fetchurl {
+ url = "mirror://sourceforge/mingw/Other/UserContributed/regex/mingw-regex-${version}/mingw-${pname}-${version}-src.tar.gz";
+ sha256 = "0xjxcxgws3bblybw5zsp9a4naz2v5bs1k3mk8dw00ggc0vwbfivi";
+ };
+
+ meta = {
+ platforms = stdenv.lib.platforms.windows;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mcfgthreads/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mcfgthreads/default.nix
new file mode 100644
index 000000000000..6c4cd1710256
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mcfgthreads/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation {
+ pname = "mcfgthreads";
+ version = "git";
+
+ src = fetchFromGitHub {
+ owner = "lhmouse";
+ repo = "mcfgthread";
+ rev = "9570e5ca7b98002d707c502c919d951bf256b9c6";
+ sha256 = "10y2x3x601a7c1hkd6zlr3xpfsnlr05xl28v23clf619756a5755";
+ };
+
+ outputs = [ "out" "dev" ];
+
+ # Don't want prebuilt binaries sneaking in.
+ postUnpack = ''
+ rm -r "$sourceRoot/debug" "$sourceRoot/release"
+ '';
+
+ nativeBuildInputs = [
+ autoreconfHook
+ ];
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/default.nix
new file mode 100644
index 000000000000..6c17e0718bb5
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, windows, fetchurl }:
+
+let
+ version = "6.0.0";
+in stdenv.mkDerivation {
+ pname = "mingw-w64";
+ inherit version;
+
+ src = fetchurl {
+ url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
+ sha256 = "1w28mynv500y03h92nh87rgw3fnp82qwnjbxrrzqkmr63q812pl0";
+ };
+
+ outputs = [ "out" "dev" ];
+
+ configureFlags = [
+ "--enable-idl"
+ "--enable-secure-api"
+ ];
+
+ enableParallelBuilding = true;
+
+ buildInputs = [ windows.mingw_w64_headers ];
+ dontStrip = true;
+ hardeningDisable = [ "stackprotector" "fortify" ];
+
+ meta = {
+ platforms = stdenv.lib.platforms.windows;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/headers.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/headers.nix
new file mode 100644
index 000000000000..1fd27a8c4573
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/headers.nix
@@ -0,0 +1,11 @@
+{ stdenvNoCC, mingw_w64 }:
+
+stdenvNoCC.mkDerivation {
+ name = "${mingw_w64.name}-headers";
+ inherit (mingw_w64) src meta;
+
+ preConfigure = ''
+ cd mingw-w64-headers
+ '';
+
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/pthreads.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/pthreads.nix
new file mode 100644
index 000000000000..bbcb028d3cbb
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingw-w64/pthreads.nix
@@ -0,0 +1,10 @@
+{ stdenv, mingw_w64 }:
+
+stdenv.mkDerivation {
+ name = "${mingw_w64.name}-pthreads";
+ inherit (mingw_w64) src meta;
+
+ preConfigure = ''
+ cd mingw-w64-libraries/winpthreads
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingwrt/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingwrt/default.nix
new file mode 100644
index 000000000000..4fb92569a47a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/mingwrt/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, lib, fetchurl }:
+
+stdenv.mkDerivation rec {
+ name = "mingwrt-5.0.2";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/mingw/MinGW/Base/mingwrt/${name}/${name}-mingw32-src.tar.xz";
+ sha256 = "1vj6f578wcffdmy7zzf7xz1lw57kxjy08j0k1n28f0j4ylrk68vp";
+ };
+
+ meta = {
+ platforms = lib.platforms.windows;
+ };
+
+ dontStrip = true;
+ hardeningDisable = [ "stackprotector" "fortify" ];
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/pthread-w32/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/pthread-w32/default.nix
new file mode 100644
index 000000000000..257067339674
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/pthread-w32/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchzip }:
+
+stdenv.mkDerivation {
+ pname = "pthreads-w32";
+ version = "2.9.1";
+
+ src = fetchzip {
+ url = "https://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz";
+ sha256 = "1s8iny7g06z289ahdj0kzaxj0cd3wvjbd8j3bh9xlg7g444lhy9w";
+ };
+
+ makeFlags = [ "CROSS=${stdenv.cc.targetPrefix}" "GC-static" ];
+
+ installPhase = ''
+ runHook preInstall
+
+ install -D libpthreadGC2.a $out/lib/libpthread.a
+
+ runHook postInstall
+ '';
+
+ meta = with stdenv.lib; {
+ description = "POSIX threads library for Windows";
+ homepage = "https://sourceware.org/pthreads-win32";
+ license = licenses.lgpl21Plus;
+ maintainers = with maintainers; [ yegortimoshenko ];
+ platforms = platforms.windows;
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/w32api/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/w32api/default.nix
new file mode 100644
index 000000000000..ebc95ecaa7a9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/w32api/default.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl, lib }:
+
+stdenv.mkDerivation rec {
+ name = "w32api-3.17-2";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/mingw/MinGW/Base/w32api/w32api-3.17/${name}-mingw32-src.tar.lzma";
+ sha256 = "09rhnl6zikmdyb960im55jck0rdy5z9nlg3akx68ixn7khf3j8wb";
+ };
+
+ meta = {
+ platforms = lib.platforms.windows;
+ };
+
+ dontStrip = true;
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/windows/wxMSW-2.8/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/wxMSW-2.8/default.nix
new file mode 100644
index 000000000000..4dc886915b73
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/windows/wxMSW-2.8/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, compat24 ? false, compat26 ? true, unicode ? true }:
+
+stdenv.mkDerivation {
+ name = "wxMSW-2.8.11";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/wxwindows/wxWidgets-2.8.11.tar.gz";
+ sha256 = "0icxd21g18d42n1ygshkpw0jnflm03iqki6r623pb5hhd7fm2ksj";
+ };
+
+ configureFlags = [
+ (if compat24 then "--enable-compat24" else "--disable-compat24")
+ (if compat26 then "--enable-compat26" else "--disable-compat26")
+ "--disable-precomp-headers"
+ (if unicode then "--enable-unicode" else "")
+ "--with-opengl"
+ ];
+
+ preConfigure = "
+ substituteInPlace configure --replace /usr /no-such-path
+ ";
+
+ postBuild = "(cd contrib/src && make)";
+
+ postInstall = "
+ (cd contrib/src && make install)
+ (cd $out/include && ln -s wx-*/* .)
+ ";
+
+ passthru = {inherit compat24 compat26 unicode;};
+
+ meta = {
+ platforms = stdenv.lib.platforms.windows;
+
+ broken = true;
+ };
+}