devenv: add environment

Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
This commit is contained in:
Patrizio Bekerle 2025-04-15 22:36:48 +02:00
parent 1bb347f3b6
commit d6bfa8fe6b
No known key found for this signature in database
GPG key ID: 75960E6926556207
6 changed files with 195 additions and 2 deletions

8
.envrc
View file

@ -1,2 +1,8 @@
use nix
#use nix
#use flake
export DIRENV_WARN_TIMEOUT=20s
eval "$(devenv direnvrc)"
use devenv

10
.gitignore vendored
View file

@ -27,3 +27,13 @@ ui_*.h
/src/QOwnNotes
secrets/*
# Devenv
.devenv*
devenv.local.nix
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml

103
devenv.lock Normal file
View file

@ -0,0 +1,103 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1744725539,
"owner": "cachix",
"repo": "devenv",
"rev": "e35cb7bb6e6424b83560b5ae0896f75263942191",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1742649964,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1744463964,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
}
}
},
"root": "root",
"version": 7
}

69
devenv.nix Normal file
View file

@ -0,0 +1,69 @@
{
pkgs,
config,
...
}:
{
# https://devenv.sh/supported-languages/cplusplus/
languages.cplusplus.enable = true;
# https://devenv.sh/packages/
packages =
with pkgs;
with qt6;
[
just
crowdin-cli
cmake
qmake
qttools
wrapQtAppsHook
pkg-config
libclang # for clang-format
procs # fetches process info
gawk # for parsing procs output
fzf # for interactive process selection
# for ./build-systems/github/build-github-src.sh
coreutils
gh
# for shell scripts
findutils
gnused
ripgrep
librsvg
imagemagick
libicns
# Packages for treefmt
libclang
nodePackages.prettier
shfmt
nixfmt-rfc-style
statix
taplo
cmake-format
];
# https://devenv.sh/git-hooks/
git-hooks.hooks.treefmt.enable = true;
# This script updates the symlinks to the qmake binaries in the nix store
# The symlinks are to be used in Qt Creator and CLion
scripts.update-qmake-symlinks.exec = ''
BIN_DIR="''${DEVENV_ROOT}/bin"
echo "Updating qmake symlinks in ''${BIN_DIR}..."
mkdir -p "''${BIN_DIR}"
ln -sf "${pkgs.kdePackages.qtbase}/bin/qmake" "''${BIN_DIR}/qmake6"
ln -sf "${pkgs.libsForQt5.qt5.qtbase.dev}/bin/qmake" "''${BIN_DIR}/qmake5"
'';
enterShell = ''
update-qmake-symlinks
'';
# See full reference at https://devenv.sh/reference/options/
}

5
devenv.yaml Normal file
View file

@ -0,0 +1,5 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
# url: github:cachix/devenv-nixpkgs/rolling
url: github:NixOS/nixpkgs/nixos-unstable

View file

@ -175,7 +175,7 @@ fix-settings-ui-file:
# Attach to the QOwnNotes process with lurk
[group('debug')]
process-trace:
sudo lurk --attach `procs QOwnNotes | fzf --height 40% --layout reverse | awk '{print $1}'`
nix-shell -p lurk --run "sudo lurk --attach `procs QOwnNotes | fzf --height 40% --layout reverse | awk '{print $1}'`"
# Generate the icons for the whole project based on icons/icon.svg and icons/icon-dark.svg
[group('icons')]