rework flake

main
Moritz Böhme 2022-12-31 16:26:03 +01:00
parent 012d85c8c2
commit 71e82cca2b
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 17 additions and 17 deletions

View File

@ -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;
});
}; };
} }