can't find curl-config on NixOS - nixos

I'm trying to install vim-now-haskell on NixOS 17.09.
The installation fails with the exception
*** Installer requires 'curl-config'. Please install and try again.
*** Aborting...
Unfortunately Search NixOS packages doesn't list any package for curl-config. It also isn't in installed curl-7.56.1.
I can hardly believe NixOS doesn't provide curl-config. Therefore I'm looking here for help to find it.

It's in the curl.dev output.
$ ls $(nix-build --no-out-link '<nixpkgs>' -A curl.dev)/bin
curl-config
The reason for this is to keep the closure size of anything the uses curl small. Normally Nixpkgs' stdenv.mkDerivation takes care of those details when processing the buildInputs attribute, but if you're not using Nixpkgs to build something you may have to do a bit more manual work.
Another way to get the curl-config command is nix-shell -p curl, which launches a shell that has the command in its environment.
[user#feb:~]$ nix-shell -p curl
[nix-shell:~]$ curl-config --version
libcurl 7.65.3
[nix-shell:~]$ exit
[user#feb:~]$
NixPkgs also has a curlFull package which has more features enabled, as can be seen by the number of packages in the closure of the runtime library output:
$ nix-store -q --requisites $(nix-build --no-out-link '<nixpkgs>' -A curl.out) | wc -l
6
$ nix-store -q --requisites $(nix-build --no-out-link '<nixpkgs>' -A curlFull.out) | wc -l
29
So for a more capable build of curl, use curlFull.dev.

Related

Error while trying to install Kops on Ubuntu 20 EC2 Instance

I went through the steps listed here: https://kubernetes.io/docs/setup/production-environment/tools/kops/
After moving the kops file to /usr/local/bin/ and renaming to kops, I tried to confirm if it was in fact installed and executable by trying 'kops --help' and 'kops --version'/'kops version' and neither command worked. Any idea what the issue might be?
Edit: Here's what I did step by step
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64
sudo chmod +x kops-darwin-amd64
sudo mv kops-darwin-amd64 /usr/local/bin/kops
It's a t2.micro Ubuntu 20.04 EC2 Instance.
Tried to confirm if kops was properly installed and executable by entering 'kops --help' and 'kops --version' and also 'kops version' but they all return this error:
-bash: /usr/local/bin/kops: cannot execute binary file: Exec format error
I think its because you are using kops-darwin-amd64. This is for mac. I think you should be using kops-linux-amd64 instead for linux.

"FATAL: cannot determine kernel version" when updating initramfs

I download linux kernel-5.0.0 and try to compile and install it on my Ubuntu-18.04.3
the commands i used in /usr/src/linux-5.0:
sudo make mrproper
sudo make menuconfig
sudo make -j4
sudo make modules_install
sudo make install
at the result of last command, there is a error:
* dkms: running auto installation service for kernel 5.0.02173611831
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.0.02173611831 /boot/vmlinuz-5.0.02173611831
update-initramfs: Generating /boot/initrd.img-5.0.02173611831
FATAL: cannot determine kernel version
I have no idea why this is a "FATAL: cannot determine kernel version" and how can i fix it.
At the beginning, i skip it but then I find that the "cannot determine kernel version" always show up once i open vim like this.
when i open vim
by the way, the strange numbers 5.0.02173611831 are (the kernel version) + (my numbers in university), i did the config when "sudo make menuconfig" as my teacher ask.
I had this error "FATAL: cannot determine kernel version", it turned out to be a misuse of 'cpp' in a ./configure script.
Other uses were like
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
But this error came from a line
kernsrcver=`(echo "#include <$utsrelease>";
echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2`
I changed the cpp line to (and it worked):
cpp -I $kernelbuild/include -E - |

Nix shell: How to list the installed Haskell package versions

As a non-nix'er I installed the newest version of https://github.com/reflex-frp/reflex-platform. I think working in this nix-shell is a nice experience.
Now I want to know which Haskell packages in which versions are installed and used in this shell. After some googling I found a nix-env command in the following form:
nix-env -f '<nixpkgs>' -qaPA haskellPackages|grep reflex-dom
This command gives me the version of reflex-dom as reflex-dom-0.3. But I know from here that in my nix shell I use the newest version 0.4 of reflex-dom. So I assume the above command just lists the available Hackage packages.
What is the correct nix-env -q command to get only the installed Haskell packages and its versions?.
(I played with the --installed option, however I never got something back)
You can try to nix-store -q --references $out after you entered the shell. This will, however, mix both haskell and non-haskell dependencies in output.
This is a complete example with filter applied:
$ nix-store -q --references $out \
| while read p; do du -a $p | grep -q ghc && echo $p; done

Finding path of static system libraries in Linux

I am compiling a package that links against the OpenSSL static libraries libssl.a and libcrypto.a which are included with libssl-dev in Debian/Ubuntu. However the actual location of these files depends on the architecture and distribution at hand.
Is there some sort of method or environment variable that I can use in the Makefile to give the linker the correct path to the system directory with static libraries? Currently I am using:
-L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/i686-linux-gnu/ -lssl -lcrypto
However this gives a bunch of warnings if these dirs do not exist, and might still not generally work.
If you are sure, that your users are using aptitude as package manager, that is default for Debian/Ubuntu, than you can use apt-file to locate libraries.
$ apt-file update
$ LIBSSL_PATH=`apt-file list libssl-dev | grep libssl.a | awk '{ print $2 }'`
$ LIBCRYPTO_PATH=`apt-file list libssl-dev | grep libcrypto.a | awk '{ print $2 }'`
Next you may use them. Say on my machine:
$ echo $LIBSSL_PATH
/usr/lib/libssl.a
I known no other way and doubt if any exists.
I was struggling with the same for my ubuntu machine.
I was able to find the library by using the following command.
sudo find libssl.a / | grep libssl.a
The default location for ubuntu is.
/usr/lib/x86_64-linux-gnu/libssl.a

Without admin prevlieges, how do I find the directories searched by ld?

How do I find the directories searched in by the GNU linker, without admin privileges?
I can get the listing in the following way:
$ sudo ldconfig -v 2>/dev/null | grep -v ^$'\t'
/lib/i386-linux-gnu:
/usr/lib/i386-linux-gnu:
/usr/local/lib:
/lib/x86_64-linux-gnu:
/usr/lib/x86_64-linux-gnu:
/usr/lib/fglrx:
/usr/lib32/fglrx:
/lib32:
/usr/lib32:
/lib:
/usr/lib:
/usr/lib/i386-linux-gnu/sse2: (hwcap: 0x0000000004000000)
this solution came from: How to print the ld(linker) search path
However, on a machine where I do not have admin privileges, this will not work. I assume that’s because ldconfig is located in /sbin/. I download glibc and installed it locally to create another version of ldconfig. I guess that was silly though because the local version gives me:
/usr/local/lib:
/usr/local/lib64:
Is it still possible to get all the directories as a non-admin?
There doesn't appear to be any helpful ld flags, or environment variables to do the job.
Just because ldconfig is in sbin doesn't mean it can't be run as a normal user. Simply use that command and specify the full path to ldconfig:
/sbin/ldconfig -v 2>/dev/null | grep -v ^$'\t'

Resources