Skip to content

Help with caching for flakes #96

@brookst

Description

@brookst

Hi,
    I'm just trying to get a flake with a working devShell containing an old Python version. I can run nix shell ... to pull a specific version and that works from cache. However, no matter what I try to do in a flake, nix develop always tries to build Python from source. Here's my attempt to just get python-3.8 in a devShell from flake.nix:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixpkgs-python = {
      url="github:cachix/nixpkgs-python";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  
  nixConfig = {
      substituters = [ "https://nixpkgs-python.cachix.org" ];
      trusted-substituters = [ "https://nixpkgs-python.cachix.org" ];
      trusted-public-keys = [ "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" ];
      extra-substituters = [ "https://nixpkgs-python.cachix.org" ];
      extra-trusted-substituters = [ "https://nixpkgs-python.cachix.org" ];
      extra-trusted-public-keys = [ "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" ];
  };
 
  outputs = { self, nixpkgs, nixpkgs-python }: {
    devShells."x86_64-linux".default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
        packages = [
            nixpkgs-python.packages.x86_64-linux."3.8"
        ];
    };
  };
}

If I remove the nixpkgs.follows, Nix starts building a lot of foundational packages like perl, so I'm reasonably sure I need that.
I'd appreciate a hand in getting this working. nixpkgs-python is the closest I've gotten to running old python version without resorting to containers.

Cheers,
    Tim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions