diff --git a/buildscripts/nixos_qtox.nix b/buildscripts/nixos_qtox.nix index 0e8651332..46e9eaf1a 100644 --- a/buildscripts/nixos_qtox.nix +++ b/buildscripts/nixos_qtox.nix @@ -1,67 +1,7 @@ -let - overlay = final: prev: - # a fixed point overay for overriding a package set - - with final; { - # use the final result of the overlay for scope - - libtoxcore = - # build a custom libtoxcore - prev.libtoxcore.overrideAttrs ({ ... }: { - src = fetchFromGitHub { - owner = "zoff99"; - repo = "c-toxcore"; - rev = "4932f9dcf7181d30a0abb4a12b1144ccb1a741fa"; - fetchSubmodules = true; - sha256 = "sha256-cNVUZe4xfl88quk8Tm6jeG4ov1L6q/wh81WZIotVbnk="; - }; - buildInputs = [ - libsodium msgpack ncurses libconfig - libopus libvpx x264 ffmpeg - ]; - }); - - toxext = - # use an existing package or package it here - prev.toxext or stdenv.mkDerivation rec { - pname = "toxext"; - version = "0.0.3"; - src = fetchFromGitHub { - owner = pname; - repo = pname; - rev = "v${version}"; - hash = "sha256-I0Ay3XNf0sxDoPFBH8dx1ywzj96Vnkqzlu1xXsxmI1M="; - }; - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ libtoxcore ]; - }; - - toxextMessages = - # use an existing package or package it here - prev.toxextMessages or stdenv.mkDerivation rec { - pname = "tox_extension_messages"; - version = "0.0.3"; - src = fetchFromGitHub { - owner = "toxext"; - repo = pname; - rev = "v${version}"; - hash = "sha256-qtjtEsvNcCArYW/Zyr1c0f4du7r/WJKNR96q7XLxeoA="; - }; - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ libtoxcore toxext ]; - }; - - qtox = prev.qtox.overrideAttrs ({ buildInputs, ... }: { - version = "push_notification-"; - # take sources directly from this repo checkout - buildInputs = buildInputs ++ [ curl libtoxcore toxext toxextMessages ]; - }); - - }; - -in { pkgs ? import { } }: +{ pkgs ? import { } }: # take nixpkgs from the environment let + overlay = import ./overlay.nix; pkgs' = pkgs.extend overlay; # apply overlay in pkgs'.qtox diff --git a/buildscripts/overlay.nix b/buildscripts/overlay.nix new file mode 100644 index 000000000..b3ef217d5 --- /dev/null +++ b/buildscripts/overlay.nix @@ -0,0 +1,54 @@ +final: prev: +# a fixed point overay for overriding a package set + +with final; { + # use the final result of the overlay for scope + + libtoxcore = + # build a custom libtoxcore + prev.libtoxcore.overrideAttrs ({ ... }: { + src = fetchFromGitHub { + owner = "zoff99"; + repo = "c-toxcore"; + rev = "4932f9dcf7181d30a0abb4a12b1144ccb1a741fa"; + fetchSubmodules = true; + sha256 = "sha256-cNVUZe4xfl88quk8Tm6jeG4ov1L6q/wh81WZIotVbnk="; + }; + buildInputs = + [ libsodium msgpack ncurses libconfig libopus libvpx x264 ffmpeg ]; + }); + + toxext = stdenv.mkDerivation rec { + pname = "toxext"; + version = "0.0.3"; + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "v${version}"; + hash = "sha256-I0Ay3XNf0sxDoPFBH8dx1ywzj96Vnkqzlu1xXsxmI1M="; + }; + nativeBuildInputs = [ cmake pkg-config ]; + buildInputs = [ libtoxcore ]; + }; + + toxextMessages = stdenv.mkDerivation rec { + pname = "tox_extension_messages"; + version = "0.0.3"; + src = fetchFromGitHub { + owner = "toxext"; + repo = pname; + rev = "v${version}"; + hash = "sha256-qtjtEsvNcCArYW/Zyr1c0f4du7r/WJKNR96q7XLxeoA="; + }; + nativeBuildInputs = [ cmake pkg-config ]; + buildInputs = [ libtoxcore toxext ]; + }; + + qtox = prev.qtox.overrideAttrs ({ buildInputs, ... }: { + version = "push_notification-unstable"; + src = lib.sources.cleanSource ./..; + # take sources directly from this repo checkout + buildInputs = buildInputs ++ [ curl libtoxcore toxext toxextMessages ]; + }); + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..f6ff3a180 --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1670267727, + "narHash": "sha256-hUFAn5gjNHIBpLQT0CmqpuQjQwgWUm+D6aziGAYsDmw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a5f661b80e4c163510a5013b585a040a5c7ef55e", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..3f7132864 --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + description = "qTox development flake"; + + outputs = { self, nixpkgs }: + let + inherit (nixpkgs) lib; + intersectOverlay = builtins.intersectAttrs (self.overlay { } { }); + in { + overlay = import ./buildscripts/overlay.nix; + + legacyPackages = + lib.mapAttrs (system: { extend, ... }: extend self.overlay) + nixpkgs.legacyPackages; + + packages = lib.mapAttrs + (system: pkgs: intersectOverlay pkgs // { default = pkgs.qtox; }) + self.legacyPackages; + }; +}