diff --git a/.gitignore b/.gitignore index 83edd24..d23641d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,21 @@ # Rust build artifacts /target/ -Cargo.lock +Cargo.toml.orig # IDE .vscode/ .idea/ +*.swp +*~ # Nix result +result-* .direnv/ + +# Flatpak +build-flatpak/ + +# System Files +.DS_Store +Thumbs.db diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..780d704 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "r_eom" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 3a7b7a8..a2aba04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "r_eom" description = "R_EoM library with a demo platform for testing and showcasing its features" version = "0.1.0" edition = "2021" +license = "CC-BY-SA-4.0" [lib] name = "r_eom" diff --git a/Makefile b/Makefile index efd5f56..5efbff2 100644 --- a/Makefile +++ b/Makefile @@ -17,3 +17,8 @@ clean: .PHONY: flatpak-build flatpak-build: flatpak-builder --force-clean build-flatpak flatpak/app.flatpak.json + +# Nix build target +.PHONY: nix-build +nix-build: + nix build .#default diff --git a/README.md b/README.md index 4cd8b2b..b43f1ce 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,30 @@ To run tests: cargo test ``` +### Nix + +This project provides Nix support via flakes and a traditional `default.nix`. + +To build the project using Nix: + +```bash +nix build +``` + +To run the demo platform using Nix: + +```bash +nix run +``` + +To enter a development shell: + +```bash +nix develop +``` + +(or `nix-shell` for non-flake users) + ### Flatpak To build the Flatpak: @@ -55,3 +79,7 @@ This project includes shared run configurations in the `.run` directory. When yo Additionally, the IDE automatically detects all targets defined in `Cargo.toml`. +## License + +This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License - see the [LICENSE](LICENSE) file for details. + diff --git a/default.nix b/default.nix index 9bfc4d3..486267c 100644 --- a/default.nix +++ b/default.nix @@ -1,29 +1,18 @@ -{ pkgs }: -let - lib = pkgs.lib; - templateName = builtins.baseNameOf (toString ./.); -in -{ - ${templateName} = pkgs.stdenvNoCC.mkDerivation { - pname = templateName; - version = "0.1.0"; - src = ./.; - dontBuild = true; - installPhase = '' - mkdir -p $out/share/${templateName} - if [ -d src ]; then - cp -r src $out/share/${templateName}/ - fi - for f in README.md project.toml flake.nix default.nix shell.nix Makefile .editorconfig .gitignore; do - if [ -f "$f" ]; then - cp "$f" $out/share/${templateName}/ - fi - done - ''; - meta = with lib; { - description = "Template project: ${templateName}"; - license = licenses.unfreeRedistributable; - platforms = platforms.all; - }; +{ pkgs ? import { } }: + +pkgs.rustPlatform.buildRustPackage { + pname = "r_eom"; + version = "0.1.0"; + + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + meta = with pkgs.lib; { + description = "R_EoM library with a demo platform for testing and showcasing its features"; + license = licenses.cc-by-sa-40; + platforms = platforms.all; }; } diff --git a/flake.nix b/flake.nix index b064c4a..abcdf68 100644 --- a/flake.nix +++ b/flake.nix @@ -126,13 +126,8 @@ packages = forEachSupportedSystem ( { pkgs }: { - # Build the skeletal Cargo project - default = pkgs.rustPlatform.buildRustPackage { - pname = "sample-rust-app"; - version = "0.1.0"; - src = ./.; - cargoLock.lockFile = ./Cargo.lock; - }; + # Build the r_eom package + default = pkgs.callPackage ./default.nix { }; devHelper = pkgs.writeShellScriptBin "dev-helper" '' echo "Rust toolchain available:" diff --git a/project.toml b/project.toml index c307b6d..7385615 100644 --- a/project.toml +++ b/project.toml @@ -3,4 +3,4 @@ name = "r_eom" description = "R_EoM library with a demo platform for testing and showcasing its features" version = "0.1.0" authors = ["gooba42 "] -license = "MIT" +license = "CC-BY-SA-4.0"