-
-
Save samueldr/64da1cedcf0f2678a118f5f402858148 to your computer and use it in GitHub Desktop.
This file contains 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
let | |
hostPkgs = import <nixpkgs> {}; | |
# Look here for information about how to generate `nixpkgs-version.json`. | |
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs | |
pinnedVersion = hostPkgs.lib.importJSON ./nixpkgs-version.json; | |
pinnedPkgs = hostPkgs.fetchFromGitHub { | |
owner = "NixOS"; | |
repo = "nixpkgs-channels"; | |
inherit (pinnedVersion) rev sha256; | |
}; | |
in | |
# This allows overriding nixpkgs by passing `--arg nixpkgs ...` | |
{ nixpkgs ? import pinnedPkgs {} }: | |
with nixpkgs; | |
stdenv.mkDerivation { | |
name = "WORK-env"; | |
buildInputs = [ | |
ruby | |
]; | |
} |
@samueldr consider the following shell.nix
. What are the pros/cons of using shell.nix
with mkShell
compared to what you have?
cat shell.nix ~/.private
let
hostPkgs = import <nixpkgs> {};
# Look here for information about how to generate `nixpkgs-version.json`.
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
pinnedVersion = hostPkgs.lib.importJSON ./nixpkgs-version.json;
pinnedPkgs = hostPkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs-channels";
inherit (pinnedVersion) rev sha256;
};
in
# This allows overriding nixpkgs by passing `--arg nixpkgs ...`
{ nixpkgs ? import pinnedPkgs {} }:
nixpkgs.mkShell {
buildInputs = with nixpkgs; [
ruby
rake
];
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how you'd override
nixpkgs
for one session...