Files

89 lines
2.6 KiB
Nix

{
description = "Inner Breeze breathing, meditation, and habit practice app";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
versionLine =
pkgs.lib.lists.findFirst
(line: builtins.match ''#define APP_VERSION_STRING "([^"]+)".*'' line != null)
null
(pkgs.lib.strings.splitString "\n" (builtins.readFile ./src/core/version.h));
versionMatch = builtins.match ''#define APP_VERSION_STRING "([^"]+)".*'' versionLine;
in {
default = pkgs.stdenv.mkDerivation rec {
pname = "breathing";
version = builtins.elemAt versionMatch 0;
src = self;
nativeBuildInputs = with pkgs; [
cmake
gnumake
pkg-config
];
buildInputs = with pkgs; [
curl
gtk3
libdrm
libglvnd
mesa
openssl
SDL2
zlib
];
buildPhase = ''
runHook preBuild
make native
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -d "$out/bin"
install -m755 "$(find build/bin/linux -maxdepth 1 -type f -name 'breathing-linux-*' | head -n 1)" "$out/bin/breathing"
install -D -m644 packaging/linux/appimage/breathing.desktop \
"$out/share/applications/breathing.desktop"
install -D -m644 packaging/linux/appimage/breathing.png \
"$out/share/icons/hicolor/512x512/apps/breathing.png"
install -D -m644 packaging/linux/appimage/breathing.appdata.xml \
"$out/share/metainfo/xyz.waozi.breathing.metainfo.xml"
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Syncable breathing, meditation, and habit practice app";
homepage = "https://breathing.waozi.xyz/";
license = licenses.bsd3;
mainProgram = "breathing";
platforms = platforms.linux;
};
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/breathing";
};
});
};
}