Compare commits
No commits in common. "868ae1ffef0256a388854a7e0e4a86e434bc0349" and "e9231986c3ea2185e8ea45bcdea33702c26b80e2" have entirely different histories.
868ae1ffef
...
e9231986c3
6 changed files with 23 additions and 211 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,3 @@
|
||||||
.direnv/
|
.direnv/
|
||||||
.idea/
|
.idea/
|
||||||
/target
|
/target
|
||||||
.rust-toolchain
|
|
||||||
.pre-commit-config.yaml
|
|
||||||
|
|
|
||||||
74
flake.lock
generated
74
flake.lock
generated
|
|
@ -1,31 +1,15 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1696426674,
|
|
||||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1726560853,
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -34,34 +18,13 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitignore": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"pre-commit-hooks",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1709087332,
|
|
||||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1753694789,
|
"lastModified": 1729413321,
|
||||||
"narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=",
|
"narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "dc9637876d0dcc8c9e5e22986b857632effeb727",
|
"rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -71,33 +34,10 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pre-commit-hooks": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1750779888,
|
|
||||||
"narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs"
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|
|
||||||
37
flake.nix
37
flake.nix
|
|
@ -2,38 +2,33 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
pre-commit-hooks = {
|
|
||||||
url = "github:cachix/git-hooks.nix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{ self
|
{ nixpkgs
|
||||||
, nixpkgs
|
|
||||||
, flake-utils
|
, flake-utils
|
||||||
, ...
|
, ...
|
||||||
}@inputs:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
# Place all toolchain components in a single directory for IntelliJ
|
|
||||||
rust-toolchain = pkgs.symlinkJoin {
|
|
||||||
name = "rust-toolchain";
|
|
||||||
paths = with pkgs; [
|
|
||||||
rustc
|
|
||||||
cargo
|
|
||||||
rustPlatform.rustcSrc
|
|
||||||
] ++ lib.optionals stdenv.isDarwin [
|
|
||||||
libiconv
|
|
||||||
];
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
checks = import ./nix/git-hooks.nix { inherit inputs pkgs; };
|
devShells.default = pkgs.mkShell {
|
||||||
devShells = import ./nix/shell.nix { inherit pkgs rust-toolchain self; };
|
name = "immich-tools";
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
buildInputs = with pkgs; [
|
||||||
|
cargo
|
||||||
|
cargo-machete
|
||||||
|
cargo-release
|
||||||
|
cargo-sort
|
||||||
|
openssl
|
||||||
|
pkg-config
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
libiconv
|
||||||
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
];
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
{ inputs, pkgs, ... }:
|
|
||||||
let
|
|
||||||
conventional-commit = pkgs.callPackage ./pkgs/conventional-pre-commit.nix { };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
pre-commit-check = inputs.pre-commit-hooks.lib.${pkgs.system}.run {
|
|
||||||
src = ./..;
|
|
||||||
hooks = {
|
|
||||||
# TOML
|
|
||||||
check-toml.enable = true;
|
|
||||||
|
|
||||||
# YAML
|
|
||||||
check-yaml.enable = true;
|
|
||||||
|
|
||||||
# Nix
|
|
||||||
deadnix.enable = true;
|
|
||||||
flake-checker.enable = true;
|
|
||||||
nixpkgs-fmt.enable = true;
|
|
||||||
statix.enable = true;
|
|
||||||
|
|
||||||
# Rust
|
|
||||||
clippy = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
denyWarnings = true;
|
|
||||||
};
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
openssl
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
};
|
|
||||||
rustfmt.enable = true;
|
|
||||||
cargo-check = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
pkg-config
|
|
||||||
openssl
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Git
|
|
||||||
no-commit-to-branch = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
branch = [ "main" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
conventional-commit = {
|
|
||||||
enable = true;
|
|
||||||
name = "conventional-commit";
|
|
||||||
description = "A pre-commit hook that checks commit messages for Conventional Commits formatting";
|
|
||||||
package = conventional-commit;
|
|
||||||
entry = "${conventional-commit}/bin/conventional-pre-commit";
|
|
||||||
args = [ "--strict" "feat" "fix" "chore" "revert" "style" "docs" "build" "refactor" "test" "ci" "perf" ];
|
|
||||||
stages = [ "commit-msg" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
rust.check.cargoDeps = pkgs.rustPlatform.importCargoLock {
|
|
||||||
lockFile = ../Cargo.lock;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
{ python3Packages, fetchPypi, ... }:
|
|
||||||
|
|
||||||
python3Packages.buildPythonApplication rec {
|
|
||||||
pname = "conventional_pre_commit";
|
|
||||||
version = "4.2.0";
|
|
||||||
|
|
||||||
src = fetchPypi {
|
|
||||||
inherit pname version;
|
|
||||||
hash = "sha256-a1ooZzOMWKHRTTAN5otWwXt8hAO7EiFV84Y5pCPSH/E=";
|
|
||||||
};
|
|
||||||
|
|
||||||
doCheck = false;
|
|
||||||
pyproject = true;
|
|
||||||
|
|
||||||
build-system = with python3Packages; [
|
|
||||||
setuptools
|
|
||||||
setuptools-scm
|
|
||||||
wheel
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
{ pkgs, rust-toolchain, self, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
name = "immich-tools";
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
cargo
|
|
||||||
cargo-edit
|
|
||||||
cargo-insta
|
|
||||||
cargo-machete
|
|
||||||
cargo-release
|
|
||||||
cargo-sort
|
|
||||||
git-cliff
|
|
||||||
openssl
|
|
||||||
pkg-config
|
|
||||||
rustc
|
|
||||||
rust-toolchain
|
|
||||||
] ++ lib.optionals stdenv.isDarwin [
|
|
||||||
libiconv
|
|
||||||
] ++ self.checks.${pkgs.system}.pre-commit-check.enabledPackages;
|
|
||||||
RUST_BACKTRACE = 1;
|
|
||||||
|
|
||||||
# Copy rust-toolchain to project directory for easy use in IntelliJ
|
|
||||||
shellHook = ''
|
|
||||||
if [ -L ./.rust-toolchain ] && [ "$(readlink ./.rust-toolchain)" = "${rust-toolchain}" ]; then
|
|
||||||
echo "Rust toolchain symlink is already correct."
|
|
||||||
else
|
|
||||||
rm -f ./.rust-toolchain
|
|
||||||
ln -s ${rust-toolchain} ./.rust-toolchain
|
|
||||||
echo "Rust toolchain symlink updated."
|
|
||||||
fi
|
|
||||||
|
|
||||||
${self.checks.${pkgs.system}.pre-commit-check.shellHook}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue