Add flake.nix

This commit is contained in:
Dave Gallant
2025-04-06 21:54:58 -04:00
parent 98bb23ee28
commit 5c069cb289
2 changed files with 107 additions and 0 deletions

46
flake.nix Normal file
View File

@@ -0,0 +1,46 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
let
vpngate =
pkgs:
pkgs.buildGo123Module rec {
name = "vpngate";
src = ./.;
vendorHash = "sha256-sx56YaeXMkxnzrA2pL1Ghu4pQYCRL7JNd1UGlCtLHJg=";
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.makeWrapper ];
env.CGO_ENABLED = 0;
doCheck = false;
};
flakeForSystem =
nixpkgs: system:
let
pkgs = nixpkgs.legacyPackages.${system};
vg = vpngate pkgs;
in
{
packages = {
default = vg;
vpngate = vg;
};
devShell = pkgs.mkShell {
packages = with pkgs; [
gopls
gotools
go_1_23
];
};
};
in
flake-utils.lib.eachDefaultSystem (system: flakeForSystem nixpkgs system);
}