mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
chore(hass): finalPackage attr
This commit is contained in:
parent
ff935b70de
commit
925a52cf8f
1 changed files with 17 additions and 1 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cfg = config.services.home-assistant;
|
cfg = config.services.home-assistant;
|
||||||
inherit (lib.modules) mkIf mkMerge mkBefore mkDefault;
|
inherit (lib.modules) mkIf mkMerge mkBefore mkDefault mkOptionDefault;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.lists) optional optionals elem unique;
|
inherit (lib.lists) optional optionals elem unique;
|
||||||
inherit (lib.strings) toLower;
|
inherit (lib.strings) toLower;
|
||||||
|
|
@ -41,6 +41,10 @@ in {
|
||||||
default = cfg.openFirewall;
|
default = cfg.openFirewall;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
finalPackage = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
@ -180,6 +184,18 @@ in {
|
||||||
"test_check_config"
|
"test_check_config"
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
finalPackage = let
|
||||||
|
inherit (lib.strings) hasSuffix removeSuffix splitString;
|
||||||
|
inherit (lib.lists) head;
|
||||||
|
inherit (lib.attrsets) attrNames filterAttrs;
|
||||||
|
inherit (config.systemd.services.home-assistant.serviceConfig) ExecStart;
|
||||||
|
isHassDrv = drv: context: hasSuffix "-${cfg.package.name}.drv" drv && context.outputs or [ ] == [ "out" ];
|
||||||
|
drvs = filterAttrs isHassDrv (builtins.getContext ExecStart);
|
||||||
|
isImpure = builtins ? currentSystem;
|
||||||
|
in mkIf cfg.enable (mkOptionDefault (
|
||||||
|
if isImpure then import (head (attrNames drvs))
|
||||||
|
else removeSuffix "/bin/hass" (head (splitString " " ExecStart))
|
||||||
|
));
|
||||||
extraPackages = python3Packages: with python3Packages; mkMerge [
|
extraPackages = python3Packages: with python3Packages; mkMerge [
|
||||||
[
|
[
|
||||||
psycopg2
|
psycopg2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue