From abbe7190568c3a74b7c525198fb35a57029288bd Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 19 Jan 2024 14:10:45 +0100 Subject: [PATCH] templates/top: show how to export/import EPNix support modules importing an EPNix support modules by: - adding the repository as a flake input - importing its overlay - adding the package as a dependency in `epnix.support.modules` exporting an EPNix support modules by: - exporting the generated overlay --- templates/top/flake.nix | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/templates/top/flake.nix b/templates/top/flake.nix index a1cb68d4..3be88393 100644 --- a/templates/top/flake.nix +++ b/templates/top/flake.nix @@ -4,6 +4,14 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.epnix.url = "github:epics-extensions/epnix"; + # If you have a support module as a separate EPNix repository, + # add it as an input here: + # --- + #inputs.mySupportModule = { + # url = "git+ssh://git@my-server.org/me/exampleApp.git"; + # inputs.epnix.follows = "epnix"; + #}; + # If you have an "App" as a separate repository, # add it as an input here: # --- @@ -18,10 +26,15 @@ epnix, ... } @ inputs: let - myEpnixDistribution = {pkgs, ...}: { + myEpnixConfig = {pkgs, ...}: { # Set your EPNix options here # --- + # If you have a support module as a separate EPNix repository, + # uncomment this line to make the package available: + # --- + #overlays = [inputs.mySupportModule.overlays.default]; + epnix = { inherit inputs; @@ -33,9 +46,9 @@ # --- #epics-base.releaseBranch = "3"; # Defaults to "7" - # Add one of the supported modules here: + # Add your support modules here: # --- - #support.modules = with pkgs.epnix.support; [ StreamDevice ]; + #support.modules = with pkgs.epnix.support; [ StreamDevice mySupportModule ]; # If you have an "App" as a separate repository, # add it here: @@ -69,7 +82,7 @@ # environment can be built on your machine. flake-utils.lib.eachSystem ["x86_64-linux"] (system: with epnix.lib; let - result = evalEpnixModules { + epnixDistribution = evalEpnixModules { nixpkgsConfig = { # This specifies the build architecture inherit system; @@ -81,17 +94,23 @@ # --- #crossSystem = epnix.inputs.nixpkgs.lib.systems.examples.armv7l-hf-multiplatform; }; - epnixConfig = myEpnixDistribution; + epnixConfig = myEpnixConfig; }; in { packages = - result.outputs + epnixDistribution.outputs // { default = self.packages.${system}.build; }; + inherit epnixDistribution; + devShells.default = self.packages.${system}.devShell; - checks = result.config.epnix.checks.derivations; - }); + checks = epnixDistribution.config.epnix.checks.derivations; + }) + // { + overlays.default = final: prev: + self.epnixDistribution.x86_64-linux.generatedOverlay final prev; + }; }