From 8170151c842e26cef4ab7619c05a2436c6028980 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Thu, 25 Jan 2024 17:19:11 +0100 Subject: [PATCH] added documentation and dev tools --- .envrc | 1 + .gitignore | 3 +++ README.md | 23 +++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++++++++---- 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .envrc create mode 100644 README.md diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index b2be92b..ef4d6a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ result +*.AppImage + +.direnv/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..b75c89e --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# Story Architect Flake + +This flake packages the [Story Architect](https://github.com/story-apps/starc) AppImage. + +## Build + +```txt +nix build +``` + +## Developing + +```txt +nix develop +nix run .#dev +``` + +The `nix run .#dev` command will download the AppImage used for building. +It can then be inspected locally with tools like `file` and `appimage-run`, which are offered by the `nix develop` command. + +### Resources + +* [Nix Manual](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools) diff --git a/flake.nix b/flake.nix index 86b89a5..6b69499 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,11 @@ sha256 = "sha256-wixqb1cV+WEhgxsl2CeOjrid4P0daHqh0O40h2iPst4="; }; + appimage = pkgs.fetchurl { + url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage"; + sha256 = "sha256-KLawvuLyqd7aPidH3ghr7mLl9NFQ7nduhnxAq0RpToQ="; + }; + desktopItem = pkgs.makeDesktopItem { exec = name; @@ -39,10 +44,7 @@ default = pkgs.appimageTools.wrapType1 { inherit name; - src = pkgs.fetchurl { - url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage"; - sha256 = "sha256-KLawvuLyqd7aPidH3ghr7mLl9NFQ7nduhnxAq0RpToQ="; - }; + src = appimage; extraInstallCommands = '' # Install .desktop file @@ -59,5 +61,23 @@ ''; }; }; + + apps.${system} = { + dev = { + program = "${pkgs.writeShellScript "download-appimage" '' + ${pkgs.curl}/bin/curl ${appimage.url} -Lo ${name}.AppImage + ''}"; + type = "app"; + }; + }; + + devShells.${system} = { + default = pkgs.mkShellNoCC { + packages = with pkgs; [ + appimage-run + file + ]; + }; + }; }; }