From 60636cd7d88d160cec199ca56bc51bc4755af070 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Thu, 27 Feb 2025 18:33:37 +0000 Subject: [PATCH] Use flakes vs devbox (#723) Reviewed-on: https://gitea.com/gitea/tea/pulls/723 Co-authored-by: techknowlogick Co-committed-by: techknowlogick --- .envrc | 1 + .gitignore | 7 +++++- devbox.json | 15 ------------- devbox.lock | 23 -------------------- flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 .envrc delete mode 100644 devbox.json delete mode 100644 devbox.lock create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..7f8af4d --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1dc5a9f..ee80700 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -tea +/tea /gitea-vet /gitea-vet.exe @@ -12,3 +12,8 @@ vendor/ coverage.out dist/ + +# Nix-specific +.direnv/ +result +result-* diff --git a/devbox.json b/devbox.json deleted file mode 100644 index 59a7f50..0000000 --- a/devbox.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "packages": [ - "go@1.24.0", - "gopls@latest", - "gnumake@latest" - ], - "shell": { - "init_hook": [ - "echo 'Welcome to tea. Check out the Makefile for runnable targets.'" - ], - "scripts": { - "build": "make" - } - } -} diff --git a/devbox.lock b/devbox.lock deleted file mode 100644 index f39999e..0000000 --- a/devbox.lock +++ /dev/null @@ -1,23 +0,0 @@ -{ - "lockfile_version": "1", - "packages": { - "gnumake@latest": { - "last_modified": "2023-08-30T00:25:28Z", - "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#gnumake", - "source": "devbox-search", - "version": "4.4.1" - }, - "go@1.20": { - "last_modified": "2023-08-30T00:25:28Z", - "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#go", - "source": "devbox-search", - "version": "1.20.7" - }, - "gopls@latest": { - "last_modified": "2023-08-30T00:25:28Z", - "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#gopls", - "source": "devbox-search", - "version": "0.13.2" - } - } -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..45ebada --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1740547748, + "narHash": "sha256-Ly2fBL1LscV+KyCqPRufUBuiw+zmWrlJzpWOWbahplg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3a05eebede89661660945da1f151959900903b6a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e4d25d7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Tea - A command line tool to interact with Gitea"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + name = "tea-dev-environment"; + buildInputs = with pkgs; [ + go_1_24 + gopls + gnumake + # Add other dependencies here if needed + ]; + + shellHook = '' + echo 'Welcome to tea. Check out the Makefile for runnable targets.' + ''; + }; + } + ); +} \ No newline at end of file