diff options
| author | Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> | 2024-05-12 21:02:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-12 21:02:47 +0100 |
| commit | 97b62ac72b3948a2e33dcb8f494153a016fce2fd (patch) | |
| tree | 2510c58ee2bdf7a3002336dd588696a0c8f5bd89 | |
| parent | 0b1c0694489b1b74b21c10ad29b59912edeb5e01 (diff) | |
| download | decky-loader-97b62ac72b3948a2e33dcb8f494153a016fce2fd.tar.gz decky-loader-97b62ac72b3948a2e33dcb8f494153a016fce2fd.zip | |
[needs websockets] Add development flake file (#620)
* Add development flake file
* use regular nixpkgs import
* Make vscode work and add .envrc
* add .direnv to the .gitignore file
| -rw-r--r-- | .envrc | 1 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | flake.lock | 175 | ||||
| -rw-r--r-- | flake.nix | 54 |
4 files changed, 231 insertions, 0 deletions
@@ -0,0 +1 @@ +use flake @@ -126,6 +126,7 @@ venv/ ENV/ env.bak/ venv.bak/ +.direnv/ # Spyder project settings .spyderproject diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..e4cebc16 --- /dev/null +++ b/flake.lock @@ -0,0 +1,175 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1714763106, + "narHash": "sha256-DrDHo74uTycfpAF+/qxZAMlP/Cpe04BVioJb6fdI0YY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9be42459999a253a9f92559b1f5b72e1b44c13d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1714855626, + "narHash": "sha256-fqvhXqJVykGHr6OHJ2eLhmNr76vKYqrEnXErLJ5eUe8=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "c8766d12a9efd0467998b887d6de6d838091f2b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714058656, + "narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..13567e97 --- /dev/null +++ b/flake.nix @@ -0,0 +1,54 @@ +{ + description = "Decky development environment"; + # pulls in the python deps from poetry + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, poetry2nix }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + p2n = (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }); + in { + devShells.default = (p2n.mkPoetryEnv { + projectDir = self + "/backend"; + # pyinstaller fails to compile so precompiled it is + overrides = p2n.overrides.withDefaults (final: prev: { + pyinstaller = prev.pyinstaller.override { preferWheel = true; }; + pyright = null; + }); + }).env.overrideAttrs (oldAttrs: { + shellHook = '' + set -o noclobber + PYTHONPATH=`which python` + FILE=.vscode/settings.json + if [ -f "$FILE" ]; then + echo "$FILE already exists, not writing interpreter path to it." + else + echo "{\"python.defaultInterpreterPath\": \"''${PYTHONPATH}\"}" > "$FILE" + fi + ''; + buildInputs = with pkgs; [ + nodejs_22 + nodePackages.pnpm + poetry + # fixes local pyright not being able to see the pythonpath properly. + (pkgs.writeShellScriptBin "pyright" '' + ${pkgs.pyright}/bin/pyright --pythonpath `which python3` "$@" '') + (pkgs.writeShellScriptBin "pyright-langserver" '' + ${pkgs.pyright}/bin/pyright-langserver --pythonpath `which python3` "$@" '') + (pkgs.writeShellScriptBin "pyright-python" '' + ${pkgs.pyright}/bin/pyright-python --pythonpath `which python3` "$@" '') + (pkgs.writeShellScriptBin "pyright-python-langserver" '' + ${pkgs.pyright}/bin/pyright-python-langserver --pythonpath `which python3` "$@" '') + ]; + }); + }); +} |
