starc-flake/flake.nix

73 lines
1.8 KiB
Nix
Raw Permalink Normal View History

2024-01-24 20:50:46 +00:00
{
description = "An advanced text editor for script writers working professionally in film, novel, theatre, radio or writing for comic books.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
name = "starc";
version = "0.6.4";
2024-01-25 11:55:25 +00:00
2024-01-25 17:30:18 +00:00
src = pkgs.fetchurl {
2024-01-25 16:19:11 +00:00
url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage";
sha256 = "sha256-KLawvuLyqd7aPidH3ghr7mLl9NFQ7nduhnxAq0RpToQ=";
};
2024-01-24 20:50:46 +00:00
in {
packages.${system} = {
2024-01-25 16:58:02 +00:00
default = pkgs.appimageTools.wrapType2 {
2024-01-25 17:30:18 +00:00
inherit name src;
2024-01-25 11:55:25 +00:00
2024-01-25 16:58:02 +00:00
extraInstallCommands = let
contents = pkgs.appimageTools.extract {
2024-01-25 17:30:18 +00:00
inherit name src;
2024-01-25 16:58:02 +00:00
};
in ''
2024-01-25 14:33:24 +00:00
# Install .desktop file
2024-01-25 17:30:18 +00:00
install -m 444 ${contents}/${name}.desktop -Dt $out/share/applications
2024-01-25 14:17:30 +00:00
# Install icons
2024-01-25 17:30:18 +00:00
for file in $(find ${contents}/share/icons -type f); do
directory=$(dirname ''${file#${contents}})
install -m 444 $file -D $out/$directory/${name}.png
done
2024-01-25 11:55:25 +00:00
'';
2024-01-24 20:50:46 +00:00
};
};
2024-01-25 16:19:11 +00:00
apps.${system} = {
dev = {
program = "${pkgs.writeShellScript "download-appimage" ''
${pkgs.curl}/bin/curl ${src.url} -C - -Lo ${name}.AppImage
2024-01-25 16:19:11 +00:00
''}";
type = "app";
};
};
2024-02-06 11:51:20 +00:00
overlays = {
default = final: prev: {
starc = self.packages.${system}.default;
};
};
2024-01-25 16:19:11 +00:00
devShells.${system} = {
default = pkgs.mkShellNoCC {
packages = with pkgs; [
appimage-run
file
];
shellHook = ''
${self.apps.${system}.dev.program}
'';
2024-01-25 16:19:11 +00:00
};
};
2024-01-24 20:50:46 +00:00
};
}