2022-12-30 19:43:37 +01:00
|
|
|
{
|
|
|
|
description = "Cooklang tools";
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs }:
|
|
|
|
let
|
|
|
|
supportedSystems = [ "x86_64-linux" ];
|
|
|
|
pkgsFor = system: import nixpkgs { inherit system; };
|
|
|
|
perSystem = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
mkApp =
|
|
|
|
{ drv
|
|
|
|
, name ? drv.pname or drv.name
|
2022-12-31 16:26:03 +01:00
|
|
|
, exePath ? drv.passthru.exePath or "bin/${drv.meta.mainProgram or name}"
|
2022-12-30 19:43:37 +01:00
|
|
|
}: {
|
|
|
|
type = "app";
|
|
|
|
program = "${drv}/${exePath}";
|
|
|
|
};
|
2022-12-31 16:26:03 +01:00
|
|
|
mkPackage = pkgs: name: pkgs.callPackage ./packages/${name}.nix { };
|
|
|
|
|
|
|
|
defaultApp = builtins.head apps; # first app is default one
|
|
|
|
packages = apps ++ nonApps;
|
|
|
|
|
|
|
|
# Apps
|
|
|
|
apps = [ "cookcli" "cook-docs" ];
|
|
|
|
# Packages which are not apps
|
|
|
|
nonApps = [ "cook-mode" ];
|
2022-12-30 19:43:37 +01:00
|
|
|
in
|
|
|
|
{
|
2022-12-31 16:26:03 +01:00
|
|
|
packages = perSystem (system: nixpkgs.lib.genAttrs packages (mkPackage (pkgsFor system)));
|
|
|
|
apps = perSystem (system:
|
|
|
|
nixpkgs.lib.genAttrs apps (name: mkApp { drv = self.packages.${system}.${name}; }) // {
|
|
|
|
default = self.apps.${system}.${defaultApp};
|
2022-12-30 19:43:37 +01:00
|
|
|
});
|
2022-12-31 16:26:03 +01:00
|
|
|
overlays = nixpkgs.lib.genAttrs packages (name: final: prev: mkPackage prev name) // {
|
|
|
|
default = final: prev: nixpkgs.lib.genAttrs packages (mkPackage prev);
|
|
|
|
};
|
2022-12-30 19:43:37 +01:00
|
|
|
};
|
|
|
|
}
|