Hello guys, I’m packaging a custom version of NixOps but suddenly it
stopped working and I do not know what has gone wrong. Let me start
from the beginning. I’m doing this to use the “remote” capability for
libvirt introduced by PR #824.
My own fork of it it’s here GitHub - azazel75/nixops at remote-libvirt .
Now, up until before upgrading my NixOS this morning (I’m using the
unstable channel) I was using this snippet to package it as dependency
in my nix-shell
:
let
pkgs = import <nixpkgs> {};
remoteVirtNixOpsPkg = builtins.fetchTarball {
url = "https://github.com/azazel75/nixops/archive/remote-libvirt.tar.gz";
sha256 = "1mg1bsgwrydyk2i0g5pzc35kr6ybjrihvfns8kd8d6b74qxnyh40";
};
nixOpsRelease = import "${remoteVirtNixOpsPkg}/release.nix" {};
in
nixOpsRelease.build.${pkgs.system}
but now if I do a nix-build
on it I get an error, specifically:
error: aiohttp-3.5.4 not supported for interpreter python2.7
This is probably a problem of the packages in unstable that are
diverging too much from the expected versions present in current
stable release. Looking for a solution in the NixOps release.nix
source
I saw that it accepts a nixpkgs
parameter, so I though of feeding it
with a stable nixpkgs tarball so I tried:
let
# nixos-18.09-small Released on 2019-03-02
stableTarball = builtins.fetchTarball {
url = "https://github.com/NixOs/nixpkgs-channels/archive/80754f5cfd69d0caf8cff6795d3ce6d99479abde.tar.gz";
sha256 = "1v8g68gqgij389dssh6ry5x1zlhpgcgwjac0rgrh8146gf9hq74f";
};
pkgs = import <nixpkgs> {};
remoteVirtNixOpsPkg = builtins.fetchTarball {
url = "https://github.com/azazel75/nixops/archive/remote-libvirt.tar.gz";
sha256 = "1mg1bsgwrydyk2i0g5pzc35kr6ybjrihvfns8kd8d6b74qxnyh40";
};
nixOpsRelease = import "${remoteVirtNixOpsPkg}/release.nix" {nixpkgs=stableTarball;};
in
nixOpsRelease.build.${pkgs.system}
but trying to build it I get:
$ nix-build --show-trace /tmp/build_nixops.nix
error: while evaluating the attribute 'buildInputs' of the derivation 'nixops-1.6.1pre0_abcdef' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating 'chooseDevOutputs' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/lib/attrsets.nix:462:22, called from undefined position:
while evaluating 'optional' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/lib/lists.nix:241:20, called from /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/pkgs/development/interpreters/python/mk-python-derivation.nix:77:8:
while evaluating 'hasSuffix' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/lib/strings.nix:232:5, called from /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/pkgs/development/interpreters/python/mk-python-derivation.nix:77:22:
while evaluating the attribute 'src.name' at /nix/store/651063fc6njk8ma6i88kyz5k78r8a2b3-source/release.nix:76:7:
while evaluating the attribute 'distPhase' of the derivation 'nixops-tarball-1.6.1pre0_abcdef' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/pkgs/stdenv/generic/make-derivation.nix:177:11:
while evaluating the attribute 'buildCommand' of the derivation 'options-db.xml' at /nix/store/927lfycfz9mh61rmwqr7ylpn45wy6xjz-source/pkgs/stdenv/generic/make-derivation.nix:177:11:
getting attributes of path '/nixos/doc/manual/options-to-docbook.xsl': No such file or directory
Trying to debug the situation, I think that the evaluation jumps from
/release.nix#39
to
/doc/manual/resource.nix#18
where it incredibly evaluates the expression ${nixpkgs + /nixos/doc/manual/options-to-docbook.xsl}
to
/nixos/doc/manual/options-to-docbook.xsl
, thus giving the error.
The fun/sad thing is that if you preload the tarball of the custom
NixOps with nix-prefetch-url
:
$ nix-prefetch-url --unpack https://github.com/NixOs/nixpkgs-channels/archive/80754f5cfd69d0caf8cff6795d3ce6d99479abde.tar.gz
unpacking...
[14.4 MiB DL]
path is '/nix/store/wq5cwrk0lf5r217676ypcp3fppky3b1w-80754f5cfd69d0caf8cff6795d3ce6d99479abde.tar.gz'
1v8g68gqgij389dssh6ry5x1zlhpgcgwjac0rgrh8146gf9hq74f
and then you hardcode this path in the previous expression:
let
# nixos-18.09-small Released on 2019-03-02
stableTarball = /nix/store/wq5cwrk0lf5r217676ypcp3fppky3b1w-80754f5cfd69d0caf8cff6795d3ce6d99479abde.tar.gz;
pkgs = import <nixpkgs> {};
remoteVirtNixOpsPkg = builtins.fetchTarball {
url = "https://github.com/azazel75/nixops/archive/remote-libvirt.tar.gz";
sha256 = "1mg1bsgwrydyk2i0g5pzc35kr6ybjrihvfns8kd8d6b74qxnyh40";
};
nixOpsRelease = import "${remoteVirtNixOpsPkg}/release.nix" {nixpkgs=stableTarball;};
in
nixOpsRelease.build.${pkgs.system}
it builds:
$ nix-build --show-trace /tmp/build_nixops.nix
/nix/store/zp4bhakb3vj826pnazy5bln26rgym77g-nixops-1.6.1pre0_abcdef
again if you pass in a stableTarball
with the same path as string
it doesn’t build, with the same error above. What’s happening here?
Can somebody explain it to me?
P.S.
I tried to transform the output of fetchTarball
from string to path
using the expression nixpkgs = (/. + stableTarball)
(as suggested by @samueldr on IRC, now that
builtins.toPath is deprecated) but I’ve got the error “a string that
refers to a store path cannot be appended to a path” whose real
meaning I fail to understand? Why should it be an issue?