nixos-configs/packages/repl/repl.nix
matt1432 84c7944ba6
All checks were successful
Discord / discord commits (push) Has been skipped
fix(repl): don't inherit lib
2024-11-21 13:31:19 -05:00

31 lines
742 B
Nix

{
flakePath,
hostnamePath ? "/etc/hostname",
}: let
inherit (builtins) currentSystem getFlake head match pathExists readFile removeAttrs;
hostname =
if pathExists hostnamePath
then head (match "([a-zA-Z0-9\\-]+)\n" (readFile hostnamePath))
else "";
self =
if pathExists flakePath
then
removeAttrs (getFlake (toString flakePath)) [
# If you use flakegen, these take a lot of space
"nextFlake"
"nextFlakeSource"
]
else {};
pkgs = self.inputs.nixpkgs.legacyPackages.${currentSystem} or {};
lib =
if pkgs != {}
then pkgs.lib
else {};
in
{inherit lib pkgs self;}
// self.nixosConfigurations.${hostname}
or self.nixOnDroidConfigurations.default
or {}