Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
.direnv/
target/
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
35 changes: 35 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ pkgs ? import <nixpkgs> { }
, stdenv ? pkgs.stdenv
, lib ? stdenv.lib
# A set providing `buildRustPackage :: attrsets -> derivation`
, rustPlatform ? pkgs.rustPlatform
, fetchFromGitHub ? pkgs.fetchFromGitHub
, gitignoreSrc ? null
}:

let
gitignoreSource =
if gitignoreSrc != null
then gitignoreSrc.gitignoreSource
else (import (fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "c4662e662462e7bf3c2a968483478a665d00e717";
sha256 = "0jx2x49p438ap6psy8513mc1nnpinmhm8ps0a4ngfms9jmvwrlbi";
}) { inherit lib; }).gitignoreSource;
in
rustPlatform.buildRustPackage rec {
pname = "git-utils";
version = "0.1.0";

src = gitignoreSource ./.;

nativeBuildInputs = [ pkgconfig ];
cargoSha256 = "sha256-0hfmV4mbr3l86m0X7EMYTOu/b+BjueVEbbyQz0KgOFY=";

meta = with stdenv.lib; {
homepage = "";
description = "Personal git utilities";
license = licenses.mit;
};
}
169 changes: 169 additions & 0 deletions flake.lock

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

28 changes: 28 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
description = "git-utils flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # We want to use packages from the binary cache
flake-utils.url = "github:numtide/flake-utils";
gitignore = { url = "github:hercules-ci/gitignore.nix"; flake = false; };
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};

outputs = inputs@{ self, nixpkgs, flake-utils, pre-commit-hooks, ... }:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gitignoreSrc = pkgs.callPackage inputs.gitignore { };
in rec {
packages.app = pkgs.callPackage ./default.nix { inherit gitignoreSrc; };

legacyPackages = packages;

defaultPackage = packages.app;

devShells.default = pkgs.callPackage ./shell.nix {
inherit pre-commit-hooks;
};
})
);
}
34 changes: 34 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ pkgs, pre-commit-hooks }:
let
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
# cargo-check = {
# enable = true;
# name = "cargo-check";
# description = "Check project";
# files = "\.rs$";
# entry = "${pkgs.cargo}/bin/cargo check --all";
# require_serial = true;
# pass_filenames = false;
# };
rustfmt.enable = true;
# clippy.enable = true;
};
};
in
pkgs.mkShell {
inherit (pre-commit-check) shellHook;

CARGO_INSTALL_ROOT = "${toString ./.}/.cargo";

packages = [
pkgs.cargo
pkgs.clippy
pkgs.deno
pkgs.ollama
pkgs.overmind
pkgs.rustc
pkgs.rustfmt
];
}