-
-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nixos build support #9690
Merged
Merged
Nixos build support #9690
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use nix | ||
layout python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#! /usr/bin/env bash | ||
|
||
rm -rf .direnv | ||
rm -rf .venv | ||
rm -rf .vscode-extensions | ||
rm -rf __pycache__ | ||
cd .. | ||
cd - | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
while read SUBSTITUTION; do | ||
COUNT=`grep -ir -m1 $SUBSTITUTION --include="*.rst" docs/ | wc -l`;echo $SUBSTITUTION $COUNT | ||
done <subst.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from os import path, walk | ||
import glob | ||
from sys import argv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# replacing |nix| |qg| |win| |osx| | ||
rpl -qi '|qg|' 'QGIS' $1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
let | ||
pinnedHash = "f03c983c83471408ef16fcb9f47078491070064f"; | ||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/${pinnedHash}.tar.gz") { }; | ||
pythonPackages = pkgs.python3Packages; | ||
in pkgs.mkShell rec { | ||
name = "impurePythonEnv"; | ||
venvDir = "./.venv"; | ||
buildInputs = [ | ||
# A Python interpreter including the 'venv' module is required to bootstrap | ||
# the environment. | ||
pythonPackages.python | ||
|
||
# This executes some shell code to initialize a venv in $venvDir before | ||
# dropping into the shell | ||
pythonPackages.venvShellHook | ||
pkgs.vscode | ||
pkgs.transifex-cli | ||
|
||
# Those are dependencies that we would like to use from nixpkgs, which will | ||
# add them to PYTHONPATH and thus make them accessible from within the venv. | ||
]; | ||
|
||
# Run this command, only after creating the virtual environment | ||
postVenvCreation = '' | ||
export DIRENV_LOG_FORMAT= | ||
unset SOURCE_DATE_EPOCH | ||
pip install -r REQUIREMENTS.txt | ||
echo "-----------------------" | ||
echo "🌈 Your Dev Environment is prepared." | ||
echo "📒 Note:" | ||
echo "-----------------------" | ||
echo "start vscode like this:" | ||
echo "" | ||
echo "./vscode.sh" | ||
echo "-----------------------" | ||
''; | ||
|
||
# Now we can execute any commands within the virtual environment. | ||
# This is optional and can be left out to run pip manually. | ||
postShellHook = '' | ||
# allow pip to install wheels | ||
unset SOURCE_DATE_EPOCH | ||
''; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env bash | ||
echo "🪛 Installing VSCode Extensions:" | ||
echo "--------------------------------" | ||
|
||
# Locate QGIS binary | ||
QGIS_BIN=$(which qgis) | ||
|
||
if [[ -z "$QGIS_BIN" ]]; then | ||
echo "Error: QGIS binary not found!" | ||
exit 1 | ||
fi | ||
|
||
# Extract the Nix store path (removing /bin/qgis) | ||
QGIS_PREFIX=$(dirname "$(dirname "$QGIS_BIN")") | ||
|
||
# Construct the correct QGIS Python path | ||
QGIS_PYTHON_PATH="$QGIS_PREFIX/share/qgis/python" | ||
# Needed for qgis processing module import | ||
PROCESSING_PATH="$QGIS_PREFIX/share/qgis/python/qgis" | ||
|
||
# Check if the Python directory exists | ||
if [[ ! -d "$QGIS_PYTHON_PATH" ]]; then | ||
echo "Error: QGIS Python path not found at $QGIS_PYTHON_PATH" | ||
exit 1 | ||
fi | ||
|
||
# Create .env file for VSCode | ||
ENV_FILE=".env" | ||
|
||
QTPOSITIONING="/nix/store/nb3gkbi161fna9fxh9g3bdgzxzpq34gf-python3.11-pyqt5-5.15.10/lib/python3.11/site-packages" | ||
|
||
echo "Creating VSCode .env file..." | ||
cat <<EOF > "$ENV_FILE" | ||
PYTHONPATH=$QGIS_PYTHON_PATH:$QTPOSITIONING | ||
QGIS_PREFIX_PATH=$QGIS_PREFIX | ||
PYQT5_PATH="$QGIS_PREFIX/share/qgis/python/PyQt" | ||
QT_QPA_PLATFORM=offscreen | ||
EOF | ||
|
||
echo "✅ .env file created successfully!" | ||
echo "Contents of .env:" | ||
cat "$ENV_FILE" | ||
|
||
# Also set the python path in this shell in case we want to run tests etc from the command line | ||
export PYTHONPATH=$PYTHONPATH:$QGIS_PYTHON_PATH | ||
|
||
# Ensure .vscode directory exists | ||
mkdir -p .vscode | ||
|
||
# Define the settings.json file path | ||
SETTINGS_FILE=".vscode/settings.json" | ||
|
||
# Ensure settings.json exists | ||
if [[ ! -f "$SETTINGS_FILE" ]]; then | ||
echo "{}" > "$SETTINGS_FILE" | ||
fi | ||
|
||
# Update settings.json non-destructively | ||
echo "Updating VSCode settings.json..." | ||
jq --arg pyenv "\${workspaceFolder}/.env" \ | ||
--arg qgispath "$QGIS_PYTHON_PATH" \ | ||
--arg prefixpath "$QGIS_PREFIX" \ | ||
'.["python.envFile"] = $pyenv | | ||
.["python.analysis.extraPaths"] += [$qgispath] | | ||
.["terminal.integrated.env.linux"].PYTHONPATH = $qgispath | | ||
.["git.enableCommitSigning"] = true' \ | ||
"$SETTINGS_FILE" > "$SETTINGS_FILE.tmp" && mv "$SETTINGS_FILE.tmp" "$SETTINGS_FILE" | ||
|
||
echo "✅ VSCode settings.json updated successfully!" | ||
echo "Contents of settings.json:" | ||
cat "$SETTINGS_FILE" | ||
|
||
# Install required extensions | ||
code --user-data-dir='.vscode' \ | ||
--profile='qgis-documentation' \ | ||
--extensions-dir='.vscode-extensions' . \ | ||
--install-extension [email protected] \ | ||
--install-extension [email protected] \ | ||
--install-extension [email protected] | ||
|
||
# Launch VSCode with the sandboxed environment | ||
code --user-data-dir='.vscode' \ | ||
--profile='qgis-documentation' \ | ||
--extensions-dir='.vscode-extensions' . |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops no, thanks.