Initial open source release with CC BY-NC-SA 4.0 license
- Add complete CC BY-NC-SA 4.0 International License - Add comprehensive README with project description and usage - Add CONTRIBUTING guidelines for developers - Add Nix development environment with OpenSCAD tooling - Add .gitignore for OpenSCAD and Nix projects - Add copyright headers to source files
This commit is contained in:
commit
31bfdb83bb
6 changed files with 451 additions and 0 deletions
113
flake.nix
Normal file
113
flake.nix
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
description = "Cuatro - 3D Printable Game Pieces";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
openscad
|
||||
# For viewing and editing STL files
|
||||
meshlab
|
||||
# For version control
|
||||
git
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Cuatro Development Environment"
|
||||
echo "Available tools:"
|
||||
echo " openscad - OpenSCAD for 3D modeling"
|
||||
echo " meshlab - 3D mesh viewer/editor"
|
||||
echo ""
|
||||
echo "To generate STL files:"
|
||||
echo " openscad -o output.stl parts.scad"
|
||||
echo ""
|
||||
echo "To open the design in OpenSCAD GUI:"
|
||||
echo " openscad parts.scad"
|
||||
'';
|
||||
};
|
||||
|
||||
packages.default = pkgs.stdenv.mkDerivation {
|
||||
pname = "cuatro";
|
||||
version = "1.0.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ pkgs.openscad ];
|
||||
|
||||
buildPhase = ''
|
||||
# Generate STL files for all piece types
|
||||
mkdir -p $out/stl
|
||||
|
||||
# Create individual STL files for each piece type
|
||||
openscad -D 'tube_holes(row=1, fn=360);' -o $out/stl/tube-holes.stl parts.scad
|
||||
openscad -D 'tubes(row=1);' -o $out/stl/tubes.stl parts.scad
|
||||
openscad -D 'boxes(row=1);' -o $out/stl/boxes.stl parts.scad
|
||||
openscad -D 'box_holes(row=1);' -o $out/stl/box-holes.stl parts.scad
|
||||
|
||||
# Create combined file
|
||||
openscad -o $out/stl/all-pieces.stl parts.scad
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/cuatro
|
||||
cp -r . $out/share/cuatro/
|
||||
|
||||
# Create a script for easy STL generation
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/cuatro-generate << 'EOF'
|
||||
#!/bin/sh
|
||||
OUTPUT_DIR="''${1:-./stl}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
echo "Generating Cuatro STL files to $OUTPUT_DIR"
|
||||
|
||||
openscad -D 'tube_holes(row=1, fn=360);' -o "$OUTPUT_DIR/tube-holes.stl" ${placeholder "out"}/share/cuatro/parts.scad
|
||||
openscad -D 'tubes(row=1);' -o "$OUTPUT_DIR/tubes.stl" ${placeholder "out"}/share/cuatro/parts.scad
|
||||
openscad -D 'boxes(row=1);' -o "$OUTPUT_DIR/boxes.stl" ${placeholder "out"}/share/cuatro/parts.scad
|
||||
openscad -D 'box_holes(row=1);' -o "$OUTPUT_DIR/box-holes.stl" ${placeholder "out"}/share/cuatro/parts.scad
|
||||
openscad -o "$OUTPUT_DIR/all-pieces.stl" ${placeholder "out"}/share/cuatro/parts.scad
|
||||
|
||||
echo "STL files generated successfully!"
|
||||
EOF
|
||||
chmod +x $out/bin/cuatro-generate
|
||||
'';
|
||||
};
|
||||
|
||||
checks = {
|
||||
openscad-syntax = pkgs.runCommand "cuatro-syntax-check" {
|
||||
buildInputs = [ pkgs.openscad ];
|
||||
} ''
|
||||
# Check OpenSCAD syntax
|
||||
openscad --check ${self}/parts.scad
|
||||
touch $out
|
||||
'';
|
||||
|
||||
stl-generation = pkgs.runCommand "cuatro-stl-test" {
|
||||
buildInputs = [ pkgs.openscad ];
|
||||
} ''
|
||||
mkdir -p test-output
|
||||
|
||||
# Test STL generation
|
||||
openscad -o test-output/test.stl ${self}/parts.scad
|
||||
|
||||
# Verify STL file was created and is not empty
|
||||
if [ ! -s test-output/test.stl ]; then
|
||||
echo "Error: STL file was not generated or is empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "STL generation test passed"
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue