medit/flake.nix

48 lines
1.4 KiB
Nix
Raw Normal View History

2022-08-16 01:42:40 +00:00
{
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";
2022-08-16 03:28:39 +00:00
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
2022-08-16 01:42:40 +00:00
};
2022-08-16 03:28:39 +00:00
outputs = { self, flake-parts, nixpkgs, naersk, rust }:
let
overlays = [ rust.overlays.default ];
in
2022-08-16 01:42:40 +00:00
flake-parts.lib.mkFlake { inherit self; } {
imports = [{
config.perSystem = { system, ... }: {
2022-08-16 03:28:39 +00:00
config._module.args.pkgs = import nixpkgs { inherit system overlays; };
2022-08-16 01:42:40 +00:00
};
}];
2022-08-16 03:28:39 +00:00
systems = nixpkgs.lib.systems.flakeExposed;
perSystem = { config, self', inputs', pkgs, system, ... }:
let
2022-08-19 02:49:54 +00:00
toolchain = pkgs.rust-bin.stable.latest.complete;
2022-08-16 03:28:39 +00:00
naersk-lib = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
2022-08-19 02:49:54 +00:00
deps = with pkgs; [ SDL2 SDL2_gfx SDL2_ttf ];
2022-08-16 03:28:39 +00:00
in
{
packages.default = naersk-lib.buildPackage {
src = ./.;
2022-08-19 02:49:54 +00:00
buildInputs = deps;
2022-08-16 03:28:39 +00:00
};
apps.default.program = "${config.packages.default}/bin/medit";
devShells.default = pkgs.mkShell {
2022-08-19 02:49:54 +00:00
nativeBuildInputs = [ toolchain ] ++ deps;
2022-08-16 03:28:39 +00:00
};
};
2022-08-16 01:42:40 +00:00
};
}