Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 58 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 pkgsBuildHost, 6 versionCheckHook, 7}: 8 9# Changing the variables CPPFLAGS and BUILD_CONFIG_NAME can be done by 10# overriding the same-named attributes. See ./presets.nix for examples. 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "mkspiffs"; 14 version = "0.2.3"; 15 16 src = fetchFromGitHub { 17 owner = "igrr"; 18 repo = "mkspiffs"; 19 tag = finalAttrs.version; 20 fetchSubmodules = true; 21 hash = "sha256-oa6Lmo2yb66IjtEKkZyJBgM/p7rdvmrKfgNd2rAM/Lk="; 22 }; 23 24 # 1) Fix build for Darwin 25 # 2) Fix cross 26 # 3) Do not run test as part of the buildPhase - the checkPhase will run it as `make test` 27 postPatch = '' 28 substituteInPlace Makefile \ 29 --replace-fail "-arch i386 -arch x86_64" "" \ 30 --replace-fail "strip" "${pkgsBuildHost.binutils.targetPrefix}strip" \ 31 --replace-fail "dist: test" "" 32 ''; 33 34 strictDeps = true; 35 36 buildFlags = [ "dist" ]; 37 38 makeFlags = [ 39 "VERSION=${finalAttrs.version}" 40 "SPIFFS_VERSION=unknown" 41 ]; 42 43 installPhase = '' 44 install -Dm755 -t $out/bin mkspiffs 45 ''; 46 47 nativeInstallCheckInputs = [ versionCheckHook ]; 48 doInstallCheck = true; 49 50 meta = { 51 description = "Tool to build and unpack SPIFFS images"; 52 license = lib.licenses.mit; 53 homepage = "https://github.com/igrr/mkspiffs"; 54 maintainers = [ lib.maintainers.haslersn ]; 55 platforms = lib.platforms.all; 56 mainProgram = "mkspiffs"; 57 }; 58})