diff --git a/.gitignore b/.gitignore index 545f9a3..dee1460 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .direnv -target \ No newline at end of file +result \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..86a5fc4 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# NixOS Fedi Emotes + +Ever wanted to describe your emotes declaratively? ya us too. + +Extremely WIP, but likely to stay stable with care. + +## Modules + +### Akkoma + +We have a module to automatically import and configure derivations as Akkoma emoji... Assuming you're already importing this as a flake named `fedi-emotes`... + +```nix +{ inputs, pkgs, ... }: { + imports = [ + inputs.fedi-emotes.nixosModules.akkoma + ]; + + services.akkoma = { + # ... + emoji = { + enable = true; # Enable the emoji tool + emojiPackages = with inputs.fedi-emotes.packages.${pkgs.system}; [ + # Any packages are OK here, Akkoma expects .png/.gif. + pkgs.akkoma-emoji.blobs_gg + lightrunner-custom.hearts + lightrunner-custom.anime + ]; + }; + # ... + }; +} +``` + +This module will place these packages/derivations in `services.akkoma.extraStatic."emoji/${package.name}"`, and map these prefixes to picker tabs via `services.akkoma.config.":pleroma".":emoji".groups`. + +## Emote Packs + +### Lightrunner Custom + +_Used by https://sapphic.engineer and https://porcelain.doll.repair, among others._ + +- **Hearts** - `lightrunner-custom.hearts` - Hearts, Noegrams, and other personal bits and bobs. +- **Anime** - `lightrunner-custom.anime` - A pack of cute anime emotes + +### Volpeon + +- **Blobfox** - `volpeon.blobfox` - Blobfoxes +- **Neocat** - `volpeon.neocat` - Neocats diff --git a/akkoma.nix b/akkoma.nix new file mode 100644 index 0000000..92c0e31 --- /dev/null +++ b/akkoma.nix @@ -0,0 +1,41 @@ +{ pkgs, config, lib, ... }: with lib; let + cfg = config.services.akkoma.emotes; +in { + options.services.akkoma.emoji = { + enable = mkEnableOption "Akkoma Emoji"; + + emojiPackages = mkOption { + type = with types; listOf package; + default = []; + description = '' + List of packages to install into Akkoma's emoji store. + + Each entry will be its own category in the emoji picker. + + These can be _any_ package/derivation, Akkoma is expecting .png and .gif files, though. + ''; + }; + + }; + config = mkIf cfg.enable { + services.akkoma = { + config.":pleroma".":emoji" = with (pkgs.formats.elixirConf { }).lib; { + # shortcode_globs = ["/emoji/**/*.png" "/emoji/**/*.gif"]; + groups = mkMap(builtins.listToAttrs( + map (package: { + name = package.name; + value = "/emoji/${package.name}/*"; + }) cfg.emotePackages + )); + }; + + extraStatic = builtins.listToAttrs( + map (package: { + name = "emoji/${package.name}"; + value = package; + }) cfg.emotePackages + ); + + }; + }; +} \ No newline at end of file diff --git a/flake.nix b/flake.nix index 186b302..56f905f 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,17 @@ systems = [ "aarch64-linux" "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs systems; in { + nixosModules = { + akkoma = import ./akkoma.nix; + }; + + packages = forAllSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in import ./packages.nix { + inherit pkgs inputs; + utils = import ./utils.nix { inherit pkgs; }; + }); + devShells = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in { diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..1b90901 --- /dev/null +++ b/packages.nix @@ -0,0 +1,14 @@ +{ pkgs, utils, inputs, ... }: let + specialArgs = { inherit pkgs utils inputs; }; +in { + # These are specific to the Lightrunner System instances. + lightrunner-custom = { + anime = import ./custom/anime.nix specialArgs; + hearts = import ./custom/hearts.nix specialArgs; + }; + + volpeon = { + blobfox = import ./volpeon/blobfox.nix specialArgs; + neocat = import ./volpeon/neocat.nix specialArgs; + }; +} \ No newline at end of file diff --git a/utils.nix b/utils.nix new file mode 100644 index 0000000..8b1d83f --- /dev/null +++ b/utils.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + mkEmotePack = { + src, + name, + version ? "v0.0.1", + convertSVGs ? false + }: pkgs.stdenvNoCC.mkDerivation { + inherit src name version; + + buildPhase = '' + cp -r $src/ $out/ + ''; + }; +} \ No newline at end of file diff --git a/volpeon/blobfox.nix b/volpeon/blobfox.nix new file mode 100644 index 0000000..5a0f8cc --- /dev/null +++ b/volpeon/blobfox.nix @@ -0,0 +1,12 @@ +{ utils, pkgs, ... }: let + rev = "6d3bb625c795ac1bd1484d37b1e1ceb5015d624e"; +in utils.mkEmotePack { + name = "volpeon-blobfox"; + version = rev; + convertSVGs = true; + src = pkgs.fetchgit { + url = "https://git.vulpes.one/git/blobfox-emojis.git"; + rev = rev; + hash = "sha256-IMXC4WfAIGs3Ljc+GM3/YyfE0jOyxsoRvF4LwA4AYrw="; + }; +} \ No newline at end of file diff --git a/volpeon/neocat.nix b/volpeon/neocat.nix new file mode 100644 index 0000000..281bde5 --- /dev/null +++ b/volpeon/neocat.nix @@ -0,0 +1,9 @@ +{ utils, pkgs, ... }: utils.mkEmotePack { + name = "volpeon-neocat"; + version = "1.1"; + unzip = true; + src = pkgs.fetchurl { + url = "https://volpeon.ink/emojis/neocat/neocat.zip"; + hash = "sha256-DZDuk0Djlax504flNWdpqAw+ROLOOVGj0ZvJLyouo7A="; + }; +} \ No newline at end of file