Basix/flake.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-11 00:12:26 +00:00
{
2024-05-11 01:30:52 +00:00
description = "Base16/Base24 schemes for Nix";
2024-05-11 00:12:26 +00:00
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
2024-05-11 01:54:47 +00:00
outputs = inputs @ {
flake-parts,
self,
...
}:
2024-05-11 00:12:26 +00:00
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
2024-05-11 00:37:07 +00:00
perSystem = {pkgs, ...}: {
2024-05-11 00:12:26 +00:00
packages = {
convert-scheme = pkgs.callPackage ./packages/convert-scheme/package.nix {};
};
};
2024-05-11 01:30:52 +00:00
flake = let
inherit (inputs.nixpkgs) lib;
2024-05-11 01:34:20 +00:00
evalSchemeData = lib.flip lib.pipe [
builtins.unsafeDiscardStringContext
lib.filesystem.listFilesRecursive
(builtins.filter (lib.hasSuffix ".json"))
(map (n: {
name = lib.removePrefix ((dirOf n) + "/") (lib.removeSuffix ".json" n);
value = lib.importJSON n;
}))
lib.listToAttrs
];
2024-05-11 01:30:52 +00:00
in {
2024-05-11 01:54:47 +00:00
lib = {
inherit evalSchemeData;
};
2024-05-11 01:30:52 +00:00
schemeData = {
2024-05-11 01:34:20 +00:00
base16 = evalSchemeData "${self}/json/base16";
base24 = evalSchemeData "${self}/json/base24";
2024-05-11 01:30:52 +00:00
};
};
2024-05-11 00:12:26 +00:00
};
}