initial commit

This commit is contained in:
Kristian Krsnik 2024-01-28 18:36:58 +01:00
commit 3dc9935de4
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85
5 changed files with 138 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

4
.gitignore vendored Normal file
View File

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

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# Story Architect Flake
This flake packages the [Moosync](https://github.com/Moosync/Moosync) 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)

27
flake.lock generated Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1705856552,
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

79
flake.nix Normal file
View File

@ -0,0 +1,79 @@
{
description = "Moosync is a customizable desktop music player with a clean interface.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
name = "moosync";
version = "10.3.0";
src = pkgs.fetchurl {
url = "https://github.com/Moosync/Moosync/releases/download/v${version}/Moosync-${version}-linux-x86_64.AppImage";
sha256 = "sha256-Mr8dTpjHs+1S3kOKZ2VGBQuY8z/8+sCNEIyp9FTc7iw=";
};
desktopItem = pkgs.makeDesktopItem {
inherit name;
exec = name;
desktopName = "Moosync";
terminal = false;
icon = name;
startupWMClass = "Moosync";
comment = "Moosync is a customizable desktop music player with a clean interface";
mimeTypes = ["x-scheme-handler/moosync"];
categories = ["Audio"];
extraConfig = {X-AppImage-Version = version;};
};
in {
packages.${system} = {
default = pkgs.appimageTools.wrapType2 {
inherit name src;
extraInstallCommands = let
contents = pkgs.appimageTools.extract {
inherit name src;
};
in ''
# Install .desktop file
install -m 444 ${desktopItem}/share/applications/${name}.desktop -Dt $out/share/applications
# Install icons
for file in $(find ${contents}/usr/share/icons -type f); do
directory=$(dirname ''${file#${contents}/usr})
install -m 444 $file -D $out/$directory/${name}.png
done
'';
};
};
apps.${system} = {
dev = {
program = "${pkgs.writeShellScript "download-appimage" ''
${pkgs.curl}/bin/curl ${src.url} -C - -Lo ${name}.AppImage
''}";
type = "app";
};
};
devShells.${system} = {
default = pkgs.mkShellNoCC {
packages = with pkgs; [
appimage-run
file
];
shellHook = ''
${self.apps.${system}.dev.program}
'';
};
};
};
}