Lisp error whilst updating the system

Hi everyone,

I got an error with lisp whilst updating my system via sudo nixos-rebuild switch:

base/lisp.run -B . -M base/lispinit.mem -norc -q -i i18n/i18n -i syscalls/posix -i regexp/regexp -i readline/readline -x (saveinitmem "base/lispinit.mem")
;; Loading file /build/clisp-2.49/builddir/i18n/i18n.fas ...
;; Loaded file /build/clisp-2.49/builddir/i18n/i18n.fas
;; Loading file /build/clisp-2.49/builddir/syscalls/posix.fas ...
;; Loaded file /build/clisp-2.49/builddir/syscalls/posix.fas
;; Loading file /build/clisp-2.49/builddir/regexp/regexp.fas ...
;; Loaded file /build/clisp-2.49/builddir/regexp/regexp.fas
;; Loading file /build/clisp-2.49/builddir/readline/readline.fas ...
*** - FFI::FIND-FOREIGN-VARIABLE: foreign variable
      #<FOREIGN-VARIABLE "rl_readline_state" #x00007FFFF7FBC640> does not have
      the required size or alignment

./clisp-link: failed in /build/clisp-2.49/builddir
make: *** [Makefile:2623: base] Error 1
error: builder for '/nix/store/rbykd92038rp80a71diyxqmbiz4m8f60-clisp-2.49.drv' failed with exit code 2
error: 1 dependencies of derivation '/nix/store/5v7rahkfv6hvc6ikgab8in2h6fwiz915-texlive-xindy.bin-2021.drv' failed to build
error: 1 dependencies of derivation '/nix/store/zfx0nfhqc59s4jz579wdmjx3c9vqbyr0-texlive-combined-full-2021-final.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bwslsyzi2sa98l9xsl87lirdm0710fqz-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jpfkhaykks0i1rwii5yj7abw7qpvpnja-nixos-system-nixos-22.05.3167.e64df9c5c8f.drv' failed to build

My configuration
Thank you :slight_smile:
Davide

1 Like

Tracking issue clisp fails to build · Issue #206958 · NixOS/nixpkgs · GitHub

1 Like

Thank you very much for bringing this to my attention. How can I modify my configuration in order to include the fix?

Cheers,
Davide

Hi!

I’ve done it for the first time too, and while you shouldn’t consider it as the best way to do (I’ve almost no idea what I’ve been doing :blush:) here is what worked for me: fix(pkgs): patch clisp with an overlay to ensure zettlr can build · real34/dotfiles@cf7e5fc · GitHub

1 Like

Hi,
I copy-pasted your fix in my main configuration file (I installed all the packages for all the users), but unfortunately it gives exactly the same error

The problem with the fix proposed above is that, apparently, my configuration ignores nixpkgs.overlays (as long as they are syntactically correct.

Maybe this behaviour originates from the fact that I used some fixes to set unstable packages from configuration.nix? I have no experience with overlays, and any help may be very useful. My configuration.
Relevant parts of my configuration.nix:

{ config, pkgs, ... }:

let
  # Unstable packages
  unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz;
in
{
  # Unstable packages
  nixpkgs.config = {
    packageOverrides = pkgs: {
      unstable = import unstableTarball {
        config = config.nixpkgs.config;
      };
    };
  };

  # Temporary overlays for patches
  nixpkgs.overlays = [
   (self: super: {
      # see https://github.com/NixOS/nixpkgs/pull/206745
      clisp = super.clisp.override
        {
          readline = pkgs.readline6;
        };
    })
  ];

  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
       # all the packages in environment.systemPackages below here
      ../imports/systemPackages_standard.nix
  ];
}

You can not combine packageOverrides and overlays, it is an either/or.

1 Like

I see, thank you.

Is it still possible to override current clisp version with the older one, without using overlays and within my definition of packageOverrides?

Yes. Though alternatively, you might want to move the overrides to overlays. They generally compose better, and most of the time, overlays are expected to work by 3rd party instructions.

I use the override to tell nixos to use the unstable channel (which I prefer to do within my configuration.nix). Is it possible to do so through overlays? If yes, how? I don’t know nixos language very much.

thanks,
Davide

Yes, you can do that. You will pe able to use unstable just like now through pkgs.unstable.

Can you please explain me how and, if possible, provide some code snippets? I have not enough knowledge to write the appropriate nixos code by myself.

Thanks,
Davide

final: prev: {
  unstable = import unstableTarball {
    config = config.nixpkgs.config;
  };
};
1 Like

Thank you.
And how to define more than one overlay? I tried

 nixpkgs.overlays = [
    (
      final: prev: {
        unstable = import unstableTarball {
          config = config.nixpkgs.config;
        };
      }
      self: super: {
        # see https://github.com/NixOS/nixpkgs/pull/206745
        clisp = super.clisp.override
          {
            readline = pkgs.readline6;
          };
      }
    )
];

but does not work

You need to wrap them in parenthesis individually, or combine them into one.

1 Like

Thank you very much. My solution:

  # Overlays for unstable packages and for patches
  nixpkgs.overlays = [
    # Overlay to define unstable packages
    (
      final: prev: {
        unstable = import unstableTarball {
          config = config.nixpkgs.config;
        };
      }
    )
    # Template for an overlay to define a patch on clisp
    (
      self: super: {
        # see https://github.com/NixOS/nixpkgs/pull/206745
        clisp = super.clisp.override {
          readline = pkgs.readline6;
        };
      }
    )
  ];