default.nix: add option for static build
This commit is contained in:
parent
eeeaa00de6
commit
47f4f46e65
13
default.nix
13
default.nix
@ -1,13 +1,16 @@
|
|||||||
|
{ static ? false # whether to build fully static binaries
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
nixpkgs = builtins.fetchTarball
|
nixpkgs = import (builtins.fetchTarball
|
||||||
{ url = "https://github.com/NixOS/nixpkgs/archive/f12ee5f64c6a.tar.gz";
|
{ url = "https://github.com/NixOS/nixpkgs/archive/f12ee5f64c6a.tar.gz";
|
||||||
sha256 = "14afxk35w3kbqimxcp39ngv9cqpc24glss1727ymk4napfg5v7hm";
|
sha256 = "14afxk35w3kbqimxcp39ngv9cqpc24glss1727ymk4napfg5v7hm";
|
||||||
};
|
}) { };
|
||||||
|
|
||||||
pkgs = import <nixpkgs> { };
|
pkgs = if static then nixpkgs.pkgsStatic else nixpkgs;
|
||||||
|
|
||||||
magnetico = { lib, buildGoModule, nixosTests, sqlite }:
|
magnetico = { lib, stdenv, buildGoModule, nixosTests, sqlite }:
|
||||||
buildGoModule {
|
buildGoModule {
|
||||||
pname = "magnetico";
|
pname = "magnetico";
|
||||||
version = "0.12.1";
|
version = "0.12.1";
|
||||||
@ -21,6 +24,8 @@ let
|
|||||||
tags = [ "fts5" "libsqlite3" ];
|
tags = [ "fts5" "libsqlite3" ];
|
||||||
ldflags = [ "-s" "-w" ];
|
ldflags = [ "-s" "-w" ];
|
||||||
|
|
||||||
|
doCheck = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
passthru.tests = { inherit (nixosTests) magnetico; };
|
passthru.tests = { inherit (nixosTests) magnetico; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user