11 # Use techniques described in https://web.archive.org/web/20220904051329/https://tapesoftware.net/replace-symbol/
13 # Adapted from https://github.com/KenMacD/etc-nixos/blob/d3d28085586358a62b2bb4b427eb21aad05b5b23/dcc/default.nix
15 # Used https://github.com/NixOS/nixpkgs/pull/84926 as a template
16 # then converted to use autoPatchelfHook instead, and link with
17 # the dependencies from other pkgs.
22 unpacked = stdenv.mkDerivation rec {
24 pname = "dell-command-configure-unpacked";
28 "https://dl.dell.com/FOLDER10469726M/1/command-configure_${version}.ubuntu22_amd64.tar.gz"
29 "https://web.archive.org/web/20240228233129/https://dl.dell.com/FOLDER10469726M/1/command-configure_4.11.0-6.ubuntu22_amd64.tar.gz"
31 # The CDN blocks the Curl user-agent, so set to blank instead.
33 hash = "sha256-Bwa4sYguYwEBKEJSP3wzHhzjuDeaGQN8fKeooWHX18E=";
38 nativeBuildInputs = [ dpkg ];
42 dpkg-deb -x command-configure_${version}.ubuntu22_amd64.deb command-configure
43 dpkg-deb -x srvadmin-hapi_9.5.0_amd64.deb srvadmin-hapi
52 # Contains a fopen() wrapper for finding the firmware package
53 wrapperLibName = "wrapper-lib.so";
54 wrapperLib = stdenv.mkDerivation {
55 pname = "dell-command-configure-unpacked-wrapper-lib";
59 cp ${./wrapper-lib.c} wrapper-lib.c
63 substitute wrapper-lib.c lib.c \
64 --subst-var-by to "${unpacked}/srvadmin-hapi/opt/dell/srvadmin/etc/omreg.d/omreg-hapi.cfg"
65 cc -fPIC -shared lib.c -o ${wrapperLibName}
68 install -D ${wrapperLibName} -t $out/lib
72 in stdenv.mkDerivation rec {
74 pname = "dell-command-configure";
76 buildInputs = [ openssl stdenv.cc.cc.lib ];
77 nativeBuildInputs = [ autoPatchelfHook ];
83 install -D -t $out/lib -m644 -v command-configure/opt/dell/dcc/libhapiintf.so
84 install -D -t $out/lib -m644 -v command-configure/opt/dell/dcc/libsmbios_c.so.2
85 install -D -t $out/bin -m755 -v command-configure/opt/dell/dcc/cctk
86 install -D -t $out/bin -m755 -v srvadmin-hapi/opt/dell/srvadmin/sbin/dchcfg
87 for lib in $(find srvadmin-hapi/opt/dell/srvadmin/lib64 -type l); do
88 install -D -t $out/lib -m644 -v $lib
93 echo fopen fopen_wrapper > fopen_name_map
94 echo access access_wrapper > access_name_map
95 ${patchelfUnstable}/bin/patchelf \
96 --rename-dynamic-symbols fopen_name_map \
97 --rename-dynamic-symbols access_name_map \
98 --add-needed ${wrapperLibName} \
99 --set-rpath ${lib.makeLibraryPath [ wrapperLib ]} \
104 description = "Configure BIOS settings on Dell laptops";
106 "https://www.dell.com/support/article/us/en/19/sln311302/dell-command-configure";
107 license = licenses.unfree;
108 maintainers = with maintainers; [ ryangibb ];
109 platforms = [ "x86_64-linux" ];