os/shell.nix
Timothy DeHerrera 5f7af10bae
shell: add a nixpkgs-compat file
We are now able to pull in the same revision of nixpkgs as listed in
the lock file.
2020-12-27 00:40:12 -07:00

36 lines
842 B
Nix

{ pkgs ? import (import ./nixpkgs-compat.nix) { } }:
let
configs = "${toString ./.}#nixosConfigurations";
build = "config.system.build";
flk = pkgs.writeShellScriptBin "flk" ''
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 nixos-rebuild --flake ".#$1" $2
fi
'';
in
pkgs.mkShell {
name = "nixflk";
nativeBuildInputs = with pkgs; [
git
git-crypt
flk
nix-zsh-completions
];
shellHook = ''
mkdir -p secrets
if ! nix flake show &> /dev/null; then
PATH=${
pkgs.writeShellScriptBin "nix" ''
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
''
}/bin:$PATH
fi
'';
}