Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchbower is not deterministic #5

Closed
mr-ouss opened this issue Jul 7, 2016 · 6 comments
Closed

fetchbower is not deterministic #5

mr-ouss opened this issue Jul 7, 2016 · 6 comments

Comments

@mr-ouss
Copy link

mr-ouss commented Jul 7, 2016

Issue description

After using bower2nix to generate bower-generated.nix, I get the following error when running a nix-build on my expression:

output path ‘/nix/store/lbn3c6i5v62xqi8mk2dfy54vi8mgzkli-angular-block-ui-0.2.2’ has r:sha256 hash ‘09sccghl6mbn32bai6bsa47mw3vibkdnzginc4y62hkx5wks42rk’ when ‘0nzqan0mqj47qic7m74d2rwp178n2wgjw523hw9x2mfnrcicsyvp’ was expected

and the hash is different time I run nix-build!

Steps to reproduce

The problem is easily reproducible.

1- I have the followingbower-generated.nix:

{ fetchbower, buildEnv }:
buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
    (fetchbower "angular-sweetalert" "1.1.0" "1.1.0" "060wmhivpb257xxa4lg9jznnqn9w7rfk5cvx5513pzfmm5clqw4z")
    (fetchbower "satellizer" "0.14.1" "0.14.1" "00m566lq6ajknxfvlnz65b4wqr4j6cc6vvsym3jbbf8rnss35yha")
    (fetchbower "angular-block-ui" "0.2.2" "0.2.2" "0nzqan0mqj47qic7m74d2rwp178n2wgjw523hw9x2mfnrcicsyvp")
    (fetchbower "angular-moment" "1.0.0-beta.6" "1.0.0-beta.6" "1xzx4z35cmaajwrc7vvyg8n7kkpn03p6yg0q54kldrfkc3r19icz")
    (fetchbower "ngstorage" "0.3.6" "0.3.6" "06y7y0j6igp6w42kh8msbjfnqs1555jxnw4kq6hcl9s8145a0864")
    (fetchbower "angular-smart-table" "2.1.8" "2.1.8" "0yjld9sinx1hxgc28qs8q0dc6xfvf14bdm88zzrwmcdyaggjwf0a")
    (fetchbower "ngSticky" "1.8.11" "1.8.11" "1vwsj1dlnl6462ynn6ji4hff7mzf4p7l6lqzv9b7kb8g1w70lkq4")
    (fetchbower "angular-bootstrap" "1.3.2" "1.3.2" "0b9kr2926643ryfkmhn0hiv78a82q12qgwyadw2la5ajdkv80pvj")
    (fetchbower "angular-ui-router" "0.2.18" "0.2.18" "02xvdn93wfzya6fb6srnk2175hgdkpdwxpnybrsl1yz0j05vphs0")
    (fetchbower "angular-google-chart" "0.1.0" "0.1.0" "16gyw7ww5v2ks43gixg7vfynjgm8xar9h77dkvd1ml2r0z2brc73")
    (fetchbower "jquery" "2.2.4" "2.2.4" "0jir5x9xgkkpql5kwfclg9j4lpysg9dbkq8qbp5j0384kn23d9x8")
    (fetchbower "angular" "1.5.3" "1.5.3" "010fhrgfh8ykwfkyxpndadkpzl72dgy3yr4j83jp3nwpjismnbmg")
    (fetchbower "angular-ui-bootstrap" "1.3.2" "1.3.2" "06rfib7mlgbnlaniyb76w1gqzg5s1hccpzv5hbqwhvvk38fyqkgw")
    (fetchbower "moment" "2.14.1" "2.14.1" "191x42jhgww1bk2h1zmh08h79fz5g5hps5w874rbj8sc7siabkza")
  ];
}

2- And this default.nix:

{ pkgs ? import <nixpkgs> {} 
, mySource ? ./.
, system ? builtins.currentSystem
}:
with import <nixpkgs> { inherit system; };
let
  bowerPackages = import ./bower-generated.nix { inherit (pkgs) fetchbower buildEnv; };
in
{
  bowerComponents = pkgs.stdenv.mkDerivation {
    name = "bower_components";
    inherit bowerPackages;
    src = mySource;
    buildPhase = ''
      cp -RL --reflink=auto ${bowerPackages} bc
      chmod -R u+w bc
      HOME=$PWD bower \
        --config.storage.packages=bc/packages \
        --config.storage.registry=bc/registry \
        --offline install
    '';
    installPhase = "mv bower_components $out";
    buildInputs = [ pkgs.git bowerPackages pkgs.nodePackages.bower ];
  };
}

3- Command that is run:

$ nix-build

Technical details

  • System: OSX El Capitan v 10.11.5
  • Nix version: (Nix) 1.11.2
  • Nixpkgs version: 16.03.1011.6317da4
@rvl
Copy link
Owner

rvl commented Jul 8, 2016

Sometimes I got different hashes when there was an error downloading the bower package. Could you try fetch-bower -o tmp-bower angular-block-ui 0.2.2 0.2.2 and see if that works ok?

@mr-ouss
Copy link
Author

mr-ouss commented Jul 8, 2016

Thank you for the quick reply!
That command did not produce anything

[nix-shell:/Volumes/Projects/foo]$ fetch-bower -o tmp-bower angular-block-ui 0.2.2 0.2.2

[nix-shell:/Volumes/Projects/foo]$ ls -l
total 0

I tried with other packages as well. Nothing seems to happen.

@rvl
Copy link
Owner

rvl commented Jul 8, 2016

Could I please confirm what are the versions coming from bower2nix --version and fetch-bower --version? The hashes in the above bower-generated.nix work for me.

@mr-ouss
Copy link
Author

mr-ouss commented Jul 8, 2016

I'm using the following version of bower2nix

$ bower2nix --version
2.1.0

fetch-bower is not returning anything !

$ fetch-bower --version

@rvl
Copy link
Owner

rvl commented Jul 8, 2016

Aha, sorry for not noticing earlier. Nixpkgs unstable has a newer version of bower2nix (3.0.1) with bug fixes.

If you switch to the unstable channel, you will also be able to use a simpler method to build bower_components (see Nixpkgs manual 16.09).

If you need to stay with 16.03, it may require overriding the fetchbower function.

@mr-ouss
Copy link
Author

mr-ouss commented Jul 8, 2016

Thank you Roney! I'll do that!

@mr-ouss mr-ouss closed this as completed Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants