DavHau / mach-nix

Create highly reproducible python environments
MIT License
851 stars 106 forks source link

When changing default provider getting attribute error #58

Closed 573 closed 3 years ago

573 commented 4 years ago

When I use the _default for providers as in

providers = {
  _default = "nixpkgs,wheel,sdist";
};

my build says:

copying 1 paths... copying path '/nix/store/76dsxlbvwn7hk6xwxf2lm3w43m038bzv-mach_nix_file' from 'ssh://builder'... error: attribute 'unstable-2019-12-09' missing, at /nix/store/js7jvdbqp1i804frs52c7aqsqp0zj7py-nix-pypi-fetcher/default.nix:13:17

DavHau commented 4 years ago

It would be great if you could provide a nix expression that causes the error.

573 commented 4 years ago

Sure.

I have

# ~/.config/nixpkgs/nix-on-droid.nix
{ pkgs, ... }:
{
  home-manager.config = import ./home.nix;
}
# ~/.config/nixpkgs/home.nix
{ pkgs ? import <nixpkgs> {}, config, lib,...}:
with lib;
let
  home-manager = with pkgs; writeShellScriptBin "home-manager" ''
    # `toString` is required to impurely track your configuration instead of copying it to `/nix/store`
    exec ${(callPackage ./home-sources.nix {}).home-manager}/bin/home-manager -f ${toString ./home.nix} $@
  '';
in
{
  imports = [
    ./program/python
  ];

  home.packages = with pkgs; [
    home-manager
  ];
}

as well as ~/.config/nixpkgs/home-sources.nix and ~/.config/nixpkgs/program/python/default.nix

It should be possible to have a nix-shell with that configuration using:

nix-shell -E "with import <nixpkgs> {}; mkShell { buildInputs = [ (callPackage ~/.config/nixpkgs/home-sources.nix {}).home-manager ]; }" --run "home-manager -f ~/.config/nixpkgs/home.nix switch"
DavHau commented 4 years ago

Hey I'm having a lot of open tickets right now which I need to take care of. The nix expressions you're currently providing are difficult for me to assemble and to analyze since they are split apart and there is a lot of stuff in there which is not really relevant.

It would be a great help if you could already simplify it to one expression like this for example:

let
   mach-nix = import (builtins.fetchGit {
     url = "https://github.com/DavHau/mach-nix/";
     ref = "refs/tags/2.2.2";
   });
in mach-nix.mkPythonShell rec {
  python = mach-nix.nixpkgs.python37;
  requirements =  ''
    packages-triggering-the-problem  
  '';
}
573 commented 3 years ago

I'm closing this for now as I cannot reproduce the error currently. I think I did not use the _default override in a useful manner.