diff options
Diffstat (limited to 'pkgs/applications')
12 files changed, 320 insertions, 222 deletions
diff --git a/pkgs/applications/graphics/hello-wayland/default.nix b/pkgs/applications/graphics/hello-wayland/default.nix new file mode 100644 index 00000000000..79bfb698f3c --- /dev/null +++ b/pkgs/applications/graphics/hello-wayland/default.nix @@ -0,0 +1,31 @@ +{ stdenv, lib, fetchFromGitHub +, imagemagick, pkg-config, wayland, wayland-protocols +}: + +stdenv.mkDerivation { + pname = "hello-wayland-unstable"; + version = "2019-01-16"; + + src = fetchFromGitHub { + owner = "emersion"; + repo = "hello-wayland"; + rev = "6c2762e653d4f91b36ee443642b735aa48128a74"; + sha256 = "0qxkyn9w9v477gagcrs18vdzy1ffg8jgp2qsqgdf9rxkfs6m4f36"; + }; + + nativeBuildInputs = [ imagemagick pkg-config ]; + buildInputs = [ wayland wayland-protocols ]; + + installPhase = '' + mkdir -p $out/bin + install hello-wayland $out/bin + ''; + + meta = with lib; { + description = "Hello world Wayland client"; + homepage = "https://github.com/emersion/hello-wayland"; + maintainers = with maintainers; [ qyliss ]; + license = licenses.mit; + platforms = platforms.linux; + }; +} diff --git a/pkgs/applications/virtualization/crosvm/default-seccomp-policy-dir.diff b/pkgs/applications/virtualization/crosvm/default-seccomp-policy-dir.diff deleted file mode 100644 index f1aa50ee102..00000000000 --- a/pkgs/applications/virtualization/crosvm/default-seccomp-policy-dir.diff +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/crosvm.rs b/src/crosvm.rs -index b7055df..5989c87 100644 ---- a/src/crosvm.rs -+++ b/src/crosvm.rs -@@ -141,7 +141,9 @@ impl Default for Config { - x_display: None, - shared_dirs: Vec::new(), - sandbox: !cfg!(feature = "default-no-sandbox"), -- seccomp_policy_dir: PathBuf::from(SECCOMP_POLICY_DIR), -+ seccomp_policy_dir: PathBuf::from( -+ option_env!("DEFAULT_SECCOMP_POLICY_DIR").unwrap_or(SECCOMP_POLICY_DIR), -+ ), - seccomp_log_failures: false, - cras_audio: false, - cras_capture: false, diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix deleted file mode 100644 index 38ce277bf3f..00000000000 --- a/pkgs/applications/virtualization/crosvm/default.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ stdenv, lib, rustPlatform, fetchgit, runCommand, symlinkJoin -, pkgconfig, minijail, dtc, libusb1, libcap, linux -}: - -let - - upstreamInfo = with builtins; fromJSON (readFile ./upstream-info.json); - - arch = with stdenv.hostPlatform; - if isAarch64 then "arm" - else if isx86_64 then "x86_64" - else throw "no seccomp policy files available for host platform"; - - crosvmSrc = fetchgit { - inherit (upstreamInfo.components."chromiumos/platform/crosvm") - url rev sha256 fetchSubmodules; - }; - - adhdSrc = fetchgit { - inherit (upstreamInfo.components."chromiumos/third_party/adhd") - url rev sha256 fetchSubmodules; - }; - -in - - rustPlatform.buildRustPackage rec { - pname = "crosvm"; - inherit (upstreamInfo) version; - - unpackPhase = '' - runHook preUnpack - - mkdir -p chromiumos/platform chromiumos/third_party - - pushd chromiumos/platform - unpackFile ${crosvmSrc} - mv ${crosvmSrc.name} crosvm - popd - - pushd chromiumos/third_party - unpackFile ${adhdSrc} - mv ${adhdSrc.name} adhd - popd - - chmod -R u+w -- "$sourceRoot" - - runHook postUnpack - ''; - - sourceRoot = "chromiumos/platform/crosvm"; - - patches = [ - ./default-seccomp-policy-dir.diff - ]; - - cargoSha256 = "0lhivwvdihslwp81i3sa5q88p5hr83bzkvklrcgf6x73arwk8kdz"; - - nativeBuildInputs = [ pkgconfig ]; - - buildInputs = [ dtc libcap libusb1 minijail ]; - - postPatch = '' - sed -i "s|/usr/share/policy/crosvm/|$out/share/policy/|g" \ - seccomp/*/*.policy - ''; - - preBuild = '' - export DEFAULT_SECCOMP_POLICY_DIR=$out/share/policy - ''; - - postInstall = '' - mkdir -p $out/share/policy/ - cp seccomp/${arch}/* $out/share/policy/ - ''; - - CROSVM_CARGO_TEST_KERNEL_BINARY = - lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) - "${linux}/${stdenv.hostPlatform.platform.kernelTarget}"; - - passthru = { - inherit adhdSrc; - src = crosvmSrc; - updateScript = ./update.py; - }; - - meta = with lib; { - description = "A secure virtual machine monitor for KVM"; - homepage = "https://chromium.googlesource.com/chromiumos/platform/crosvm/"; - maintainers = with maintainers; [ qyliss ]; - license = licenses.bsd3; - platforms = [ "aarch64-linux" "x86_64-linux" ]; - }; - } diff --git a/pkgs/applications/virtualization/crosvm/update.py b/pkgs/applications/virtualization/crosvm/update.py deleted file mode 100755 index 29e68b9f579..00000000000 --- a/pkgs/applications/virtualization/crosvm/update.py +++ /dev/null @@ -1,91 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -p nix-prefetch-git "python3.withPackages (ps: with ps; [ lxml ])" -#! nix-shell -i python - -import base64 -import json -import re -import subprocess -from codecs import iterdecode -from os.path import dirname, splitext -from lxml import etree -from lxml.etree import HTMLParser -from urllib.request import urlopen - -# ChromiumOS components required to build crosvm. -components = ['chromiumos/platform/crosvm', 'chromiumos/third_party/adhd'] - -git_root = 'https://chromium.googlesource.com/' -manifest_versions = f'{git_root}chromiumos/manifest-versions' -buildspecs_url = f'{manifest_versions}/+/refs/heads/master/full/buildspecs/' - -# CrOS version numbers look like this: -# [<chrome-major-version>.]<tip-build>.<branch-build>.<branch-branch-build> -# -# As far as I can tell, branches are where internal Google -# modifications are added to turn Chromium OS into Chrome OS, and -# branch branches are used for fixes for specific devices. So for -# Chromium OS they will always be 0. This is a best guess, and is not -# documented. -with urlopen('https://cros-updates-serving.appspot.com/') as resp: - document = etree.parse(resp, HTMLParser()) - # bgcolor="lightgreen" is set on the most up-to-date version for - # each channel, so find a lightgreen cell in the "Stable" column. - (platform_version, chrome_version) = document.xpath(""" - (//table[@id="cros-updates"]/tr/td[1 + count( - //table[@id="cros-updates"]/thead/tr[1]/th[text() = "Stable"] - /preceding-sibling::*) - ][@bgcolor="lightgreen"])[1]/text() - """) - -chrome_major_version = re.match(r'\d+', chrome_version)[0] -chromeos_tip_build = re.match(r'\d+', platform_version)[0] - -# Find the most recent buildspec for the stable Chrome version and -# Chromium OS build number. Its branch build and branch branch build -# numbers will (almost?) certainly be 0. It will then end with an rc -# number -- presumably these are release candidates, one of which -# becomes the final release. Presumably the one with the highest rc -# number. -with urlopen(f'{buildspecs_url}{chrome_major_version}/?format=TEXT') as resp: - listing = base64.decodebytes(resp.read()).decode('utf-8') - buildspecs = [(line.split('\t', 1)[1]) for line in listing.splitlines()] - buildspecs = [s for s in buildspecs if s.startswith(chromeos_tip_build)] - buildspecs.sort(reverse=True) - buildspec = splitext(buildspecs[0])[0] - -revisions = {} - -# Read the buildspec, and extract the git revisions for each component. -with urlopen(f'{buildspecs_url}{chrome_major_version}/{buildspec}.xml?format=TEXT') as resp: - xml = base64.decodebytes(resp.read()) - root = etree.fromstring(xml) - for project in root.findall('project'): - revisions[project.get('name')] = project.get('revision') - -# Initialize the data that will be output from this script. Leave the -# rc number in buildspec so nobody else is subject to the same level -# of confusion I have been. -data = {'version': f'{chrome_major_version}.{buildspec}', 'components': {}} - -# Fill in the 'components' dictionary with the output from -# nix-prefetch-git, which can be passed straight to fetchGit when -# imported by Nix. -for component in components: - argv = ['nix-prefetch-git', - '--url', git_root + component, - '--rev', revisions[component]] - - output = subprocess.check_output(argv) - data['components'][component] = json.loads(output.decode('utf-8')) - -# Find the path to crosvm's default.nix, so the srcs data can be -# written into the same directory. -argv = ['nix-instantiate', '--eval', '--json', '-A', 'crosvm.meta.position'] -position = json.loads(subprocess.check_output(argv).decode('utf-8')) -filename = re.match(r'[^:]*', position)[0] - -# Finally, write the output. -with open(dirname(filename) + '/upstream-info.json', 'w') as out: - json.dump(data, out, indent=2) - out.write('\n') diff --git a/pkgs/applications/virtualization/crosvm/upstream-info.json b/pkgs/applications/virtualization/crosvm/upstream-info.json deleted file mode 100644 index bb9cc8841b4..00000000000 --- a/pkgs/applications/virtualization/crosvm/upstream-info.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "version": "81.12871.0.0-rc1", - "components": { - "chromiumos/platform/crosvm": { - "url": "https://chromium.googlesource.com/chromiumos/platform/crosvm", - "rev": "8b8c01e1ad31718932491e4aee63f56109a138e2", - "date": "2020-01-25T02:28:10+00:00", - "sha256": "1qmf1k06pwynh15c3nr9m6v90z2pkk930xniwvlvbvnazrk4rllg", - "fetchSubmodules": false, - "deepClone": false, - "leaveDotGit": false - }, - "chromiumos/third_party/adhd": { - "url": "https://chromium.googlesource.com/chromiumos/third_party/adhd", - "rev": "f361d5b02623274723bff251dafa1e2a2887b013", - "date": "2020-01-23T18:37:46+00:00", - "sha256": "1p8iwjwgmcgmzri03ik2jaid8l0ch0bzn6z9z64dix1hlrvrlliw", - "fetchSubmodules": false, - "deepClone": false, - "leaveDotGit": false - } - } -} diff --git a/pkgs/applications/window-managers/wayfire/applications.nix b/pkgs/applications/window-managers/wayfire/applications.nix new file mode 100644 index 00000000000..6c22227c0c5 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/applications.nix @@ -0,0 +1,23 @@ +{ newScope, wayfirePlugins }: + +let + self = with self; { + inherit wayfirePlugins; + + callPackage = newScope self; + + wayfire = callPackage ./. { }; + + wcm = callPackage ./wcm.nix { + inherit (wayfirePlugins) wf-shell; + }; + + wrapWayfireApplication = callPackage ./wrapper.nix { }; + + withPlugins = selector: self // { + wayfire = wrapWayfireApplication wayfire selector; + wcm = wrapWayfireApplication wcm selector; + }; + }; +in +self diff --git a/pkgs/applications/window-managers/wayfire/default.nix b/pkgs/applications/window-managers/wayfire/default.nix new file mode 100644 index 00000000000..c870d7aed78 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/default.nix @@ -0,0 +1,66 @@ +{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, ninja, pkg-config, git +, cairo, libdrm, libexecinfo, libinput, libjpeg, libxkbcommon, wayland +, wayland-protocols, wf-config, wlroots +}: + +let + self = stdenv.mkDerivation rec { + pname = "wayfire"; + version = "0.4.0"; + + src = fetchFromGitHub { + owner = "WayfireWM"; + repo = "wayfire"; + rev = version; + sha256 = "01rfkb7m1b4d0a9ph9c9jzaa7q6xa91i2ygd3xcnkz35b35qcxn2"; + }; + + patches = [ + # Fix gles32 support with Nixpkgs' LibGL's glesv2.pc. Can be + # removed if <https://github.com/WayfireWM/wayfire/pull/496> is + # applied upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wayfire/commit/ca3c74d9f472e929bee45a89e40fe6351e9d0bf5.patch"; + sha256 = "0jl36z1n0vs4dzsxxp4n1wzlzcasm5hy12dpnr3c9gzwlvns3wk9"; + }) + + # The following three patches add support for plugins installed + # outside of Wayfire's prefix. Without these, Wayfire plugins + # would all have to be built in this derivation. All three + # patches can be removed if + # <https://github.com/WayfireWM/wayfire/pull/497> is applied + # upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wayfire/commit/b9a456c8304546bfb66a9474a47937180b2d2555.patch"; + sha256 = "1l6vsch5n8h6830bisnzdfjjrvp3q9hqml3hzb5d99lrmc3zcld8"; + }) + (fetchpatch { + url = "https://github.com/WayfireWM/wayfire/commit/4bc39424688b8919311bc7ceee9eae2374e4d521.patch"; + excludes = [ "subprojects/wf-config" ]; + sha256 = "1cqhzbqlwlz0gv5239bx29yfjfmfv0lwyb3qx4wcnwxc3f70vr64"; + }) + (fetchpatch { + url = "https://github.com/WayfireWM/wayfire/commit/39096c8b544d06addf88234a16a93f9a2aada07c.patch"; + sha256 = "0in6mcx045grbdxwzgckhyfvffq7xs5k1n3pij6fxh9ckjylpx5k"; + }) + ]; + + strictDeps = true; + nativeBuildInputs = [ meson ninja pkg-config wayland git ]; + buildInputs = [ + cairo libdrm libexecinfo libinput libjpeg libxkbcommon wayland + wayland-protocols wf-config wlroots + ]; + + mesonFlags = [ "--sysconfdir" "/etc" ]; + + meta = with lib; { + homepage = "https://wayfire.org/"; + description = "3D wayland compositor"; + license = licenses.mit; + maintainers = with maintainers; [ qyliss wucke13 ]; + platforms = platforms.unix; + }; + }; +in +self diff --git a/pkgs/applications/window-managers/wayfire/plugins.nix b/pkgs/applications/window-managers/wayfire/plugins.nix new file mode 100644 index 00000000000..830a918fcb7 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/plugins.nix @@ -0,0 +1,12 @@ +{ newScope, wayfire }: + +let + self = with self; { + inherit wayfire; + + callPackage = newScope self; + + wf-shell = callPackage ./wf-shell.nix { }; + }; +in +self diff --git a/pkgs/applications/window-managers/wayfire/wcm.nix b/pkgs/applications/window-managers/wayfire/wcm.nix new file mode 100644 index 00000000000..7c246d9e0f7 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/wcm.nix @@ -0,0 +1,48 @@ +{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, ninja, pkg-config, wayland +, gnome3, libevdev, libxml2, wayfire, wayland-protocols, wf-config, wf-shell +}: + +stdenv.mkDerivation rec { + pname = "wcm"; + version = "0.4.0"; + + src = fetchFromGitHub { + owner = "WayfireWM"; + repo = "wcm"; + rev = "v${version}"; + sha256 = "0irypa0814nmsmi9s8wxwfs507w41g41zjv8dkp0fdhg0429zxwa"; + }; + + patches = [ + # The following three patches add support for loading Wayfire + # plugin metadata from outside of Wayfire's prefix. Remove if + # <https://github.com/WayfireWM/wcm/pull/18> is applied upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wcm/commit/8930ce96f51175947c42a605a520adc7282138ef.patch"; + sha256 = "10s3jikm99msxx73k6ccam8jlpdvvy379mifks4zmpfbag9ammrl"; + }) + (fetchpatch { + url = "https://github.com/WayfireWM/wcm/commit/07dfe16bf83ca3389ddfa8b1f90afee0a8c16135.patch"; + sha256 = "1hgqzqpf2anyhfb1bl4v3n2vwsw0w7far651p7aisn9vr6iqbmls"; + }) + (fetchpatch { + url = "https://github.com/WayfireWM/wcm/commit/0864c3d842ca1dfe6b2d25013941a7679d867458.patch"; + sha256 = "1z4zjl9al09wgb39gyc4g2ib5kkzppq37zla6ncmhmglis4l8arn"; + }) + ]; + + strictDeps = true; + nativeBuildInputs = [ meson ninja pkg-config wayland ]; + buildInputs = [ + gnome3.gtk libevdev libxml2 wayfire wayland wayland-protocols wf-config + wf-shell + ]; + + meta = with lib; { + homepage = "https://github.com/WayfireWM/wcm"; + description = "Wayfire Config Manager"; + license = licenses.mit; + maintainers = with maintainers; [ qyliss wucke13 ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/applications/window-managers/wayfire/wf-config.nix b/pkgs/applications/window-managers/wayfire/wf-config.nix new file mode 100644 index 00000000000..31e0b5a7a49 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/wf-config.nix @@ -0,0 +1,40 @@ +{ stdenv, lib, fetchFromGitHub, fetchpatch, meson, ninja, pkg-config +, glm, libevdev, libxml2 +}: + +stdenv.mkDerivation rec { + pname = "wf-config"; + version = "0.4.0"; + + src = fetchFromGitHub { + owner = "WayfireWM"; + repo = "wf-config"; + rev = version; + sha256 = "0pb2v71x0dv9s96wi20d9bc9rlxzr85rba7vny6751j7frqr4xf7"; + }; + + patches = [ + # Modify wf::config::build_configuration to allow plugins + # installed outside of Wayfire's prefix. Otherwise, we'd have to + # build all Wayfire plugins in the wayfire derivation. Remove if + # <https://github.com/WayfireWM/wf-config/pull/25> is applied + # upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wf-config/commit/36578282f774d71eb8ebcd2dfc9d923eb70ac637.patch"; + sha256 = "152744xgi9ha135r7qfyivdl5cgcp9kik224ncwqv9a480m7nwj6"; + }) + ]; + + strictDeps = true; + nativeBuildInputs = [ meson ninja pkg-config ]; + buildInputs = [ libevdev libxml2 ]; + propagatedBuildInputs = [ glm ]; + + meta = with lib; { + homepage = "https://github.com/WayfireWM/wf-config"; + description = "Library for managing configuration files, written for Wayfire"; + license = licenses.mit; + maintainers = with maintainers; [ qyliss wucke13 ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/applications/window-managers/wayfire/wf-shell.nix b/pkgs/applications/window-managers/wayfire/wf-shell.nix new file mode 100644 index 00000000000..5bddd954f0d --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/wf-shell.nix @@ -0,0 +1,61 @@ +{ stdenv, lib, fetchurl, fetchpatch, meson, ninja, pkg-config, wayland, git +, alsaLib, gnome3, gtk-layer-shell, pulseaudio, wayfire, wf-config +}: + +stdenv.mkDerivation rec { + pname = "wf-shell"; + version = "0.4.0"; + + # > Note to packagers: do not use the autogenerated "Source code" + # > archives from GitHub, but the wf-shell-0.4.0.tar.xz file. + src = fetchurl { + url = "https://github.com/WayfireWM/wf-shell/releases/download/${version}/wf-shell-${version}.tar.xz"; + sha256 = "184sdbfqisz96r0k9dmp8vc1arw9bs7nhkv3pbv9pxkj5liya0xw"; + }; + + patches = [ + # Use the wf::config::build_configuration API as modified by the + # corresponding wf-config patch. Remove if + # <https://github.com/WayfireWM/wf-shell/pull/52> is applied + # upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wf-shell/commit/078f7d845f39689906d008d857681416c312991a.patch"; + sha256 = "0bgkm9sv9y2y4iyhga453vnffbyi8zy2by3fkhakpjlrzx9qlzza"; + }) + + # Allow wf-shell to be installed into its own prefix, rather than + # wayfire's. Remove if + # <https://github.com/WayfireWM/wf-shell/pull/53> is applied + # upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wf-shell/commit/482f00455f0b0e08e3fffc844c865e43c80df84b.patch"; + sha256 = "0zcwgshdd5d03fnkz30nmpzv0xv3085iqjmn61r05bin8v2b2b2h"; + }) + + # Generate and install a wf-shell.pc file, so that other packages + # can find wf-shell's metadata directory, rather than assuming + # it's the same as Wayfire's. Remove if + # <https://github.com/WayfireWM/wf-shell/pull/54> is applied + # upstream. + (fetchpatch { + url = "https://github.com/WayfireWM/wf-shell/commit/2c97d63cde3fd683f3b4159f459a5116e1a539f3.patch"; + sha256 = "0pfi6x1ddm9bbhmy48bxmgvqpl754d3f7q91703mzfza0rlwpr4q"; + }) + ]; + + strictDeps = true; + nativeBuildInputs = [ meson ninja pkg-config wayland git ]; + buildInputs = [ + alsaLib gnome3.gtkmm gtk-layer-shell pulseaudio wayfire wf-config + ]; + + mesonFlags = [ "--sysconfdir" "/etc" ]; + + meta = with lib; { + homepage = "https://github.com/WayfireWM/wf-shell"; + description = "GTK3-based panel for Wayfire"; + license = licenses.mit; + maintainers = with maintainers; [ qyliss wucke13 ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/applications/window-managers/wayfire/wrapper.nix b/pkgs/applications/window-managers/wayfire/wrapper.nix new file mode 100644 index 00000000000..62292898547 --- /dev/null +++ b/pkgs/applications/window-managers/wayfire/wrapper.nix @@ -0,0 +1,39 @@ +{ runCommandNoCC, lib, makeWrapper, wayfirePlugins }: + +let + inherit (lib) escapeShellArg makeBinPath; + + xmlPath = plugin: "${plugin}/share/wayfire/metadata/wf-shell"; + + makePluginPath = lib.makeLibraryPath; + makePluginXMLPath = lib.concatMapStringsSep ":" xmlPath; +in + +application: + +choosePlugins: + +let + plugins = choosePlugins wayfirePlugins; +in + +runCommandNoCC "${application.name}-wrapped" { + nativeBuildInputs = [ makeWrapper ]; + + passthru = application.passthru // { + unwrapped = application; + }; + + inherit (application) meta; +} '' + mkdir -p $out/bin + for bin in ${application}/bin/* + do + makeWrapper "$bin" $out/bin/''${bin##*/} \ + --suffix PATH : ${escapeShellArg (makeBinPath plugins)} \ + --suffix WAYFIRE_PLUGIN_PATH : ${escapeShellArg (makePluginPath plugins)} \ + --suffix WAYFIRE_PLUGIN_XML_PATH : ${escapeShellArg (makePluginXMLPath plugins)} + done + find ${application} -mindepth 1 -maxdepth 1 -not -name bin \ + -exec ln -s '{}' $out ';' +'' |