+/config

my dotfiles and nix configuration

git clone https://git.julia.blue/+/config

Julia RyanUpdate and xorg migration504a1b6

main
2.2 KiB90 linesraw
1{ config, lib, pkgs, ... }: let
2  opts = {
3    enable = lib.mkEnableOption ''
4      Arcade and fighting game emulator and netplay client
5    '';
6    path = lib.mkOption {
7      type = lib.types.str;
8      description = lib.mdDoc "Path to your download of fightcade";
9    };
10  };
11  cfg = config.programs.fightcade;
12
13  downloader = builtins.fetchurl {
14    url = "https://fightcade.download/fc2json.zip";
15    hash = "";
16  };
17
18  libs = lib.makeLibraryPath (with pkgs; [
19    alsa-lib
20    atk
21    cairo
22    cups
23    dbus
24    expat
25    gdk-pixbuf
26    glib
27    gtk3
28    libdrm
29    mesa
30    nss
31    nspr
32    pango
33    zlib
34    wine
35    libx11
36    libxcb
37    libxcomposite
38    libxcursor
39    libxdamage
40    libxext
41    libxfixes
42    libxi
43    libxrandr
44    libxrender
45    libxscrnsaver
46    libxtst
47  ]);
48
49  quark = (pkgs.makeDesktopItem {
50    name = "fcade-quark";
51    desktopName = "Fightcade Replay";
52    exec = ''bash -c "cd ${cfg.path}/emulator && env LD_LIBRARY_PATH=${libs} ./fcade"'';
53    mimeTypes = [ "x-scheme-handler/fcade" ];
54    type = "Application";
55  });
56  desktop = (pkgs.makeDesktopItem {
57    name = "fightcade";
58    desktopName = "Fightcade";
59    exec = ''bash -c "cd ${cfg.path} && env LD_LIBRARY_PATH=${libs} ./fc2-electron/fc2-electron"'';
60    icon = "${cfg.path}/fc2-electron/resources/app/icon.png";
61    comment = "Fightcade";
62    type = "Application";
63    categories = [ "Game" "Emulator" "ArcadeGame"];
64  });
65in {
66  options.programs.fightcade = opts;
67  config = lib.mkIf cfg.enable {
68    # TODO: not needed if desktop file is there?
69    xdg.mimeApps.defaultApplications."x-scheme-handler/fcade" = "fcade-quark.desktop";
70    home = {
71      packages = [
72        (pkgs.callPackage ( { stdenvNoCC, copyDesktopItems }:
73          stdenvNoCC.mkDerivation {
74            name = "fightcade-desktop";
75            nativeBuildInputs = [ copyDesktopItems ];
76            desktopItems = [ quark desktop ];
77            phases = [ "installPhase" ];
78          }) {}
79        )
80      ];
81
82      activation.extractFightcadeDownloader = lib.hm.dag.entryAfter
83      [ "writeBoundary" ] ''
84        if [ ! -f ${cfg.path}/emulator/fbneo_roms.json ]; then
85          unzip -d ${cfg.path}/emulator ${downloader}
86        fi
87      '';
88    };
89  };
90}