Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ repos:
- id: ruff-format
- id: ruff
args: [ --fix ]
- repo: https://github.com/kamadorueda/alejandra
rev: 3.0.0
hooks:
# Requires Alejandra to be previously installed in the system
- id: alejandra-system
18 changes: 17 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 47 additions & 47 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
description = "brain";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
description = "A script to patch the MonoLisa font with Nerd Fonts glyphs.";

outputs = inputs @ {
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};

outputs = {
self,
nixpkgs,
systems,
}: let
inherit (nixpkgs.lib) genAttrs;
forAllSystems = f:
genAttrs
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
(system: f nixpkgs.legacyPackages.${system});
inherit (nixpkgs) lib;
eachSystem = fn:
lib.genAttrs (import systems) (system: let
pkgs = import nixpkgs {
localSystem.system = system;
overlays = [self.overlays.default];
};
in
fn system pkgs);
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
]}
overlays = {
default = final: prev: {
monolisa-nerdfont-patch = final.stdenv.mkDerivation {
name = "monolisa-nerdfont-patch";
src = ./.;
nativeBuildInputs = with final; [makeWrapper];
buildInputs = with final; [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 final; [fontforge])}
'';
};
};
}
);
};

devShells = forAllSystems (
pkgs:
with pkgs; {
default = mkShell {
buildInputs = [
fontforge
python3
pre-commit
];
};
}
);
packages = eachSystem (system: pkgs: {
default = self.packages.${system}.monolisa-nerdfont-patch;
monolisa-nerdfont-patch = pkgs.monolisa-nerdfont-patch;
});

devShells = eachSystem (_: pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [fontforge python3 pre-commit];
};
});
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand not wanting to take the formatter's flake as an input, however consider re-introducing the formatter output because it is special. You can use the package from Nixpkgs instead. The output allows nix fmt to work. This is useful: I manually run nix fmt to keep myself organized while I am working on dirty code, and additionally, configure my editor to format the code using the nix fmt command when the file is saved. This allows me to write long lines, and then semi-automatically format to keep my head clear and the code readable.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am well aware of how nix fmt works.

}