-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
33 lines (31 loc) · 814 Bytes
/
shell.nix
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
{ pkgs ? import <nixpkgs> { } }:
let
configs = "${toString ./.}#nixosConfigurations";
build = "config.system.build";
rebuild = pkgs.writeShellScriptBin "rebuild" ''
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) host {switch|boot|test|iso}"
elif [[ $1 == "iso" ]]; then
nix build ${configs}.niximg.${build}.isoImage
else
sudo -E nix shell -v ${configs}.$1.${build}.toplevel -c switch-to-configuration $2
fi
'';
in
pkgs.mkShell {
name = "nixflk";
nativeBuildInputs = with pkgs; [
git
git-crypt
nixVersions.stable
rebuild
];
shellHook = ''
mkdir -p secrets
PATH=${
pkgs.writeShellScriptBin "nix" ''
${pkgs.nixVersions.stable}/bin/nix --option experimental-features "nix-command flakes" "$@"
''
}/bin:$PATH
'';
}