Compare commits

...

8 Commits

Author SHA1 Message Date
Jacob Birkett fa54af9cba flake: package: remove needless unpackPase override 2024-02-02 00:16:00 -07:00
Jacob Birkett 09fcb3e71d flake: introduce overlay 2024-02-02 00:16:00 -07:00
Jacob Birkett e5a80628c5 flake: move usages of with to smallest scopes 2024-02-02 00:16:00 -07:00
Jacob Birkett 1da617b5a3 flake: inherit lib at top level 2024-02-02 00:16:00 -07:00
Jacob Birkett cdd398eac6 flake: replace forAllSystems with eachSystem and pkgsFor 2024-02-02 00:16:00 -07:00
Jacob Birkett e5b1362c40 flake: make systems overrideable 2024-02-02 00:16:00 -07:00
Jacob Birkett feb076653b flake: format nix code 2024-02-02 00:16:00 -07:00
Jacob Birkett 6f7ae92648 flake: add nixfmt as formatter 2024-02-02 00:15:59 -07:00
2 changed files with 1314 additions and 54 deletions

1258
flake.lock

File diff suppressed because it is too large Load Diff

110
flake.nix
View File

@ -1,58 +1,62 @@
{
description = "A script to patch the MonoLisa font with Nerd Fonts glyphs.";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = inputs @ {
self,
nixpkgs,
}: let
inherit (nixpkgs.lib) genAttrs;
forAllSystems = f:
genAttrs
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
(system: f nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (
pkgs:
with pkgs; {
default = stdenv.mkDerivation {
name = "monolisa-nerdfont-patch";
src = ./.;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
fontforge
python3
];
unpackPhase = ":";
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 ${lib.makeBinPath [
fontforge
]}
'';
};
}
);
devShells = forAllSystems (
pkgs:
with pkgs; {
default = mkShell {
buildInputs = [
fontforge
python3
pre-commit
];
};
}
);
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
nixfmt.url = "github:serokell/nixfmt";
};
outputs = { self, nixpkgs, systems, nixfmt, }:
let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = [ self.overlays.default ];
});
in {
overlays = {
default = pkgs: pkgs0: {
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 ${lib.makeBinPath (with pkgs; [ fontforge ])}
'';
};
};
};
packages = eachSystem (system:
let pkgs = pkgsFor.${system};
in {
default = self.packages.${system}.monolisa-nerdfont-patch;
monolisa-nerdfont-patch = pkgs.monolisa-nerdfont-patch;
});
devShells = eachSystem (system:
let pkgs = pkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [ fontforge python3 pre-commit ];
};
});
formatter = eachSystem (system: nixfmt.packages.${system}.default);
};
}