Skip to content

Commit

Permalink
Merge pull request #3 from stvnliu/feat-poetry-nix
Browse files Browse the repository at this point in the history
Feature: Integrating Nix development environment and Poetry
  • Loading branch information
Ate329 authored Jun 5, 2024
2 parents 0d1b8cb + 71ef1c4 commit 4087bc5
Show file tree
Hide file tree
Showing 10 changed files with 1,201 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="

use devenv
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
node_modules/
node_modules/*
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ configparser
tkinter

javascript


## Special instructions for using devenv
You should run `npm install` first to install all necessary dependencies.
JsPyBridge should have provided a workaround, but perhaps due to NixOS peculiarities it may not work.

# Thanks to
[Mineflayer](https://github.com/PrismarineJS/mineflayer)
Expand Down
122 changes: 122 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1717507522,
"owner": "cachix",
"repo": "devenv",
"rev": "8485851fadfce27d394fabbc4ccb679c84f8c0dc",
"treeHash": "74b90b3d05afccfc458567ea994af5771b1c9bbc",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1717530100,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a2e1d0414259a144ebdc048408a807e69e0565af",
"treeHash": "d1a59f4c20789566e0ef4b5471521a4fc58963a1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1716213921,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
"treeHash": "17b9f9f9983467bcff247b09761dca9831d3d3be",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
60 changes: 60 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{ pkgs, lib, config, inputs, ... }:

{
# https://devenv.sh/basics/
env.GREET = "devenv";

# https://devenv.sh/packages/
packages = with pkgs; [
git
tk
python311Packages.tkinter
];
cachix.enable = false;
# https://devenv.sh/scripts/

enterShell = ''
git --version
python --version
poetry --version
'';

# https://devenv.sh/tests/
enterTest = ''
echo "Running tests"
git --version | grep "2.42.0"
'';

# https://devenv.sh/services/
# services.postgres.enable = true;

# https://devenv.sh/languages/
languages.nix.enable = true;
languages.javascript = {
enable = true;
npm = {
enable = true;
install.enable = true;
};
};
languages.python = {
enable = true;
package = pkgs.python311Full;
poetry = {
enable = true;
activate.enable = true;
install.enable = true;
};
};

# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
shellcheck.enable = true;
commitizen.enable = true;
};

# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";

# See full reference at https://devenv.sh/reference/options/
}
15 changes: 15 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling

# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true

# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"

# If you have more than one devenv you can merge them
#imports:
# - ./backend
Loading

0 comments on commit 4087bc5

Please sign in to comment.