feat: add nix package with gomod2nix

This commit is contained in:
Tulili 2024-01-12 04:13:48 -03:00
parent c59bc6958e
commit f7ca05f296
No known key found for this signature in database
5 changed files with 231 additions and 0 deletions

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
{
description = "Quick ";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
gomod2nix.url = "github:nix-community/gomod2nix";
gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
gomod2nix.inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, nixpkgs, flake-utils, gomod2nix }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
in {
packages.default = pkgs.callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
};
packages.updater = pkgs.writeShellScriptBin "updater" ''
set -euo pipefail
echo "WARNING: This package is for updating this nix package! You should also update default.nix release variable if you wanna update this too"
${pkgs.nix}/bin/nix run github:nix-community/gomod2nix
'';
devShells.default = pkgs.mkShell {
packages = with pkgs; [ nil go gopls ];
};
}
);
}