Skip to content

Commit 0c08ecb

Browse files
committed
Use naersk, add pre-commit hook
1 parent 095aa06 commit 0c08ecb

File tree

4 files changed

+41
-39
lines changed

4 files changed

+41
-39
lines changed

flake.lock

Lines changed: 22 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
description = "A gemini browser";
33
inputs = {
44
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
5+
naersk.url = "github:nix-community/naersk";
56
};
6-
outputs = { self, nixpkgs, microvm }:
7+
outputs = { self, nixpkgs, naersk }:
78
with import nixpkgs { system = "x86_64-linux"; };
89
rec {
910
packages.x86_64-linux.blueprint-compiler = callPackage ./nix/blueprint-compiler.nix { };
10-
packages.x86_64-linux.geopard = callPackage ./nix/geopard.nix { blueprint-compiler = packages.x86_64-linux.blueprint-compiler; };
11+
packages.x86_64-linux.geopard = callPackage ./nix/geopard.nix {
12+
naersk-lib = naersk.lib.x86_64-linux;
13+
blueprint-compiler = packages.x86_64-linux.blueprint-compiler;
14+
};
1115
packages.x86_64-linux.build-flatpak = callPackage ./nix/build-flatpak.nix { };
1216
packages.x86_64-linux.default = packages.x86_64-linux.geopard;
1317
};

hooks/pre-commit.hook

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/env sh
2+
#
3+
# An example hook script to verify what is about to be committed.
4+
# Called by "git commit" with no arguments. The hook should
5+
# exit with non-zero status after issuing an appropriate message if
6+
# it wants to stop the commit.
7+
8+
cargo fmt --check
9+
cargo clippy

nix/geopard.nix

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,31 @@
1919
, blueprint-compiler
2020
, gobject-introspection
2121
, appstream-glib
22+
, naersk-lib
23+
, clippy
2224
}:
2325

24-
stdenv.mkDerivation rec {
26+
naersk-lib.buildPackage rec {
2527
pname = "geopard";
2628
version = "1.0.1";
2729

2830
src = ../.;
2931

30-
cargoDeps = rustPlatform.fetchCargoTarball {
31-
inherit src;
32-
name = "${pname}-${version}";
33-
hash = "sha256-gqScVEkf/rw1W7Z4M5k1rr9VwOFuLKIUWxmjqxc1x00=";
34-
};
35-
3632
nativeBuildInputs = [
3733
openssl
3834
gettext
3935
glib # for glib-compile-schemas
4036
meson
4137
ninja
4238
pkg-config
43-
rustPlatform.rust.cargo
44-
rustPlatform.cargoSetupHook
45-
rustPlatform.rust.rustc
4639
wrapGAppsHook4
4740
cmake
4841
blueprint-compiler
4942
desktop-file-utils
5043
appstream-glib
5144
blueprint-compiler
5245
rustfmt
46+
clippy
5347
];
5448

5549
buildInputs = [
@@ -61,7 +55,6 @@ stdenv.mkDerivation rec {
6155
openssl
6256
];
6357
checkPhase = ''
64-
cargo fmt --check
6558
'';
6659
doCheck = true;
6760
meta = with lib; {

0 commit comments

Comments
 (0)