aboutsummaryrefslogtreecommitdiff
path: root/nix/README.md
blob: 7a422fc5b6cd60b4bc288a1f2e865a981b70ca71 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Prism Launcher Nix Packaging

## Installing a stable release (nixpkgs)

Prism Launcher is packaged in [nixpkgs](https://github.com/NixOS/nixpkgs/) since 22.11.

See [Package variants](#package-variants) for a list of available packages.

## Installing a development release (flake)

We use [garnix](https://garnix.io/) to build and cache our development builds.
If you want to avoid rebuilds you may add the garnix cache to your substitutors.

Example (NixOS):

```nix
{...}:
{
  nix.settings = {
    trusted-substituters = [
      "https://cache.garnix.io"
    ];

    trusted-public-keys = [
      "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
    ];
  };
}
```

### Using the overlay

After adding `github:PrismLauncher/PrismLauncher` to your flake inputs, you can add the `default` overlay to your nixpkgs instance.

Example:

```nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    prismlauncher = {
      url = "github:PrismLauncher/PrismLauncher";
      # Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
      # Note that overriding any input of prismlauncher may break reproducibility
      # inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {nixpkgs, prismlauncher}: {
    nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";

      modules = [
        ({pkgs, ...}: {
          nixpkgs.overlays = [prismlauncher.overlays.default];

          environment.systemPackages = [pkgs.prismlauncher];
        })
      ];
    };
  }
}
```

### Installing the package directly

Alternatively, if you don't want to use an overlay, you can install Prism Launcher directly by installing the `prismlauncher` package.
This way the installed package is fully reproducible.

Example:

```nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    prismlauncher = {
      url = "github:PrismLauncher/PrismLauncher";
      # Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
      # Note that overriding any input of prismlauncher may break reproducibility
      # inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {nixpkgs, prismlauncher}: {
    nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";

      modules = [
        ({pkgs, ...}: {
          environment.systemPackages = [prismlauncher.packages.${pkgs.system}.prismlauncher];
        })
      ];
    };
  }
}
```

### Installing the package ad-hoc (`nix shell`, `nix run`, etc.)

You can simply call the default package of this flake.

Example:

```shell
nix run github:PrismLauncher/PrismLauncher

nix shell github:PrismLauncher/PrismLauncher

nix profile install github:PrismLauncher/PrismLauncher
```

## Installing a development release (without flakes)

We use [garnix](https://garnix.io/) to build and cache our development builds.
If you want to avoid rebuilds you may add the garnix cache to your substitutors.

Example (NixOS):

```nix
{...}:
{
  nix.settings = {
    trusted-substituters = [
      "https://cache.garnix.io"
    ];

    trusted-public-keys = [
      "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
    ];
  };
}
```

### Using the overlay (`fetchTarball`)

We use flake-compat to allow using this Flake on a system that doesn't use flakes.

Example:

```nix
{pkgs, ...}: {
  nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).overlays.default];

  environment.systemPackages = [pkgs.prismlauncher];
}
```

### Installing the package directly (`fetchTarball`)

Alternatively, if you don't want to use an overlay, you can install Prism Launcher directly by installing the `prismlauncher` package.
This way the installed package is fully reproducible.

Example:

```nix
{pkgs, ...}: {
  environment.systemPackages = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).packages.${pkgs.system}.prismlauncher];
}
```

### Installing the package ad-hoc (`nix-env`)

You can add this repository as a channel and install its packages that way.

Example:

```shell
nix-channel --add https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz prismlauncher

nix-channel --update prismlauncher

nix-env -iA prismlauncher.prismlauncher
```

## Package variants

Both Nixpkgs and this repository offer the following packages:

- `prismlauncher` - Preferred build using Qt 6
- `prismlauncher-qt5` - Legacy build using Qt 5 (i.e. for Qt 5 theming support)

Both of these packages also have `-unwrapped` counterparts, that are not wrapped and can therefore be customized even further than what the wrapper packages offer.

### Customizing wrapped packages

The wrapped packages (`prismlauncher` and `prismlauncher-qt5`) offer some build parameters to further customize the launcher's environment.

The following parameters can be overridden:

- `msaClientID` (default: `null`, requires full rebuild!) Client ID used for Microsoft Authentication
- `gamemodeSupport` (default: `true`) Turn on/off support for [Feral GameMode](https://github.com/FeralInteractive/gamemode)
- `jdks` (default: `[ jdk17 jdk8 ]`) Java runtimes added to `PRISMLAUNCHER_JAVA_PATHS` variable
- `additionalLibs` (default: `[ ]`) Additional libraries that will be added to `LD_LIBRARY_PATH`