Git Product home page Git Product logo

Comments (5)

knedlsepp avatar knedlsepp commented on May 30, 2024

Finally got it working. I don't know if there is something wrong with my nix installation or there were simply some braces missing from your blog post, but the following works for me:

{ nixpkgs ? (import ( _nixpkgs.fetchFromGitHub { 
owner = "NixOS"; 
repo = "nixpkgs"; 
rev = "..."; 
sha256 = "..."; }){})}:

Whereas the original solution does not:

{ nixpkgs ? (import _nixpkgs.fetchFromGitHub { 
owner = "NixOS"; 
repo = "nixpkgs"; 
rev = ...; 
sha256 = ...; })}:

I don't know enough nix, but wouldn't something like the following be great to have? Can't we add such behaviour to import itself?

{nixpkgs ? import <nixpkgs> { rev = "..."; sha256 = "..."; }  }:
...

from nixpkgs-mozilla.

knedlsepp avatar knedlsepp commented on May 30, 2024

Hm. The part where we set the nix path still does not work with this solution:

nix-shell --arg nixpkgs /absolute/path/to/nixpkgs.

from nixpkgs-mozilla.

knedlsepp avatar knedlsepp commented on May 30, 2024

Ok. Finally got something working:

{nixpkgs ? null}:
let
  sysPkg = import <nixpkgs> { };
  pinnedPkg = sysPkg.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs";
    rev = "cf62a27a326a9cdbb01d627b1faaea3a0d5e886c";
    sha256 = "1q74ciqq5r17vidw2025x8idsncz9k7w60warrij4q7piaffgvd7";
  };
  pkgs = if nixpkgs==null then
           import pinnedPkg {}
         else
           import nixpkgs {};
in with pkgs; stdenv.mkDerivation rec {
  name = "ProjectA-1.0.0";
  src = ./.;
  buildInputs = [ pkgs.python ];
  installPhase= ''
    sed -i -e "s|python|`which python`" bin/serve
    mkdir -p $out/bin
    cp bin/* $out/bin
  '';
}

from nixpkgs-mozilla.

zimbatm avatar zimbatm commented on May 30, 2024

Looks right to me. I don't know if we can reduce this further.

My only suggestion would be to name it mozpkgs or anything else than nixpkgs since that term is already referencing the nixos/nixpkgs repo.

from nixpkgs-mozilla.

taktoa avatar taktoa commented on May 30, 2024

You guys may also be interested in my technique for fully deterministic bootstrapping of a nixpkgs pin. It makes no assumptions other than that your Nix interpreter implements a superset of the semantics implemented by Nix 1.11.8 (which seems likely to be true into the forseeable future). In the future, when Nix 1.12 comes out, fetchTarball will support a sha256 argument, and this hack can be replaced with fetchTarball (if you try to use fetchTarball now, it will redownload every time the cache expires, which can be very annoying).

from nixpkgs-mozilla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.