ISO with Pinned Packages

I can create a binary with pinned packages and deploy it successfully. I love create custom ISOs also.

However, am unsure how to create custom ISO with pinned packages… I am sure it’s a basic misunderstanding I have (or don’t have).

  nixpkgs = builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/fd3e33d696b81e76b30160dfad2efb7ac1f19879.tar.gz";
    sha256 = "1liw3glyv1cx0bxgxnq2yjp0ismg0np2ycg72rqghv75qb73zf9h";
    };

  pkgs = import "${nixpkgs}/nixos" { config = {}; };

...

in

{config, pkgs, ...}:
{

  imports = [
    <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
    ];
...

The following works:

nixos-generate -f iso -c iso.nix

but it doesn’t seem to use the pinned packages.

1 Like

The <nixpkgs/.../...> expression is the issue here. This will look up “nixpkgs” in the NIX_PATH environment variable, which is the impurity you’re seeing.

2 Likes

Ahhh, now I see, I will give it a go. Thanks!