Initial Commit

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2025-06-29 10:17:54 +02:00
commit 37a4e87986
10 changed files with 405 additions and 0 deletions

25
.changelogs/template.md Normal file
View file

@ -0,0 +1,25 @@
# CHANGELOG
<!-- generated from cargo-changelog -->
{{#if this.versions}}
{{#each (reverse (sort_versions this.versions))}}
## v{{this.version}}
{{#each (group_by_header this.entries "target" default="Other Changes")}}
### {{ @key }}
{{#each this ~}}
* {{~ #if this.header.issue }} (#{{this.header.issue}}){{/if}}{{~ #if this.header.type }} \[{{this.header.type}}\]{{/if}} {{this.header.subject}}
{{indent this.text spaces=2}}
{{/each ~}}
{{~ /each ~}}
{{~ /each ~}}
{{/if}}
{{#if this.suffix}}
{{this.suffix}}
{{/if}}

View file

View file

@ -0,0 +1,4 @@
+++
subject = "Start initial repository"
+++

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Rust/Cargo
/target
# Direnv
/.direnv
# Nix
/result*

127
changelog.toml Normal file
View file

@ -0,0 +1,127 @@
# Configuration for cargo-changelog
#
# unimplemented
#
add_version_date = true
#
# The directory where the changelog fragments and other data will be stored.
# Relative to repository root.
#
fragment_dir = ".changelogs"
#
# The path to the template file, relative to `fragment_dir`
#
template_path = "template.md"
#
# Whether to edit the header data when opening $EDITOR for a new changelog
# fragment
#
edit_data = true
#
# The format to edit the header with.
# Possible values: "toml"
#
# Right now, only "toml" is supported
#
edit_format = "toml"
# Set whether and how to use git after creating a new entry
#
# Possible values are "add" or "commit" (or none, which is default).
#
# "add" means only git-add the newly created file
# "commit" means commit the newly created file as well, with a default message
#
# Not enabling this setting means that no action will be taken
#git = "commit"
# The commit message to use if `git = "commit"` is set.
#
# Can also be set if `git = "add"` is configured, because the CLI might override this
# setting.
#git_commit_message = "Create new changelog entry"
# Use the --signoff flag when calling "git-commit"
# Defaults to false, because we cannot decide whether you want to signoff
git_commit_signoff = false
#
# The header fields that each fragment can have
#
# Format:
#
# ```
# <header field name> = { type = "<type>", required = <bool>, default_value = <data> }
# ```
#
# The `default_value` key is optional.
# Possible values for `type` are "bool", "int", "string", "list", "map"
# Possible values for `data` are "bool", "int", "string", "list", "map"
#
[header_fields]
# Require a "subject" in the header.
# The text serves as a more detailed explanation
subject = { type = "string", required = true }
# A header field named "issue"
[header_fields.issue]
# which is of type "integer"
type = "int"
# default value for the field, optional
#default = 123
# and is not required
required = false
# crawler, which will be used to auto-fill the field
# containing "type" of the "value", either "path" or "command"
# and a "value" field which is either
# - the path to the script (from the repository root)
# - a commandline call
#
# The following environment variables are set for both types of crawler:
# - "CARGO_CHANGELOG_CRAWLER_FIELD_NAME"
# The name of the field which gets crawled right now
# - "CARGO_CHANGELOG_CRAWLER_FIELD_TYPE"
# Possible values: one of "bool", "int", "string", "list<{}>" where '{}' is
# again one of the former.
# The list is expected to be a comma seperated list
#
# Usecase:
#
# This field could for example be used to fetch a git commit hash from the
# repository.
# If we have a header field named "relevant_commit", which is used in the
# template to refer to a commit in the repository that was created in relation
# to the changelog entry we're currently crafting, the script for fetching
# that metadata could be something like
#
# ```bash
# #!/usr/bin/env bash
# fzfargs='--ansi --no-sort --reverse --preview'
# git log --format='%H - %s' | \
# fzf $fzfargs 'git show --color=always $(echo {} | cut -d " " -f 1)' | \
# sed 's/ -.*//'
# ```
#
# to interactively fetch a git hash from the repository history.
#
#[header_fields.issue.crawler]
#type = "path"
#value = "scripts/fetch_issue_number.sh"
#value = "some command to execute with arguments"
# A header field named "type"
# With three possible values: "Bugfix", "Feature" or "Misc"
# which is optional
[header_fields.type]
type = [ "Bugfix", "Feature", "Misc" ]
required = false

127
flake.lock generated Normal file
View file

@ -0,0 +1,127 @@
{
"nodes": {
"cargo-changelog": {
"inputs": {
"crane": [
"crane"
],
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": [
"rust-overlay"
]
},
"locked": {
"lastModified": 1750052036,
"narHash": "sha256-FkvhPmXCfvsmu7atlzZ6b7CTVDwJieeHHQgWKiVt06U=",
"owner": "matthiasbeyer",
"repo": "cargo-changelog",
"rev": "9a5ffab5603d5d00459f90adc1fca2bacb5bb9b1",
"type": "github"
},
"original": {
"owner": "matthiasbeyer",
"repo": "cargo-changelog",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1750266157,
"narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=",
"owner": "ipetkov",
"repo": "crane",
"rev": "e37c943371b73ed87faf33f7583860f81f1d5a48",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750994206,
"narHash": "sha256-3u6rEbIX9CN/5A5/mc3u0wIO1geZ0EhjvPBXmRDHqWM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "80d50fc87924c2a0d346372d242c27973cf8cdbf",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"cargo-changelog": "cargo-changelog",
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1751165203,
"narHash": "sha256-3QhlpAk2yn+ExwvRLtaixWsVW1q3OX3KXXe0l8VMLl4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "90f547b90e73d3c6025e66c5b742d6db51c418c3",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

108
flake.nix Normal file
View file

@ -0,0 +1,108 @@
{
description = "library";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
};
crane = {
url = "github:ipetkov/crane";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
cargo-changelog = {
url = "github:matthiasbeyer/cargo-changelog";
inputs = {
nixpkgs.follows = "nixpkgs";
crane.follows = "crane";
flake-utils.follows = "flake-utils";
rust-overlay.follows = "rust-overlay";
};
};
};
outputs =
inputs:
inputs.flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
};
rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
unstableRustTarget = pkgs.rust-bin.selectLatestNightlyWith (
toolchain:
toolchain.default.override {
extensions = [
"rust-src"
"miri"
"rustfmt"
];
}
);
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustTarget;
unstableCraneLib = (inputs.crane.mkLib pkgs).overrideToolchain unstableRustTarget;
tomlInfo = craneLib.crateNameFromCargoToml { cargoToml = ./Cargo.toml; };
inherit (tomlInfo) version;
src = ./.;
rustfmt' = pkgs.writeShellScriptBin "rustfmt" ''
exec "${unstableRustTarget}/bin/rustfmt" "$@"
'';
cargoArtifacts = craneLib.buildDepsOnly {
inherit src;
cargoExtraArgs = "--all-features --all";
};
crate = craneLib.buildPackage {
inherit cargoArtifacts src version;
cargoExtraArgs = "--all-features --all";
};
in
rec {
checks = {
inherit crate;
crate-clippy = craneLib.cargoClippy {
inherit cargoArtifacts src;
cargoExtraArgs = "--all --all-features";
cargoClippyExtraArgs = "-- --deny warnings";
};
crate-fmt = unstableCraneLib.cargoFmt {
inherit src;
};
};
packages.crate = crate;
packages.default = packages.crate;
apps.crate = inputs.flake-utils.lib.mkApp {
name = "library";
drv = crate;
};
apps.default = apps.crate;
devShells.default = devShells.crate;
devShells.crate = pkgs.mkShell {
buildInputs = [ ];
nativeBuildInputs = [
rustfmt'
rustTarget
inputs.cargo-changelog.packages.${system}.default
];
};
}
);
}

2
rust-toolchain.toml Normal file
View file

@ -0,0 +1,2 @@
[toolchain]
channel = "1.88.0"

3
rustfmt.toml Normal file
View file

@ -0,0 +1,3 @@
imports_granularity = "Item"
reorder_imports = true
group_imports = "StdExternalCrate"