feat: initial commit

This commit is contained in:
Maurice Debray 2025-12-10 20:32:34 +01:00 committed by sinavir
commit 2ec883ff80
12 changed files with 610 additions and 0 deletions

47
shell/default.nix Normal file
View file

@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2025 Tom Hubrecht <tom.hubrecht@dgnum.eu>
# SPDX-FileCopyrightText: 2025 Maurice Debray <maurice@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
sprinkle,
pkgs,
lib,
mkShellNoCC,
lon,
cargo,
cargo-edit,
clippy,
rustc,
python3,
}:
let
git-hooks = import ./git-hooks.nix { inherit pkgs sprinkle; };
nix-reuse = import ./nix-reuse.nix { inherit sprinkle; };
in
mkShellNoCC {
name = "phoenix";
packages = [
lon
cargo
cargo-edit
clippy
rustc
(python3.withPackages (ps: [
ps.requests
ps.black
]))
]
++ git-hooks.enabledPackages;
shellHook = lib.concatMapStringsSep "\n" (lib.getAttr "shellHook") [
git-hooks
nix-reuse
];
}

32
shell/git-hooks.nix Normal file
View file

@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2025 Tom Hubrecht <tom.hubrecht@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ sprinkle, pkgs }:
let
inherit (sprinkle.input.nixpkgs.lib) genAttrs recursiveUpdate getExe;
in
sprinkle.input.git-hooks.run {
inherit (sprinkle.output) src;
default_stages = [
"pre-commit"
"pre-push"
];
hooks = {
black.enable = true;
isort.enable = true;
ruff.enable = true;
commitizen.enable = true;
nixfmt-rfc-style.enable = true;
reuse = sprinkle.input.nix-reuse.output.gitHook { };
# Rust
cargo-check.enable = true;
rustfmt.enable = true;
};
}

33
shell/nix-reuse.nix Normal file
View file

@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2025 Maurice Debray <maurice@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{
sprinkle,
}:
sprinkle.input.nix-reuse.output.run {
defaultLicense = "EUPL-1.2";
defaultCopyright = "La Délégation Générale Numérique <contact@dgnum.eu>";
downloadLicenses = true;
generatedPaths = [
"**/.envrc"
"**/Cargo.lock"
"**/_hardware-configuration.nix"
".gitignore"
"REUSE.toml"
"shell.nix"
"**/lon.lock"
"**/lon.nix"
];
annotations = [
#{
# path = [ ];
# copyright = [
# "2024 Maurice Debray <maurice.debray@dgnum.eu>"
# ];
#}
];
}