From bf3cdf318ba21cdadf401d058aa8bc98e8cab2fc Mon Sep 17 00:00:00 2001 From: Marce Coll Date: Wed, 21 Aug 2024 10:05:26 +0200 Subject: [PATCH] feat: Initialized new flake --- flake.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fb9d235 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Zen Browser"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + version = "1.0.0-a.26"; + downloadUrl = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-specific.tar.bz2"; + pkgs = import nixpkgs { + inherit system; + }; + + runtimeLibs = with pkgs; [ + libGL stdenv.cc.cc fontconfig libxkbcommon zlib freetype + gtk3 libxml2 dbus xcb-util-cursor alsa-lib + ] ++ (with pkgs.xorg; [ + libxcb libX11 libXcursor libXrandr libXi + ]); + in + { + packages.${system}.default = pkgs.stdenv.mkDerivation { + name = "zen-browser"; + + src = builtins.fetchTarball { + url = downloadUrl; + sha256 = "sha256:1z81dg3xgfpkyj501gflx8lw7d8124iqwm27zqfja2b47zf4ai2x"; + }; + + phases = [ "installPhase" "fixupPhase" ]; + + nativeBuildInputs = [ pkgs.makeWrapper ] ; + + installPhase = '' + mkdir -p $out/bin && cp -r $src/* $out/bin + ''; + + fixupPhase = '' + chmod 755 $out/bin/* + 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}" + ''; + }; + }; +}