add doctrine

This commit is contained in:
Fabian Montero 2025-08-05 23:22:16 -06:00 committed by Alejandro Soto
parent 1c7810a49e
commit 26619394f4
No known key found for this signature in database
GPG key ID: A2C4C79764EE8F16
10 changed files with 113 additions and 63 deletions

12
doctrine/default.nix Normal file
View file

@ -0,0 +1,12 @@
{
pkgs,
namespace,
}: let
doctrine = {
lib = import ./lib {inherit lib pkgs doctrine;};
prefix = "trivium";
inherit namespace;
};
inherit (pkgs) lib;
in
doctrine

10
doctrine/lib/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
lib,
doctrine,
pkgs,
}: let
close = f: args: f (args // {inherit lib pkgs doctrine;});
in {
importAll = pkgs.callPackage ./importAll.nix {};
mkModule = close (import ./mk-module.nix);
}

View file

@ -0,0 +1,38 @@
{
name,
hm ? null,
sys ? null,
options ? null,
lib,
config,
pkgs,
doctrine,
}: let
optionsSet = import options {
inherit config lib pkgs cfg name doctrine;
};
configSet = import configFiles.${doctrine.namespace} {
inherit config lib pkgs doctrine cfg;
};
configFiles = lib.filterAttrs (k: v: v != null) {
inherit sys hm;
};
cfg = config.${doctrine.prefix}.${name};
in {
config =
lib.optionalAttrs (configFiles ? ${doctrine.namespace})
(lib.mkIf cfg.enable configSet);
options = lib.optionalAttrs (options
!= null
&& optionsSet ? ${doctrine.namespace}) {
${doctrine.prefix}.${name} =
optionsSet.${doctrine.namespace}
// {
enable = lib.mkEnableOption name;
};
};
}

View file

@ -45,8 +45,8 @@
trivium = overlay; trivium = overlay;
}; };
homeManagerModules.default = ./hm; homeManagerModules.default = ./modules;
nixosModules.default = ./nixos; nixosModules.default = ./modules;
lib = { lib = {
mkSystemFlake = { mkSystemFlake = {

View file

@ -1 +0,0 @@
{}

3
modules/default.nix Normal file
View file

@ -0,0 +1,3 @@
{
imports = [];
}

View file

@ -1,8 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
imports = [];
}

View file

@ -1,3 +0,0 @@
{callPackage}: {
importAll = callPackage ./importAll.nix {};
}

View file

@ -4,15 +4,14 @@
nodePackages, nodePackages,
lib, lib,
writeShellScriptBin, writeShellScriptBin,
pkgs pkgs,
}: }: let
let
schemaEngine = "${pkgs.prisma-engines}/bin/schema-engine"; schemaEngine = "${pkgs.prisma-engines}/bin/schema-engine";
queryEngineBin = "${pkgs.prisma-engines}/bin/query-engine"; queryEngineBin = "${pkgs.prisma-engines}/bin/query-engine";
queryEngineLib = "${pkgs.prisma-engines}/lib/libquery_engine.node"; queryEngineLib = "${pkgs.prisma-engines}/lib/libquery_engine.node";
buildFlags = [ "--ignore-scripts" ]; buildFlags = ["--ignore-scripts"];
in in
buildNpmPackage { buildNpmPackage {
pname = "spliit2"; pname = "spliit2";
version = "master-20250420"; version = "master-20250420";
@ -26,7 +25,7 @@ buildNpmPackage {
npmDepsHash = "sha256-sd0/7ruNUFxUKTeTwx/v8Vc/G3llkXP6RSDE78h3qVU="; npmDepsHash = "sha256-sd0/7ruNUFxUKTeTwx/v8Vc/G3llkXP6RSDE78h3qVU=";
nativeBuildInputs = [ pkgs.openssl ]; nativeBuildInputs = [pkgs.openssl];
npmRebuildFlags = buildFlags; npmRebuildFlags = buildFlags;
@ -65,7 +64,7 @@ buildNpmPackage {
--replace @out@ $out --replace @out@ $out
wrapProgram $out/bin/spliit2 \ wrapProgram $out/bin/spliit2 \
--prefix PATH : ${lib.makeBinPath [ pkgs.openssl ]} --prefix PATH : ${lib.makeBinPath [pkgs.openssl]}
''; '';
meta = { meta = {
@ -74,4 +73,4 @@ buildNpmPackage {
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = with lib.maintainers; []; maintainers = with lib.maintainers; [];
}; };
} }