| 16 Apr 2026 |
Randy Eckenrode | $ DEVELOPER_DIR=$DEVELOPER_DIR_26 SDKROOT=$SDKROOT_26 clang test.c -o test --ld-path=$PWD/src/ld/ld
$ ./test
Hello, arm64e
| 01:40:12 |
Randy Eckenrode | Yay. | 01:40:14 |
xored | anyone familiar with flake-parts, i need to expose a package (output of pkgs.writeShellApplication) only on macos on my flake, is there an easy way of doing this with flake parts? Also, the "normal" way of flake .packages.aarch64-darwin is not working inside of a flake-parts module
https://termbin.com/iohy | 02:22:11 |
antifuchs | In reply to @xored:xored.lol anyone familiar with flake-parts, i need to expose a package (output of pkgs.writeShellApplication) only on macos on my flake, is there an easy way of doing this with flake parts? Also, the "normal" way of flake .packages.aarch64-darwin is not working inside of a flake-parts module
https://termbin.com/iohy Might just set meta.platforms to darwin, that way the package won’t build elsewhere; not great if you want perfect flake metadata but it’ll do the trick | 02:41:45 |
Randy Eckenrode | https://github.com/NixOS/nixpkgs/pull/510469 updates ld64 and fixes the 26.4 SDK issue. | 02:48:35 |
Randy Eckenrode | Also incorporates the duplicate RPATH patch. | 02:48:44 |
EsperLily [she/her] | it would be really nice to get https://github.com/NixOS/nixpkgs/pull/506844 reviewed so macvim stops being broken. i just rebased/updated it now that my other vim PR has been merged | 09:14:40 |
EsperLily [she/her] | i haven't used flake-parts myself. looking at it right now, it has a whole perSystem thing and it looks like you're supposed to do something like perSystem = { config, pkgs, ... }: { packages.foo = pkgs.callPackage ./foo.nix {}; }? my inclination would be to figure out how you look up the current system (is it just pkgs.stdenv.hostPlatform.system or is there a better way to check, such as is it available just as an argument here?) and to then just conditionally expose a packages.aerospace-focus-fzf package depending on whether that system is darwin. something like perSystem = { lib, config, pkgs, ... }: { packages.${lib.optionalDrvAttr pkgs.stdenv.hostPlatform.isDarwin "aerospace-focus-fzf"} = aerospace-focus-fzf; } | 09:26:49 |
Randy Eckenrode | I remember the previous discussion about hardening flags, so LGTM. I approved and added it to the merge queue. | 10:42:28 |
xored | I tried this with mkIf and some part of flake-parts was referencing the missing platform, I’m not sure what optionalDrv… does but I’ll try later | 12:25:06 |
Randy Eckenrode | I second the suggestion to set meta.platforms to lib.platforms.darwin. That flakes allow packages to vary per system feels like a footgun. You’ll get a worse error message on unsupported platforms (i.e., Nix will complain about a missing attribute instead of telling you the platform is unsupported), and it adds complexity to the flake definition. | 13:15:08 |
Randy Eckenrode | I can understand the motivation (avoiding the need to eval the package to determine supported platforms), but it makes the UX worse. | 13:18:05 |
xored | the problem is I have more than one package that has this issue, e.g the arrs don't build on darwin at this point, so I need to force them on linux only, i've been experimenting with patching pkgs-by-name-for-flake-parts (which handles the linux ones), but I'd need to need how to have it behave properly to begin with | 17:36:53 |
xored | and I have meta.badPlatforms on the arrs btw, nix screams on refusing to evaluate | 17:37:34 |
xored | * the problem is I have more than one package that has this issue, e.g the arrs don't build on darwin at this point, so I need to force them on linux only, i've been experimenting with patching pkgs-by-name-for-flake-parts (which handles the linux ones), but I'd need to know how to have it behave properly to begin with | 17:39:36 |
EsperLily [she/her] | optionalDrvAttr cond s is just if cond then s else null, so this avoids defining the key unless the condition holds | 18:03:52 |
EsperLily [she/her] | (technically that method exists to use for derivation attributes, because nulls get omitted from the environment, but it works equally well as shorthand for "${if cond then "key" else null} = value syntax) | 18:04:56 |
EsperLily [she/her] | * (technically that method exists to use for derivation attributes, because nulls get omitted from the environment, but it works equally well as shorthand for "${if cond then "key" else null} = value; syntax) | 18:05:06 |
EsperLily [she/her] | i guess the other idea is to see if you can do this in the top-level flake section, if you define e.g. flake.packages.aarch64-darwin.aerospace-focus-fzf maybe that will get merged with the perSystem stuff? | 18:07:34 |
xored | unfortunately flake-parts does something weird with flake.packages and i can't seem to export packages that way (i believe it tries to transpose system into it, I might be wrong | 18:10:56 |
EsperLily [she/her] | does it give you some sort of error? I'm digging into the code but there's a lot here. it looks to me like perSystem is a deferred module (which is a thing i haven't really explored how it works yet) and it uses that to construct config.allSystems as a lazy attrset where each attr is a system and the value is the perSystem module module set evaluated with that system. And then for each of the options defined in perSystem it also defines flake.${option}.${system} = config.allSystems.${system}.${option}. The packages attrset is lazy so you can't write packages.foo = mkIf (or rather if you do I think what will happen is accessing that package from any system where that evaluates false will throw an error as package doesn't define an empty value). But defining packages.${if stdenv.hostPlatform.isDarwin then "aerospace-focus-fzf" else null} = aerospace-focus-fzf; still seems like it should work? and similarly, just defining flake.packages.aarch64-darwin.aerospace-focus-fzf should also work? | 19:45:39 |
EsperLily [she/her] | * does it give you some sort of error? I'm digging into the code but there's a lot here. it looks to me like perSystem is a deferred module and it uses that to construct config.allSystems as a lazy attrset where each attr is a system and the value is the perSystem module module set evaluated with that system. And then for each of the options defined in perSystem it also defines flake.${option}.${system} = config.allSystems.${system}.${option}. The packages attrset is lazy so you can't write packages.foo = mkIf (or rather if you do I think what will happen is accessing that package from any system where that evaluates false will throw an error as package doesn't define an empty value). But defining packages.${if stdenv.hostPlatform.isDarwin then "aerospace-focus-fzf" else null} = aerospace-focus-fzf; still seems like it should work? and similarly, just defining flake.packages.aarch64-darwin.aerospace-focus-fzf should also work? | 19:46:21 |
EsperLily [she/her] | * does it give you some sort of error? I'm digging into the code but there's a lot here. it looks to me like perSystem is a deferred module and it uses that to construct config.allSystems as a lazy attrset where each attr is a system and the value is the perSystem module set evaluated with that system. And then for each of the options defined in perSystem it also defines flake.${option}.${system} = config.allSystems.${system}.${option}. The packages attrset is lazy so you can't write packages.foo = mkIf (or rather if you do I think what will happen is accessing that package from any system where that evaluates false will throw an error as package doesn't define an empty value). But defining packages.${if stdenv.hostPlatform.isDarwin then "aerospace-focus-fzf" else null} = aerospace-focus-fzf; still seems like it should work? and similarly, just defining flake.packages.aarch64-darwin.aerospace-focus-fzf should also work? | 19:46:34 |
xored | when i tried it back with mkIf I got option packages.aarch64-darwin.foo option was accessed but not defined kind of error | 19:47:30 |
EsperLily [she/her] | with mkIf I'd expect an error that looks like "The option `${showOption loc}' was accessed but has no value defined. Try setting the option." | 19:48:02 |
xored | yeah | 19:48:09 |
xored | i'll try in a sec fixing my rust crap :P | 19:48:19 |
xored | i meant crab, surely :kappa: | 19:48:25 |
EsperLily [she/her] | that's what happens with a lazyAttrsOf when the element type doesn't define an empty value | 19:48:26 |
EsperLily [she/her] | * that's what happens with a lazyAttrsOf when the element type doesn't define an empty value and you use mkIf | 19:48:40 |