Skip to content

Commit

Permalink
Add Nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Jun 17, 2024
1 parent 287259f commit b3725ea
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/tilesheets
ftb.json
*.exe
# nix build generates this
/result
88 changes: 88 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
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";
flake-utils.inputs.systems.follows = "systems";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.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 {
buildInputs = [ (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";
};
});
}

0 comments on commit b3725ea

Please sign in to comment.