diff --git a/.gitignore b/.gitignore index 8dd4bac..1e00fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /tilesheets ftb.json *.exe +# nix build generates this +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..335b472 --- /dev/null +++ b/flake.lock @@ -0,0 +1,88 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "systems": "systems" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718590793, + "narHash": "sha256-92OO8XrQTvdvDtRi0BAkjTaoZXW5ORuvqdk677wW7ko=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "5265b8a1e1d2e370e8b45b557326b691aec7d163", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7210732 --- /dev/null +++ b/flake.nix @@ -0,0 +1,53 @@ +{ + description = "Stuff for FTB wiki"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + rustVersion = pkgs.rust-bin.stable.latest.default; + in { + devShell = pkgs.mkShell { + packages = [ (rustVersion.override { extensions = [ "rust-src" ]; }) ]; + }; + + packages = { + ftb-rs = pkgs.rustPlatform.buildRustPackage rec { + pname = "ftb-rs"; + version = "0.1.0"; + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "mediawiki-0.0.1" = "sha256-iekGJXWT4n5ad4nlu27sNfuydL9quvEe4Bw327LgaBE="; + }; + }; + + buildInputs = [ ] ++ pkgs.lib.optional pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Foundation pkgs.darwin.apple_sdk.frameworks.Security ]; + }; + }; + + defaultPackage = self.packages.${system}.ftb-rs; + + apps.default = { + type = "app"; + program = "${self.packages.${system}.ftb-rs}/bin/ftb"; + }; + }); +}