?
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
if [[ ! -d "/Users/andrew/personal/Projects/C/image_processor" ]]; then
|
|
||||||
echo "Cannot find source directory; Did you move it?"
|
|
||||||
echo "(Looking for "/Users/andrew/personal/Projects/C/image_processor")"
|
|
||||||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# rebuild the cache forcefully
|
|
||||||
_nix_direnv_force_reload=1 direnv exec "/Users/andrew/personal/Projects/C/image_processor" true
|
|
||||||
|
|
||||||
# Update the mtime for .envrc.
|
|
||||||
# This will cause direnv to reload again - but without re-building.
|
|
||||||
touch "/Users/andrew/personal/Projects/C/image_processor/.envrc"
|
|
||||||
|
|
||||||
# Also update the timestamp of whatever profile_rc we have.
|
|
||||||
# This makes sure that we know we are up to date.
|
|
||||||
touch -r "/Users/andrew/personal/Projects/C/image_processor/.envrc" "/Users/andrew/personal/Projects/C/image_processor/.direnv"/*.rc
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/nix/store/yy3zc65ij95wfnap3zqcr44kc4wzwlbq-nix-shell-env
|
|
||||||
Vendored
BIN
Binary file not shown.
Generated
-27
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1774273680,
|
|
||||||
"narHash": "sha256-a++tZ1RQsDb1I0NHrFwdGuRlR5TORvCEUksM459wKUA=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "fdc7b8f7b30fdbedec91b71ed82f36e1637483ed",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
@@ -1,60 +1,45 @@
|
|||||||
{
|
{
|
||||||
description = "Image Processor API";
|
description = "A C library with a clean API";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
# Ghostty uses 'systems' to be cleaner, we can do similar or stick to a list
|
|
||||||
};
|
|
||||||
|
|
||||||
# This mirrors the Ghostty 'nixConfig' to ensure settings stay local to the project
|
|
||||||
nixConfig = {
|
|
||||||
extra-substituters = ["https://cache.nixos.org"];
|
|
||||||
extra-trusted-public-keys = ["cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
}: let
|
}: let
|
||||||
supportedSystems = ["aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux"];
|
# Support for multiple systems (Linux and macOS)
|
||||||
# A helper to generate outputs for all systems
|
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs {inherit system;}));
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
|
pkgsFor = system: import nixpkgs {inherit system;};
|
||||||
|
in {
|
||||||
|
# This is the actual library package
|
||||||
|
packages = forAllSystems (system: let
|
||||||
|
pkgs = pkgsFor system;
|
||||||
in {
|
in {
|
||||||
# 1. THE PACKAGE (What you 'pull' into other projects)
|
|
||||||
packages = forAllSystems (pkgs: {
|
|
||||||
default = pkgs.stdenv.mkDerivation {
|
default = pkgs.stdenv.mkDerivation {
|
||||||
pname = "image_processor";
|
pname = "my-c-api";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [pkgs.cmake pkgs.pkg-config];
|
# Add dependencies here
|
||||||
buildInputs = [pkgs.libjpeg_turbo];
|
buildInputs = [];
|
||||||
|
nativeBuildInputs = [pkgs.pkg-config];
|
||||||
|
|
||||||
# Ensure headers are found in the dev environment
|
# Nix expects a standard 'make install' by default.
|
||||||
propagatedBuildInputs = [pkgs.libjpeg_turbo];
|
# Ensure your Makefile handles $(DESTDIR)$(PREFIX) correctly.
|
||||||
|
installFlags = ["PREFIX=$(out)"];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
# 2. THE DEV SHELL (What 'direnv' uses)
|
# This provides 'nix develop' for you to work on the API itself
|
||||||
devShells = forAllSystems (pkgs: {
|
devShells = forAllSystems (system: let
|
||||||
|
pkgs = pkgsFor system;
|
||||||
|
in {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
# Use 'inputsFrom' so the shell always matches the package
|
inputsFrom = [self.packages.${system}.default];
|
||||||
inputsFrom = [self.packages.${pkgs.system}.default];
|
packages = with pkgs; [gdb valgrind clang-tools];
|
||||||
|
|
||||||
# Add extra dev tools you only want when coding, not building
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
gdb
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
# These exports make sure your C compiler finds the Nix-provided libs
|
|
||||||
export CPATH="${pkgs.libjpeg_turbo.dev}/include:$CPATH"
|
|
||||||
export LIBRARY_PATH="${pkgs.libjpeg_turbo.out}/lib:$LIBRARY_PATH"
|
|
||||||
export PKG_CONFIG_PATH="${pkgs.libjpeg_turbo.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
||||||
|
|
||||||
echo "⚙️ Image Processor API Dev Shell Loaded"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
{pkgs ? import <nixpkgs> {}}:
|
|
||||||
pkgs.mkShell {
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
cmake
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
libjpeg_turbo
|
|
||||||
];
|
|
||||||
# This tells pkg-config where the Nix libraries are automatically
|
|
||||||
shellHook = ''
|
|
||||||
echo "Image Processor Dev Environment Loaded"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user