materia/flake.nix

176 lines
4.3 KiB
Nix
Raw Normal View History

2024-05-07 16:49:30 +05:00
{
description = "Materia";
2024-05-07 16:49:30 +05:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
dream2nix = {
url = "github:nix-community/dream2nix";
inputs.nixpkgs.follows = "nixpkgs";
2024-05-07 16:49:30 +05:00
};
bonfire.url = "github:L-Nafaryus/bonfire";
};
2024-05-07 16:49:30 +05:00
outputs = {
self,
nixpkgs,
dream2nix,
bonfire,
...
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
2024-07-25 13:33:05 +05:00
bonLib = bonfire.lib;
dreamBuildPackage = {
module,
meta ? {},
extraModules ? [],
extraArgs ? {},
}:
(
nixpkgs.lib.evalModules {
modules = [module] ++ extraModules;
specialArgs =
{
inherit dream2nix;
packageSets.nixpkgs = pkgs;
}
// extraArgs;
}
)
.config
.public
// {inherit meta;};
in {
packages.x86_64-linux = {
2024-07-31 14:59:22 +05:00
materia-frontend-nodejs = dreamBuildPackage {
module = {
lib,
config,
dream2nix,
...
}: {
name = "materia-frontend";
2024-08-03 01:01:01 +05:00
version = "0.0.5";
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
2024-05-07 16:49:30 +05:00
mkDerivation = {
2024-07-31 14:59:22 +05:00
src = ./workspaces/frontend;
};
deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
fetchFromGitHub
stdenv
;
};
WIP-nodejs-builder-v3 = {
packageLockFile = "${config.mkDerivation.src}/package-lock.json";
};
};
meta = with nixpkgs.lib; {
2024-07-31 14:59:22 +05:00
description = "Materia frontend (nodejs)";
license = licenses.mit;
2024-07-25 13:33:05 +05:00
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = false;
};
};
2024-07-31 14:59:22 +05:00
materia-frontend = dreamBuildPackage {
extraArgs = {
2024-07-31 14:59:22 +05:00
inherit (self.packages.x86_64-linux) materia-frontend-nodejs;
};
module = {
config,
lib,
dream2nix,
2024-07-31 14:59:22 +05:00
materia-frontend-nodejs,
...
}: {
imports = [dream2nix.modules.dream2nix.WIP-python-pdm];
2024-08-03 01:01:01 +05:00
pdm.lockfile = ./workspaces/frontend/pdm.lock;
pdm.pyproject = ./workspaces/frontend/pyproject.toml;
deps = _: {
2024-08-03 01:01:01 +05:00
python = pkgs.python312;
};
mkDerivation = {
2024-07-31 14:59:22 +05:00
src = ./workspaces/frontend;
buildInputs = [
2024-08-03 01:01:01 +05:00
pkgs.python312.pkgs.pdm-backend
];
configurePhase = ''
2024-08-03 01:01:01 +05:00
cp -rv ${materia-frontend-nodejs}/dist ./src/materia_frontend/
'';
};
};
meta = with nixpkgs.lib; {
2024-07-31 14:59:22 +05:00
description = "Materia frontend";
license = licenses.mit;
2024-07-25 13:33:05 +05:00
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = false;
};
};
2024-08-03 01:01:01 +05:00
materia = dreamBuildPackage {
extraArgs = {
inherit (self.packages.x86_64-linux) materia-frontend;
};
module = {
config,
lib,
dream2nix,
materia-frontend,
...
}: {
imports = [dream2nix.modules.dream2nix.WIP-python-pdm];
2024-05-07 16:49:30 +05:00
2024-08-03 01:01:01 +05:00
pdm.lockfile = ./pdm.lock;
pdm.pyproject = ./pyproject.toml;
deps = _: {
2024-08-03 01:01:01 +05:00
python = pkgs.python312;
};
mkDerivation = {
2024-08-03 01:01:01 +05:00
src = ./.;
buildInputs = [
2024-08-03 01:01:01 +05:00
pkgs.python312.pkgs.pdm-backend
];
nativeBuildInputs = [
2024-08-03 01:01:01 +05:00
pkgs.python312.pkgs.wrapPython
];
propagatedBuildInputs = [
materia-frontend
];
};
};
meta = with nixpkgs.lib; {
description = "Materia";
license = licenses.mit;
2024-07-25 13:33:05 +05:00
maintainers = with bonLib.maintainers; [L-Nafaryus];
broken = false;
2024-08-03 01:01:01 +05:00
mainProgram = "materia";
};
};
2024-07-25 13:33:05 +05:00
postgresql-devel = bonfire.packages.x86_64-linux.postgresql;
2024-07-25 13:33:05 +05:00
redis-devel = bonfire.packages.x86_64-linux.redis;
};
devShells.x86_64-linux.default = pkgs.mkShell {
2024-08-03 01:01:01 +05:00
buildInputs = with pkgs; [postgresql redis pdm nodejs python312];
# greenlet requires libstdc++
LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [pkgs.stdenv.cc.cc];
};
};
2024-05-07 16:49:30 +05:00
}