From a968e4f76150eac21035bdd22f585136e343bfca Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:30:53 +0200 Subject: [PATCH 1/5] nix: add flake --- flake.lock | 69 ++++++++++++++++++++++++++++++ flake.nix | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 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..bcd33ad --- /dev/null +++ b/flake.nix @@ -0,0 +1,120 @@ +{ + 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.1.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 7c6a5e58cc947f8eb5eaf392a5a866c0fc5388d6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:42:27 +0200 Subject: [PATCH 2/5] 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 49658de1d89380628b57ddfe385b246139de2661 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:01 +0200 Subject: [PATCH 3/5] 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 dbc10b50666fec1f2593b023b2765a221340ad9e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:31:08 +0200 Subject: [PATCH 4/5] 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 ed45ad9b6f90336d6856ccf745b684368b43c26c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 8 Oct 2021 14:38:31 +0200 Subject: [PATCH 5/5] 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.