Nix flake init

This commit is contained in:
[Assassin] committed 2025-08-04 18:27:11 +02:00
1 parent 492a384fe1
commit 8baaef762b
5 files changed
+85

No files matched your search

+1
View File
@@ -0,0 +1 @@
use flake
+4
View File
@@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# Nix atrifacts
/.direnv
**/result
# User-specific files
.idea/
*.rsuser
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1754214453,
"narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+33
View File
@@ -0,0 +1,33 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs, ... }: let
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs systems;
pkgsFor = system: import nixpkgs {
inherit system;
};
in {
devShells = forAllSystems (system: let
pkgs = pkgsFor system;
dotnet = pkgs.dotnetCorePackages.dotnet_8;
in {
default = pkgs.mkShell rec {
buildInputs = with pkgs; [
cmake opencv icu udev
dotnet.sdk dotnet.runtime
xorg.libX11 xorg.libSM xorg.libICE
libjpeg onnxruntime libGL fontconfig
(pkgs.callPackage ./nix/opencvsharp.nix {})
];
shellHook = ''
export DOTNET_ROOT="${dotnet.sdk}"
# Fuck knows why the runtime looks in PATH instead of LD_LIBRARY_PATH
export PATH="$PATH:${builtins.toString (pkgs.lib.makeLibraryPath buildInputs)}";
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${builtins.toString (pkgs.lib.makeLibraryPath buildInputs)}";
'';
};
});
};
}
+20
View File
@@ -0,0 +1,20 @@
{lib, stdenv, fetchFromGitHub, cmake, opencv}:
stdenv.mkDerivation rec {
name = "opencvsharp";
src = fetchFromGitHub {
owner = "shimat";
repo = "opencvsharp";
tag = "4.11.0.20250507";
hash = "sha256-CkG4Kx/AkZqyhtclMfS51a9a9R+hsqBRlM4fry32YJ0=";
};
buildInputs = [ opencv ];
nativeBuildInputs = [ cmake ];
sourceRoot = "${src.name}/src";
meta = with lib; {
license = licenses.asl20;
platforms = platforms.unix;
description = "OpenCV wrapper for .NET";
homepage = "https://github.com/shimat/opencvsharp";
};
}