22 Oct 2024 |
Ihar 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 | * 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 | (The command that fails is install -Dvm644 ${distributionIni} $resourceDir/distribution/distribution.ini ) | 13:54:25 |
K900 | Probably $out/Applications/*.app/Contents/Resources doesn't exist | 13:57:07 |
Ihar Hrachyshka | $out/Applications/Firefox.app/Contents/MacOS does | 13:57:54 |
Austin Horstman | It's a glob pattern that would return a list of files so probably has to be handled differently | 13:58:12 |
Ihar 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 |
Austin Horstman | are you trying to support derivations with multiple .app or just an unknown app name? | 14:00:53 |
Ihar 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 | thunderbird, floorp, librewolf, betterbird | 14:02:07 |
Ihar 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 | firefox/common.nix is a misnomer these days, given that it builds a lot of mozilla mach projects | 14:02:32 |
Austin Horstman | i think you would have to populate a bash array from the glob pattern and iterate over that | 14:02:53 |
Ihar Hrachyshka | I wonder if I would do resourceDir=$(ls $out/Applications/*.app/...) ... if it would work then | 14:03:26 |
Ihar Hrachyshka | * I wonder if I would do resourceDir=$(ls -d $out/Applications/*.app/...) ... if it would work then | 14:03:57 |
K900 | So | 14:04:21 |
K900 | New stable kernels are out | 14:04:24 |
K900 | And the netfilter fix is missing | 14:04:29 |
K900 | @Alyssa Ross @ma27 thoughts on cherry-picking? | 14:04:39 |
K900 | https://lore.kernel.org/netfilter-devel/Zxda-7wzYe6WypX5@calendula/T/#u | 14:05:12 |
K900 | Specifically these | 14:05:14 |
hexa | please. | 14:05:43 |
Austin 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 | it's always a single entry | 14:07:27 |
ma27 | In reply to @k900:0upti.me @Alyssa Ross @ma27 thoughts on cherry-picking? would be fine by me. | 14:39:46 |
Ihar 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 |
dish [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 |
dish [Fox/It/She] | i was thinking something like goat-atproto or atproto-goat or just go-at . | 18:25:15 |
| comm0n(they/them) changed their display name from comm0n to comm0n(they/them). | 19:03:53 |
Morgan | 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 |