From fa3cf05f721f6bacf1fde492b64e749e4c6641c1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:29:59 +0200 Subject: [PATCH 01/25] dragger: initial version --- dragger.cc | 33 +++++++++++++++++++++++++++++++++ dragger.pro | 3 +++ 2 files changed, 36 insertions(+) create mode 100644 dragger.cc create mode 100644 dragger.pro diff --git a/dragger.cc b/dragger.cc new file mode 100644 index 0000000..87c59e4 --- /dev/null +++ b/dragger.cc @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char* argv[]) { + QApplication app(argc, argv); + + QList urls; + for (int i = 1; i < argc; ++i) { + QFileInfo file(QFile(argv[i])); + if (file.exists()) { + urls << QUrl("file:" + file.absoluteFilePath()); + } else { + qInfo() << file.filePath() << "does not exist"; + } + } + + if (urls.empty()) { + return 0; + } + + QMimeData* mimeData = new QMimeData(); + mimeData->setUrls(urls); + + QDrag drag(&app); + drag.setMimeData(mimeData); + drag.exec(); +} diff --git a/dragger.pro b/dragger.pro new file mode 100644 index 0000000..6015b89 --- /dev/null +++ b/dragger.pro @@ -0,0 +1,3 @@ +SOURCES = dragger.cc +CONFIG += qt +QT += widgets From 124443bb7c8c965cd300c19d23391b0c17b87878 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:25 +0200 Subject: [PATCH 02/25] project: add clang-format --- .clang-format | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f47e7d6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,10 @@ +# vim: ft=yaml +--- +BasedOnStyle: LLVM +IndentWidth: 4 +--- +Language: Cpp +# Force pointers to the type for C++. +DerivePointerAlignment: false +PointerAlignment: Left +--- From 6ac136c5e6a10c2a1fea17f8e951f95ac352ad94 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:30:53 +0200 Subject: [PATCH 03/25] nix: add flake --- flake.lock | 69 +++++++++++++++++++++++++++++++++ flake.nix | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..00c49b4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "master", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1633329294, + "narHash": "sha256-0LpQLS4KMgxslMgmDHmxG/5twFlXDBW9z4Or1iOrCvU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ee084c02040e864eeeb4cf4f8538d92f7c675671", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1631170176, + "narHash": "sha256-RLN/kur2Kpxt0cJp0Fms8ixuGpT8IHX0OpeQ8u8f0X4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "3ed0e618cebc1ff291c27b749cf7568959cac028", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "master", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..42cfda1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,112 @@ +{ + description = "A simple calculator"; + + inputs = { + flake-utils = { + type = "github"; + owner = "numtide"; + repo = "flake-utils"; + ref = "master"; + }; + + nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixpkgs-unstable"; + }; + + pre-commit-hooks = { + type = "github"; + owner = "cachix"; + repo = "pre-commit-hooks.nix"; + ref = "master"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + + outputs = + { self + , flake-utils + , nixpkgs + , pre-commit-hooks + }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; + in + rec { + apps = { + dragger = flake-utils.lib.mkApp { drv = packages.dragger; }; + }; + + checks = { + pre-commit = pre-commit-hooks.lib.${system}.run { + src = self; + + hooks = { + clang-format = { + enable = true; + name = "clang-format"; + entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i"; + types = [ "text" "c++" ]; + language = "system"; + }; + + nixpkgs-fmt = { + enable = true; + }; + }; + }; + }; + + defaultApp = apps.dragger; + + defaultPackage = packages.dragger; + + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ ] + ++ defaultPackage.nativeBuildInputs + ++ defaultPackage.buildInputs + ; + + inherit (checks.pre-commit) shellHook; + }; + + packages = { + inherit (pkgs) dragger; + }; + }) // { + overlay = final: prev: { + dragger = with final; stdenv.mkDerivation { + pname = "dragger"; + version = "0.1.0"; + + src = self; + + buildInputs = [ + libsForQt5.qt5.qtbase + ]; + nativeBuildInputs = [ + libsForQt5.qt5.wrapQtAppsHook + ]; + + configurePhase = '' + qmake + ''; + + installPhase = '' + mkdir -p $out/bin + cp dragger $out/bin + ''; + }; + }; + }; +} From 7b10fef4c0d9903de343ea0b7b3835a12b2a138f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:01 +0200 Subject: [PATCH 04/25] nix: add direnv integration --- .envrc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c4f5ea4 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +use_flake() { + watch_file flake.nix + watch_file flake.lock + eval "$(nix print-dev-env)" +} + +use flake From d7afffbce22e3c81585bd8971a53b62474ebb486 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:08 +0200 Subject: [PATCH 05/25] git: add ignore file --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e2d53d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Nix files +/result +/.pre-commit-config.yaml + +# Qt files +/Makefile +/.qmake.stash From 6193170b5e5373ff0a76e6df4b3221117328ef16 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:38:31 +0200 Subject: [PATCH 06/25] project: add README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..93cc1a8 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# `dragger` + +Drag files from CLI, without the need to open a GUI. + +## Usage + +Simply issue the command: + +```bash +dragger [FILES...] +``` + +`dragger` will initiate a drag-and-drop operation for all files and directories +provided as arguments. From 853ebeb6f39a691cde147061cd30399958dfa02f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:29:59 +0200 Subject: [PATCH 07/25] dragger: initial version --- dragger.pro | 3 +++ src/dragger.cc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 dragger.pro create mode 100644 src/dragger.cc diff --git a/dragger.pro b/dragger.pro new file mode 100644 index 0000000..62c7379 --- /dev/null +++ b/dragger.pro @@ -0,0 +1,3 @@ +SOURCES = src/dragger.cc +CONFIG += qt +QT += widgets diff --git a/src/dragger.cc b/src/dragger.cc new file mode 100644 index 0000000..87c59e4 --- /dev/null +++ b/src/dragger.cc @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char* argv[]) { + QApplication app(argc, argv); + + QList urls; + for (int i = 1; i < argc; ++i) { + QFileInfo file(QFile(argv[i])); + if (file.exists()) { + urls << QUrl("file:" + file.absoluteFilePath()); + } else { + qInfo() << file.filePath() << "does not exist"; + } + } + + if (urls.empty()) { + return 0; + } + + QMimeData* mimeData = new QMimeData(); + mimeData->setUrls(urls); + + QDrag drag(&app); + drag.setMimeData(mimeData); + drag.exec(); +} From 6a1f55d4204ea78ce10d1cbd857a81df6774e24c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:25 +0200 Subject: [PATCH 08/25] project: add clang-format --- .clang-format | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..f47e7d6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,10 @@ +# vim: ft=yaml +--- +BasedOnStyle: LLVM +IndentWidth: 4 +--- +Language: Cpp +# Force pointers to the type for C++. +DerivePointerAlignment: false +PointerAlignment: Left +--- From 962b762909440d7efb1814df729c9d97c45671c9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:30:53 +0200 Subject: [PATCH 09/25] nix: add flake --- flake.lock | 69 ++++++++++++++++++++++++++++++ flake.nix | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..00c49b4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "master", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1633329294, + "narHash": "sha256-0LpQLS4KMgxslMgmDHmxG/5twFlXDBW9z4Or1iOrCvU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ee084c02040e864eeeb4cf4f8538d92f7c675671", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1631170176, + "narHash": "sha256-RLN/kur2Kpxt0cJp0Fms8ixuGpT8IHX0OpeQ8u8f0X4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "3ed0e618cebc1ff291c27b749cf7568959cac028", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "master", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..22e0da6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,121 @@ +{ + description = "A CLI drag-and-drop tool"; + + inputs = { + flake-utils = { + type = "github"; + owner = "numtide"; + repo = "flake-utils"; + ref = "master"; + }; + + nixpkgs = { + type = "github"; + owner = "NixOS"; + repo = "nixpkgs"; + ref = "nixpkgs-unstable"; + }; + + pre-commit-hooks = { + type = "github"; + owner = "cachix"; + repo = "pre-commit-hooks.nix"; + ref = "master"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + + outputs = + { self + , flake-utils + , nixpkgs + , pre-commit-hooks + }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; + in + rec { + apps = { + dragger = flake-utils.lib.mkApp { drv = packages.dragger; }; + }; + + checks = { + pre-commit = pre-commit-hooks.lib.${system}.run { + src = self; + + hooks = { + clang-format = { + enable = true; + name = "clang-format"; + entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i"; + types = [ "text" "c++" ]; + language = "system"; + }; + + nixpkgs-fmt = { + enable = true; + }; + }; + }; + }; + + defaultApp = apps.dragger; + + defaultPackage = packages.dragger; + + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ ] + ++ defaultPackage.nativeBuildInputs + ++ defaultPackage.buildInputs + ; + + inherit (checks.pre-commit) shellHook; + }; + + packages = { + inherit (pkgs) dragger; + }; + }) // { + overlay = final: prev: { + dragger = with final; stdenv.mkDerivation { + pname = "dragger"; + version = "0.0.0"; + + src = self; + + buildInputs = [ + libsForQt5.qt5.qtbase + ]; + + nativeBuildInputs = [ + libsForQt5.qt5.wrapQtAppsHook + ]; + + configurePhase = '' + qmake + ''; + + installPhase = '' + mkdir -p $out/bin + cp dragger $out/bin + ''; + + meta = with lib; { + description = "A CLI drag-and-drop tool"; + homepage = "https://gitea.belanyi.fr/ambroisie/dragger"; + license = licenses.mit; + maintainers = [ ambroisie ]; + platforms = platforms.all; + }; + }; + }; + }; +} From 3695e157920e48bfc11635e05ae3dd9bcb506388 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:42:27 +0200 Subject: [PATCH 10/25] project: add LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 183e0a4e314a828b4104bca73573aec0f3b0f71f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:01 +0200 Subject: [PATCH 11/25] nix: add direnv integration --- .envrc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c4f5ea4 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +use_flake() { + watch_file flake.nix + watch_file flake.lock + eval "$(nix print-dev-env)" +} + +use flake From c053a6fe516fa0898239993c1ba5a2fde8c70769 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:08 +0200 Subject: [PATCH 12/25] git: add ignore file --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e2d53d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Nix files +/result +/.pre-commit-config.yaml + +# Qt files +/Makefile +/.qmake.stash From ec07fe4fdff8680f3e378904a704e308fa87c210 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:38:31 +0200 Subject: [PATCH 13/25] project: add README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..93cc1a8 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# `dragger` + +Drag files from CLI, without the need to open a GUI. + +## Usage + +Simply issue the command: + +```bash +dragger [FILES...] +``` + +`dragger` will initiate a drag-and-drop operation for all files and directories +provided as arguments. From e852239a4510600fc73993b4b39772842bbfff5d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:55:14 +0200 Subject: [PATCH 14/25] nix: use 'qt5.mkDerivation' --- flake.nix | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 22e0da6..ee8d592 100644 --- a/flake.nix +++ b/flake.nix @@ -85,20 +85,12 @@ }; }) // { overlay = final: prev: { - dragger = with final; stdenv.mkDerivation { + dragger = with final; qt5.mkDerivation { pname = "dragger"; version = "0.0.0"; src = self; - buildInputs = [ - libsForQt5.qt5.qtbase - ]; - - nativeBuildInputs = [ - libsForQt5.qt5.wrapQtAppsHook - ]; - configurePhase = '' qmake ''; From 5b3ea6e976bb07eca77536f81fe0bb1da398f661 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:55:57 +0200 Subject: [PATCH 15/25] project: bump version to v0.1.0 --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ee8d592..8a18a85 100644 --- a/flake.nix +++ b/flake.nix @@ -87,7 +87,7 @@ overlay = final: prev: { dragger = with final; qt5.mkDerivation { pname = "dragger"; - version = "0.0.0"; + version = "0.1.0"; src = self; From 66747de1bb019ff636c37977e4a8b618c1aa0cf4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 15:27:52 +0200 Subject: [PATCH 16/25] clang-format: fix break of arguments --- .clang-format | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index f47e7d6..22d4205 100644 --- a/.clang-format +++ b/.clang-format @@ -7,4 +7,8 @@ Language: Cpp # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Left + +# Break after every argument or not at all +BinPackArguments: false +BinPackParameters: false --- From 5002193c63f33695504f8682f32a17a583ecb9a0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 15:27:36 +0200 Subject: [PATCH 17/25] dragger: use actual argument parsing --- src/dragger.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/dragger.cc b/src/dragger.cc index 87c59e4..7c08b83 100644 --- a/src/dragger.cc +++ b/src/dragger.cc @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -9,10 +10,23 @@ int main(int argc, char* argv[]) { QApplication app(argc, argv); + QApplication::setApplicationName("dragger"); + QApplication::setApplicationVersion("0.1.0"); + + QCommandLineParser parser; + parser.setApplicationDescription("A CLI drag-and-drop tool"); + parser.addHelpOption(); + parser.addVersionOption(); + parser.addPositionalArgument( + "files", + QCoreApplication::translate("files", "files to drag-and-drop"), + "[FILES...]"); + + parser.process(app); QList urls; - for (int i = 1; i < argc; ++i) { - QFileInfo file(QFile(argv[i])); + for (auto const& path : parser.positionalArguments()) { + QFileInfo file{QFile{path}}; if (file.exists()) { urls << QUrl("file:" + file.absoluteFilePath()); } else { From 9d0f311598608ef5d86188c55080454a6f6817e2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 15:28:53 +0200 Subject: [PATCH 18/25] nix: use current directory for 'pre-commit' hooks The behaviour makes more sense when e.g: one modifies the clang-format rules but has not committed them yet. --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 8a18a85..56c5c1c 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,7 @@ checks = { pre-commit = pre-commit-hooks.lib.${system}.run { - src = self; + src = ./.; hooks = { clang-format = { From bc54c3a6f60a61aa92563846fe6613b50d141216 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 15:46:27 +0200 Subject: [PATCH 19/25] nix: use 'inputsFrom' --- flake.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 56c5c1c..dc173c2 100644 --- a/flake.nix +++ b/flake.nix @@ -72,10 +72,9 @@ defaultPackage = packages.dragger; devShell = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ ] - ++ defaultPackage.nativeBuildInputs - ++ defaultPackage.buildInputs - ; + inputsFrom = with packages; [ + dragger + ]; inherit (checks.pre-commit) shellHook; }; From f8687ee5bd397319a5af05feaaf2498abd0a6ee0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 9 Oct 2021 13:24:06 +0200 Subject: [PATCH 20/25] nix: bump inputs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 00c49b4..f54086e 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ ] }, "locked": { - "lastModified": 1631170176, - "narHash": "sha256-RLN/kur2Kpxt0cJp0Fms8ixuGpT8IHX0OpeQ8u8f0X4=", + "lastModified": 1633726775, + "narHash": "sha256-imcgx7bHP0qzRNu31jknZAzze71pWnEbMbnBcZYxXMg=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "3ed0e618cebc1ff291c27b749cf7568959cac028", + "rev": "77b45d526e4dcc1f26ce449f5dc561f2e6eb5db6", "type": "github" }, "original": { From 74825f34a777282ec7e153a6e57b7e95ca24a319 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 9 Oct 2021 13:24:24 +0200 Subject: [PATCH 21/25] nix: use upstream 'clang-format' hook --- flake.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index dc173c2..f39bfbf 100644 --- a/flake.nix +++ b/flake.nix @@ -54,10 +54,7 @@ hooks = { clang-format = { enable = true; - name = "clang-format"; - entry = "${pkgs.clang-tools}/bin/clang-format -style=file -i"; - types = [ "text" "c++" ]; - language = "system"; + types_or = [ "c++" ]; }; nixpkgs-fmt = { From 5ff0fb460db59c60d4f02d085569c1576dfdd520 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 1 Apr 2023 16:51:49 +0100 Subject: [PATCH 22/25] ci: add Woodpecker CI workflow --- .woodpecker/check.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .woodpecker/check.yml diff --git a/.woodpecker/check.yml b/.woodpecker/check.yml new file mode 100644 index 0000000..921c363 --- /dev/null +++ b/.woodpecker/check.yml @@ -0,0 +1,31 @@ +labels: + type: exec + +pipeline: +- name: flake check + image: bash + commands: + - nix flake check + +- name: package check + image: bash + commands: + - nix build + +- name: notify + image: bash + secrets: + - source: matrix_roomid + target: room + - source: matrix_username + target: user + - source: matrix_password + target: pass + - source: matrix_homeserver + target: address + commands: + - nix run github:ambroisie/matrix-notifier + when: + status: + - failure + - success From 2c807f6a52c4df22243e2a6d18f92b8be7030bd9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 1 Apr 2023 16:54:45 +0100 Subject: [PATCH 23/25] nix: fix 'flake-utils' branch --- flake.lock | 2 +- flake.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index f54086e..d5e8fb4 100644 --- a/flake.lock +++ b/flake.lock @@ -11,7 +11,7 @@ }, "original": { "owner": "numtide", - "ref": "master", + "ref": "main", "repo": "flake-utils", "type": "github" } diff --git a/flake.nix b/flake.nix index f39bfbf..84c960e 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ type = "github"; owner = "numtide"; repo = "flake-utils"; - ref = "master"; + ref = "main"; }; nixpkgs = { From eacb0230ddd78070e6c07c6e1b0be71d17d64810 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 1 Apr 2023 16:56:14 +0100 Subject: [PATCH 24/25] nix: fix 'maintainers' --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 84c960e..7e5ca9b 100644 --- a/flake.nix +++ b/flake.nix @@ -100,7 +100,7 @@ description = "A CLI drag-and-drop tool"; homepage = "https://gitea.belanyi.fr/ambroisie/dragger"; license = licenses.mit; - maintainers = [ ambroisie ]; + maintainers = with maintainers; [ ambroisie ]; platforms = platforms.all; }; }; From 79da9d8074aca0ecb2c0aea2e0199fd20f5bcd6a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 1 Apr 2023 16:56:24 +0100 Subject: [PATCH 25/25] nix: bump inputs --- flake.lock | 76 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index d5e8fb4..37d0752 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,28 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { - "lastModified": 1631561581, - "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -16,13 +32,34 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1633329294, - "narHash": "sha256-0LpQLS4KMgxslMgmDHmxG/5twFlXDBW9z4Or1iOrCvU=", + "lastModified": 1680273054, + "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ee084c02040e864eeeb4cf4f8538d92f7c675671", + "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", "type": "github" }, "original": { @@ -32,21 +69,40 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { + "flake-compat": "flake-compat", "flake-utils": [ "flake-utils" ], + "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" - ] + ], + "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1633726775, - "narHash": "sha256-imcgx7bHP0qzRNu31jknZAzze71pWnEbMbnBcZYxXMg=", + "lastModified": 1680170909, + "narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "77b45d526e4dcc1f26ce449f5dc561f2e6eb5db6", + "rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816", "type": "github" }, "original": {