Closed p-alik closed 2 years ago
Do you have a Dockerfile for testing this, @p-alik ?
No I haven't it yet, but I'll prepare once.
On fddd82e8944974daf3ed32d15002c488a721dd7b docker build .
succeeds with this Dockerfile
:
FROM nixos/nix
WORKDIR /opt/gearmand
ADD . .
RUN nix-shell --packages autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx \
--run "bash && ./bootstrap.sh -a && ./configure --with-mysql=no --with-postgresql=no --with-boost=$(nix-build --no-out-link '<nixpkgs>' -A boost) --with-boost-libdir=$(nix-build --no-out-link '<nixpkgs>' -A boost.out)/lib && make && make test"
On fddd82e
docker build .
succeeds with thisDockerfile
:FROM nixos/nix WORKDIR /opt/gearmand ADD . . RUN nix-shell --packages autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx \ --run "bash && ./bootstrap.sh -a && ./configure --with-mysql=no --with-postgresql=no --with-boost=$(nix-build --no-out-link '<nixpkgs>' -A boost) --with-boost-libdir=$(nix-build --no-out-link '<nixpkgs>' -A boost.out)/lib && make && make test"
Hi, @p-alik. Thank you for the above.
The extra configure arguments should not be needed. Something is broken if they are needed, IMHO.
Any idea as to why nix-env --install autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx
fails with
warning: there are multiple derivations named 'git-2.26.2'; using the first one
error: selector 'libuuid' matches no derivations
If I remove libuuid
from that list, I then get
error: selector 'python37Packages.sphinx' matches no derivations
Using nixos/nix:latest
:
97a3ebb198b7:/# nix-env --install libuuid
error: selector 'libuuid' matches no derivations
97a3ebb198b7:/# nix-env --install python37Packages.sphinx
error: selector 'python37Packages.sphinx' matches no derivations
97a3ebb198b7:/# nix-env --version
nix-env (Nix) 2.3.6
You could run nix-env -f '<nixpkgs>' --install -A autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx
if you intend to use nix-env
.
As mentioned here nix-shell
appears to me more appropriate for the purpose of development.
You could run
nix-env -f '<nixpkgs>' --install -A autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx
if you intend to usenix-env
. As mentioned herenix-shell
appears to me more appropriate for the purpose of development.
I can see their point for when it comes to distributing an image, but it doesn't fit how I test builds.
Your new nix-env
command gives me the following errors:
error: packages '/nix/store/jijd3hi94w5nwzrd9ihvs34q69hx0vcd-boost-1.69.0/lib/libboost_context.so' and '/nix/store/j8dbv5w6jl34caywh2ygdy88knx1mdf7-nix-2.3.6/lib/libboost_context.so' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/746clhr2530ra1xfsj67v7ly9v0hak15-user-environment.drv' failed with exit code 1
error: build of '/nix/store/746clhr2530ra1xfsj67v7ly9v0hak15-user-environment.drv' failed
I split up the nix-env
and got it to work.
nix-env --install \
autoconf \
automake \
bash \
boost \
git \
gperf \
libevent \
libtool \
openssl \
&& nix-env -f '<nixpkgs>' --install -A \
gcc \
m4 \
libuuid \
python37Packages.sphinx
I had to add m4 and gcc, by the way.
./configure can't find boost though, and the nix-build --no-out-link '<nixpkgs>' -A boost
command does not work as non-root user.
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted
Wow, this nix package manager is super-annoying!
Wow, this nix package manager is super-annoying!
In my opinion because you are trying to install all dependencies with nix-env
. All will be fine, if you'll switch to nix-shell
:
nix-shell --packages autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx
Wow, this nix package manager is super-annoying!
In my opinion because you are trying to install all dependencies with
nix-env
. All will be fine, if you'll switch tonix-shell
:nix-shell --packages autoconf automake bash boost git gperf libevent libtool libuuid python37Packages.sphinx
Only if you build gearmand as root, I think, and I don't want to do that.
Only if you build gearmand as root, I think, and I don't want to do that.
You can run nix-shell
(and nix-env --install
as well) as usual user.
What I've put into a Dockerfile
is a subset of shell.nix
, which I'm using to start nix-shell
. It looks like:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
in
pkgs.mkShell {
buildInputs = [
pkgs.boost
pkgs.boost.dev
pkgs.boost.out
pkgs.file
pkgs.libevent
pkgs.libuuid
pkgs.libtool
pkgs.hiredis
pkgs.python37Packages.sphinx
pkgs.gperf
pkgs.autoconf
pkgs.automake
# keep this line if you use bash
pkgs.bashInteractive
];
nativeBuilds = [
pkgs.gcc8
pkgs.pkgconfig
];
shellHook =''
cat <<'HERE'
To build gearmand:
cd gearmand
./bootstrap.sh -a
./configure --with-mysql=no --with-postgresql=no --with-boost=$(nix-build --no-out-link '<nixpkgs>' -A boost) --with-boost-libdir=$(nix-build --no-out-link '<nixpkgs>' -A boost.out)/lib
HERE
'';
}
Only if you build gearmand as root, I think, and I don't want to do that.
You can run
nix-shell
(andnix-env --install
as well) as usual user.
Well, it doesn't work for me, at least not using the nixos/nix
image. The nix-*
commands in that Docker image only work as root.
There are differences between nix-docker and PC (VM surely also) environment:
ba10e3ca04d6:/# ls -l `which nix-env`
lrwxrwxrwx 12 root root 3 Jun 10 16:45 /root/.nix-profile/bin/nix-env -> nix
ba10e3ca04d6:/# ls -l `which nix`
-r-xr-xr-x 2 root root 1816736 Jan 1 1970 /root/.nix-profile/bin/nix
$ nixos-version
20.03.2648.69af91469be (Markhor)
$ ll `which nix-env`
lrwxrwxrwx 1 root root 65 Jan 1 1970 /run/current-system/sw/bin/nix-env -> /nix/store/jrl2jxaqzq7si48crdk69brbv6bgqfs7-nix-2.3.6/bin/nix-env
These days Debian testing offers nix
package manager.
This PR aims to support bootstrapping on NixOS