I’d like to use a specific version of singularity (https://github.com/NixOS/nixpkgs/blob/74c3268a1cefeb89796d93272ea90d6f112a6390/nixos/modules/programs/singularity.nix). From https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=singularity I’ve found that the specific version that I’m after, 3.7.2, is available in unstable at ref a765beccb52f30a30fee313fbae483693ffe200d
. There’s even a page for how to use it: Nix Package Versions. However, I’d like to add this to my configuration.nix
, so I’ve tried this:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
nix_pkgs_with_singularity_version_3_7_2 = import (builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "nix_pkgs_with_singularity";
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/heads/nixpkgs-unstable";
rev = "a765beccb52f30a30fee313fbae483693ffe200d";
}) {};
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
...
programs.singularity = {
enable = true;
package = nix_pkgs_with_singularity_version_3_7_2.singularity;
};
...
}
However when I try to build that, I get this error:
error: attribute 'currentSystem' missing
at /nix/store/nd0x64ljbw98y50ypph1pg9mb42pwbjz-nix_pkgs_with_singularity/pkgs/top-level/impure.nix:18:43:
17| # (build, in GNU Autotools parlance) platform.
18| localSystem ? { system = args.system or builtins.currentSystem; }
| ^
19|
(use '--show-trace' to show detailed location information)
My system is using flakes, and my flake.nix and flake.lock looks like this:
flake.nix
{
description = "dell flake config";
inputs = {
nixpkgs = {
url = "nixpkgs/nixos-unstable";
};
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs = {
nixpkgs = {
follows = "nixpkgs";
};
};
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
in {
nixosConfigurations = {
nixos-dell = lib.nixosSystem {
inherit system;
modules = [
# System config
./configuration.nix
# Make home-manager available in the above configuration.nix:
home-manager.nixosModules.home-manager
{
# use system-level nixpkgs rather than the HM private ones
# "This saves an extra Nixpkgs evaluation, adds consistency, and removes the dependency on NIX_PATH, which is otherwise used for importing Nixpkgs."
home-manager.useGlobalPkgs = true;
}
];
};
};
};
}
flake.lock
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1667907331,
"narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6639e3a837fc5deb6f99554072789724997bc8e5",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-22.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1676300157,
"narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "545c7a31e5dedea4a6d372712a18e00ce097d462",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
Is there a nice way to add this to my machine system-wide? Or should I instead create a custom shell where I have what I need available? Thanks!