monorepo/flake.nix

120 lines
3.9 KiB
Nix

{
description = "Lumenescent Dreams Tools";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
unstable.url = "nixpkgs/nixos-unstable";
typeshare.url = "github:1Password/typeshare";
};
outputs = { self, nixpkgs, unstable, typeshare, ... }:
let
version = builtins.string 0 8 self.lastModifiedDate;
supportedSystems = [ "x86_64-linux" ];
in
{
devShell."x86_64-linux" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
pkgs-unstable = import unstable { system = "x86_64-linux"; };
in
pkgs.mkShell {
name = "ld-tools-devshell";
buildInputs = [
pkgs.cargo-nextest
pkgs.clang
pkgs.crate2nix
pkgs.glib
pkgs.gst_all_1.gst-plugins-bad
pkgs.gst_all_1.gst-plugins-base
pkgs.gst_all_1.gst-plugins-good
pkgs.gst_all_1.gst-plugins-ugly
pkgs.gst_all_1.gstreamer
pkgs.gtk4
pkgs.libadwaita
pkgs.librsvg
pkgs.nodejs
pkgs.openssl
pkgs.pipewire
pkgs.pkg-config
pkgs.rustup
pkgs.sqlite
pkgs.cargo-nextest
pkgs.wasm-pack
pkgs.sqlx-cli
pkgs.udev
pkgs.wasm-pack
typeshare.packages."x86_64-linux".default
];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
ENV = "dev";
};
packages."x86_64-linux" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
gtkNativeInputs = [
pkgs.pkg-config
pkgs.gtk4
pkgs.libadwaita
pkgs.wrapGAppsHook4
];
cargoOverrides = pkgs: pkgs.buildRustCrate.override {
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
gobject-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
gio-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
gdk-pixbuf-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
libadwaita-sys = attrs: { nativeBuildInputs = gtkNativeInputs; };
dashboard = attrs: { nativeBuildInputs = gtkNativeInputs; };
fitnesstrax = import ./fitnesstrax/app/override.nix { gtkNativeInputs = gtkNativeInputs; };
kifu-gtk = import ./kifu/gtk/override.nix { gtkNativeInputs = gtkNativeInputs; };
xdg-test = import ./xdg-test/override.nix { wrapGAppsHook4 = pkgs.wrapGAppsHook4; };
};
};
cargo_nix = pkgs.callPackage ./Cargo.nix {
nixpkgs = nixpkgs;
buildRustCrateForPkgs = cargoOverrides;
};
in rec {
cyberpunk-splash = cargo_nix.workspaceMembers.cyberpunk-splash.build;
dashboard = cargo_nix.workspaceMembers.dashboard.build;
file-service = cargo_nix.workspaceMembers.file-service.build;
fitnesstrax = cargo_nix.workspaceMembers.fitnesstrax.build;
kifu-gtk = cargo_nix.workspaceMembers.kifu-gtk.build;
l10n = cargo_nix.workspaceMembers.l10n.build;
l10n-codegen-rust = pkgs.stdenv.mkDerivation {
name = "l10n-codegen-rust";
src = ./.;
buildInputs = [ l10n ];
installPhase = ''
mkdir -p $out/bin
cp ${l10n}/bin/codegen-rust $out/bin/l10n-codegen-rust
'';
};
xdg-test = cargo_nix.workspaceMembers.xdg-test.build;
all = pkgs.symlinkJoin {
name = "all";
paths = [
cyberpunk-splash
dashboard
file-service
fitnesstrax
# kifu-gtk
l10n
l10n-codegen-rust
xdg-test
];
};
default = all;
};
};
}