feat: add nix flake

This commit is contained in:
Technofab 2023-05-23 18:30:41 +02:00
parent 5eb92a0677
commit 43de744f09
No known key found for this signature in database
GPG key ID: A0AA746B951C8830
2 changed files with 75 additions and 0 deletions

41
flake.lock generated Normal file
View file

@ -0,0 +1,41 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1684661732,
"narHash": "sha256-2/Xo/UmUUoMXc0T5tzoUsYjMLLMjEfzRWDAQB0WwtW0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b0671cbf1e5c443f7fbfd4941ee0f8a151435114",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
}
},
"root": "root",
"version": 7
}

34
flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
description = "A jsonnet package manager";
inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
outputs = { self, nixpkgs, systems }:
let
version = "0.5.1";
forEachSystem = nixpkgs.lib.genAttrs (import systems);
nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
in {
# Provide some binary packages for selected system types.
packages = forEachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
jb = pkgs.buildGoModule {
pname = "jsonnet-bundler";
inherit version;
src = ./.;
CGO_ENABLED = 0;
ldflags = [ "-s" "-w" "-X main.Version=${version}" ];
vendorSha256 = "sha256-5a+8emtKjOlSr4V9P2YW5u0FVy9to5rIVfF9i90BCe4=";
doCheck = false;
};
}
);
defaultPackage = forEachSystem (system: self.packages.${system}.jb);
};
}