refactor: use flake package directly in NixOS module

Instead of requiring users to provide the package via overlay,
the module now receives `self` from the flake and uses the
package directly from `self.packages`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 05:08:02 +01:00
parent 9237814fed
commit cf3b1ce2c9
3 changed files with 8 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ Add the module to your NixOS configuration:
| Option | Type | Default | Description | | Option | Type | Default | Description |
|--------|------|---------|-------------| |--------|------|---------|-------------|
| `enable` | bool | `false` | Enable the listener service | | `enable` | bool | `false` | Enable the listener service |
| `package` | package | `pkgs.homelab-deploy` | Package to use | | `package` | package | from flake | Package to use |
| `hostname` | string | `config.networking.hostName` | Hostname for subject templates | | `hostname` | string | `config.networking.hostName` | Hostname for subject templates |
| `tier` | enum | required | `"test"` or `"prod"` | | `tier` | enum | required | `"test"` or `"prod"` |
| `role` | string | `null` | Role for role-based targeting | | `role` | string | `null` | Role for role-based targeting |

View File

@@ -49,7 +49,7 @@
}; };
}); });
nixosModules.default = import ./nixos/module.nix; nixosModules.default = import ./nixos/module.nix { inherit self; };
nixosModules.homelab-deploy = self.nixosModules.default; nixosModules.homelab-deploy = self.nixosModules.default;
}; };
} }

View File

@@ -1,3 +1,4 @@
{ self }:
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
@@ -21,7 +22,11 @@ in
options.services.homelab-deploy.listener = { options.services.homelab-deploy.listener = {
enable = lib.mkEnableOption "homelab-deploy listener service"; enable = lib.mkEnableOption "homelab-deploy listener service";
package = lib.mkPackageOption pkgs "homelab-deploy" { }; package = lib.mkOption {
type = lib.types.package;
default = self.packages.${pkgs.system}.homelab-deploy;
description = "The homelab-deploy package to use";
};
hostname = lib.mkOption { hostname = lib.mkOption {
type = lib.types.str; type = lib.types.str;