Last active
June 15, 2020 16:40
-
-
Save knedlsepp/3dcb222306326d80999ff600e4a52bb9 to your computer and use it in GitHub Desktop.
How to pin a nix version in a default.nix file. (Override the pinned version via: nix-shell --arg nixpkgs '<nixpkgs>')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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 | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment