@_Andrew thanks for sharing that link, it is interesting.
It is nice to see it say “Installing older versions of packages in Nix is easy”.
These two sections are interesting as it looks like how a previous version of a package could be specified:
“”"
Use hplip in a nix script via tarball
let
pkgs = import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/02e464590ebd69ec541f0b9deea638b26e0dc0ac.tar.gz";
}) {};
myPkg = pkgs.hplip;
in
...
Use hplip in a nix script via Git
let
pkgs = import (builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "my-old-revision";
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/heads/nixos-23.11";
rev = "02e464590ebd69ec541f0b9deea638b26e0dc0ac";
}) {};
myPkg = pkgs.hplip;
in
...
“”"
I am not sure how either of those would be used in a configuration.nix file for NixOS. I think I am missing an important part which is what is truncated by the ... parts.
Hi, I think I’ve got the same result.
I thought there would be an easy way to install older versions of software on NixOS. I’m new and trying this here the first time.
Hi, I was referring to bluebull’s comment. I’ve got the same error. With tarball and github. I admit, this might be rather a more general skill issue with the configure script. I’m going to look myself for a more general solution.
If you’re getting that specific error, it’s probably because you put a let-expression directly inside an attribute set.
This is a binding:
name = expr;
This is a let-expression:
let
name = expr;
in
expr2
This is an attribute set:
{
name = expr;
}
Attribute sets can only contain bindings, not expressions. This is wrong:
{
expr
}
And as a special case of above, so is this:
{
let
name = expr;
in
expr2
}
But this is okay, and probably what you want to do, because a let-expression is a kind of expression:
{
name =
let
name2 = expr;
in
expr2;
}
This is also okay (because attribute sets are also expressions), and what you want if you want to share a let-binding among multiple attribute-bindings:
I assure you that, provided you understand the syntax of the Nix language, you can copy the fragment from NPV into a configuration.nix and get good results. But you can’t simply paste it anywhere. Just like ‘I assure you that’ is not a complete sentence, let pkgs = whatever; in is not a complete Nix expression. But ‘I assure you that’ can be used correctly in a sentence, provided you don’t do I assure you that something confused, like this. Similarly, you have to choose the right place to insert let pkgs = whatever; in in your configuration.nix, by understanding the syntax and making sure that the result is a valid Nix expression.
It looks like you forgot the in keyword here.
It looks like you’re defining an attribute users.users.user.pkgsOLD here, which is not going to do you any good because that attribute isn’t a NixOS option.
An attribute-binding and a let-binding have identical syntax but do different things. An attribute-binding creates an attribute on an attribute set, and a let-binding creates a variable for you to use within that let-expression.
Okay, I’ll look into it at some time. Unfortunate that there’s no easier way. I’ll rather use some live distro running my old HP scanner for now, and the video editing (Flowblade) I wanted to try out was just meant as a test, so it can wait.