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 /flake.nix | |
| 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
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 54 |
1 files changed, 54 insertions, 0 deletions
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` "$@" '') + ]; + }); + }); +} |
