nisspkgs/flake.nix

47 lines
1.5 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 = [
"multi-ghc"
"basilisk" "isabelle"
"firefox-esr-alias" "inkscape-xwayland"
];
fontNames = [
"constructium" "fairfax-hd" "kreative-square" "muller"
"pragmatapro" "teranoptia"
];
linuxAppNames = [
"basilisk" "isabelle" "firefox-esr-alias" "inkscape-xwayland"
];
linuxAppExes = {
firefox-esr-alias = "firefox-esr";
inkscape-xwayland = "inkscape";
};
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);
};
}