Initial Commit

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2025-12-29 07:52:15 +01:00
commit 5260a9ee91
6 changed files with 208 additions and 0 deletions

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*

97
flake.lock generated Normal file
View file

@ -0,0 +1,97 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1766774972,
"narHash": "sha256-8qxEFpj4dVmIuPn9j9z6NTbU+hrcGjBOvaxTzre5HmM=",
"owner": "ipetkov",
"repo": "crane",
"rev": "01bc1d404a51a0a07e9d8759cd50a7903e218c82",
"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": 1766736597,
"narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-25.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1766976750,
"narHash": "sha256-w+o3AIBI56tzfMJRqRXg9tSXnpQRN5hAT15o2t9rxYw=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "9fe44e7f05b734a64a01f92fc51ad064fb0a884f",
"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
}

97
flake.nix Normal file
View file

@ -0,0 +1,97 @@
{
description = "nixie-ci project";
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.11";
flake-utils = {
url = "github:numtide/flake-utils";
};
crane = {
url = "github:ipetkov/crane";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
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
];
};
}
);
}

2
rust-toolchain.toml Normal file
View file

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

3
rustfmt.toml Normal file
View file

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