How to override package version

I’m looking to override a package (https://github.com/NixOS/nixpkgs/blob/b6300babad7334f93f2e2e414dd575a5ba26418a/pkgs/applications/misc/houdini/runtime.nix) to 17.5.229, from 17.0.352, how do i do this (ideally inside configuration.nix)

Thank you

1 Like

You might wanna use an overlay.

I haven’t tested this one, but usually is just a matter of overwriting the version and src .

self: super:
{
  houdini = super.houdini.overrideAttrs ( old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.229";
    src =  requireFile rec {
         name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
         sha256 = new-sha-256;
         (...)
    };
  });
}

Although I’m not sure how to update your src.

1 Like

Thanks for the clear example.

Can you tell me where exactly you would put this overlay, and then how to invoke it? It’s a low level question but these kinds of things never click for me until I see a full, concrete example in action.

Hi,
Thanks for that, but ive run into a problem

  nixpkgs.overlays = [
    ( import ./overlays/houdini.nix )
  ];

{ config, pkgs, requireFile, ... }:

self: super:

{
  houdini = super.houdini.overrideAttrs ( old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.229";
    src =  requireFile rec {
         name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
         sha256 = "b20e0f35c51479fe3f89489ad64122b96f9d14eab26b54dbc062fdbb1681f5e0";
    };
  });
}

~ $ sudo nixos-rebuild switch
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)
building Nix...
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)
building the system configuration...
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)

No idea, might be due to the double recursion at the level and after the requireFile. Usually the src attribute is actually a git repo and not a file.

You need to explicitly pass in the params to the overlay. I think this should work in houdini.nix:

self: super:

{
  houdini = super.houdini.overrideAttrs (old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.229";
    src = super.requireFile {
      name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
      sha256 = "b20e0f35c51479fe3f89489ad64122b96f9d14eab26b54dbc062fdbb1681f5e0";
    };
  });
}

Hmm, not sure what im doing wrong. I have that inside my houdini.nix and i get an

error: assertion failed at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/build-support/trivial-builders.nix:295 

doing show trace i it failed while evaluating ‘requireFile’

but adding { requireFile, ... }: to the top of the overlay doesnt work, complaining about infinite recursion

Ah yeah you need more options set in requireFile. I think this works:

self: super:

{
  houdini = super.houdini.overrideAttrs (old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.229";
    src = super.requireFile {
      name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
      sha256 = "b20e0f35c51479fe3f89489ad64122b96f9d14eab26b54dbc062fdbb1681f5e0";
    };
    message = ''
      This nix expression requires that ${name} is already part of the store.
      Download it from https://sidefx.com and add it to the nix store with:
          nix-prefetch-url <URL>
      This can't be done automatically because you need to create an account on
      their website and agree to their license terms before you can download
      it. That's what you get for using proprietary software.
    '';
  });
}

Hi, sorry to be a pain but still not working

while evaluating the attribute 'serviceDirectories' of the derivation 'dbus-1' at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:257:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:378:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:370:32, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:370:19:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:245:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:371:10:
while evaluating the attribute 'passAsFile' of the derivation 'system-path' at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'src' of the derivation 'houdini-runtime-17.5.229' at /etc/nixos/overlays/houdini.nix:6:5:
while evaluating 'requireFile' at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/build-support/trivial-builders.nix:288:17, called from /etc/nixos/overlays/houdini.nix:8:11:
assertion failed at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/build-support/trivial-builders.nix:295:clock5:

Sorry! My bad it should be:


{
  houdini = super.houdini.overrideAttrs (old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.229";
    src = super.requireFile {
      name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
      sha256 = "b20e0f35c51479fe3f89489ad64122b96f9d14eab26b54dbc062fdbb1681f5e0";
      message = ''
        This nix expression requires that ${name} is already part of the store.
        Download it from https://sidefx.com and add it to the nix store with:
            nix-prefetch-url <URL>
        This can't be done automatically because you need to create an account on
        their website and agree to their license terms before you can download
        it. That's what you get for using proprietary software.
      '';
    };
  });
}

Actually tested this time :slight_smile:

Hi, that works (i dont get errors now), but it doesnt seem to override to base package

building '/nix/store/hw4b3s5ci7abvdm05whaf6p4z85dg4sk-houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz.drv'...
building '/nix/store/gcmnh33924drx4y3lfj5cvhfijjj2z64-houdini-17.0.352-chrootenv-etc.drv'...

***
This nix expression requires that houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz is already part of the store.
Download it from https://sidefx.com and add it to the nix store with:

    nix-prefetch-url <URL>

This can't be done automatically because you need to create an account on
their website and agree to their license terms before you can download
it. That's what you get for using proprietary software.

***

builder for '/nix/store/hw4b3s5ci7abvdm05whaf6p4z85dg4sk-houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz.drv' failed with exit code 1
cannot build derivation '/nix/store/7bh85ww6lqqjmpd5wmfadlxk9pwj0k1b-houdini-runtime-17.0.352.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/49scqp94phq5rmp8ljxxwa23ir5jlqpm-houdini-17.0.352-init.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/f8wz2sq9cf9w2qvxs2rhwk58rl12jf7n-houdini-runtime-17.5.229.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wgycdfimi8651n3hj3gks8lxj65qa4mr-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/cbhw3nyrp9ax5dkhv3rfblz6898pi90f-nixos-system-red-19.03.172538.7bb74e65365.drv': 1 dependencies couldn't be built
error: build of '/nix/store/cbhw3nyrp9ax5dkhv3rfblz6898pi90f-nixos-system-red-19.03.172538.7bb74e65365.drv' failed

Many thanks for your help

Still not sure how to get this working,

self: super:


{
  houdini = super.houdini.overrideAttrs (old: rec {
    version = "17.5.258";
    name = "houdini-runtime-${version}";
    src = super.requireFile {
      name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
      sha256 = "1pibc0gmjyw0s9vj0f77idfh41kgjk7l0qfjg4ahlxh84pwhsvzx";
      message = ''
      This nix expression requires that ${name} is already part of the store.
      Download it from https://sidefx.com and add it to the nix store with:
          nix-prefetch-url <URL>
      This can't be done automatically because you need to create an account on
      their website and agree to their license terms before you can download
      it. That's what you get for using proprietary software.
      '';

    };
  });
}

configuration.nix

{ config, pkgs, options, ... }:
{
...
...
nixpkgs.overlays = [
    ( import ./overlays/houdini.nix )
  ];
...
...
environment.systemPackages = with pkgs; [
    houdini
];
...

error produced

building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/x4197hii83lxk84rpzjypf4c8ij4vwff-houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz.drv
  /nix/store/jrw8kwdmcny0qy4fxqcfr34jbhig13d2-houdini-runtime-17.0.352.drv
  /nix/store/sxd8i8ji4wp9frp1dq4l82574pl1jbmv-houdini-17.0.352-chrootenv-etc.drv
  /nix/store/dykg7d37v00yzqyxq9v54wqg4jrii827-houdini-17.0.352-usr-target.drv
  /nix/store/nhp33b1g06drymwwlmnp87ar2q0mi88s-houdini-17.0.352-fhs.drv
  /nix/store/1xpvyk53x4gr75a1wbx8yxgcv5cqkipz-houdini-17.0.352-init.drv
  /nix/store/il02a2hxy1g2iqj7d7lhlzfikj1rmgbb-restrict-message.drv
  /nix/store/s4w3kp62d5n4v4d7m7x9kgd23pzw7cnz-houdini-17.5.258-linux_x86_64_gcc6.3.tar.gz.drv
  /nix/store/859yqhy0nvajp378hhnw8vdfm6ns7h86-houdini-runtime-17.5.258.drv
  /nix/store/81y73p84d9i77dsb4j2widpnn1ymd3mh-system-path.drv
  /nix/store/1l7lgvkkckgvavx098qj199i8bbkkrvk-dbus-1.drv
  /nix/store/6ccbv542q38j3sjvk716nisj1ihg1j0n-unit-dbus.service.drv
  /nix/store/jq8j4nv9kd2kqvjw940y10hy1xpvvs85-unit-systemd-fsck-.service.drv
  /nix/store/p358rr85dsb12v02vkvn9vgln05r156h-unit-polkit.service.drv
  /nix/store/6a9cz574qsg3r24imhwh95dy940wrjyx-system-units.drv
  /nix/store/b03a1gnlxdn7nving6g2n6yakd6zawa5-unit-dbus.service.drv
  /nix/store/da6psvzxbaw949jh01nf89zs5bxw34kd-user-units.drv
  /nix/store/3hz7zb6a560jw77dd775hxpni2k45856-etc.drv
  /nix/store/s4cc0d831x9h94k5hq7xj9abj6x5pxnk-nixos-system-Heimdall-19.03.172627.c21f08bfedd.drv
building '/nix/store/il02a2hxy1g2iqj7d7lhlzfikj1rmgbb-restrict-message.drv'...
building '/nix/store/x4197hii83lxk84rpzjypf4c8ij4vwff-houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz.drv'...
building '/nix/store/sxd8i8ji4wp9frp1dq4l82574pl1jbmv-houdini-17.0.352-chrootenv-etc.drv'...

***
This nix expression requires that houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz is already part of the store.
Download it from https://sidefx.com and add it to the nix store with:

    nix-prefetch-url <URL>

This can't be done automatically because you need to create an account on
their website and agree to their license terms before you can download
it. That's what you get for using proprietary software.

***

builder for '/nix/store/x4197hii83lxk84rpzjypf4c8ij4vwff-houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz.drv' failed with exit code 1
cannot build derivation '/nix/store/jrw8kwdmcny0qy4fxqcfr34jbhig13d2-houdini-runtime-17.0.352.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1xpvyk53x4gr75a1wbx8yxgcv5cqkipz-houdini-17.0.352-init.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/859yqhy0nvajp378hhnw8vdfm6ns7h86-houdini-runtime-17.5.258.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/81y73p84d9i77dsb4j2widpnn1ymd3mh-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/s4cc0d831x9h94k5hq7xj9abj6x5pxnk-nixos-system-Heimdall-19.03.172627.c21f08bfedd.drv': 1 dependencies couldn't be built
error: build of '/nix/store/s4cc0d831x9h94k5hq7xj9abj6x5pxnk-nixos-system-Heimdall-19.03.172627.c21f08bfedd.drv' failed

The error you quoted includes the instructions you want:

This nix expression requires that houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz is already part of the store.
Download it from https://sidefx.com and add it to the nix store with:

    nix-prefetch-url <URL>

This can't be done automatically because you need to create an account on
their website and agree to their license terms before you can download
it. That's what you get for using proprietary software.

So I guess you should go to https://sidefx.com, create an account, locate the file houdini-17.0.352-linux_x86_64_gcc6.3.tar.gz, agree to the terms, and then pass the download URL to nix-prefetch-url.

I’m trying to override the version to 17.5.258, and i have added that file to the store, but my overlay isnt overriding the verison, although there is mention of the new verison in the error

cannot build derivation '/nix/store/859yqhy0nvajp378hhnw8vdfm6ns7h86-houdini-runtime-17.5.258.drv': 1 dependencies couldn't be built

thanks

I just took a look at the source of the houdini package and it looks like

{ callPackage, buildFHSUserEnv, undaemonize }:

let
  houdini-runtime = callPackage ./runtime.nix { };
in buildFHSUserEnv rec {
  name = "houdini-${houdini-runtime.version}";

  extraBuildCommands = ''
    mkdir -p $out/usr/lib/sesi
  '';

  runScript = "${undaemonize}/bin/undaemonize ${houdini-runtime}/bin/houdini";
}

I’m not familiar with the details of buildFHSUserEnv but it looks to me as though the houdini package is itself just a thin wrapper around houdini-runtime and so what you’ve done with your override is produced a hybrid package that tries to install houdini-runtime-17.5.258 but also depends on houdini-runtime-17.0.352.

Without any testing on my part, I’d wager that you need to instead duplicate the default.nix while overriding the runtime portion. This might look like the following (completely untested):

self: super:
let
  orig-houdini-runtime = super.callPackage <nixpkgs/pkgs/applications/misc/houdini/runtime.nix> { };
  houdini-runtime = orig-houdini-runtime.overrideAttrs (old: rec {
    name = "houdini-runtime-${version}";
    version = "17.5.258";
    src = super.requireFile rec {
      name = "houdini-${version}-linux_x86_64_gcc6.3.tar.gz";
      sha256 = "1pibc0gmjyw0s9vj0f77idfh41kgjk7l0qfjg4ahlxh84pwhsvzx";
      message = ''
        This nix expression requires that ${name} is already part of the store.
        Download it from https://sidefx.com and add it to the nix store with:

            nix-prefetch-url <URL>

        This can't be done automatically because you need to create an account on
        their website and agree to their license terms before you can download
        it. That's what you get for using proprietary software.
      '';
    };
  });
in
{
  houddini = super.buildFHSUserEnv rec {
    name = "houdini-${houdini-runtime.version}";

    extraBuildCommands = ''
      mkdir -p $out/usr/lib/sesi
    '';

    runScript = "${self.undaemonize}/bin/undaemonize ${houdini-runtime}/bin/houdini";
  };
}