From c23b5bd4126c1abb0227399ab0d113f5a6bb0565 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 2 Jul 2021 05:49:16 -0300 Subject: [PATCH 1/8] arcan: create skeleton/infrastructure Arcan is a powerful development framework for creating virtually anything from user interfaces for specialized embedded applications all the way to full-blown standalone desktop environments. At its heart lies a robust and portable multimedia engine, with a well-tested and well-documented Lua scripting interface. The development emphasizes security, debuggability and performance -- guided by a principle of least surprise in terms of API design. (Descriptions taken from official Github site!) --- pkgs/desktops/arcan/default.nix | 4 ++++ pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 pkgs/desktops/arcan/default.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix new file mode 100644 index 000000000000..5f26ee033c83 --- /dev/null +++ b/pkgs/desktops/arcan/default.nix @@ -0,0 +1,4 @@ +{ callPackage, lib, pkgs }: + +rec { +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index be0b60596998..8f10b405894e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29557,6 +29557,10 @@ in gtk = gtk2; }; + arcan = recurseIntoAttrs (callPackage ../desktops/arcan { + callPackage = newScope pkgs.arcan; + }); + xfce = recurseIntoAttrs (callPackage ../desktops/xfce { }); xrandr-invert-colors = callPackage ../applications/misc/xrandr-invert-colors { }; From 09eacdb0dfb4d8eba59466dacf7714f7e5150f3f Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 2 Jul 2021 06:01:46 -0300 Subject: [PATCH 2/8] arcan.arcan: init at 0.6.1pre1+unstable=2021-07-07 --- pkgs/desktops/arcan/arcan.nix | 157 ++++++++++++++++++++++++++++++++ pkgs/desktops/arcan/default.nix | 9 ++ 2 files changed, 166 insertions(+) create mode 100644 pkgs/desktops/arcan/arcan.nix diff --git a/pkgs/desktops/arcan/arcan.nix b/pkgs/desktops/arcan/arcan.nix new file mode 100644 index 000000000000..8a30da9e81f2 --- /dev/null +++ b/pkgs/desktops/arcan/arcan.nix @@ -0,0 +1,157 @@ +{ lib +, stdenv +, fetchFromGitHub +, SDL2 +, cmake +, espeak +, ffmpeg +, file +, freetype +, harfbuzz +, leptonica +, libGL +, libX11 +, libXau +, libXcomposite +, libXdmcp +, libXfixes +, libdrm +, libffi +, libusb1 +, libuvc +, libvlc +, libvncserver +, libxcb +, libxkbcommon +, luajit +, makeWrapper +, mesa +, openal +, pkg-config +, sqlite +, tesseract +, valgrind +, wayland +, wayland-protocols +, xcbutil +, xcbutilwm +, xz +, buildManPages ? true, ruby +}: + +let + # TODO: investigate vendoring, especially OpenAL + # WARN: vendoring of OpenAL is required for running arcan_lwa + # INFO: maybe it needs leaveDotGit, but it is dangerous/impure + letoram-openal-src = fetchFromGitHub { + owner = "letoram"; + repo = "openal"; + rev = "1c7302c580964fee9ee9e1d89ff56d24f934bdef"; + hash = "sha256-InqU59J0zvwJ20a7KU54xTM7d76VoOlFbtj7KbFlnTU="; + }; +in +stdenv.mkDerivation rec { + pname = "arcan"; + version = "0.6.1pre1+unstable=2021-07-07"; + + src = fetchFromGitHub { + owner = "letoram"; + repo = "arcan"; + rev = "f3341ab94b32d02f3d15c3b91a512b2614e950a5"; + hash = "sha256-YBtRA5uCk4tjX3Bsu5vMkaNaCLRlM6HVQ53sna3gDsY="; + }; + + postUnpack = '' + ( + cd $sourceRoot/external/git/ + cp -a ${letoram-openal-src}/ openal/ + chmod --recursive 744 openal/ + ) + ''; + + # TODO: work with upstream in order to get rid of these hardcoded paths + postPatch = '' + substituteInPlace ./src/platform/posix/paths.c \ + --replace "/usr/bin" "$out/bin" \ + --replace "/usr/share" "$out/share" + + substituteInPlace ./src/CMakeLists.txt --replace "SETUID" "# SETUID" + ''; + + nativeBuildInputs = [ + cmake + makeWrapper + pkg-config + ] ++ lib.optionals buildManPages [ + ruby + ]; + + buildInputs = [ + SDL2 + espeak + ffmpeg + file + freetype + harfbuzz + leptonica + libGL + libX11 + libXau + libXcomposite + libXdmcp + libXfixes + libdrm + libffi + libusb1 + libuvc + libvlc + libvncserver + libxcb + libxkbcommon + luajit + mesa + openal + sqlite + tesseract + valgrind + wayland + wayland-protocols + xcbutil + xcbutilwm + xz + ]; + + # INFO: According to the source code, the manpages need to be generated before + # the configure phase + preConfigure = lib.optionalString buildManPages '' + (cd doc; ruby docgen.rb mangen) + ''; + + cmakeFlags = [ + "-DBUILD_PRESET=everything" + # The upstream project recommends tagging the distribution + "-DDISTR_TAG=Nixpkgs" + "-DENGINE_BUILDTAG=${version}" + "-DHYBRID_SDL=on" + "-DSTATIC_OPENAL=off" + "../src" + ]; + + hardeningDisable = [ + "format" + ]; + + meta = with lib; { + homepage = "https://arcan-fe.com/"; + description = "Combined Display Server, Multimedia Framework, Game Engine"; + longDescription = '' + Arcan is a portable and fast self-sufficient multimedia engine for + advanced visualization and analysis work in a wide range of applications + e.g. game development, real-time streaming video, monitoring and + surveillance, up to and including desktop compositors and window managers. + ''; + license = with licenses; [ bsd3 gpl2Plus lgpl2Plus ]; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index 5f26ee033c83..62a8546c8442 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -1,4 +1,13 @@ { callPackage, lib, pkgs }: rec { + # Dependencies + + espeak = pkgs.espeak-ng; + ffmpeg = pkgs.ffmpeg-full; + harfbuzz = pkgs.harfbuzzFull; + + # Arcan + + arcan = callPackage ./arcan.nix { }; } From 8c6d94298487ba1a71abc905bbca1c3852c3f81d Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 2 Jul 2021 06:03:58 -0300 Subject: [PATCH 3/8] arcan: create a wrapper This commit creates a wrapper with the purpose of gracefully execute Arcan applications (appls, in Arcan jargon). In a typical FHS system, Arcan can be invoked by a commandline like `arcan `, or more generally `arcan `. In order to emulate this behaviour, this wrapper was crafted. It `symlinkJoin`s Arcan and the appls, and sets the relevant environment variables accordingly. --- pkgs/desktops/arcan/default.nix | 1 + pkgs/desktops/arcan/wrapper.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/desktops/arcan/wrapper.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index 62a8546c8442..f7883dad646f 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -10,4 +10,5 @@ rec { # Arcan arcan = callPackage ./arcan.nix { }; + arcan-wrapped = callPackage ./wrapper.nix { }; } diff --git a/pkgs/desktops/arcan/wrapper.nix b/pkgs/desktops/arcan/wrapper.nix new file mode 100644 index 000000000000..a8b93ca1deac --- /dev/null +++ b/pkgs/desktops/arcan/wrapper.nix @@ -0,0 +1,28 @@ +{ arcan +, makeWrapper +, symlinkJoin +, appls ? [ ] +, name ? "arcan-wrapped" +}: + +symlinkJoin rec { + inherit name; + + paths = appls ++ [ arcan ]; + + nativeBuildInputs = [ makeWrapper ]; + + postBuild = '' + for prog in ${placeholder "out"}/bin/*; do + wrapProgram $prog \ + --prefix PATH ":" "${placeholder "out"}/bin" \ + --set ARCAN_APPLBASEPATH "${placeholder "out"}/share/arcan/appl/" \ + --set ARCAN_BINPATH "${placeholder "out"}/bin/arcan_frameserver" \ + --set ARCAN_LIBPATH "${placeholder "out"}/lib/" \ + --set ARCAN_RESOURCEPATH "${placeholder "out"}/share/arcan/resources/" \ + --set ARCAN_SCRIPTPATH "${placeholder "out"}/share/arcan/scripts/" \ + --set ARCAN_STATEBASEPATH "$HOME/.arcan/resources/savestates/" + done + ''; +} +# TODO: set ARCAN_FONTPATH to a set of fonts that can be provided in a parameter From 94a08abdb40853936fa79aa6cb7c395443ae491b Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 2 Jul 2021 18:39:14 -0300 Subject: [PATCH 4/8] arcan.xarcan: init at 0.6.0+unstable=2021-06-14 --- pkgs/desktops/arcan/default.nix | 1 + pkgs/desktops/arcan/xarcan.nix | 118 ++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 pkgs/desktops/arcan/xarcan.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index f7883dad646f..7d3013c6c4ea 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -11,4 +11,5 @@ rec { arcan = callPackage ./arcan.nix { }; arcan-wrapped = callPackage ./wrapper.nix { }; + xarcan = callPackage ./xarcan.nix { }; } diff --git a/pkgs/desktops/arcan/xarcan.nix b/pkgs/desktops/arcan/xarcan.nix new file mode 100644 index 000000000000..9bfd7e290733 --- /dev/null +++ b/pkgs/desktops/arcan/xarcan.nix @@ -0,0 +1,118 @@ +{ lib +, stdenv +, fetchFromGitHub +, arcan +, audit +, dbus +, epoxy +, fontutil +, libGL +, libX11 +, libXau +, libXdmcp +, libXfont2 +, libdrm +, libgcrypt +, libmd +, libselinux +, libtirpc +, libxcb +, libxkbfile +, libxshmfence +, mesa +, meson +, nettle +, ninja +, openssl +, pixman +, pkg-config +, systemd +, xcbutil +, xcbutilwm +, xkbcomp +, xkeyboard_config +, xorgproto +, xtrans +}: + +stdenv.mkDerivation rec { + pname = "xarcan"; + version = "0.6.0+unstable=2021-06-14"; + + src = fetchFromGitHub { + owner = "letoram"; + repo = pname; + rev = "98d28a5f2c6860bb191fbc1c9e577c18e4c9a9b7"; + hash = "sha256-UTIVDKnYD/q0K6G7NJUKh1tHcqnsuiJ/cQxWuPMJ2G4="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + arcan + audit + dbus + epoxy + fontutil + libGL + libX11 + libXau + libXdmcp + libXfont2 + libdrm + libgcrypt + libmd + libselinux + libtirpc + libxcb + libxkbfile + libxshmfence + mesa + nettle + openssl + pixman + systemd + xcbutil + xcbutilwm + xkbcomp + xkeyboard_config + xorgproto + xtrans + ]; + + configureFlags = [ + "--disable-int10-module" + "--disable-static" + "--disable-xnest" + "--disable-xorg" + "--disable-xvfb" + "--disable-xwayland" + "--enable-glamor" + "--enable-glx" + "--enable-ipv6" + "--enable-kdrive" + "--enable-record" + "--enable-xarcan" + "--enable-xcsecurity" + "--with-xkb-bin-directory=${xkbcomp}/bin" + "--with-xkb-output=/tmp" + "--with-xkb-path=${xkeyboard_config}/share/X11/xkb" + ]; + + meta = with lib; { + homepage = "https://github.com/letoram/letoram"; + description = "Patched Xserver that bridges connections to Arcan"; + longDescription = '' + xarcan is a patched X server with a KDrive backend that uses the + arcan-shmif to map Xlib/Xcb/X clients to a running arcan instance. It + allows running an X session as a window under Arcan. + ''; + license = licenses.mit; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} From 1566968ebfd0f003542108bfadcc47ac7611dec0 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Fri, 2 Jul 2021 18:33:31 -0300 Subject: [PATCH 5/8] arcan.durden: init at 0.6.1+unstable=2021-06-25 --- pkgs/desktops/arcan/default.nix | 8 +++++++ pkgs/desktops/arcan/durden.nix | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pkgs/desktops/arcan/durden.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index 7d3013c6c4ea..989ba69b90f9 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -12,4 +12,12 @@ rec { arcan = callPackage ./arcan.nix { }; arcan-wrapped = callPackage ./wrapper.nix { }; xarcan = callPackage ./xarcan.nix { }; + + # Appls + + durden = callPackage ./durden.nix { }; + durden-wrapped = callPackage ./wrapper.nix { + name = "durden-wrapped"; + appls = [ durden ]; + }; } diff --git a/pkgs/desktops/arcan/durden.nix b/pkgs/desktops/arcan/durden.nix new file mode 100644 index 000000000000..cfe41cb6ec22 --- /dev/null +++ b/pkgs/desktops/arcan/durden.nix @@ -0,0 +1,39 @@ +{ lib +, stdenv +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "durden"; + version = "0.6.1+unstable=2021-06-25"; + + src = fetchFromGitHub { + owner = "letoram"; + repo = pname; + rev = "fb618fccc57a68b6ce933b4df5822acd1965d591"; + hash = "sha256-PovI837Xca4wV0g0s4tYUMFGVUDf+f8HcdvM1+0aDxk="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p ${placeholder "out"}/share/arcan/appl/ + cp -a ./durden ${placeholder "out"}/share/arcan/appl/ + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://durden.arcan-fe.com/"; + description = "Reference Desktop Environment for Arcan"; + longDescription = '' + Durden is a desktop environment for the Arcan Display Server. It serves + both as a reference showcase on how to take advantage of some of the + features in Arcan, and as a very competent entry to the advanced-user side + of the desktop environment spectrum. + ''; + license = licenses.bsd3; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} From f910cce5d240dce96fd52177798db9453d9d00a0 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sat, 3 Jul 2021 00:46:21 -0300 Subject: [PATCH 6/8] arcan.pipeworld: init at 0.0.0+unstable=2021-05-27 --- pkgs/desktops/arcan/default.nix | 6 ++++ pkgs/desktops/arcan/pipeworld.nix | 46 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 pkgs/desktops/arcan/pipeworld.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index 989ba69b90f9..fd973adb07bb 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -20,4 +20,10 @@ rec { name = "durden-wrapped"; appls = [ durden ]; }; + + pipeworld = callPackage ./pipeworld.nix { }; + pipeworld-wrapped = callPackage ./wrapper.nix { + name = "pipeworld-wrapped"; + appls = [ pipeworld ]; + }; } diff --git a/pkgs/desktops/arcan/pipeworld.nix b/pkgs/desktops/arcan/pipeworld.nix new file mode 100644 index 000000000000..a48ce5044ca0 --- /dev/null +++ b/pkgs/desktops/arcan/pipeworld.nix @@ -0,0 +1,46 @@ +{ lib +, stdenv +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "pipeworld"; + version = "0.0.0+unstable=2021-05-27"; + + src = fetchFromGitHub { + owner = "letoram"; + repo = pname; + rev = "c26df9ca0225ce2fd4f89e7ec59d4ab1f94a4c2e"; + hash = "sha256-RkDAbM1q4o61RGPLPLXHLvbvClp+bfjodlWgUGoODzA="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p ${placeholder "out"}/share/arcan/appl/ + cp -a ./pipeworld ${placeholder "out"}/share/arcan/appl/ + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/letoram/pipeworld"; + description = "Dataflow 'spreadsheet' desktop environment"; + longDescription = '' + Pipeworld is a zooming dataflow tool and desktop heavily inspired by + userland. It is built using the arcan desktop engine. + + It combines the programmable processing of shell scripts and pipes, the + interactive visual addressing/programming model of spread sheets, the + scenegraph- and interactive controls-, IPC- and client processing- of + display servers into one model with zoomable tiling window management. + + It can be used as a standalone desktop of its own, or as a normal + application within another desktop as a 'substitute' for your normal + terminal emulator. + ''; + license = licenses.bsd3; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} From d2c07b3a5674d4a4c8c2af989e8b582f4d82767b Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sat, 3 Jul 2021 02:04:46 -0300 Subject: [PATCH 7/8] arcan.prio: init at 0.0.0+unstable=2018-09-13 --- pkgs/desktops/arcan/default.nix | 6 ++++++ pkgs/desktops/arcan/prio.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 pkgs/desktops/arcan/prio.nix diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index fd973adb07bb..0b3206b2d14f 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -26,4 +26,10 @@ rec { name = "pipeworld-wrapped"; appls = [ pipeworld ]; }; + + prio = callPackage ./prio.nix { }; + prio-wrapped = callPackage ./wrapper.nix { + name = "prio-wrapped"; + appls = [ prio ]; + }; } diff --git a/pkgs/desktops/arcan/prio.nix b/pkgs/desktops/arcan/prio.nix new file mode 100644 index 000000000000..764d82fae9b7 --- /dev/null +++ b/pkgs/desktops/arcan/prio.nix @@ -0,0 +1,33 @@ +{ lib +, stdenv +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "prio"; + version = "0.0.0+unstable=2018-09-13"; + + src = fetchFromGitHub { + owner = "letoram"; + repo = pname; + rev = "c3f97491339d15f063d6937d5f89bcfaea774dd1"; + hash = "sha256-Idv/duEYmDk/rO+TI8n+FY3VFDtUEh8C292jh12BJuM="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p ${placeholder "out"}/share/arcan/appl/prio + cp -a ./* ${placeholder "out"}/share/arcan/appl/prio + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/letoram/prio"; + description = "Plan9- Rio like Window Manager for Arcan"; + license = licenses.bsd3; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} From f3b1c8cee30e275502e9569a4b88afdc987c6104 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sat, 3 Jul 2021 02:12:26 -0300 Subject: [PATCH 8/8] arcan: an expression to install all the appls --- pkgs/desktops/arcan/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/desktops/arcan/default.nix b/pkgs/desktops/arcan/default.nix index 0b3206b2d14f..dba284f0100d 100644 --- a/pkgs/desktops/arcan/default.nix +++ b/pkgs/desktops/arcan/default.nix @@ -32,4 +32,11 @@ rec { name = "prio-wrapped"; appls = [ prio ]; }; + + # One Expression to SymlinkJoin Them All + + everyone-wrapped = callPackage ./wrapper.nix { + name = "everyone-wrapped"; + appls = [ durden pipeworld prio ]; + }; }