mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2024-12-21 22:40:44 -06:00
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>
This commit is contained in:
parent
2603e90ce8
commit
80c347ef1c
3 changed files with 71 additions and 48 deletions
|
@ -12,3 +12,8 @@ repos:
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [ --fix ]
|
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
flake.lock
18
flake.lock
|
@ -18,7 +18,23 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"systems": "systems"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
72
flake.nix
72
flake.nix
|
@ -1,29 +1,35 @@
|
||||||
{
|
{
|
||||||
description = "brain";
|
description = "A script to patch the MonoLisa font with Nerd Fonts glyphs.";
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
|
|
||||||
outputs = inputs @ {
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
systems.url = "github:nix-systems/default";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
systems,
|
||||||
}: let
|
}: let
|
||||||
inherit (nixpkgs.lib) genAttrs;
|
inherit (nixpkgs.lib) genAttrs makeBinPath;
|
||||||
forAllSystems = f:
|
eachSystem = fn:
|
||||||
genAttrs
|
genAttrs (import systems)
|
||||||
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
|
(system:
|
||||||
(system: f nixpkgs.legacyPackages.${system});
|
fn system
|
||||||
|
(import nixpkgs {
|
||||||
|
localSystem.system = system;
|
||||||
|
overlays = [self.overlays.default];
|
||||||
|
}));
|
||||||
in {
|
in {
|
||||||
packages = forAllSystems (
|
overlays = {
|
||||||
pkgs:
|
default = final: _prev: let
|
||||||
with pkgs; {
|
pkgs = final;
|
||||||
default = stdenv.mkDerivation {
|
in {
|
||||||
|
monolisa-nerdfont-patch = pkgs.stdenv.mkDerivation {
|
||||||
name = "monolisa-nerdfont-patch";
|
name = "monolisa-nerdfont-patch";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = with pkgs; [makeWrapper];
|
||||||
buildInputs = [
|
buildInputs = with pkgs; [fontforge python3];
|
||||||
fontforge
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
unpackPhase = ":";
|
|
||||||
buildPhase = ":";
|
buildPhase = ":";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
@ -34,25 +40,21 @@
|
||||||
'';
|
'';
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
wrapProgram $out/bin/monolisa-nerdfont-patch \
|
wrapProgram $out/bin/monolisa-nerdfont-patch \
|
||||||
--set PATH ${lib.makeBinPath [
|
--set PATH ${makeBinPath (with final; [fontforge])}
|
||||||
fontforge
|
|
||||||
]}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
);
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (
|
packages = eachSystem (system: pkgs: {
|
||||||
pkgs:
|
default = self.packages.${system}.monolisa-nerdfont-patch;
|
||||||
with pkgs; {
|
monolisa-nerdfont-patch = pkgs.monolisa-nerdfont-patch;
|
||||||
default = mkShell {
|
});
|
||||||
buildInputs = [
|
|
||||||
fontforge
|
devShells = eachSystem (_: pkgs: {
|
||||||
python3
|
default = pkgs.mkShell {
|
||||||
pre-commit
|
buildInputs = with pkgs; [fontforge python3 pre-commit];
|
||||||
];
|
};
|
||||||
};
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue