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