Skip to content

Commit

Permalink
Switch from flake to devenv
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Mar 29, 2024
1 parent ff53c89 commit 7592b9d
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 205 deletions.
7 changes: 3 additions & 4 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U="
fi
use flake
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="

use devenv
29 changes: 8 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
*.pyc
*.so
__pycache__
.DS_Store
.benchmarks
.cache
.coverage*
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv
.eggs
.hypothesis
.idea
.mypy_cache
.tox
.venv
*.egg-info
build
_build
coverage.xml
dist
htmlcov
pip-wheel-metadata
image

# pre-commit
.pre-commit-config.yaml
4 changes: 4 additions & 0 deletions app/__init__.py → app/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ def main():
httpd.serve_forever()
except KeyboardInterrupt:
print("Bye")


if __name__ == "__main__":
raise SystemExit(main())
Binary file added app/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added app/__pycache__/__main__.cpython-311.pyc
Binary file not shown.
296 changes: 296 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1711676035,
"owner": "cachix",
"repo": "devenv",
"rev": "19098329b4e79f60705d7fb241a3617266658f98",
"treeHash": "bb680b45d423ed04d309353584413a5623f25d76",
"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"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"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"
}
},
"nix2container": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708764364,
"owner": "nlewo",
"repo": "nix2container",
"rev": "c891f90d2e3c48a6b33466c96e4851e0fc0cf455",
"treeHash": "747af167fd4350bd81b11ce824a756bb85b1757c",
"type": "github"
},
"original": {
"owner": "nlewo",
"repo": "nix2container",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1711715736,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "807c549feabce7eddbf259dbdcec9e0600a0660d",
"treeHash": "682dc19175b69e6aa827cad28db6e11fb51a8252",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-python": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1710929962,
"owner": "cachix",
"repo": "nixpkgs-python",
"rev": "a9e19aafbf75b8c7e5adf2d7319939309ebe0d77",
"treeHash": "713691f04a2553f7196e6d1beb64ce96ef74b3ee",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "nixpkgs-python",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1711668574,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
"treeHash": "51ec3259d600ba0dbef93d23999da1141e943713",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1711668574,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
"treeHash": "51ec3259d600ba0dbef93d23999da1141e943713",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1711519547,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "7d47a32e5cd1ea481fab33c516356ce27c8cef4a",
"treeHash": "a2d07a1647ab5265bebc6a0141c89c455eefefcb",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nix2container": "nix2container",
"nixpkgs": "nixpkgs",
"nixpkgs-python": "nixpkgs-python",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
31 changes: 31 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ pkgs, ... }:

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

# https://devenv.sh/packages/
# packages = [ pkgs.uv ];

# https://devenv.sh/scripts/
# scripts.hello.exec = "echo hello from $MY_ENV_VAR";

# enterShell = ''
# hello
# '';

# https://devenv.sh/languages/
languages.nix.enable = true;

languages.python.enable = true;
# languages.python.version = "3.12";

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

# https://devenv.sh/processes/
processes.serve-app.exec = "python -m app";

# See full reference at https://devenv.sh/reference/options/
}
10 changes: 10 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
nixpkgs-python:
url: github:cachix/nixpkgs-python
nix2container:
url: github:nlewo/nix2container
inputs:
nixpkgs:
follows: nixpkgs
Loading

0 comments on commit 7592b9d

Please sign in to comment.