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 4638ddd
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/tilesheets
ftb.json
*.exe
# nix-adjacent
result
.direnv/
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.

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
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=";
};
};

nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ]
++ pkgs.lib.optional pkgs.stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Foundation pkgs.darwin.apple_sdk.frameworks.Security ]
;
};
default = self.packages.${system}.ftb-rs;
};

apps.default = {
type = "app";
program = "${self.packages.${system}.ftb-rs}/bin/ftb";
};
});
}

0 comments on commit 4638ddd

Please sign in to comment.