Use flakes vs devbox (#723)

Reviewed-on: https://gitea.com/gitea/tea/pulls/723
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
This commit is contained in:
techknowlogick 2025-02-27 18:33:37 +00:00 committed by techknowlogick
parent 47ee397110
commit 60636cd7d8
6 changed files with 98 additions and 39 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

7
.gitignore vendored
View File

@ -1,4 +1,4 @@
tea /tea
/gitea-vet /gitea-vet
/gitea-vet.exe /gitea-vet.exe
@ -12,3 +12,8 @@ vendor/
coverage.out coverage.out
dist/ dist/
# Nix-specific
.direnv/
result
result-*

View File

@ -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"
}
}
}

View File

@ -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"
}
}
}

61
flake.lock generated Normal file
View File

@ -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
}

30
flake.nix Normal file
View File

@ -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.'
'';
};
}
);
}