add nix development environment

This commit is contained in:
Pim Kunis 2023-10-05 15:49:14 +02:00
parent 7a9625cd44
commit 2a32b7983d
5 changed files with 54 additions and 1 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use_flake

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ __pycache__
build/
dist/
pip-wheel-metadata/
.direnv

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1696374741,
"narHash": "sha256-gt8B3G0ryizT9HSB4cCO8QoxdbsHnrQH+/BdKxOwqF0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8a4c17493e5c39769f79117937c79e1c88de6729",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"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 Nix-flake-based Python development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ python311 virtualenv borgbackup ] ++
(with pkgs.python311Packages; [ apprise pipx tox isort flexmock ]);
shellHook = ''
export PATH=~/.local/bin/:$PATH
'';
};
});
};
}

View File

@ -16,7 +16,7 @@ docstring-quotes = '''
profile=black
known_first_party = borgmatic
line_length = 100
skip = .tox
skip = .tox,.direnv
[codespell]
skip = .git,.tox,build