1
0
Fork 0

feat: Add specific and generic versions of the package

This commit is contained in:
Marce Coll 2024-08-22 10:07:02 +02:00
parent 0ecc25c0a0
commit 9f4607359e
2 changed files with 68 additions and 35 deletions

View file

@ -11,12 +11,25 @@ inputs = {
}
```
Then in the `configuration.nix` in the `environment.systemPackages` add
## Packages
This flake exposes two packages, corresponding to the `specific` and `generic` zen versions.
The generic version maximizes compatibility with old CPUs and kernels by compiling it with some
lower common denominator CFLAGS, the `specific` one targets newer CPUs and kernels but it may not
work in your case.
The `default` package is the `specific` one for backwards compatibility with older versions of the flake.
Then in the `configuration.nix` in the `environment.systemPackages` add one of:
```nix
inputs.zen-browser.packages."${system}".default
inputs.zen-browser.packages."${system}".specific
inputs.zen-browser.packages."${system}".generic
```
Depending on which version you want
```shell
$ sudo nixos-rebuild switch
$ zen

View file

@ -9,7 +9,17 @@
let
system = "x86_64-linux";
version = "1.0.0-a.27";
downloadUrl = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-specific.tar.bz2";
downloadUrl = {
"specific" = {
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-specific.tar.bz2";
sha256 = "sha256:1z81dg3xgfpkyj501gflx8lw7d8124iqwm27zqfja2b47zf4ai2x";
};
"generic" = {
url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-generic.tar.bz2";
sha256 = "sha256:1801pcvvmmdz5drqvxs95yzij099mhq7cnw663dna4kcn2nqwvni";
};
};
pkgs = import nixpkgs {
inherit system;
};
@ -20,14 +30,17 @@
] ++ (with pkgs.xorg; [
libxcb libX11 libXcursor libXrandr libXi libXext libXcomposite libXdamage libXfixes
]);
mkZen = { variant }:
let
downloadData = downloadUrl."${variant}";
in
{
packages.${system}.default = pkgs.stdenv.mkDerivation {
pkgs.stdenv.mkDerivation {
name = "zen-browser";
src = builtins.fetchTarball {
url = downloadUrl;
sha256 = "sha256:1z81dg3xgfpkyj501gflx8lw7d8124iqwm27zqfja2b47zf4ai2x";
url = downloadData.url;
sha256 = downloadData.sha256;
};
desktopSrc = ./.;
@ -56,5 +69,12 @@
wrapProgram $out/bin/vaapitest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
'';
};
in
{
packages."${system}" = {
generic = mkZen { variant = "generic"; };
specific = mkZen { variant = "specific"; };
default = self.packages."${system}".specific;
};
};
}