Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unixODBCDrivers.msodbcsql17: init at 17.2.0.1 #44140

Merged
merged 3 commits into from Aug 2, 2018

Conversation

spencerjanssen
Copy link
Contributor

Motivation for this change

This patch adds Microsoft's ODBC driver for SQL Server. I have tested it on NixOS against SQL Server 2008 and it has worked quite reliably in that scenario.

I'm new to packaging binaries with Nix and would appreciate feedback. The 'libshim' symlinks in particular I'm not sure about -- the driver is linked against specific names of libssl and libcrypto and I couldn't find another way to provide or fake those names.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

ln -s ${lib.makeLibraryPath [openssl]}/libcrypto.so.1.0.0 $out/libshim/libcrypto.so.1.0.2
cp -r opt/microsoft/msodbcsql${versionMajor}/lib64 opt/microsoft/msodbcsql${versionMajor}/share $out/
patchelf --set-rpath ${lib.makeLibraryPath [ openssl unixODBC kerberos curl libuuid stdenv.cc.cc]}:$out/libshim \
$out/lib64/libmsodbcsql-${versionMajor}.${versionMinor}.so.${versionAdditional}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried autoPatchelfHook? It might simplify future maintenance of this package: ea5787a

Copy link
Member

@Mic92 Mic92 Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it tries to match libraries from buildInputs with required libraries in the package. It automatically handle transitive dependencies which means that the buildInputs list get smaller as only direct dependencies needs to be specified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The openssl symlink could be added to $out/lib so it will be found by the hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip! autoPatchelfHook works quite nicely.

@matthewbauer
Copy link
Member

@GrahamcOfBorg build unixODBCDrivers.msodbcsql17

@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: unixODBCDrivers.msodbcsql17

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

No attempt on x86_64-darwin (full log)

The following builds were skipped because they don't evaluate on x86_64-darwin: unixODBCDrivers.msodbcsql17

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: unixODBCDrivers.msodbcsql17

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


installPhase = ''
mkdir -p $out
mkdir -p $out/lib
ln -s ${lib.makeLibraryPath [openssl]}/libssl.so.1.0.0 $out/lib/libssl.so.1.0.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not what you want. I think you want to do:

ln -s ${lib.getLib openssl}/lib/libssl.so.1.0.0 $out/lib/libssl.so.1.0.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That makes sense.

@matthewbauer matthewbauer merged commit cbaac40 into NixOS:master Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants