Add Nix Flake support (using poetry2nix)

This commit is contained in:
Pierre Bourdon 2022-08-20 04:37:46 +02:00
parent 3aa4cc73ae
commit fcd4ad0f67
No known key found for this signature in database
GPG Key ID: 6FB80DCD84DA0F1C
3 changed files with 136 additions and 0 deletions

View File

@ -19,6 +19,16 @@ A NetPlay Index server for Dolphin.
## Setup
### Using Nix
Note: this requires Nix Flakes to be enabled on your system.
```bash
nix run github:dolphin-emu/netplay-index
```
### Without Nix
This project uses [Poetry](https://python-poetry.org/) for dependency
management.

93
flake.lock Normal file
View File

@ -0,0 +1,93 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1653936696,
"narHash": "sha256-M6bJShji9AIDZ7Kh7CPwPBPb/T7RiVev2PAcOi4fxDQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ce6aa13369b667ac2542593170993504932eb836",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1660955571,
"narHash": "sha256-B52/TeY4KQvsQ4h9aFasXFQHEwu4G9ZmeIvq73JcWQY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "99294df80861eddc88d4de246846aebbc444b11e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1660542485,
"narHash": "sha256-XfklMwJMLB7bLI5ZnQTrNaK7KyBnElLGoWOL++XO3zk=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "8b6239cf2ded121f8f3d570d2563d69f05d4208f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix"
}
}
},
"root": "root",
"version": 7
}

33
flake.nix Normal file
View File

@ -0,0 +1,33 @@
{
description = "Dolphin's NetPlay Index / Lobby Server";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/22.05";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix }: {
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(final: prev: {
netplay-lobby = prev.poetry2nix.mkPoetryApplication {
projectDir = ./.;
checkPhase = "GEOIP_DATABASE_PATH=testdata/GeoLite2-Country.mmdb pytest";
};
})
];
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in rec {
packages.netplay-lobby = pkgs.netplay-lobby;
defaultPackage = pkgs.netplay-lobby;
devShells.default = with pkgs; mkShell {
inputsFrom = [ python3Packages.poetry ];
};
}
));
}