Skip to content

Commit

Permalink
Add Nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Aug 14, 2024
1 parent 287259f commit 08db131
Show file tree
Hide file tree
Showing 4 changed files with 143 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/
85 changes: 85 additions & 0 deletions flake.lock

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

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

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 08db131

Please sign in to comment.