Move nix shell to separate shell.nix
Update README for nix shell instructions, refile long lines
This commit is contained in:
parent
bd0f546401
commit
0396bdb66a
31
README.md
31
README.md
|
@ -1,10 +1,13 @@
|
||||||
# Nix Background Upgrade
|
# Nix Background Upgrade
|
||||||
Upgrade NixOS system (and/or home-manager) in the background, with notification support.
|
Upgrade NixOS system (and/or home-manager) in the background, with
|
||||||
|
notification support.
|
||||||
|
|
||||||
**Early stages of development, subject to change and likely not working at the current stage.**
|
**Early stages of development, subject to change and likely not
|
||||||
|
working at the current stage.**
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
Clone the repository and install with pip (or preferred Python packaging system):
|
Clone the repository and install with pip (or preferred Python
|
||||||
|
packaging system):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.xenia.me.uk/pixelifytica/nix-background-upgrade.git
|
git clone https://git.xenia.me.uk/pixelifytica/nix-background-upgrade.git
|
||||||
|
@ -12,9 +15,12 @@ python3 -m pip install ./nix-background-upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
### For development
|
### For development
|
||||||
Project uses [Poetry](https://python-poetry.org/ "Poetry: Python packaging and dependency management tool") to manage dependencies.
|
Project uses [Poetry](https://python-poetry.org/ "Poetry: Python
|
||||||
|
packaging and dependency management tool") to manage dependencies.
|
||||||
|
|
||||||
Install Poetry (see [documentation](https://python-poetry.org/docs/#installation) for more details), for example using `pipx`:
|
Install Poetry (see
|
||||||
|
[documentation](https://python-poetry.org/docs/#installation) for more
|
||||||
|
details), for example using `pipx`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pipx install poetry
|
pipx install poetry
|
||||||
|
@ -26,14 +32,23 @@ Then install project using `poetry`:
|
||||||
poetry install
|
poetry install
|
||||||
```
|
```
|
||||||
|
|
||||||
Python code is formatted using [black](https://pypi.org/project/black/ "The uncompromising code formatter") and [isort](https://pypi.org/project/isort/ "A Python utility / library to sort Python imports").
|
Python code is formatted using [black](https://pypi.org/project/black/
|
||||||
|
"The uncompromising code formatter") and
|
||||||
|
[isort](https://pypi.org/project/isort/ "A Python utility / library to
|
||||||
|
sort Python imports").
|
||||||
|
|
||||||
#### `pre-commit`
|
#### `pre-commit`
|
||||||
[pre-commit](https://pre-commit.com/ "A framework for managing and maintaining multi-language pre-commit hooks") is used to ensure formatting of new/changed files. Install pre-commit hooks with:
|
[pre-commit](https://pre-commit.com/ "A framework for managing and
|
||||||
|
maintaining multi-language pre-commit hooks") is used to ensure
|
||||||
|
formatting of new/changed files. Install pre-commit hooks with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pre-commit install --install-hooks
|
pre-commit install --install-hooks
|
||||||
```
|
```
|
||||||
|
|
||||||
### Nix Flake
|
### Nix Flake
|
||||||
Project provides a Nix `flake.nix` to get up and running quickly.
|
Project provides a Nix `flake.nix` and `shell.nix` to get up and
|
||||||
|
running quickly.
|
||||||
|
|
||||||
|
Run `nix develop` (Flake) or `nix-shell` (non-Flake) to enter
|
||||||
|
development shell containing project dependencies.
|
||||||
|
|
16
flake.nix
16
flake.nix
|
@ -29,18 +29,10 @@
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forAllSystems (system: let
|
devShells = forAllSystems (system: {
|
||||||
inherit (poetry2nix.lib.mkPoetry2Nix {pkgs = pkgs.${system};}) mkPoetryEnv;
|
default = import ./shell.nix {
|
||||||
in {
|
pkgs = pkgs.${system};
|
||||||
default = pkgs.${system}.mkShellNoCC {
|
inherit (poetry2nix.lib.mkPoetry2Nix {pkgs = pkgs.${system};}) mkPoetryEnv;
|
||||||
packages = with pkgs.${system}; [
|
|
||||||
(mkPoetryEnv {
|
|
||||||
projectDir = self;
|
|
||||||
preferWheels = true;
|
|
||||||
extraPackages = ps: with ps; [python-lsp-server];
|
|
||||||
})
|
|
||||||
poetry
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
15
shell.nix
Normal file
15
shell.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> {},
|
||||||
|
mkPoetryEnv ? ((builtins.getFlake "github:nix-community/poetry2nix").lib.mkPoetry2Nix {inherit pkgs;}).mkPoetryEnv,
|
||||||
|
}:
|
||||||
|
pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs; [
|
||||||
|
(mkPoetryEnv {
|
||||||
|
projectDir = ./.;
|
||||||
|
preferWheels = true;
|
||||||
|
editablePackageSources = {nix_background_upgrade = ./src;};
|
||||||
|
extraPackages = ps: with ps; [python-lsp-server];
|
||||||
|
})
|
||||||
|
poetry
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue