instalando o .net core sdk 2.0 no NixOs (não é possível encontrar modelos)

3

Retomar

No momento, estou tentando instalar o dot-net-core-sdk 2.0 com o gerenciador de pacotes Nix no NixOs.

Sou muito novo em ambos os NixOs, Nix, bash scripting e coisas como ELF. No entanto, acho que consegui criar uma descrição de pacote Nix válida para o dot-net-core-sdk 2.0.

No entanto, quando tento criar um novo projeto console , ele reclama que não consegue encontrar o modelo de console:

No templates matched the input template name: console.

A longa história ...

Eu defini meu pacote Nix e construo o script da seguinte forma:

dotnet-sdk.nix

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = "dotnet-sdk-2.0";

  builder = ./builder.sh;

  libPath = stdenv.lib.makeLibraryPath
    [ lttng-tools kerberos zlib gettext openssl icu libunwind eject stdenv.cc.cc glib ];

  src = fetchurl {
    url = "https://download.microsoft.com/download/1/B/4/1B4DE605-8378-47A5-B01B-2C79D6C55519/dotnet-sdk-2.0.0-linux-x64.tar.gz";
    sha256 = "6059a6f72fb7aa6205ef4b52583e9c041fd128e768870a0fc4a33ed84c98ca6b";
  };
}

builder.sh

source $stdenv/setup

mkdir -p $out/dotnet-sdk

echo "unpacking $src..."
tar xvfa $src -C $out/dotnet-sdk

echo "unpacking dotnet-sdk..."
p=$out/libexec/dotnet
mkdir -p $out/libexec
mv $out/dotnet-sdk $p

ls -lrth $p

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --force-rpath --set-rpath $libPath --debug $p/dotnet

echo "libPath"
echo $libPath

mkdir -p $out/bin
ln -s $p/dotnet $out/bin/dotnet

Eu posso criar o pacote com sucesso com

$ sudo nix-build dotnet-sdk.nix 

Que resulta em uma saída longa que termina com

...
unpacking dotnet-sdk...
total 136K
-rw-r--r-- 1 nixbld1 nixbld 8.0K Jul 20 23:06 ThirdPartyNotices.txt
-rw-r--r-- 1 nixbld1 nixbld 1.1K Jul 20 23:06 LICENSE.txt
-rwxr-xr-x 1 nixbld1 nixbld 104K Jul 20 23:16 dotnet
drwxr-xr-x 3 nixbld1 nixbld 4.0K Aug  3 19:34 store
drwxr-xr-x 3 nixbld1 nixbld 4.0K Aug  3 19:34 shared
drwxr-xr-x 3 nixbld1 nixbld 4.0K Aug  3 19:34 sdk
drwxr-xr-x 3 nixbld1 nixbld 4.0K Aug  3 19:34 host
drwxr-xr-x 4 nixbld1 nixbld 4.0K Aug  3 19:34 additionalDeps
patching ELF file '/nix/store/f1sankahbj7pss7vjrvbmng9z7gd08a6-dotnet-sdk-2.0/libexec/dotnet/dotnet'
Kernel page size is 4096 bytes
new rpath is '/nix/store/xdv40bsxp4c7m2nw63nrnkadmivczk24-lttng-tools-2.9.3/lib:/nix/store/b7yiqkykhj3lr7dlb3v81rsdasjg32jw-libkrb5-1.15/lib:/nix/store/sg6ri2jj92sbv7f4rvchzr00d24pi4nq-zlib-1.2.11/lib:/nix/store/s70cbg1lh45h3gl6xplz6bi2qdszi2cf-gettext-0.19.8/lib:/nix/store/b6d4mxvj5wdnf28lpww73pllmm0zd2nv-openssl-1.0.2l/lib:/nix/store/03gqmzrbh1pr5izy24gmyw1bfdzpy6q8-icu4c-58.2/lib:/nix/store/f4xflmvgszhrwa1r1jn5fddz8j196qzv-libunwind-1.1/lib:/nix/store/awxn3kfww8hjnd1pyji4zdmmi2x3kvzb-util-linux-2.29.2/lib:/nix/store/lc9cdddv2xv45ighz8znsanjfgkcdgbx-gcc-5.4.0-lib/lib:/nix/store/75pmwxf02m6i4vd3b0iybc3w54xf4r2z-glib-2.50.3/lib'
rpath is too long, resizing...
DT_NULL index is 28
replacing section '.dynamic' with size 560
replacing section '.dynstr' with size 22942
replacing section '.interp' with size 80
this is an executable
using replaced section '.interp'
using replaced section '.dynstr'
using replaced section '.dynamic'
last replaced is 22
looking at section '.interp'
looking at section '.note.ABI-tag'
replacing section '.note.ABI-tag' which is in the way
looking at section '.note.gnu.build-id'
replacing section '.note.gnu.build-id' which is in the way
looking at section '.hash'
replacing section '.hash' which is in the way
looking at section '.dynsym'
replacing section '.dynsym' which is in the way
looking at section '.dynstr'
looking at section '.gnu.version'
first reserved offset/addr is 0x8a38/0x408a38
first page is 0x400000
needed space is 36624
needed space is 36680
needed pages is 1
changing alignment of program header 2 from 2097152 to 4096
changing alignment of program header 3 from 2097152 to 4096
clearing first 38856 bytes
rewriting section '.dynamic' from offset 0x19da8 (size 544) to offset 0x270 (size 560)
rewriting section '.dynstr' from offset 0x4308 (size 22320) to offset 0x4a0 (size 22942)
rewriting section '.dynsym' from offset 0x1d10 (size 9720) to offset 0x5e40 (size 9720)
rewriting section '.hash' from offset 0x1298 (size 2680) to offset 0x8438 (size 2680)
rewriting section '.interp' from offset 0x1238 (size 28) to offset 0x8eb0 (size 80)
rewriting section '.note.ABI-tag' from offset 0x1254 (size 32) to offset 0x8f00 (size 32)
rewriting section '.note.gnu.build-id' from offset 0x1274 (size 36) to offset 0x8f20 (size 36)
rewriting symbol table section 3
libPath
/nix/store/xdv40bsxp4c7m2nw63nrnkadmivczk24-lttng-tools-2.9.3/lib:/nix/store/b7yiqkykhj3lr7dlb3v81rsdasjg32jw-libkrb5-1.15/lib:/nix/store/sg6ri2jj92sbv7f4rvchzr00d24pi4nq-zlib-1.2.11/lib:/nix/store/s70cbg1lh45h3gl6xplz6bi2qdszi2cf-gettext-0.19.8/lib:/nix/store/b6d4mxvj5wdnf28lpww73pllmm0zd2nv-openssl-1.0.2l/lib:/nix/store/03gqmzrbh1pr5izy24gmyw1bfdzpy6q8-icu4c-58.2/lib:/nix/store/f4xflmvgszhrwa1r1jn5fddz8j196qzv-libunwind-1.1/lib:/nix/store/awxn3kfww8hjnd1pyji4zdmmi2x3kvzb-util-linux-2.29.2/lib:/nix/store/lc9cdddv2xv45ighz8znsanjfgkcdgbx-gcc-5.4.0-lib/lib:/nix/store/75pmwxf02m6i4vd3b0iybc3w54xf4r2z-glib-2.50.3/lib
/nix/store/f1sankahbj7pss7vjrvbmng9z7gd08a6-dotnet-sdk-2.0

Agora posso executar com êxito as funções help e version no binário dotnet sem erros estranhos sobre arquivos de objetos ausentes:

$ result/bin/dotnet --version
2.0.0

No entanto , quando tento criar um novo aplicativo de console, recebo o seguinte erro:

$ /etc/nixos/dotnet-sdk/result/bin/dotnet new console
No templates matched the input template name: console.

Templates      Short Name      Language      Tags
-------------------------------------------------

Eu não tenho idéia de por que ele não pode encontrar os templates, mas eu tenho uma hipótese fraca de que talvez eu estraguei alguma coisa no binário usando --force-rpath quando modifico o binário com patchelf no buildscript.

  • A configuração do meu pacote e o buildscript estão corretos? (por exemplo, é o problema não relacionado à descrição do meu pacote Nix e ao nosso script)

  • Existe algo óbvio que estou perdendo, como de alguma forma fornecer um link para alguns dos diretórios do núcleo da rede auxiliar ao modificar o binário com patchelf?

  • Outra coisa que eu posso fazer para fazer o net core sdk 2.0 funcionar no NixOs?

por Michelrandahl 19.08.2017 / 16:19

0 respostas