add nix package, devshell and an .envrc

This commit is contained in:
nelind
2025-12-23 21:38:19 +00:00
committed by Tangled
parent 091d6d96a0
commit ac792fdd75
6 changed files with 124 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
use flake;
+2
View File
@@ -1,5 +1,7 @@
/target
.env
.direnv
.result
reference-pds-hailey/
reference-pds-bsky/
reference-relay-indigo/
+37
View File
@@ -0,0 +1,37 @@
{
lib,
rustPlatform,
pkg-config,
openssl,
}: let
toml = (lib.importTOML ./Cargo.toml).package;
in rustPlatform.buildRustPackage {
pname = "tranquil-pds";
inherit (toml) version;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./.)) (
lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./src
./.sqlx
./migrations
./frontend
]
);
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
openssl
];
cargoLock.lockFile = ./Cargo.lock;
doCheck = false;
}
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1766314097,
"narHash": "sha256-laJftWbghBehazn/zxVJ8NdENVgjccsWAdAqKXhErrM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "306ea70f9eb0fb4e040f8540e2deab32ed7e2055",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+19
View File
@@ -0,0 +1,19 @@
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs, ... }: let
forAllSystems =
function:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
system: function nixpkgs.legacyPackages.${system}
);
in {
packages = forAllSystems (pkgs: {
tranquil-pds = pkgs.callPackage ./default.nix { };
default = self.packages.${pkgs.stdenv.hostPlatform.system}.tranquil-pds;
});
devShells = forAllSystems (pkgs: {
default = pkgs.callPackage ./shell.nix { };
});
};
}
+38
View File
@@ -0,0 +1,38 @@
{
mkShell,
callPackage,
rustPlatform,
# repo tooling
just,
podman,
podman-compose,
# rust tooling
clippy,
rustfmt,
rust-analyzer,
# frontend tooling
deno,
}: let
defaultPackage = callPackage ./default.nix { };
in mkShell {
inputsFrom = [ defaultPackage ];
env = {
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
packages = [
just
podman
podman-compose
clippy
rustfmt
rust-analyzer
deno
];
}