aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-15 09:55:20 +0900
committernsfisis <nsfisis@gmail.com>2026-08-15 09:55:41 +0900
commit8bb270de6835a00ac3413988c3955c19cfa0d97e (patch)
treee51e7f4529d66f3703994db399672b9329139e1f /flake.nix
parent592ab8b1a2d73a1f77db8a7b7e17238ce3577030 (diff)
downloadphp-shirabe-8bb270de6835a00ac3413988c3955c19cfa0d97e.tar.gz
php-shirabe-8bb270de6835a00ac3413988c3955c19cfa0d97e.tar.zst
php-shirabe-8bb270de6835a00ac3413988c3955c19cfa0d97e.zip
build(nix): add a Nix flake providing the dev shell and formatters
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..57955bc2
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,72 @@
+{
+ description = "Port of Composer, the dependency manager for PHP, written in Rust";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+ systems.url = "github:nix-systems/x86_64-linux";
+
+ flake-utils = {
+ url = "github:numtide/flake-utils";
+ inputs.systems.follows = "systems";
+ };
+
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ {
+ nixpkgs,
+ flake-utils,
+ rust-overlay,
+ treefmt-nix,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ rust-overlay.overlays.default ];
+ };
+ rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
+ treefmt = treefmt-nix.lib.evalModule pkgs {
+ imports = [ ./treefmt.nix ];
+ programs.rustfmt.package = rustToolchain;
+ };
+ in
+ {
+ formatter = treefmt.config.build.wrapper;
+
+ devShells.default = pkgs.mkShell {
+ packages = [
+ rustToolchain
+ pkgs.php85
+
+ # The following softwares are used for testing.
+ # VCSs
+ pkgs.fossil
+ pkgs.git
+ pkgs.mercurial
+ pkgs.subversion
+ # Archivers
+ pkgs.bzip2
+ pkgs.gnutar
+ pkgs.gzip
+ pkgs.p7zip
+ pkgs.unzip
+ pkgs.xz
+ pkgs.zip
+ ];
+ };
+ }
+ );
+}