Skip to content

Commit

Permalink
use crane
Browse files Browse the repository at this point in the history
  • Loading branch information
benjajaja committed Dec 24, 2024
1 parent 4875e4f commit 00add9f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
- name: Build Flake
run: |
nix flake show
nix build .#defaultPackage --print-build-logs
nix build . --print-build-logs
nix flake check --print-build-logs
59 changes: 20 additions & 39 deletions flake.lock

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

65 changes: 16 additions & 49 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,59 +1,26 @@
{
description = "mdfried";
nixConfig.bash-prompt = "\[mdfried\]$ ";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
in
with pkgs;
{
packages.defaultPackage = rustPlatform.buildRustPackage {
pname = "mdfried";
version = self.shortRev or self.dirtyShortRev;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [
cmake
file
freetype
pkg-config
];
buildInputs = [
freetype
expat
rust-bin.stable.latest.default
];
doCheck = true;
};

checks = {
test = self.packages.${system}.defaultPackage;
};
{
packages.default = craneLib.buildPackage {
src = craneLib.cleanCargoSource ./.;

devShells.default = mkShell {
nativeBuildInputs = [
cmake
file
freetype
expat
pkg-config
];
buildInputs = [
rust-bin.stable.latest.default
clippy
cargo-tarpaulin
cargo-watch
cargo-release
];
};
});
# Add extra inputs here or any other derivation settings
doCheck = true;
nativeBuildInputs = with pkgs; [
cmake pkg-config freetype expat fontconfig
];
buildInputs = with pkgs; [];
};
});
}

0 comments on commit 00add9f

Please # to comment.