monolisa-nerdfont-patch/flake.nix
Jacob Birkett 80c347ef1c
Clean up the Nix flake, recommended practices, provide overlay (#6)
* flake: update description

* flake: add alejandra as formatter

* flake: format nix code

* flake: make systems overrideable

* flake: replace forAllSystems with eachSystem

* flake: inherit lib at top level

* flake: move usages of with to smallest scopes

* flake: introduce overlay

* flake: package: remove needless unpackPase override

* flake: devShell: replace buildInputs with packages

* chore: move alejandra to pre-commit-hook

* chore: inherit from nixpkgs.lib not nixpkgs

* chore: remove some lets add others

* chore: change mkShell back to buildInputs

---------

Co-authored-by: Daylin Morgan <daylinmorgan@gmail.com>
2024-02-10 14:36:03 -06:00

60 lines
1.7 KiB
Nix

{
description = "A script to patch the MonoLisa font with Nerd Fonts glyphs.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs = {
self,
nixpkgs,
systems,
}: let
inherit (nixpkgs.lib) genAttrs makeBinPath;
eachSystem = fn:
genAttrs (import systems)
(system:
fn system
(import nixpkgs {
localSystem.system = system;
overlays = [self.overlays.default];
}));
in {
overlays = {
default = final: _prev: let
pkgs = final;
in {
monolisa-nerdfont-patch = pkgs.stdenv.mkDerivation {
name = "monolisa-nerdfont-patch";
src = ./.;
nativeBuildInputs = with pkgs; [makeWrapper];
buildInputs = with pkgs; [fontforge python3];
buildPhase = ":";
installPhase = ''
mkdir -p $out/bin
install -m755 -D ${./patch-monolisa} $out/bin/monolisa-nerdfont-patch
install -m755 -D ${./font-patcher} $out/bin/font-patcher
cp -r ${./bin} $out/bin/bin
cp -r ${./src} $out/bin/src
'';
postFixup = ''
wrapProgram $out/bin/monolisa-nerdfont-patch \
--set PATH ${makeBinPath (with final; [fontforge])}
'';
};
};
};
packages = eachSystem (system: pkgs: {
default = self.packages.${system}.monolisa-nerdfont-patch;
monolisa-nerdfont-patch = pkgs.monolisa-nerdfont-patch;
});
devShells = eachSystem (_: pkgs: {
default = pkgs.mkShell {
buildInputs = with pkgs; [fontforge python3 pre-commit];
};
});
};
}