From 454f90f5cb54a7dfde6fa875a4a74184e8f57654 Mon Sep 17 00:00:00 2001 From: Spencer Brower <6729162+sbrow@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:33:11 -0400 Subject: [PATCH] build: Added thor as a nix package. --- flake.lock | 16 ---------------- flake.nix | 47 ++++++++++++++++++++++++++++++++++++++--------- main_test.odin | 10 ++++++++++ version.txt | 1 + 4 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 main_test.odin create mode 100644 version.txt diff --git a/flake.lock b/flake.lock index 5ab0b9e..d671efe 100644 --- a/flake.lock +++ b/flake.lock @@ -65,27 +65,11 @@ "type": "github" } }, - "process-compose-flake": { - "locked": { - "lastModified": 1782060835, - "narHash": "sha256-Q8HH2t1l3MITtWCWY4ytcH5F/Q7aAHo3Iq/QTMAKTe0=", - "owner": "Platonic-Systems", - "repo": "process-compose-flake", - "rev": "464ff6880737f063c3f0d3d2c7781fda9190868f", - "type": "github" - }, - "original": { - "owner": "Platonic-Systems", - "repo": "process-compose-flake", - "type": "github" - } - }, "root": { "inputs": { "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", - "process-compose-flake": "process-compose-flake", "treefmt-nix": "treefmt-nix" } }, diff --git a/flake.nix b/flake.nix index 635b707..0069e8d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; - process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; + # process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; }; @@ -16,7 +16,7 @@ , flake-parts , nixpkgs , nixpkgs-unstable - , process-compose-flake + # , process-compose-flake , treefmt-nix }: flake-parts.lib.mkFlake { inherit inputs; } { @@ -66,14 +66,43 @@ }; }; - /* - process-compose.default.settings.processes = { - web.command = "sudo ${pkgs.caddy}/bin/caddy run"; - mail.command = "${pkgs.mailhog}/bin/MailHog"; - php.command = "${php}/bin/php-fpm -F -y php-fpm.conf"; - redis.command = "${$pks.redis}/bin/redis-server"; + #process-compose.default.settings.processes = { }; + + packages.default = pkgs.stdenv.mkDerivation rec { + pname = "thor"; + version = nixpkgs.lib.trim (builtins.readFile ./version.txt); + src = ./.; + + nativeBuildInputs = [ + pkgs.odin + pkgs.pkg-config + ]; + + buildInputs = [ + pkgs.git + ]; + + doCheck = true; + checkPhase = '' + runHook preCheck + odin test . -all-packages + runHook postCheck + ''; + + buildPhase = '' + runHook preBuild + odin build . -o:speed -out:${pname}-keep + echo "Listing filles..." + ls . + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + install -Dm755 ${pname}-keep $out/bin/${pname} + runHook postInstall + ''; }; - */ devShells.default = pkgs.mkShell { diff --git a/main_test.odin b/main_test.odin new file mode 100644 index 0000000..b1c93b1 --- /dev/null +++ b/main_test.odin @@ -0,0 +1,10 @@ +#+test +package main + +import "core:testing" + +@(test) +test_true :: proc(t: ^testing.T) { + testing.expect(t, true) +} + diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.1.0