elnafo-radio/flake.nix
2024-09-26 01:03:54 +05:00

147 lines
3.4 KiB
Nix

{
description = "Elnafo";
nixConfig = {
extra-substituters = [
"https://cache.elnafo.ru"
"https://bonfire.cachix.org"
];
extra-trusted-public-keys = [
"cache.elnafo.ru:j3VD+Hn+is2Qk3lPXDSdPwHJQSatizk7V82iJ2RP1yo="
"bonfire.cachix.org-1:mzAGBy/Crdf8NhKail5ciK7ZrGRbPJJobW6TwFb7WYM="
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
crane = {
url = "github:ipetkov/crane";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.rust-analyzer-src.follows = "";
};
dream2nix = {
url = "github:nix-community/dream2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {self, ...} @ inputs: let
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
lib = pkgs.lib;
fenixPkgs = inputs.fenix.packages.x86_64-linux;
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain fenixPkgs.complete.toolchain;
dreamBuildPackage = {
module,
meta ? {},
extraModules ? [],
extraArgs ? {},
}:
(
inputs.nixpkgs.lib.evalModules {
modules = [module] ++ extraModules;
specialArgs =
{
inherit (inputs) dream2nix;
packageSets.nixpkgs = pkgs;
}
// extraArgs;
}
)
.config
.public
// {inherit meta;};
in {
packages.x86_64-linux = rec {
elnafo-radio-frontend = dreamBuildPackage {
module = {
lib,
config,
dream2nix,
...
}: {
name = "elnafo-radio-frontend";
version = "0.0.5";
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
mkDerivation = {
src = ./crates/frontend;
};
deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
fetchFromGitHub
stdenv
;
};
WIP-nodejs-builder-v3 = {
packageLockFile = "${config.mkDerivation.src}/package-lock.json";
};
};
meta = with lib; {
description = "Materia frontend (nodejs)";
license = licenses.mit;
broken = false;
};
};
elnafo-radio = let
common = {
pname = "elnafo-radio";
version = "0.1.0";
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type: (craneLib.filterCargoSources path type);
};
strictDeps = true;
#nativeBuildInputs = [pkgs.pkg-config];
#buildInputs = [pkgs.openssl];
};
cargoArtifacts = craneLib.buildDepsOnly common;
in
craneLib.buildPackage (common // {inherit cargoArtifacts;});
default = elnafo-radio;
};
checks.x86_64-linux = {
elnafo-radio-fmt = craneLib.cargoFmt {
src = craneLib.cleanCargoSource (craneLib.path ./.);
};
};
devShells.x86_64-linux = {
default = pkgs.mkShell {
buildInputs = [
fenixPkgs.complete.toolchain
pkgs.ripgrep
pkgs.postgresql
pkgs.diesel-cli
pkgs.cargo-watch
pkgs.mold-wrapped
pkgs.nodejs
pkgs.cargo-release
];
};
elnafo-radio = craneLib.devShell {
checks = self.checks.x86_64-linux;
packages = [];
};
};
};
}