Libreoffice 7.6 instead of 24.x

Hi, new NixOS user here. I recently started playing with NixOS (a fresh install) and I encountered a problem - hope that you’ll be able to help me out.

I want to install libreoffice-24.x on my system but no matter what I do I get 7.6. Nix-search tells me that 24.x versions are available:

[user@nixos:~]$ nix-search --channel=24.05 libreoffice
libreoffice @ 7.6.7.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-qt @ 7.6.7.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-bin @ 7.6.7
libreoffice-still @ 7.6.7.2-wrapped
libreoffice-fresh @ 24.2.5.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-qt-still @ 7.6.7.2-wrapped
libreoffice-qt-fresh @ 24.2.5.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-qt6-still @ 7.6.7.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-qt6-fresh @ 24.2.5.2-wrapped : libreoffice sbase scalc sdraw simpress smath soffice swriter unopkg
libreoffice-still-unwrapped @ 7.6.7.2
libreoffice-fresh-unwrapped @ 24.2.5.2
libreoffice-qt-still-unwrapped @ 7.6.7.2
libreoffice-qt-fresh-unwrapped @ 24.2.5.2
libreoffice-qt6-fresh-unwrapped @ 24.2.5.2
libre @ 3.10.0
librep @ 0.92.7 : rep rep-remote rep-xgettext repdoc
librem @ 2.12.0
librest @ 0.8.1
librepo @ 1.15.1
librelp @ 1.11.0

When I put libreoffice-fresh or libreoffice-qt6-fresh into my configuration.nix file and rebuild I always and up with libreoffice-7.6.7.2. Why? How can I install the version that I want?

Try sending your configuration. It’s a lot easier to diagnose the problem if we can see the configuration that generates it!

Also, have you checked that your nixos-rebuid invocation is using the same channel as your invocation of nixos-search?

What configuration would you need to diagnose the problem?

[root@nixos:~]# nix-channel --list 
nixos https://nixos.org/channels/nixos-24.05

[root@nixos:~]# cat /etc/nixos/configuration.nix | grep -Ev "^ +#|^#|^$"
{ config, pkgs, ... }:
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  networking.hostName = "nixos"; # Define your hostname.
  networking.networkmanager.enable = true;
  time.timeZone = "Europe/Warsaw";
  i18n.defaultLocale = "pl_PL.UTF-8";
  i18n.extraLocaleSettings = {
    LC_ADDRESS = "pl_PL.UTF-8";
    LC_IDENTIFICATION = "pl_PL.UTF-8";
    LC_MEASUREMENT = "pl_PL.UTF-8";
    LC_MONETARY = "pl_PL.UTF-8";
    LC_NAME = "pl_PL.UTF-8";
    LC_NUMERIC = "pl_PL.UTF-8";
    LC_PAPER = "pl_PL.UTF-8";
    LC_TELEPHONE = "pl_PL.UTF-8";
    LC_TIME = "pl_PL.UTF-8";
  };
  services.xserver.enable = true;
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;
  services.xserver.xkb = {
    layout = "pl";
    variant = "";
  };
  console.keyMap = "pl2";
  services.printing.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };
  users.users.user = {
    isNormalUser = true;
    description = "user";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      kdePackages.kate
    ];
  };
  programs.firefox.enable = true;
  nixpkgs.config.allowUnfree = true;
  environment.systemPackages = with pkgs; [
    htop 
    libreoffice-fresh
    mc
    neovim
    nix-search-cli
    screen
    steam
    thunderbird
    tmux
    vim
    vlc
    wget
    yakuake
  ];
  services.openssh.enable = true;
  system.stateVersion = "24.05"; # Did you read the comment?
}

[root@nixos:~]#

Ok, I have some more information. When I looked into /nix/store I found libreoffice-24.x there:

$ ls -la /nix/store/ | grep libreoffice
dr-xr-xr-x   10 root root       4096 1970-01-01  03374x8pkyk30nck226j480jklrfg09b-libreoffice-kde-dependencies-7.6.7.2
-r--r--r--    1 root root       3006 1970-01-01  2x7ip7m7k0w5bm6l15l0gc0427p8qbj5-libreoffice-7.6.7.2.tar.xz.drv
-r--r--r--    1 root root       3031 1970-01-01  46v9ykxrw4447vq8s3xdvl6l6srp4fai-libreoffice-help-24.2.5.2.tar.xz.drv
-r--r--r--    1 root root       3058 1970-01-01  4qhcgyxh387b2k3dxc0yp0ishr8xnpg6-libreoffice-translations-7.6.7.2.tar.xz.drv
-r--r--r--    1 root root       6785 1970-01-01  6qi80rks3fbqkl5fgq98jm3r9mvpc1wr-libreoffice-24.2.5.2-wrapped.drv
-r--r--r--    1 root root      70911 1970-01-01  7xia3s8lblnh62wp85vxljyz9fidgwrc-libreoffice-7.6.7.2.drv
-r--r--r--    1 root root      70733 1970-01-01  94i2dxx3gcw7lilwmihz0f6f2j768glk-libreoffice-7.6.7.2.drv
dr-xr-xr-x    4 root root       4096 1970-01-01  9vn3ls2j1gzfqbldl5iyasl2kxm7xwvs-libreoffice-24.2.5.2
dr-xr-xr-x    4 root root       4096 1970-01-01  a4yq73486ijfh4k1ci2bfds5rp4h7hkz-libreoffice-7.6.7.2
-r--r--r--    1 root root       3174 1970-01-01  b5f7nw8x1pqrs1689dvdbywzd33drjf7-libreoffice-kde-dependencies-7.6.7.2.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  fv9cqpqmcsj23kynf8in73pawjs5pv6q-libreoffice-24.2.5.2-wrapped
-r--r--r--    1 root root      80150 1970-01-01  gclh4n92l3i5115bvq126f3a5j5srpwf-libreoffice-24.2.5.2.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  gd9arpcj2ff5iw2c5l7xrhz12xsipjba-libreoffice-24.2.5.2
-r--r--r--    1 root root       6776 1970-01-01  gg4j0h77w5sfbn130zhx6wp4r2lqidd1-libreoffice-7.6.7.2-wrapped.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  gwgamg2pa5y7y2vad3bqigw5wki8bbcw-libreoffice-7.6.7.2-wrapped
-r--r--r--    1 root root       3026 1970-01-01  hazm9s57y8cq05kd15pygd1931pyi4l3-libreoffice-help-7.6.7.2.tar.xz.drv
-r--r--r--    1 root root       2922 1970-01-01  hwwvqcs514sf8caly8bfcdfq9i9cv3i8-libreoffice-kde-dependencies-7.6.7.2.drv
dr-xr-xr-x    4 root root       4096 1970-01-01  iwz4mzv8c7s8dql38pv520np5vdm3g9q-libreoffice-7.6.7.2
-r--r--r--    1 root root      72309 1970-01-01  j6xhlxhl2cb5aa6qiaki7ddbxkllgwzg-libreoffice-7.6.7.2.drv
-r--r--r--    1 root root      10626 1970-01-01  jrz8qwzs95cld5j1cnvxlqq5469xx4c4-libreoffice-7.6.7.2-wrapped.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  k1swhbmkck79qw26aqp5qgnl8irrppx6-libreoffice-7.6.7.2-wrapped
-r--r--r--    1 root root       3063 1970-01-01  liav6k5dsf7x2dfis5bk5h1xp9q5yxjr-libreoffice-translations-24.2.5.2.tar.xz.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  m083nf5hln6fg5qlr4i5jscs8d1aa50k-libreoffice-7.6.7.2
-r--r--r--    1 root root      10176 1970-01-01  m575csz45am195bh8msm7r05w22hv2pj-libreoffice-24.2.5.2-wrapped.drv
-r--r--r--    1 root root      10167 1970-01-01  mc2zs5msw4qanz0l60sgpicdjxrwiyr0-libreoffice-7.6.7.2-wrapped.drv
dr-xr-xr-x   11 root root       4096 1970-01-01  mzcxfgsm5vnbp930gi009ddji6zzmk14-libreoffice-kde-dependencies-24.2.5.2
-r--r--r--    1 root root       3011 1970-01-01  sfswngk3n8agdp0m5vfqzrpybm7w1245-libreoffice-24.2.5.2.tar.xz.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  vpdnn8kr36qwvsxgvmz6lly298xiarzz-libreoffice-7.6.7.2-wrapped
-r--r--r--    1 root root      78580 1970-01-01  ws77hyvvqn9ablbzzcl91pk3kpfw4cpb-libreoffice-24.2.5.2.drv
-r--r--r--    1 root root       2925 1970-01-01  y0p4j5yvs0i43jypsn8b7l8sip4mpd60-libreoffice-kde-dependencies-24.2.5.2.drv
dr-xr-xr-x    5 root root       4096 1970-01-01  zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped

When I peak in one of the folders:

$ ls -la /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/bin/
razem 44
dr-xr-xr-x 2 root root 4096 1970-01-01  .
dr-xr-xr-x 5 root root 4096 1970-01-01  ..
lrwxrwxrwx 1 root root   84 1970-01-01  libreoffice -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/bin/soffice
lrwxrwxrwx 1 root root  102 1970-01-01  sbase -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/sbase
lrwxrwxrwx 1 root root  102 1970-01-01  scalc -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/scalc
lrwxrwxrwx 1 root root  102 1970-01-01  sdraw -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/sdraw
lrwxrwxrwx 1 root root  105 1970-01-01  simpress -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/simpress
lrwxrwxrwx 1 root root  102 1970-01-01  smath -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/smath
lrwxrwxrwx 1 root root  104 1970-01-01  soffice -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/soffice
lrwxrwxrwx 1 root root  104 1970-01-01  swriter -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/swriter
lrwxrwxrwx 1 root root  103 1970-01-01  unopkg -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/lib/libreoffice/program/unopkg

When I run any of those binaries I get LibreOffice 24. However when I check what is “libreoffice” pointing at:

$ type libreoffice 
libreoffice is /nix/var/nix/profiles/default/bin/libreoffice

$ ls -la /nix/var/nix/profiles/default/bin/libreoffice
lrwxrwxrwx 1 root root 83 1970-01-01  /nix/var/nix/profiles/default/bin/libreoffice -> /nix/store/k1swhbmkck79qw26aqp5qgnl8irrppx6-libreoffice-7.6.7.2-wrapped/bin/soffice

So were the links not updated as they should? Is that a bug? Is there a better way to fix that other than changing the links manually?

Ok, I think I solved the problem however I still think it’s a bug. Should I report it somewhere?

Solution:

[root@nixos:~]#  nix profile list --extra-experimental-features nix-command
Index:              0
Store paths:        /nix/store/k1swhbmkck79qw26aqp5qgnl8irrppx6-libreoffice-7.6.7.2-wrapped

[root@nixos:~]#  nix profile remove 0 --extra-experimental-features nix-command
removing 'libreoffice'

[root@nixos:~]#  nix profile list --extra-experimental-features nix-command

[root@nixos:~]# type libreoffice 
libreoffice is /run/current-system/sw/bin/libreoffice

[root@nixos:~]# ls -la /run/current-system/sw/bin/libreoffice
lrwxrwxrwx 1 root root 88 1970-01-01  /run/current-system/sw/bin/libreoffice -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/bin/libreoffice

After removing the package in root’s profile it started to work not only for root but also for the user:

[user@nixos:~]$ type libreoffice
libreoffice is /run/current-system/sw/bin/libreoffice

[user@nixos:~]$ ls -la /run/current-system/sw/bin/libreoffice
lrwxrwxrwx 1 root root 88 1970-01-01  /run/current-system/sw/bin/libreoffice -> /nix/store/zi4nivfr10s75gyz2xx2b7bad4g3dh8c-libreoffice-24.2.5.2-wrapped/bin/libreoffice