From d36de054882261acaa0c7833c907754536387fae Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Tue, 16 May 2023 12:11:58 -0700 Subject: [PATCH] fantasia-archive: init --- hosts/home.nix | 2 + modules/fantasia-archive/default.nix | 7 +++ modules/fantasia-archive/fantasia-archive.nix | 50 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 modules/fantasia-archive/default.nix create mode 100644 modules/fantasia-archive/fantasia-archive.nix diff --git a/hosts/home.nix b/hosts/home.nix index f228564..af31684 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -19,6 +19,8 @@ in ../modules/startpage ../modules/terminal ../modules/todo-txt + + ../modules/fantasia-archive ]; home.file."./.background-image".source = theme.wallpaper; diff --git a/modules/fantasia-archive/default.nix b/modules/fantasia-archive/default.nix new file mode 100644 index 0000000..f7583dc --- /dev/null +++ b/modules/fantasia-archive/default.nix @@ -0,0 +1,7 @@ +{ config, lib, pkgs, ... }: + +{ + home.packages = with pkgs; [ + (pkgs.callPackage ./fantasia-archive.nix {}) + ]; +} diff --git a/modules/fantasia-archive/fantasia-archive.nix b/modules/fantasia-archive/fantasia-archive.nix new file mode 100644 index 0000000..8ee6d7c --- /dev/null +++ b/modules/fantasia-archive/fantasia-archive.nix @@ -0,0 +1,50 @@ +{ lib +, fetchzip +, appimageTools +, makeDesktopItem +}: + +let + pname = "fantasia-archive"; + version = "0.1.10"; + + archive = fetchzip { + url = "https://github.com/Elvanos/fantasia-archive/releases/download/v${version}/Fantasia.Archive-${version}-linux-appImage.zip"; + hash = "sha256-Ls+7wmj2qFoppiHJwt9Uan+9irFvzHxEWjIWrA9Nw2w="; + }; + src = "${archive}/Fantasia.Archive-${version}-linux-appImage.AppImage"; + appimageContents = appimageTools.extractType2 { + inherit pname src version; + }; + + description = "100% free, powerful & feature-rich offline worldbuilding tool that runs on your computer!"; + + desktopItem = makeDesktopItem { + name = pname; + exec = "sh -c \"${pname} || ${pname} --disable-gpu-sandbox\""; + icon = "${appimageContents}/fantasiaarchive.png"; + comment = description; + desktopName = "Fantasia Archive"; + genericName = "A database manager for world building"; + categories = [ "Office" ]; + }; +in +appimageTools.wrapType2 { + inherit pname version src; + + extraInstallCommands = '' + mkdir -p $out/share/applications + ln -s ${desktopItem}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop + cd $out/bin + mv fantasia-archive-${version} ${pname} + ''; + + meta = with lib; { + inherit description; + homepage = "https://fantasiaarchive.com/"; + license = licenses.gpl3; + maintainers = with maintainers; [ elnudev ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}