I'm on MacOS High Sierra.
$ nix --version
nix (Nix) 2.3.4
$ nix-channel --list
darwin https://github.com/LnL7/nix-darwin/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-20.03
nixpkgs https://nixos.org/channels/nixpkgs-unstable
$ echo $NIX_PATH
darwin=/Users/stricklanj/.nix-defexpr/darwin:darwin-config=/Users/stricklanj/.nixpkgs/darwin-configuration.nix:nixpkgs=/Users/stricklanj/.nix-defexpr/channels/nixpkgs:nixpkgs=/Users/stricklanj/.nix-defexpr/channels/nixpkgs
I'm trying to setup nix-darwin, building darwin-rebuild
:
$ nix-build '<darwin>' -A system --no-out-link --show-trace
I'm running into an error with a CRLF line ending:
$ nix-build '<darwin>' -A 'config.system.build.fonts' --no-out-link --show-trace
these derivations will be built:
/nix/store/wngfa8nwzg5rv884vfal4dkf09jyzrzi-fonts.drv
building '/nix/store/wngfa8nwzg5rv884vfal4dkf09jyzrzi-fonts.drv'...
/private/var/folders/y_/l6_63w553g122p9w9c3z9d75s_cs8r/T/nix-build-fonts.drv-0/.attr-0: line 1: $'\r': command not found
builder for '/nix/store/wngfa8nwzg5rv884vfal4dkf09jyzrzi-fonts.drv' failed with exit code 127
Inspecting the derivation, I see that the literal \r
character is in the file:
$ nix show-derivation /nix/store/wngfa8nwzg5rv884vfal4dkf09jyzrzi-fonts.drv | jq '."/nix/store/wngfa8nwzg5rv884vfal4dkf09jyzrzi-fonts.drv".env.buildCommand' -C
"\r\n mkdir -p $out/Library/Fonts\r\n for path in $paths; do\r\n find -L $path/share/fonts -type f -print0 | while IFS= read -rd \"\" f; do\r\n ln -s \"$f\" $out/Library/Fonts\r\n done\r\n done\r\n"
This is the script that config.system.build.fonts
evaluates to:
$ ag -F 'system.build.fonts' -A 9 ~/.nix-defexpr/channels/darwin/modules/fonts/default.nix
31: system.build.fonts = pkgs.runCommandNoCC "fonts"
32- { paths = cfg.fonts; preferLocalBuild = true; }
33- ''
34- mkdir -p $out/Library/Fonts
35- for path in $paths; do
36- find -L $path/share/fonts -type f -print0 | while IFS= read -rd "" f; do
37- ln -s "$f" $out/Library/Fonts
38- done
39- done
40- '';
- Should the literal
\r
character be present in the derivation? - Is there a
darwin-nix
ornix
setting for line-endings? - How can I address my issue and build
system
successfully?
Also hitting that https://github.com/573/nix-config-1/runs/7747091096?check_suite_focus=true