From a366c5a423217a8f97f703a5ffd8f84833ee78e6 Mon Sep 17 00:00:00 2001 From: dev-null-undefined <50732964+dev-null-undefined@users.noreply.github.com> Date: Sun, 26 Mar 2023 12:17:22 +0200 Subject: [PATCH] Feature: Added nix build support (#603) Co-authored-by: ArthurSonzogni --- flake.lock | 43 ++++++++++++++++++++++++++++++++++++++ flake.nix | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..750eb53 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1679734080, + "narHash": "sha256-z846xfGLlon6t9lqUzlNtBOmsgQLQIZvR6Lt2dImk1M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dbf5322e93bcc6cfc52268367a8ad21c09d76fea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c9a04b5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + description = "C++ Functional Terminal User Interface library"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = {self, nixpkgs, flake-utils}: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; in + { + packages.ftxui = pkgs.stdenv.mkDerivation rec { + pname = "ftxui"; + version = "v4.0.0"; + src = pkgs.fetchFromGitHub { + owner = "ArthurSonzogni"; + repo = "FTXUI"; + rev = version; + sha256 = "sha256-3kAhHDUwzwdvHc8JZAcA14tGqa6w69qrN1JXhSxNBQY="; + }; + + nativeBuildInputs = [ + pkgs.cmake + ]; + + cmakeFlags = [ + "-DFTXUI_ENABLE_INSTALL=ON" + "-DFTXUI_BUILD_EXAMPLES=OFF" + "-DFTXUI_BUILD_TESTS=OFF" + "-DFTXUI_BUILD_DOCS=OFF" + "-DCMAKE_BUILD_TYPE=Release" + ]; + + meta = { + homepage = "https://arthursonzogni.github.io/FTXUI/"; + description = "C++ Functional Terminal User Interface."; + longDescription = '' + Functional Terminal (X) User interface + + A simple C++ library for terminal based user interfaces! + Feature + - Functional style. Inspired by [1] and React + - Simple and elegant syntax (in my opinion) + - Keyboard & mouse navigation. + - Support for UTF8 and fullwidth chars (→ 测试) + - Support for animations. Demo 1, Demo 2 + - Support for drawing. Demo + - No dependencies + - Cross platform: Linux/MacOS (main target), WebAssembly, Windows (Thanks to contributors!). + - Learn by examples, and tutorials + - Multiple packages: CMake FetchContent (preferred), vcpkg, pkgbuild, conan, nix, etc... + - Good practises: documentation, tests, fuzzers, performance tests, automated CI, automated packaging, etc... + ''; + license = pkgs.lib.licenses.mit; + platforms = pkgs.lib.platforms.all; + }; + }; + } + ); +}