nisspkgs/flake.nix

54 lines
1.6 KiB
Nix

{ description = "niss's silly extra packages";
outputs = all@{ self, nixpkgs }:
let
inherit (nixpkgs.lib) genAttrs optionalAttrs systems defaultTo;
forAllSystems = genAttrs systems.flakeExposed;
packagesInDir = dir: names: pkgs:
let inherit (pkgs) callPackage; in
genAttrs names (pkg: callPackage ./${dir}/${pkg}.nix {});
linuxPackages = packagesInDir "apps" [
"multi-ghc" "basilisk" "isabelle"
"firefox-esr-alias" "inkscape-xwayland"
];
crossPlatformPackages = packagesInDir "scripts" [ "niss-misc" ];
fonts = packagesInDir "fonts" [
"constructium" "fairfax-hd" "kreative-square" "muller"
"pragmatapro" "teranoptia"
];
makeApp = pkgs: name: exe: {
inherit name;
value = {
type = "app";
program = "${pkgs.${name}}/bin/${defaultTo name exe}";
};
};
linuxApps = pkgs: builtins.listToAttrs [
(makeApp pkgs "basilisk" null)
(makeApp pkgs "isabelle" null)
(makeApp pkgs "firefox-esr-alias" "firefox-esr")
(makeApp pkgs "inkscape-xwayland" "inkscape")
];
ifLinux64 = sys: optionalAttrs (sys == "x86_64-linux");
mkPackages = sys: pkgs:
ifLinux64 sys (linuxPackages pkgs) //
crossPlatformPackages pkgs // fonts pkgs;
mkApps = sys: pkgs: ifLinux64 sys (linuxApps pkgs);
in {
packages = forAllSystems (sys: mkPackages sys nixpkgs.legacyPackages.${sys});
apps = forAllSystems (sys: mkApps sys nixpkgs.legacyPackages.${sys});
overlays = forAllSystems (sys: final: prev: mkPackages sys final);
};
}