chore: migrate development environment from Nix flakes to devenv
Replace Nix flake-based development setup with devenv for better developer experience and more streamlined environment management. Changes: - Remove flake.nix and flake.lock files - Add devenv.nix, devenv.yaml, and devenv.lock configuration - Update .envrc to use devenv instead of nix develop - Remove Docker development setup (compose.dev.yml, docker/mod.just) - Expand .gitignore with comprehensive IDE and OS exclusions - Remove Docker-related just commands from justfile
This commit is contained in:
parent
7cdaa27f3b
commit
ab2d80d2f6
9
.envrc
9
.envrc
@ -1,2 +1,7 @@
|
||||
use flake
|
||||
dotenv_if_exists
|
||||
export DIRENV_WARN_TIMEOUT=20s
|
||||
|
||||
eval "$(devenv direnvrc)"
|
||||
|
||||
# The use_devenv function supports passing flags to the devenv command
|
||||
# For example: use devenv --impure --option services.postgres.enable:bool true
|
||||
use devenv
|
||||
|
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@ -32,16 +32,16 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v27
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
uses: cachix/install-nix-action@v31
|
||||
- name: Install devenv
|
||||
run: nix profile install nixpkgs#devenv
|
||||
- name: Migrate database
|
||||
run: nix develop --command -- just migrate
|
||||
run: devenv shell just migrate
|
||||
- name: Formatting check
|
||||
run: nix develop --command -- just format-check
|
||||
run: devenv shell just format-check
|
||||
- name: Lint
|
||||
run: nix develop --command -- just lint
|
||||
run: devenv shell just lint
|
||||
- name: Audit
|
||||
run: nix develop --command -- just audit
|
||||
run: devenv shell just audit
|
||||
- name: Tests
|
||||
run: nix develop --command -- just test
|
||||
run: devenv shell just test
|
||||
|
51
.gitignore
vendored
51
.gitignore
vendored
@ -2,3 +2,54 @@
|
||||
.env
|
||||
/coverage
|
||||
/target
|
||||
|
||||
# Devenv
|
||||
.devenv*
|
||||
devenv.local.nix
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
# pre-commit
|
||||
.pre-commit-config.yaml
|
||||
|
||||
# Emacs backup files
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# Vim files
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
*.code-workspace
|
||||
|
||||
# JetBrains IDEs
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Linux
|
||||
*~
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.temp
|
||||
*.log
|
||||
|
||||
# OS generated files
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -415,7 +415,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "georm"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"georm-macros",
|
||||
"rand 0.9.0",
|
||||
@ -424,7 +424,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "georm-macros"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"deluxe",
|
||||
"proc-macro2",
|
||||
|
14
README.md
14
README.md
@ -628,29 +628,31 @@ bacon test
|
||||
bacon doc
|
||||
```
|
||||
|
||||
#### Nix Development Environment (Optional)
|
||||
#### Devenv Development Environment (Optional)
|
||||
|
||||
If you use [Nix](https://nixos.org/), you can use the provided flake for a reproducible development environment:
|
||||
If you use [Nix](https://nixos.org/), you can use the provided devenv configuration for a reproducible development environment:
|
||||
|
||||
```bash
|
||||
# Enter the development shell with all tools pre-installed
|
||||
nix develop
|
||||
devenv shell
|
||||
|
||||
# Or use direnv for automatic environment activation
|
||||
direnv allow
|
||||
```
|
||||
|
||||
The Nix flake provides:
|
||||
The devenv configuration provides:
|
||||
- Exact Rust version (1.81) with required components
|
||||
- All development tools (just, cargo-deny, sqlx-cli, bacon)
|
||||
- LSP support (rust-analyzer)
|
||||
- SQL tooling (sqls for SQL language server)
|
||||
- PostgreSQL database for development
|
||||
|
||||
**Nix flake contents:**
|
||||
**Devenv configuration:**
|
||||
- **Rust toolchain**: Specified version with rustfmt, clippy, and rust-analyzer
|
||||
- **Development tools**: just, cargo-deny, sqlx-cli, bacon
|
||||
- **SQL tools**: sqls (SQL language server)
|
||||
- **Platform support**: Currently x86_64-linux (can be extended)
|
||||
- **Database**: PostgreSQL with automatic setup
|
||||
- **Platform support**: Cross-platform (Linux, macOS, etc.)
|
||||
|
||||
#### Database Setup for Tests
|
||||
|
||||
|
123
devenv.lock
Normal file
123
devenv.lock
Normal file
@ -0,0 +1,123 @@
|
||||
{
|
||||
"nodes": {
|
||||
"devenv": {
|
||||
"locked": {
|
||||
"dir": "src/modules",
|
||||
"lastModified": 1749054588,
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "b6be42d9e6f6053be1d180e4a4fb95e0aa9a8424",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "src/modules",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1747046372,
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1747372754,
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1746807397,
|
||||
"owner": "cachix",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "rolling",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"git-hooks": "git-hooks",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": [
|
||||
"git-hooks"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1749091064,
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "12419593ce78f2e8e1e89a373c6515885e218acb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
36
devenv.nix
Normal file
36
devenv.nix
Normal file
@ -0,0 +1,36 @@
|
||||
{ pkgs, nixpkgs, rust-overlay, ... }:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
system = pkgs.stdenv.system;
|
||||
rustPkgs = import nixpkgs { inherit system overlays; };
|
||||
rustVersion = (rustPkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
||||
in {
|
||||
dotenv.enable = true;
|
||||
|
||||
packages = with rustPkgs; [
|
||||
bacon
|
||||
cargo-deny
|
||||
just
|
||||
postgresql
|
||||
sqls
|
||||
sqlx-cli
|
||||
(rustVersion.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rustfmt"
|
||||
"clippy"
|
||||
"rust-analyzer"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
services.postgres = {
|
||||
enable = true;
|
||||
listen_addresses = "localhost";
|
||||
initialScript = ''
|
||||
CREATE USER georm WITH PASSWORD 'georm' SUPERUSER;
|
||||
CREATE DATABASE georm OWNER georm;
|
||||
GRANT ALL PRIVILEGES ON DATABASE georm TO georm;
|
||||
'';
|
||||
};
|
||||
}
|
8
devenv.yaml
Normal file
8
devenv.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
inputs:
|
||||
rust-overlay:
|
||||
url: github:oxalica/rust-overlay
|
||||
inputs:
|
||||
nixpkgs:
|
||||
follows: nixpkgs
|
||||
nixpkgs:
|
||||
url: github:cachix/devenv-nixpkgs/rolling
|
@ -1,33 +0,0 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
container_name: georm-backend-db
|
||||
environment:
|
||||
POSTGRES_PASSWORD: georm
|
||||
POSTGRES_USER: georm
|
||||
POSTGRES_DB: georm
|
||||
ports:
|
||||
- 127.0.0.1:5432:5432
|
||||
volumes:
|
||||
- georm_backend_db_data:/var/lib/postgresql/data
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4:8
|
||||
restart: unless-stopped
|
||||
container_name: georm-backend-pgadmin
|
||||
environment:
|
||||
PGADMIN_DEFAULT_EMAIL: admin@example.com
|
||||
PGADMIN_DEFAULT_PASSWORD: password
|
||||
PGADMIN_DISABLE_POSTFIX: true
|
||||
PGADMIN_CONFIG_SERVER_MODE: 'False'
|
||||
ports:
|
||||
- 127.0.0.1:8080:80
|
||||
volumes:
|
||||
- georm_backend_pgadmin_data:/var/lib/pgadmin
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
volumes:
|
||||
georm_backend_db_data:
|
||||
georm_backend_pgadmin_data:
|
@ -1,14 +0,0 @@
|
||||
default: start
|
||||
|
||||
start:
|
||||
docker compose -f compose.dev.yml up -d
|
||||
|
||||
stop:
|
||||
docker compose -f compose.dev.yml down
|
||||
|
||||
logs:
|
||||
docker compose -f compose.dev.yml logs -f
|
||||
|
||||
## Local Variables:
|
||||
## mode: makefile
|
||||
## End:
|
96
flake.lock
generated
96
flake.lock
generated
@ -1,96 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1738142207,
|
||||
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1736320768,
|
||||
"narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4bc9c909d9ac828a039f288cf872d16d38185db8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738290352,
|
||||
"narHash": "sha256-YKOHUmc0Clm4tMV8grnxYL4IIwtjTayoq/3nqk0QM7k=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "b031b584125d33d23a0182f91ddbaf3ab4880236",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
37
flake.nix
37
flake.nix
@ -1,37 +0,0 @@
|
||||
{
|
||||
description = "Georm, a simple, opiniated SQLx ORM for PostgreSQL";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
||||
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
rustVersion = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
||||
in {
|
||||
devShell = with pkgs; mkShell {
|
||||
buildInputs = [
|
||||
bacon
|
||||
cargo
|
||||
cargo-deny
|
||||
just
|
||||
rust-analyzer
|
||||
(rustVersion.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rustfmt"
|
||||
"clippy"
|
||||
"rust-analyzer"
|
||||
];
|
||||
})
|
||||
sqls
|
||||
sqlx-cli
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user