From 7b7936cabc476b255fa647a100719f00d6675fcd Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 20 Jun 2023 14:06:24 -0700 Subject: [PATCH] Make use of overlay in service module --- flake.nix | 2 +- module.nix | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 7234215..9306191 100644 --- a/flake.nix +++ b/flake.nix @@ -64,7 +64,7 @@ config.nixpkgs.overlays = [ self.overlays.default ]; }; - nixosModules.intake = import ./module.nix self; + nixosModules.intake = import ./module.nix; nixosConfigurations."demo" = makeOverridable nixosSystem { inherit system; diff --git a/module.nix b/module.nix index 66eabfc..7b92bfa 100644 --- a/module.nix +++ b/module.nix @@ -1,7 +1,7 @@ -flake: { config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: 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; in { options = { @@ -20,6 +20,8 @@ in { "port based on the request's HTTP Basic Auth credentials."; }; + package = mkPackageOption pkgs "intake" {}; + internalPortStart = mkOption { type = types.port; default = 24130; @@ -48,7 +50,7 @@ in { config = let # 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 ]); # Assign each user an internal port for their personal intake instance