nisspkgs/flake.nix
2025-03-03 22:34:32 +01:00

38 lines
1.4 KiB
Nix

{ description = "niss's silly extra packages";
outputs = all@{ self, nixpkgs, ... }:
let
inherit (nixpkgs.lib) genAttrs optionalAttrs systems;
forAllSystems = genAttrs systems.flakeExposed;
getCallPackage = system: nixpkgs.legacyPackages.${system}.callPackage;
ifLinux64 = system: attrs: optionalAttrs (system == "x86_64-linux") attrs;
linuxPackageNames =
[ "basilisk" "firefox-esr-alias" "isabelle" "multi-ghc" ];
fontNames =
[ "constructium" "fairfax-hd" "kreative-square" "muller"
"pragmatapro" "teranoptia" ];
linuxAppNames = [ "basilisk" "isabelle" "firefox-esr-alias" ];
linuxAppExes = { "firefox-esr-alias" = "firefox-esr"; };
packagesInDir = names: dir: call:
genAttrs names (pkg: call ./${dir}/${pkg}.nix {});
linuxOnly = packagesInDir linuxPackageNames "apps";
fonts = packagesInDir fontNames "fonts";
all = system: call: ifLinux64 system (linuxOnly call) // fonts call;
makeApp = pkgs: name: {
type = "app";
program = "${pkgs.${name}}/bin/${linuxAppExes.${name} or name}";
};
linuxApps = call: genAttrs linuxAppNames (makeApp (linuxOnly call));
in {
packages = forAllSystems (s: all s (getCallPackage s));
apps = forAllSystems (s: ifLinux64 s (linuxApps (getCallPackage s)));
overlays = forAllSystems (s: final: prev: all s final.callPackage);
};
}