From da5dffa056a55f8c92a715b5a26e12d49a4f5132 Mon Sep 17 00:00:00 2001 From: Daniel Phan Date: Mon, 1 Nov 2021 08:18:12 +0700 Subject: [PATCH] add overlay --- flake.nix | 1 + module.nix | 11 ++++++++--- overlay.nix | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 overlay.nix diff --git a/flake.nix b/flake.nix index 97b89ef..faa52c0 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,7 @@ outputs = { self, nixpkgs, flake-utils, mach-nix, ... }: { nixosModules.peerix = import ./module.nix; + overlay = import ./overlay.nix { inherit self; }; } // flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in { packages.peerix = mach-nix.lib.${system}.buildPythonApplication { diff --git a/module.nix b/module.nix index 60af204..cff0944 100644 --- a/module.nix +++ b/module.nix @@ -1,8 +1,6 @@ { lib, config, pkgs, ... }: let cfg = config.services.peerix; - - peerix = (import ./default.nix).default; in { options = with lib; { @@ -70,6 +68,13 @@ in By default not given, as it affects the UX of the nix installation. ''; }; + + package = mkOption { + type = types.package; + default = (import ./default.nix).default or pkgs.peerix; + defaultText = literalExpression "pkgs.peerix"; + description = "The package to use for peerix"; + }; }; }; @@ -132,7 +137,7 @@ in ]; }; script = '' - exec ${peerix}/bin/peerix + exec ${cfg.package}/bin/peerix ''; }; diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..45758c9 --- /dev/null +++ b/overlay.nix @@ -0,0 +1,4 @@ +{ self }: +final: prev: { + peerix = self.packages.${prev.system}.peerix; +}