From 97abe46b2d88fbc45b51723dcd1679ff7c2f4a80 Mon Sep 17 00:00:00 2001 From: Mike Purvis Date: Wed, 9 Aug 2023 00:25:57 -0400 Subject: [PATCH] Make nix, package configurable. --- default.nix | 3 ++- module.nix | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 879ee15..5547a69 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,7 @@ { pkgs ? (import { }) , rustPlatform ? pkgs.rustPlatform , nixVersions ? pkgs.nixVersions +, nixForHarmonia ? nixVersions.unstable , nix-gitignore ? pkgs.nix-gitignore , lib ? pkgs.lib , clippy ? pkgs.clippy @@ -19,7 +20,7 @@ rustPlatform.buildRustPackage ({ nativeBuildInputs = [ pkg-config ] ++ lib.optionals enableClippy [ clippy ]; buildInputs = [ - nixVersions.unstable + nixForHarmonia nlohmann_json libsodium boost diff --git a/module.nix b/module.nix index df12910..5959294 100644 --- a/module.nix +++ b/module.nix @@ -23,6 +23,12 @@ in description = lib.mdDoc "Settings to merge with the default configuration"; }; + + package = lib.mkOption { + type = lib.types.path; + default = pkgs.callPackage ./. { }; + description = "The harmonia package"; + }; }; }; @@ -54,8 +60,9 @@ in # otherwise environment.HOME = "/run/harmonia"; + serviceConfig = { - ExecStart = "${pkgs.callPackage ./. { }}/bin/harmonia"; + ExecStart = "${cfg.package}/bin/harmonia"; User = "harmonia"; Group = "harmonia";