Skip to content

Commit

Permalink
nix
Browse files Browse the repository at this point in the history
  • Loading branch information
mekanoe committed Feb 17, 2024
1 parent 96cb2c8 commit 7ab5893
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
use nix
use flake . --accept-flake-config;

source .envrc-local
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/target
.DS_Store
*/.DS_Store
.envrc-local
.envrc-local
/.vscode
/.direnv
/result
54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
description = "PlanetSide 2 Metagame Harvesting Service";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
];

extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};

outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { config, self', pkgs, lib, system, ... }: let
fenix = inputs.fenix.packages.${system}.minimal;
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);

buildDeps = [
pkgs.openssl
];

devDeps = [
fenix.toolchain
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
in {
packages.default = (pkgs.makeRustPlatform {
cargo = fenix.toolchain;
rustc = fenix.toolchain;
}).buildRustPackage {
inherit (cargoToml.package) name version;
cargoLock.lockFile = ./Cargo.lock;
src = ./.;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = buildDeps ++ devDeps;
};

devShells.default = pkgs.mkShell {
nativeBuildInputs = buildDeps ++ devDeps;
};
};
};
}
12 changes: 0 additions & 12 deletions shell.nix

This file was deleted.

0 comments on commit 7ab5893

Please sign in to comment.