Make use of overlay in service module

This commit is contained in:
Tim Van Baak 2023-06-20 14:06:24 -07:00
parent b68b7b75fa
commit 7b7936cabc
2 changed files with 6 additions and 4 deletions

View File

@ -64,7 +64,7 @@
config.nixpkgs.overlays = [ self.overlays.default ]; config.nixpkgs.overlays = [ self.overlays.default ];
}; };
nixosModules.intake = import ./module.nix self; nixosModules.intake = import ./module.nix;
nixosConfigurations."demo" = makeOverridable nixosSystem { nixosConfigurations."demo" = makeOverridable nixosSystem {
inherit system; inherit system;

View File

@ -1,7 +1,7 @@
flake: { config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) filterAttrs foldl imap1 mapAttrsToList mkEnableOption mkIf mkMerge mkOption types; inherit (lib) filterAttrs foldl imap1 mapAttrsToList mkEnableOption mkIf mkMerge mkOption mkPackageOption types;
intakeCfg = config.services.intake; intakeCfg = config.services.intake;
in { in {
options = { options = {
@ -20,6 +20,8 @@ in {
"port based on the request's HTTP Basic Auth credentials."; "port based on the request's HTTP Basic Auth credentials.";
}; };
package = mkPackageOption pkgs "intake" {};
internalPortStart = mkOption { internalPortStart = mkOption {
type = types.port; type = types.port;
default = 24130; default = 24130;
@ -48,7 +50,7 @@ in {
config = config =
let let
# Define the intake package and a python environment to run it from # Define the intake package and a python environment to run it from
intake = flake.packages.${pkgs.stdenv.hostPlatform.system}.default; intake = intakeCfg.package;
pythonEnv = pkgs.python38.withPackages (pypkgs: [ intake ]); pythonEnv = pkgs.python38.withPackages (pypkgs: [ intake ]);
# Assign each user an internal port for their personal intake instance # Assign each user an internal port for their personal intake instance