nix: Make nix-shell not fail on non-krops machines

Only krops stores the current configuration under /var/src/config.
As I use krops much less, this is not present on all machines.
This commit is contained in:
Simon Bruder 2023-09-20 22:11:54 +02:00
parent b10b83c207
commit a39a2ba616
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -10,7 +10,7 @@ let
let
# Load the system config and get the `nixpkgs.overlays` option
# This fails gracefully if getFlake is not available
overlays = if builtins.hasAttr "getFlake" builtins
overlays = if (builtins.hasAttr "getFlake" builtins && builtins.pathExists "/var/src/config")
then (builtins.getFlake "/var/src/config").nixosConfigurations.${config.networking.hostName}.config.nixpkgs.overlays
else [ ];
in