Compare commits

...

7 Commits

4 changed files with 74 additions and 34 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

3
.gitignore vendored
View File

@ -1 +1,4 @@
result result
*.AppImage
.direnv/

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# Story Architect Flake
This flake packages the [Story Architect](https://github.com/story-apps/starc) AppImage.
## Build
```txt
nix build
```
## Developing
```txt
nix develop
```
This will put you in a shell with `appimage-run` and other useful utilities.
It will also download the AppImage that is currently being packaged.
To manually download the AppImage do:
```txt
nix run .#dev
```
### Resources
* [Nix Manual](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools)

View File

@ -13,51 +13,60 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
name = "starc"; name = "starc";
version = "0.6.4"; version = "0.7.5";
icon = pkgs.fetchurl { src = pkgs.fetchurl {
url = "https://github.com/story-apps/starc/blob/v${version}/img/starc.png"; url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage";
sha256 = "sha256-wixqb1cV+WEhgxsl2CeOjrid4P0daHqh0O40h2iPst4="; sha256 = "sha256-KAY04nXVyXnjKJxzh3Pvi50Vs0EPbLk0VgfZuz7MQR0=";
};
desktopItem = pkgs.makeDesktopItem {
exec = name;
inherit name;
desktopName = "Story Architect";
genericName = "Storywriting Software";
icon = name;
comment = "Advanced text editor for script writers.";
categories = ["Office" "TextEditor" "Utility"];
mimeTypes = ["application/x-${name}"];
}; };
in { in {
packages.${system} = { packages.${system} = {
default = pkgs.appimageTools.wrapType1 { default = pkgs.appimageTools.wrapType2 {
inherit name; inherit name src;
src = pkgs.fetchurl { extraInstallCommands = let
url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage"; contents = pkgs.appimageTools.extract {
sha256 = "sha256-KLawvuLyqd7aPidH3ghr7mLl9NFQ7nduhnxAq0RpToQ="; inherit name src;
}; };
in ''
extraInstallCommands = ''
# Install .desktop file # Install .desktop file
mkdir -p $out/share/ install -m 444 ${contents}/${name}.desktop -Dt $out/share/applications
ln -s "${desktopItem}/share/applications" $out/share/applications
# Install icons # Install icons
for dimension in 128 256 512; do for file in $(find ${contents}/share/icons -type f); do
dimensions=''${dimension}x''${dimension} directory=$(dirname ''${file#${contents}})
install -m 444 $file -D $out/$directory/${name}.png
mkdir -p $out/share/icons/hicolor/$dimensions/apps
"${pkgs.imagemagick}/bin/convert" ${icon} -resize $dimensions $out/share/icons/hicolor/$dimensions/apps/${name}.png
done done
''; '';
}; };
}; };
apps.${system} = {
dev = {
program = "${pkgs.writeShellScript "download-appimage" ''
${pkgs.curl}/bin/curl ${src.url} -C - -Lo ${name}.AppImage
''}";
type = "app";
};
};
overlays = {
default = final: prev: {
starc = self.packages.${system}.default;
};
};
devShells.${system} = {
default = pkgs.mkShellNoCC {
packages = with pkgs; [
appimage-run
file
];
shellHook = ''
${self.apps.${system}.dev.program}
'';
};
};
}; };
} }