-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.nix
More file actions
42 lines (39 loc) · 1.34 KB
/
shell.nix
File metadata and controls
42 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Shell for bootstrapping flake-enabled nix and home-manager, from any nix version
{ pkgs ? let
inherit (builtins) currentSystem pathExists fromJSON readFile;
nixpkgs =
if pathExists ./flake.lock
then
# If we have a lock, fetch locked nixpkgs
let
inherit ((fromJSON (readFile ./flake.lock)).nodes.nixpkgs-unstable) locked;
in
fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${locked.rev}.tar.gz";
sha256 = locked.narHash;
}
else
# If not (probably because not flake-enabled), fetch nixos-unstable impurely
fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz";
};
system = currentSystem;
overlays = [ (import ./overlays) ];
in
import nixpkgs { inherit system overlays; }
, ...
}:
let
# Enable experimental features without having to specify the argument
nix = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
# nix-prefetch-git # To check thee sha256 checksum needed for mkDerivation: e.g, `nix-prefetch-git --url https://github.com/example/example.git --rev v2.3.3`
];
shellHook = ''
# Put any shell code that you'll like to run here
'';
}