Stream: nixos

Topic: How to use an older version of a tool in NixOS?


view this post on Zulip majorkaks (Jul 10 2024 at 15:03):

On the latest stable, uptime command gives wrong uptime on raspberry pi. It used to work fine before

shivam@vivy ~ $ uptime
 20:30:24  up 216 days 18:21,  1 user,  load average: 0.04, 0.13, 0.10
shivam@vivy ~ $ uptime --version
uptime (GNU coreutils) 9.5
Packaged by https://nixos.org
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi.
shivam@vivy ~ $

How would I go about using uptime from an older version of coreutils in a temporary shell?

view this post on Zulip Srid (Jul 10 2024 at 15:58):

nix shell github:nixos/nixpkgs/nixos-23.05#coreutils -c uptime

view this post on Zulip Srid (Jul 10 2024 at 15:58):

Replace nixos-23.05 with the appropriate branch name or revision of https://github.com/NixOS/nixpkgs

view this post on Zulip majorkaks (Jul 10 2024 at 17:01):

Thanks

shivam@vivy ~ $ nix --extra-experimental-features nix-command --extra-experimental-features flakes shell github:nixos/nixpkgs/23.11#coreutils -c uptime
 22:30:52  up   0:34,  3 users,  load average: 0.26, 2.86, 3.02
shivam@vivy ~ $ uptime
 22:30:56  up 216 days 20:22,  3 users,  load average: 0.24, 2.82, 3.00

Last updated: Nov 15 2024 at 12:33 UTC