Skip to content

Commit

Permalink
feat: add flake, precommit, editorconfig and etc
Browse files Browse the repository at this point in the history
  • Loading branch information
cathaysia committed Sep 8, 2023
1 parent b34ab56 commit df3aacb
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 21 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{json,yaml,yml}]
indent_size = 2

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: local
hooks:
- id: rustfmt
name: rustfmt
language: system
types_or: [rust]
entry: rustfmt

- repo: local
hooks:
- id: toml
name: toml
language: system
types_or: [rust]
entry: taplo format

- repo: local
hooks:
- id: clang-format
name: clang-format
language: system
types_or: [c, c++, cuda]
entry: clang-format -i --style=file
5 changes: 5 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[formatting]
align_entries = true
inline_table_expand = true
array_auto_collapse = false
array_auto_expand = false
31 changes: 13 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
[package]
name = "nix_vscode"
name = "nix4vscode"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0.188", features = ["derive", "alloc", "rc"] }
serde_json = "1.0.105"
toml = "0.7.6"
tokio = { version = "1.32.0", features = ["full"] }
log = "0.4.20"
tracing = "0.1.37"
serde = { version = "1.0.188", features = ["derive", "alloc", "rc"] }
serde_json = "1.0.105"
toml = "0.7.6"
tokio = { version = "1.32.0", features = ["full"] }
log = "0.4.20"
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "std"] }
semver = "1.0.18"
bitflags = { version = "2.4.0", features = ["serde", "std"] }
reqwest = { version = "0.11.20", default_features = false, features = [
"rustls-tls",
"gzip",
] }
minijinja = "1.0.7"
clap = { version = "4.4.2", features = ["derive"] }
futures = "0.3.28"
semver = "1.0.18"
bitflags = { version = "2.4.0", features = ["serde", "std"] }
reqwest = { version = "0.11.20", default_features = false, features = ["rustls-tls", "gzip"] }
minijinja = "1.0.7"
clap = { version = "4.4.2", features = ["derive"] }
futures = "0.3.28"
116 changes: 116 additions & 0 deletions flake.lock

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

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "Develop environment for nix4vscode";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
(import rust-overlay)
];
};

in
{
devShell = pkgs.mkShell {
buildInputs = [
pkgs.iconv
pkgs.taplo
(
pkgs.rust-bin.nightly."2023-07-28".default
)
];
shellHook = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.iconv.out}/lib
'';
};
});
}
15 changes: 15 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
edition = "2021"
hard_tabs = false
force_explicit_abi = true
max_width = 100
merge_derives = true
newline_style = "Auto"
remove_nested_parens = true
reorder_imports = true
reorder_modules = true
tab_spaces = 4
use_field_init_shorthand = true
use_small_heuristics = "Default"
use_try_shorthand = false
format_code_in_doc_comments = true
imports_granularity = "Crate"
1 change: 1 addition & 0 deletions src/jinja.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// empty
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use log::*;
use std::str::FromStr;
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::{fmt, util::SubscriberInitExt};
use tracing_subscriber::{
fmt, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, EnvFilter,
};

use futures::future::join_all;

Expand Down

0 comments on commit df3aacb

Please sign in to comment.