From b48174745df74aaa7084230cf1a64be1f15c5f3b Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Thu, 7 Nov 2024 09:03:35 +0700 Subject: [PATCH] refactor(nix): Use nixpkgs' vesktop now that it supports darwin --- nix/flake.lock | 30 ++++++++++++------------ nix/lib/mkCommon.nix | 3 +++ nix/lib/mkSystem.nix | 3 ++- nix/overlays/darwin/vesktop.nix | 35 ---------------------------- nix/overlays/vesktop.nix | 13 +++++++++++ nix/systems/darwin/configuration.nix | 1 - nix/systems/darwin/default.nix | 2 -- 7 files changed, 33 insertions(+), 54 deletions(-) delete mode 100644 nix/overlays/darwin/vesktop.nix create mode 100644 nix/overlays/vesktop.nix diff --git a/nix/flake.lock b/nix/flake.lock index 947667f..93bd558 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -3,11 +3,11 @@ "brew-api": { "flake": false, "locked": { - "lastModified": 1730811879, - "narHash": "sha256-AiFBI++t4OVlVB6lGlyF7cUHCgPmxh5qtDP19UgnUC4=", + "lastModified": 1730943370, + "narHash": "sha256-P/ecx9MCT2TBkrZlMufl9VrhyokGDi4HqFdSZI0aIlY=", "owner": "null2264", "repo": "brew-api", - "rev": "332865573611b0936f939b0aff0867d2e65aee3c", + "rev": "884398d0769bc4651bb16f8ff1b2cc5f0308ba2c", "type": "github" }, "original": { @@ -59,11 +59,11 @@ ] }, "locked": { - "lastModified": 1730768115, - "narHash": "sha256-BbEg1w+y4+CrS5gFiR6YPGrXN0OvdyfOI8p1SgNnSzg=", + "lastModified": 1730940937, + "narHash": "sha256-1qtKUlQPBq9cQSAJCFv5+OaxTcP8Y8TAyBLS7/zO7Es=", "owner": "bandithedoge", "repo": "nixpkgs-firefox-darwin", - "rev": "4eb20be71869d6314ce7b383b63064140851d87a", + "rev": "74c4cac1fc8c07f8e9dffcb9bf1ada240f243f82", "type": "github" }, "original": { @@ -227,11 +227,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1730806663, - "narHash": "sha256-yFmtgfZnzcoJy+z26+ilRq0oxZHCwifsUMjO6pa7hIc=", + "lastModified": 1730940508, + "narHash": "sha256-sXS72AYXN/V1Ehp82/46Rqjw5Q6ayCy28ku3980+LSM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a417c003326c9a0cdebb62157466603313ffd47e", + "rev": "f39f1d2a8fe191e442ce641a6dc1320f6aa17d04", "type": "github" }, "original": { @@ -275,11 +275,11 @@ }, "nur": { "locked": { - "lastModified": 1730811841, - "narHash": "sha256-xMI+Ov/67jMDE+RK915iaJBqNrbTB7mI4Yux0y3J/Iw=", + "lastModified": 1730937175, + "narHash": "sha256-YDJ1R6NmTpGhLpXrlqp3p9H/ktr2BJD1GoG1WMagYRc=", "owner": "nix-community", "repo": "NUR", - "rev": "e356541e9a30c987e72f994011770c385322ad67", + "rev": "340b8c3ca8a5fcfe8a2230a5e76442b36f68e2ca", "type": "github" }, "original": { @@ -355,11 +355,11 @@ ] }, "locked": { - "lastModified": 1730780158, - "narHash": "sha256-ZJkCFn4PL49rINz7xrjlBqw9nF8wWJE7fSVqbHlCWSA=", + "lastModified": 1730866626, + "narHash": "sha256-0PzP+JdLcTExFXgR4h3exTZFHXANm4VZcEwgK2RtICk=", "owner": "Gerg-L", "repo": "spicetify-nix", - "rev": "2791c6662002731d3dfc00312307aef547e1c8be", + "rev": "396cf13f9310aa82c1a5da24a5213e7170d40642", "type": "github" }, "original": { diff --git a/nix/lib/mkCommon.nix b/nix/lib/mkCommon.nix index 8a11462..a4eebd7 100644 --- a/nix/lib/mkCommon.nix +++ b/nix/lib/mkCommon.nix @@ -17,8 +17,11 @@ in { pkgs.zoxide pkgs.ruby pkgs._7zz + pkgs.enchive (pkgs.pass.withExtensions (exts: [ exts.pass-otp ])) pkgs.gnupg + + pkgs.vesktop ]; } diff --git a/nix/lib/mkSystem.nix b/nix/lib/mkSystem.nix index ab17745..b5dea3b 100644 --- a/nix/lib/mkSystem.nix +++ b/nix/lib/mkSystem.nix @@ -2,7 +2,8 @@ let overlays = [ - (import ../overlays/python.nix) + (import ../overlays/python.nix) + (import ../overlays/vesktop.nix) ] ++ extraOverlays; # Placed here so that we don't need to specify hash for fetchTarball diff --git a/nix/overlays/darwin/vesktop.nix b/nix/overlays/darwin/vesktop.nix deleted file mode 100644 index 7cc818d..0000000 --- a/nix/overlays/darwin/vesktop.nix +++ /dev/null @@ -1,35 +0,0 @@ -# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix -final: prev: - -let - mkApp = import ../../lib/darwin/mkApp.nix; - - appFileName = "Vesktop.app"; - version = "1.5.3"; -in { - vesktop = mkApp { - inherit (final) stdenv undmg _7zz; - - pname = "Vesktop"; - inherit appFileName version; - - src = final.fetchurl { - url = "https://github.com/Vencord/Vesktop/releases/download/v${version}/Vesktop-${version}-universal.dmg"; - hash = "sha256-ceOUNHSOaEqCbzkM64RtUu0Yhrq4tThcXZTDd+OsEXI"; - }; - - # Replace the icon with a much more low profile icon - # REF: https://github.com/Vencord/Vesktop/pull/865 - configurePhase = '' - cp -f ${../../../include/vesktop/icon.icns} ${appFileName}/Contents/Resources/icon.icns - ''; - - meta = with final.lib; { - description = "An alternate client for Discord with Vencord built-in"; - homepage = "https://github.com/Vencord/Vesktop"; - license = licenses.gpl3Only; - platforms = platforms.darwin; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - }; - }; -} diff --git a/nix/overlays/vesktop.nix b/nix/overlays/vesktop.nix new file mode 100644 index 0000000..0b3c729 --- /dev/null +++ b/nix/overlays/vesktop.nix @@ -0,0 +1,13 @@ +final: prev: + +{ + # Replace the icon with a much more low profile icon + # REF: https://github.com/Vencord/Vesktop/pull/865 + vesktop = prev.vesktop.overrideAttrs (old: { + preBuild = + old.preBuild + + '' + cp -f ${../../include/vesktop/icon.icns} build/icon.icns + ''; + }); +} diff --git a/nix/systems/darwin/configuration.nix b/nix/systems/darwin/configuration.nix index d1e7600..b3d4466 100644 --- a/nix/systems/darwin/configuration.nix +++ b/nix/systems/darwin/configuration.nix @@ -55,7 +55,6 @@ in { pkgs.casks.zotero # pkgs.casks.lulu # Doesn't work, it needs to be installed on /Applications/ # pkgs.heliport # FIXME: https://github.com/matthewbauer/undmg/issues/2 - pkgs.vesktop pkgs.lf pkgs.yazi # lf replacement, need further testing diff --git a/nix/systems/darwin/default.nix b/nix/systems/darwin/default.nix index 5a35717..f01b150 100644 --- a/nix/systems/darwin/default.nix +++ b/nix/systems/darwin/default.nix @@ -24,7 +24,6 @@ in inputs.firefox-darwin.overlay (mkBrew { inherit system brew-api; nixpkgs = nixpkgs-stable; }) (import ../../overlays/darwin/heliport.nix) - (import ../../overlays/darwin/vesktop.nix) ]; nur = nur; } @@ -53,7 +52,6 @@ in extraOverlays = [ inputs.firefox-darwin.overlay (mkBrew { inherit system brew-api; nixpkgs = nixpkgs-stable; }) - (import ../../overlays/darwin/vesktop.nix) ]; nur = nur; }