Compare commits

..

2 Commits

Author SHA1 Message Date
Moritz Hölting d7c802a9fb update lockfile (dependabot alerts) 2026-07-07 18:39:37 +02:00
Moritz Hölting a995a2888d add nix flake and devenv configuration 2026-07-07 18:12:31 +02:00
8 changed files with 772 additions and 514 deletions

14
.gitignore vendored
View File

@ -1,2 +1,14 @@
/target /target
.env /result
.env
# Devenv
.devenv*
devenv.local.nix
devenv.local.yaml
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml

1056
Cargo.lock generated

File diff suppressed because it is too large Load Diff

6
default.nix Normal file
View File

@ -0,0 +1,6 @@
{ rustPlatform }:
rustPlatform.buildRustPackage {
name = "mensa-upb-api";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}

103
devenv.lock Normal file
View File

@ -0,0 +1,103 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1783427201,
"narHash": "sha256-oaA0ap7w1XF1P5w4IpP+F4XfLwww2R9ht8MW1auaOms=",
"owner": "cachix",
"repo": "devenv",
"rev": "821e0be605bd00b1aaf6113406c4babc3ce12d23",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1783008725,
"narHash": "sha256-jGiy6+sxjNWXSjp25uoJuNfyH9zBK1PEDY0lVoL4ibQ=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "bca82caa46d5ec0f5d422c61fb1e30bc51313cbe",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1783345554,
"narHash": "sha256-LZhOm4kqjHUnwP4CNHpaqqEVcumGNd1PvOEOad8LkS0=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "6004ea8c229fe9d41b21c6f4c76bf6c2e10771dd",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1783279667,
"narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

40
devenv.nix Normal file
View File

@ -0,0 +1,40 @@
{
pkgs,
lib,
config,
inputs,
...
}:
{
packages = [ pkgs.git pkgs.sqlx-cli ];
languages.rust.enable = true;
env.DATABASE_URL = "postgres://mensa-upb:mensa-upb@${config.services.postgres.listen_addresses}:${toString config.services.postgres.port}/mensa-upb";
services.postgres = {
enable = true;
initialDatabases = [
{
name = "mensa-upb";
user = "mensa-upb";
pass = "mensa-upb";
}
];
listen_addresses = "localhost";
};
git-hooks.hooks = {
clippy.enable = true;
sqlx-prepare = {
enable = true;
name = "Run cargo sqlx prepare";
entry = "cargo sqlx prepare --workspace --no-dotenv";
pass_filenames = false;
};
};
# See full reference at https://devenv.sh/reference/options/
}

8
devenv.yaml Normal file
View File

@ -0,0 +1,8 @@
inputs:
git-hooks:
url: github:cachix/git-hooks.nix
inputs:
nixpkgs:
follows: nixpkgs
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1783224372,
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

32
flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "Mensa UPB scraper and API";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.${system}.default = pkgs.callPackage ./default.nix { };
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
devenv
cargo
rustc
rustfmt
clippy
rust-analyzer
sqlx-cli
];
env.RUST_SRC_PATH = pkgs.rust.packages.stable.rustPlatform.rustLibSrc;
};
};
}