nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

commit 7ae496405c5b39e620ab3ce5670c322026c233f5
parent 81306b6fe2fe1b6398483e2885888ee76589082b
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Sun, 12 Jan 2020 04:14:29 +0300

Add embox (arm/qemu)

Diffstat:
Mdefault.nix | 3+++
Mnix/sources.json | 12++++++++++++
Apkgs/embox/0001-fix-build.patch | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/embox/default.nix | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 140 insertions(+), 0 deletions(-)

diff --git a/default.nix b/default.nix @@ -33,6 +33,9 @@ in rec { docker-reg-tool = callPackage ./pkgs/docker-reg-tool { inherit (sources) docker-reg-tool; }; + embox = callPackage ./pkgs/embox { + inherit (sources) embox; + }; goldendict-dark-theme = callPackage ./pkgs/goldendict-themes/dark-theme.nix { }; gpx-layer = perlPackages.callPackage ./pkgs/gpx-layer { diff --git a/nix/sources.json b/nix/sources.json @@ -59,6 +59,18 @@ "url": "https://github.com/byrnedo/docker-reg-tool/archive/c5e7ff63fa476cac1eed717d0aef238beb50c21c.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "embox": { + "branch": "master", + "description": "Modular and configurable OS for embedded applications", + "homepage": "http://embox.github.io", + "owner": "embox", + "repo": "embox", + "rev": "6f8a4207fb9649b2572b8c23c056fc776f2e4492", + "sha256": "1fwp3wk9hn3ra0ls7z4bxzrpmdrcvidlcaiv5xx766397hdk12r0", + "type": "tarball", + "url": "https://github.com/embox/embox/archive/6f8a4207fb9649b2572b8c23c056fc776f2e4492.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, "google-translate-for-goldendict": { "branch": "master", "description": "Add Google translate to GoldenDict", diff --git a/pkgs/embox/0001-fix-build.patch b/pkgs/embox/0001-fix-build.patch @@ -0,0 +1,64 @@ +diff --git i/mk/flags.mk w/mk/flags.mk +index baf62448e..7d5c2a74b 100644 +--- i/mk/flags.mk ++++ w/mk/flags.mk +@@ -12,23 +12,23 @@ BUILD_DEPS_CPPFLAGS ?= + BUILD_DEPS_LDFLAGS ?= + + CROSS_COMPILE ?= +-CXX ?= $(CROSS_COMPILE)g++ +-AR ?= $(CROSS_COMPILE)ar +-AS ?= $(CROSS_COMPILE)as +-LD ?= $(CROSS_COMPILE)ld +-NM ?= $(CROSS_COMPILE)nm +-OBJDUMP ?= $(CROSS_COMPILE)objdump +-OBJCOPY ?= $(CROSS_COMPILE)objcopy +-SIZE ?= $(CROSS_COMPILE)size ++CXX = $(CROSS_COMPILE)g++ ++AR = $(CROSS_COMPILE)ar ++AS = $(CROSS_COMPILE)as ++LD = $(CROSS_COMPILE)ld ++NM = $(CROSS_COMPILE)nm ++OBJDUMP = $(CROSS_COMPILE)objdump ++OBJCOPY = $(CROSS_COMPILE)objcopy ++SIZE = $(CROSS_COMPILE)size + + ifeq ($(COMPILER),clang) + CC ?= clang + # for clang LIBGCC_FINDER will be set externally to arm-none-eabi-gcc or something like that + else +-CC ?= $(CROSS_COMPILE)gcc ++CC = $(CROSS_COMPILE)gcc + LIBGCC_FINDER=$(CC) $(CFLAGS) + endif +-CPP ?= $(CC) -E ++CPP = $(CC) -E + + comma_sep_list = $(subst $(\s),$(,),$(strip $1)) + +diff --git i/mk/image2.mk w/mk/image2.mk +index be5f39879..ad7f2b52f 100644 +--- i/mk/image2.mk ++++ w/mk/image2.mk +@@ -51,7 +51,7 @@ $(ROOTFS_DIR)/% : + $(CP) -r $(cp_T_if_supported) $(src_file) $@$(if \ + $(and $(chmod),$(findstring $(chmod),'')),,;chmod $(chmod) $@) + @touch $@ # workaround when copying directories +- @find $@ -name .gitkeep -type f -print0 | xargs -0 /bin/rm -rf ++ @find $@ -name .gitkeep -type f -print0 | xargs -0 rm -rf + + fmt_line = $(addprefix \$(\n)$(\t)$(\t),$1) + +diff --git i/mk/image3.mk w/mk/image3.mk +index 34d1cf656..9c8ffaf37 100644 +--- i/mk/image3.mk ++++ w/mk/image3.mk +@@ -283,7 +283,7 @@ $(__cpio_files) : FORCE + $(foreach c,chmod chown,$(if $(and $($c),$(findstring $($c),'')),,$c $($c) $f;)) \ + $(foreach a,$(strip $(subst ',,$(xattr))), \ + attr -s $(basename $(subst =,.,$a)) -V $(subst .,,$(suffix $(subst =,.,$a))) $f;) \ +- find $f -name .gitkeep -type f -print0 | xargs -0 /bin/rm -rf) ++ find $f -name .gitkeep -type f -print0 | xargs -0 rm -rf) + + __copy_user_rootfs : + if [ -d $(USER_ROOTFS_DIR) ]; \ diff --git a/pkgs/embox/default.nix b/pkgs/embox/default.nix @@ -0,0 +1,61 @@ +{ stdenv, fetchurl, writers, embox +, cpio, gcc-arm-embedded, python, qemu, unzip, which }: + +stdenv.mkDerivation rec { + pname = "embox"; + version = stdenv.lib.substring 0 7 src.rev; + src = embox; + template = "arm/qemu"; + + cjson = fetchurl { + url = "http://download.embox.rocks/cJSONFiles.zip"; + sha256 = "19qdsfq4r7gjr39lkjplz418gkl2xg5j5fpdz9phlxlbggnklqhd"; + }; + + patches = [ ./0001-fix-build.patch ]; + + nativeBuildInputs = [ + cpio + gcc-arm-embedded + python + unzip + which + ]; + + postPatch = '' + patchShebangs ./mk + mkdir -p ./download + ln -s ${cjson} ./download/cjson.zip + ''; + + configurePhase = "make confload-${template}"; + + installPhase = let + runScript = writers.writeBash "run-embox" '' + ${qemu}/bin/qemu-system-arm \ + -M integratorcp \ + -kernel @out@/share/embox/images/embox.img \ + -m 256 \ + -net nic,netdev=n0,model=smc91c111,macaddr=AA:BB:CC:DD:EE:02 \ + -netdev tap,script=@out@/share/embox/scripts/qemu_start,downscript=@out@/share/embox/scripts/qemu_stop,,id=n0 \ + -nographic + ''; + in '' + mkdir -p $out/bin + substitute ${runScript} $out/bin/run-embox --subst-var out + chmod +x $out/bin/run-embox + + install -Dm644 build/base/bin/embox $out/share/embox/images/embox.img + install -Dm644 conf/*.conf* -t $out/share/embox/conf + install -Dm755 scripts/qemu/start_script $out/share/embox/scripts/qemu_start + install -Dm755 scripts/qemu/stop_script $out/share/embox/scripts/qemu_stop + ''; + + meta = with stdenv.lib; { + description = embox.description; + homepage = embox.homepage; + license = licenses.bsd2; + maintainers = with maintainers; [ sikmir ]; + platforms = platforms.linux; + }; +}