mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
ref(nix): export lib
This commit is contained in:
parent
73afd2e280
commit
5b8e87c7a4
8 changed files with 30 additions and 6 deletions
41
nix/custom/default.nix
Normal file
41
nix/custom/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
pkgs,
|
||||
unstable,
|
||||
system,
|
||||
opam-nix,
|
||||
...
|
||||
}: let
|
||||
mkNerdFont = import ./mkNerdFont.nix {inherit pkgs unstable;};
|
||||
logisim-evolution = import ./logisim-evolution.nix {inherit pkgs;};
|
||||
|
||||
necrolib = import ./necrolib.nix {
|
||||
inherit pkgs system;
|
||||
inherit opam-nix;
|
||||
};
|
||||
|
||||
hiosevka = import ./hiosevka {inherit pkgs;};
|
||||
hiosevka-nerd-font-mono = mkNerdFont {
|
||||
font = hiosevka;
|
||||
extraArgs = ["--name {/.}-NFM" "--use-single-width-glyphs"];
|
||||
};
|
||||
hiosevka-nerd-font-propo = mkNerdFont {
|
||||
font = hiosevka;
|
||||
extraArgs = ["--name {/.}-NFP" "--variable-width-glyphs"];
|
||||
};
|
||||
in {
|
||||
myPkgs = {
|
||||
inherit
|
||||
logisim-evolution
|
||||
necrolib
|
||||
hiosevka
|
||||
hiosevka-nerd-font-mono
|
||||
hiosevka-nerd-font-propo
|
||||
;
|
||||
};
|
||||
|
||||
myLib = {
|
||||
inherit
|
||||
mkNerdFont
|
||||
;
|
||||
};
|
||||
}
|
||||
28
nix/custom/hiosevka/buildplan.toml
Normal file
28
nix/custom/hiosevka/buildplan.toml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
[buildPlans.hiosevka]
|
||||
family = "hIosekva"
|
||||
spacing = "term"
|
||||
serifs = "sans"
|
||||
|
||||
[buildPlans.hiosevka.ligations]
|
||||
inherits = "haskell"
|
||||
enables = [
|
||||
"brst", # (* *)
|
||||
"logic", # \/ /\
|
||||
"lteq-separate", # <=
|
||||
"gteq-separate", # >=
|
||||
"slash-asterisk", # /* */
|
||||
]
|
||||
disables = [
|
||||
"lteq", # <=
|
||||
"gteq", # >=
|
||||
]
|
||||
|
||||
[buildPlans.hiosevka.variants.design]
|
||||
capital-z = 'straight-serifless-with-crossbar'
|
||||
capital-q = 'crossing'
|
||||
lower-lambda = 'tailed-turn'
|
||||
seven = 'straight-serifless-crossbar'
|
||||
number-sign = 'slanted'
|
||||
ampersand = "upper-open"
|
||||
dollar = 'open'
|
||||
percent = 'rings-continuous-slash-also-connected'
|
||||
14
nix/custom/hiosevka/default.nix
Normal file
14
nix/custom/hiosevka/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{pkgs}: let
|
||||
pname = "hiosevka";
|
||||
in
|
||||
(pkgs.iosevka.overrideAttrs (_: {inherit pname;}))
|
||||
.override {
|
||||
set = pname;
|
||||
/*
|
||||
Guide: https://github.com/be5invis/Iosevka/blob/main/doc/custom-build.md
|
||||
|
||||
Use `term` spacing to avoid dashed arrow issue
|
||||
https://github.com/ryanoasis/nerd-fonts/issues/1018
|
||||
*/
|
||||
privateBuildPlan = builtins.readFile ./buildplan.toml;
|
||||
}
|
||||
30
nix/custom/logisim-evolution.nix
Normal file
30
nix/custom/logisim-evolution.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{pkgs}: let
|
||||
inherit (pkgs) stdenv fetchurl jre8;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "logisim-evolution";
|
||||
version = "2023";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.irisa.fr/cosi/HOMEPAGE/Derrien/logisim/logisim-evolution.jar";
|
||||
sha256 = "sha256-24uXyTXhxxA1uwc787I+OJn+ZmqMgNIL9RE3zoRrWww=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = with pkgs; [makeWrapper unzip zip];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
makeWrapper ${jre8}/bin/java $out/bin/logisim-evolution \
|
||||
--add-flags "-jar $src" \
|
||||
--set _JAVA_AWT_WM_NONREPARENTING 1
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# NOTE: related issue
|
||||
# https://wiki.archlinux.org/title/java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing
|
||||
}
|
||||
37
nix/custom/mkNerdFont.nix
Normal file
37
nix/custom/mkNerdFont.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
pkgs,
|
||||
unstable,
|
||||
}: {
|
||||
font,
|
||||
extraArgs ? [],
|
||||
useDefaultsArgs ? true,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
/*
|
||||
Credits:
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572
|
||||
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422
|
||||
|
||||
long font names is not problematic:
|
||||
https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781
|
||||
*/
|
||||
name = "${font.name}-NerdFont";
|
||||
src = font;
|
||||
nativeBuildInputs = [unstable.nerd-font-patcher pkgs.parallel];
|
||||
buildPhase = let
|
||||
args = builtins.concatStringsSep " " extraArgs;
|
||||
defArgs =
|
||||
if useDefaultsArgs
|
||||
then builtins.concatStringsSep " " ["--careful" "--complete" "--quiet" "--no-progressbars"]
|
||||
else "";
|
||||
in ''
|
||||
mkdir -p nerd-font
|
||||
find \( -name \*.ttf -o -name \*.otf \) | parallel nerd-font-patcher {} \
|
||||
--outputdir nerd-font ${defArgs} ${args}
|
||||
'';
|
||||
installPhase = ''
|
||||
fontdir="$out"/share/fonts/truetype
|
||||
install -d "$fontdir"
|
||||
install nerd-font/* "$fontdir"
|
||||
'';
|
||||
}
|
||||
30
nix/custom/necrolib.nix
Normal file
30
nix/custom/necrolib.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
pkgs,
|
||||
opam-nix,
|
||||
system,
|
||||
version ? "v0.14.7.1",
|
||||
}: let
|
||||
pname = "necrolib";
|
||||
|
||||
hashes = {
|
||||
"v0.14.7.1" = "sha256-rFYzNFsT7LIXzWxOogoJd9vh+ywI2N1GE77tnYO7keg=";
|
||||
"v0.14.8" = "sha256-ooc1DfTf4k9vcR2aU6CYzaGCDy4XvX98tvfzTLCljSc=";
|
||||
};
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://gitlab.inria.fr/skeletons/necro/-/archive/${version}/necro-${version}.tar.gz";
|
||||
hash = hashes.${version};
|
||||
};
|
||||
|
||||
on = opam-nix.lib.${system};
|
||||
query = {ocaml-base-compiler = "4.14.1";};
|
||||
|
||||
scope = on.buildDuneProject {} pname src query;
|
||||
|
||||
overlay = self: super: {
|
||||
# credits: balsoft
|
||||
# https://github.com/tweag/opam-nix/discussions/71#discussioncomment-8344504
|
||||
necrolib = super.necrolib.overrideAttrs (oa: {inherit src;});
|
||||
};
|
||||
in
|
||||
(scope.overrideScope' overlay).${pname}
|
||||
Loading…
Add table
Add a link
Reference in a new issue