medit/flake.nix

48 lines
1.4 KiB
Nix

{
description = "Description for the project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
rust.url = "github:oxalica/rust-overlay";
rust.inputs.nixpkgs.follows = "nixpkgs";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-parts, nixpkgs, naersk, rust }:
let
overlays = [ rust.overlays.default ];
in
flake-parts.lib.mkFlake { inherit self; } {
imports = [{
config.perSystem = { system, ... }: {
config._module.args.pkgs = import nixpkgs { inherit system overlays; };
};
}];
systems = nixpkgs.lib.systems.flakeExposed;
perSystem = { config, self', inputs', pkgs, system, ... }:
let
toolchain = pkgs.rust-bin.stable.latest.complete;
naersk-lib = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
deps = with pkgs; [ SDL2 SDL2_gfx SDL2_ttf ];
in
{
packages.default = naersk-lib.buildPackage {
src = ./.;
buildInputs = deps;
};
apps.default.program = "${config.packages.default}/bin/medit";
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ toolchain ] ++ deps;
};
};
};
}