mirror of
https://github.com/Cian-H/zen-browser-flake.git
synced 2025-12-22 21:41:57 +00:00
feat: Add specific and generic versions of the package
This commit is contained in:
15
README.md
15
README.md
@@ -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
|
```nix
|
||||||
inputs.zen-browser.packages."${system}".default
|
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
|
```shell
|
||||||
$ sudo nixos-rebuild switch
|
$ sudo nixos-rebuild switch
|
||||||
$ zen
|
$ zen
|
||||||
|
|||||||
78
flake.nix
78
flake.nix
@@ -9,7 +9,17 @@
|
|||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
version = "1.0.0-a.27";
|
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 {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
@@ -20,41 +30,51 @@
|
|||||||
] ++ (with pkgs.xorg; [
|
] ++ (with pkgs.xorg; [
|
||||||
libxcb libX11 libXcursor libXrandr libXi libXext libXcomposite libXdamage libXfixes
|
libxcb libX11 libXcursor libXrandr libXi libXext libXcomposite libXdamage libXfixes
|
||||||
]);
|
]);
|
||||||
in
|
|
||||||
{
|
|
||||||
packages.${system}.default = pkgs.stdenv.mkDerivation {
|
|
||||||
name = "zen-browser";
|
|
||||||
|
|
||||||
src = builtins.fetchTarball {
|
mkZen = { variant }:
|
||||||
url = downloadUrl;
|
let
|
||||||
sha256 = "sha256:1z81dg3xgfpkyj501gflx8lw7d8124iqwm27zqfja2b47zf4ai2x";
|
downloadData = downloadUrl."${variant}";
|
||||||
|
in
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
name = "zen-browser";
|
||||||
|
|
||||||
|
src = builtins.fetchTarball {
|
||||||
|
url = downloadData.url;
|
||||||
|
sha256 = downloadData.sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
desktopSrc = ./.;
|
desktopSrc = ./.;
|
||||||
|
|
||||||
phases = [ "installPhase" "fixupPhase" ];
|
phases = [ "installPhase" "fixupPhase" ];
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.makeWrapper pkgs.copyDesktopItems pkgs.wrapGAppsHook ] ;
|
nativeBuildInputs = [ pkgs.makeWrapper pkgs.copyDesktopItems pkgs.wrapGAppsHook ] ;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin && cp -r $src/* $out/bin
|
mkdir -p $out/bin && cp -r $src/* $out/bin
|
||||||
install -D $desktopSrc/zen.desktop $out/share/applications/dev.zen.Zen.desktop
|
install -D $desktopSrc/zen.desktop $out/share/applications/dev.zen.Zen.desktop
|
||||||
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen.png
|
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen.png
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fixupPhase = ''
|
fixupPhase = ''
|
||||||
chmod 755 $out/bin/*
|
chmod 755 $out/bin/*
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen
|
||||||
wrapProgram $out/bin/zen --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
wrapProgram $out/bin/zen --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen-bin
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/zen-bin
|
||||||
wrapProgram $out/bin/zen-bin --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
wrapProgram $out/bin/zen-bin --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/glxtest
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/glxtest
|
||||||
wrapProgram $out/bin/glxtest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
wrapProgram $out/bin/glxtest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/updater
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/updater
|
||||||
wrapProgram $out/bin/updater --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
wrapProgram $out/bin/updater --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/vaapitest
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/vaapitest
|
||||||
wrapProgram $out/bin/vaapitest --set LD_LIBRARY_PATH "${pkgs.lib.makeLibraryPath runtimeLibs}"
|
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;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user