summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/ci/eval/outpaths.nix
blob: 2e24a5a5df12a8bb155f3dec7b40e5f029ac616d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# =============================================================================
# ProjT Launcher - Build Output Paths
# =============================================================================
# Defines all build output paths for the project across different configurations.
# Used by CI to track what needs to be built and cached.
#
# Usage:
#   nix-env -qaP --no-name --out-path -f ci/eval/outpaths.nix
# =============================================================================

{
  # Systems to generate output paths for
  systems ? builtins.fromJSON (builtins.readFile ../supportedSystems.json),
}:

let
  # Project metadata
  projectName = "projt-launcher";

  # Map system names to output configurations
  systemOutputs = system: {
    name = system;
    outputs = {
      # Main launcher binary
      launcher = {
        type = "executable";
        path = "bin/${projectName}";
        platform = system;
      };

      # Libraries (if built separately)
      libraries = {
        rainbow = "lib/librainbow";
        tomlplusplus = "lib/libtomlplusplus";
        libnbtplusplus = "lib/libnbt++";
        LocalPeer = "lib/libLocalPeer";
        qdcss = "lib/libqdcss";
        katabasis = "lib/libkatabasis";
      };

      # Translations
      translations = {
        type = "data";
        path = "share/${projectName}/translations";
      };

      # Icons and resources
      resources = {
        type = "data";
        path = "share/${projectName}";
      };
    };
  };

  # Build types and their output paths
  buildTypes = {
    Debug = {
      suffix = "-debug";
      optimized = false;
      symbols = true;
    };
    Release = {
      suffix = "";
      optimized = true;
      symbols = false;
    };
    RelWithDebInfo = {
      suffix = "-relwithdebinfo";
      optimized = true;
      symbols = true;
    };
  };

  # Platform-specific packaging outputs
  packageOutputs = {
    "x86_64-linux" = {
      appimage = "ProjT-Launcher-x86_64.AppImage";
      deb = "projt-launcher_VERSION_amd64.deb";
      rpm = "projt-launcher-VERSION.x86_64.rpm";
      flatpak = "org.yongdohyun.ProjTLauncher.flatpak";
    };
    "aarch64-linux" = {
      appimage = "ProjT-Launcher-aarch64.AppImage";
      deb = "projt-launcher_VERSION_arm64.deb";
    };
    "aarch64-darwin" = {
      dmg = "ProjT-Launcher-macOS-AppleSilicon.dmg";
      app = "ProjT Launcher.app";
    };
    "x86_64-windows" = {
      installer = "ProjT-Launcher-Setup.exe";
      portable = "ProjT-Launcher-portable.zip";
      msix = "ProjT-Launcher.msix";
    };
  };

  # Generate output structure for all systems
  allOutputs = builtins.listToAttrs (
    map (system: {
      name = system;
      value = {
        inherit (systemOutputs system) outputs;
        packages = packageOutputs.${system} or { };
        inherit buildTypes;
      };
    }) (if systems == null then [ builtins.currentSystem ] else systems)
  );

in
{
  # All output paths by system
  bySystem = allOutputs;

  # Flat list of all output paths
  allPaths = builtins.concatMap (
    system:
    let
      inherit (allOutputs.${system}) outputs;
    in
    [
      outputs.launcher.path
      outputs.translations.path
      outputs.resources.path
    ]
  ) (builtins.attrNames allOutputs);

  # Metadata
  meta = {
    name = projectName;
    systems = builtins.attrNames allOutputs;
    buildTypes = builtins.attrNames buildTypes;
  };
}