nix setup

This commit is contained in:
Lorenz Hohermuth 2025-03-28 16:52:31 +01:00
parent 2fe26bb5ed
commit 3408f01598
4 changed files with 64 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
db/mysql_data

12
db/docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
services:
mysql:
image: mysql:8.0
container_name: tresor-mysql
restart: always
environment:
MYSQL_DATABASE: tresordb
MYSQL_ROOT_PASSWORD: 1234
ports:
- "3306:3306"
volumes:
- ./mysql_data:/var/lib/mysql

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1742889210,
"narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "698214a32beb4f4c8e3942372c694f40848b360d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View File

@ -0,0 +1,24 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
buildInputs = [
pkgs.docker
pkgs.docker-compose
];
shellHook = ''
docker compose -f db/docker-compose.yml up mysql -d
trap 'docker compose -f db/docker-compose.yml down' EXIT
'';
};
};
}