Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Nix flakify #7

Open
wants to merge 1 commit into
base: zoxcore/push_notification
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 2 additions & 62 deletions buildscripts/nixos_qtox.nix
Original file line number Diff line number Diff line change
@@ -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 <nixpkgs> { } }:
{ pkgs ? import <nixpkgs> { } }:
# take nixpkgs from the environment
let
overlay = import ./overlay.nix;
pkgs' = pkgs.extend overlay;
# apply overlay
in pkgs'.qtox
Expand Down
54 changes: 54 additions & 0 deletions buildscripts/overlay.nix
Original file line number Diff line number Diff line change
@@ -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 ];
});

}
25 changes: 25 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}