!kjdutkOsheZdjqYmqp:nixos.org

Nixpkgs / NixOS contributions

1864 Members
NixOS 24.05 Uakari | #review-requests:nixos.org | https://nixos.org/blog/announcements.html#nixos-23.11 | https://hydra.nixos.org/jobset/nixos/trunk-combined | https://reproducible.nixos.org/ | 24.05 RMs: wegank & Mic92410 Servers

Load older messages


SenderMessageTime
22 Oct 2024
@ihar.hrachyshka:matrix.orgIhar Hrachyshka

Confused why the shell file name expansion doesn't work here:

diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix
index d2a52f187eb9..58e4c07e7320 100644
--- a/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/pkgs/applications/networking/browsers/firefox/common.nix
@@ -164,16 +164,6 @@ assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "${pname}:
 let
   inherit (lib) enableFeature;
 
-  mutFirstChar =
-    f: s:
-    let
-      firstChar = f (lib.substring 0 1 s);
-      rest = lib.substring 1 (-1) s;
-    in
-    firstChar + rest;
-  toTitle = s: mutFirstChar lib.toUpper s;
-  darwinAppName = toTitle binaryName + ".app";
-
   # Target the LLVM version that rustc is built with for LTO.
   llvmPackages0 = rustc.llvmPackages;
   llvmPackagesBuildBuild0 = pkgsBuildBuild.rustc.llvmPackages;
@@ -575,9 +565,9 @@ buildStdenv.mkDerivation {
 
   postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
     mkdir -p $out/Applications
-    cp -r dist/${binaryName}/${darwinAppName} $out/Applications
+    cp -r dist/${binaryName}/*.app $out/Applications
 
-    resourceDir=$out/Applications/${darwinAppName}/Contents/Resources
+    resourceDir=$out/Applications/*.app/Contents/Resources
 
   '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
     # Remove SDK cruft. FIXME: move to a separate output?
@@ -602,7 +592,7 @@ buildStdenv.mkDerivation {
   # Some basic testing
   doInstallCheck = true;
   installCheckPhase = lib.optionalString buildStdenv.hostPlatform.isDarwin ''
-    bindir=$out/Applications/${darwinAppName}/Contents/MacOS
+    bindir=$out/Applications/*.app/Contents/MacOS
   '' + lib.optionalString (!buildStdenv.hostPlatform.isDarwin) ''
     bindir=$out/bin
   '' + ''

This fails as follows:

> make[1]: Leaving directory '/private/tmp/nix-build-firefox-devedition-unwrapped-132.0b5.drv-1/firefox-132.0/objdir/browser/installer'
       > install: missing destination file operand after '/nix/store/80bzwch9jalvbpw3xgm3642hfz18hbbx-distribution.ini'
       > Try 'install --help' for more information.

Interesting that the file expansion in cp works; but not in resourceDir= variable declaration.

13:52:37
@ihar.hrachyshka:matrix.orgIhar Hrachyshka *

Confused why the shell file name expansion doesn't work here:

diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix
index d2a52f187eb9..58e4c07e7320 100644
--- a/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/pkgs/applications/networking/browsers/firefox/common.nix
@@ -164,16 +164,6 @@ assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "${pname}:
 let
   inherit (lib) enableFeature;
 
-  mutFirstChar =
-    f: s:
-    let
-      firstChar = f (lib.substring 0 1 s);
-      rest = lib.substring 1 (-1) s;
-    in
-    firstChar + rest;
-  toTitle = s: mutFirstChar lib.toUpper s;
-  darwinAppName = toTitle binaryName + ".app";
-
   # Target the LLVM version that rustc is built with for LTO.
   llvmPackages0 = rustc.llvmPackages;
   llvmPackagesBuildBuild0 = pkgsBuildBuild.rustc.llvmPackages;
@@ -575,9 +565,9 @@ buildStdenv.mkDerivation {
 
   postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
     mkdir -p $out/Applications
-    cp -r dist/${binaryName}/${darwinAppName} $out/Applications
+    cp -r dist/${binaryName}/*.app $out/Applications
 
-    resourceDir=$out/Applications/${darwinAppName}/Contents/Resources
+    resourceDir=$out/Applications/*.app/Contents/Resources
 
   '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
     # Remove SDK cruft. FIXME: move to a separate output?
@@ -602,7 +592,7 @@ buildStdenv.mkDerivation {
   # Some basic testing
   doInstallCheck = true;
   installCheckPhase = lib.optionalString buildStdenv.hostPlatform.isDarwin ''
-    bindir=$out/Applications/${darwinAppName}/Contents/MacOS
+    bindir=$out/Applications/*.app/Contents/MacOS
   '' + lib.optionalString (!buildStdenv.hostPlatform.isDarwin) ''
     bindir=$out/bin
   '' + ''

This fails as follows:

> make[1]: Leaving directory '/private/tmp/nix-build-firefox-devedition-unwrapped-132.0b5.drv-1/firefox-132.0/objdir/browser/installer'
       > install: missing destination file operand after '/nix/store/80bzwch9jalvbpw3xgm3642hfz18hbbx-distribution.ini'
       > Try 'install --help' for more information.

Interesting that the file expansion in cp works; but not in resourceDir= variable declaration.

13:52:51
@ihar.hrachyshka:matrix.orgIhar Hrachyshka (The command that fails is install -Dvm644 ${distributionIni} $resourceDir/distribution/distribution.ini) 13:54:25
@k900:0upti.meK900 Probably $out/Applications/*.app/Contents/Resources doesn't exist 13:57:07
@ihar.hrachyshka:matrix.orgIhar Hrachyshka $out/Applications/Firefox.app/Contents/MacOS does 13:57:54
@khaneliman:matrix.orgAustin HorstmanIt's a glob pattern that would return a list of files so probably has to be handled differently 13:58:12
@ihar.hrachyshka:matrix.orgIhar Hrachyshka it's as if the shell doesn't expand the file name properly, so resourceDir ends up empty (which results in this missing operand error) 13:58:20
@khaneliman:matrix.orgAustin Horstman are you trying to support derivations with multiple .app or just an unknown app name? 14:00:53
@ihar.hrachyshka:matrix.orgIhar Hrachyshka it's an unknown, since it's a firefox package that has flavors like Firefox Developer Edition.app plus I think there are some forks that rely on this derivation too. 14:01:39
@hexa:lossy.networkhexathunderbird, floorp, librewolf, betterbird14:02:07
@ihar.hrachyshka:matrix.orgIhar Hrachyshka I was trying to do the toTitle binaryName but it's not that easy: the binaryName is still firefox for the Developer Edition 14:02:17
@hexa:lossy.networkhexafirefox/common.nix is a misnomer these days, given that it builds a lot of mozilla mach projects14:02:32
@khaneliman:matrix.orgAustin Horstmani think you would have to populate a bash array from the glob pattern and iterate over that14:02:53
@ihar.hrachyshka:matrix.orgIhar Hrachyshka I wonder if I would do resourceDir=$(ls $out/Applications/*.app/...)... if it would work then 14:03:26
@ihar.hrachyshka:matrix.orgIhar Hrachyshka * I wonder if I would do resourceDir=$(ls -d $out/Applications/*.app/...)... if it would work then 14:03:57
@k900:0upti.meK900So14:04:21
@k900:0upti.meK900New stable kernels are out14:04:24
@k900:0upti.meK900And the netfilter fix is missing14:04:29
@k900:0upti.meK900 @Alyssa Ross @ma27 thoughts on cherry-picking? 14:04:39
@k900:0upti.meK900https://lore.kernel.org/netfilter-devel/Zxda-7wzYe6WypX5@calendula/T/#u14:05:12
@k900:0upti.meK900Specifically these14:05:14
@hexa:lossy.networkhexaplease.14:05:43
@khaneliman:matrix.orgAustin Horstman
In reply to @ihar.hrachyshka:matrix.org
I wonder if I would do resourceDir=$(ls -d $out/Applications/*.app/...)... if it would work then
if you know the specific usage will only ever have a single app returned otherwise you still need to account for multiple files
14:06:56
@ihar.hrachyshka:matrix.orgIhar Hrachyshkait's always a single entry14:07:27
@ma27:nicht-so.sexyma27
In reply to @k900:0upti.me
@Alyssa Ross @ma27 thoughts on cherry-picking?
would be fine by me.
14:39:46
@ihar.hrachyshka:matrix.orgIhar Hrachyshka so... $(ls -d .../*.app/...) works fine; but not val=.../*.app/...; I can't reproduce it in my shell, feels like maybe some shopt settings in nix build env could affect it 17:17:06
@pyrox:pyrox.devdish [Fox/It/She] Looking at adding a package for bluesky's goat tool, but there's already a goat package in nixpkgs. Any suggestions on what a package should be named? https://github.com/bluesky-social/indigo/tree/main/cmd/goat 18:18:51
@pyrox:pyrox.devdish [Fox/It/She] i was thinking something like goat-atproto or atproto-goat or just go-at. 18:25:15
@common0r:matrix.orgcomm0n(they/them) changed their display name from comm0n to comm0n(they/them).19:03:53
@numinit:matrix.orgMorgan

do we need a function to build URIs in lib? had to do this for Mattermost, wondering if we could use it for anything else...

https://github.com/NixOS/nixpkgs/pull/208181/files#diff-3517cc8e7468615ccea52f1b8fb62377b14733d2e0a08ae5c7d390650402b57eR34

22:09:46

Show newer messages


Back to Room ListRoom Version: 6