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

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": 1743814133,
"narHash": "sha256-drDyYyUmjeYGiHmwB9eOPTQRjmrq3Yz26knwmMPLZFk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "250b695f41e0e2f5afbf15c6b12480de1fe0001b",
"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
}

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);
}