rework flake
parent
012d85c8c2
commit
71e82cca2b
34
flake.nix
34
flake.nix
|
@ -9,29 +9,29 @@
|
|||
mkApp =
|
||||
{ drv
|
||||
, name ? drv.pname or drv.name
|
||||
, exePath ? drv.meta.mainProgram or "bin/${name}"
|
||||
, exePath ? drv.passthru.exePath or "bin/${drv.meta.mainProgram or name}"
|
||||
}: {
|
||||
type = "app";
|
||||
program = "${drv}/${exePath}";
|
||||
};
|
||||
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" ];
|
||||
in
|
||||
{
|
||||
packages = perSystem (system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
genPackage = name: pkgs.callPackage ./packages/${name}.nix { };
|
||||
packages = [ "cookcli" "cook-docs" "cook-mode" ];
|
||||
in
|
||||
pkgs.lib.genAttrs packages genPackage // {
|
||||
default = self.packages.${system}.cookcli;
|
||||
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};
|
||||
});
|
||||
apps = perSystem (system: rec {
|
||||
cookcli = mkApp {
|
||||
drv = self.packages.${system}.cookcli;
|
||||
exePath = "/bin/cook";
|
||||
};
|
||||
cook-docs = mkApp { drv = self.packages.${system}.cook-docs; };
|
||||
default = cookcli;
|
||||
});
|
||||
overlays = nixpkgs.lib.genAttrs packages (name: final: prev: mkPackage prev name) // {
|
||||
default = final: prev: nixpkgs.lib.genAttrs packages (mkPackage prev);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue