nix: build directly with buildGoModules
Since we have no dependencies, we don't need a vendor hash, so doing this actually makes sense. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
1f72c30033
commit
09507a541b
44
flake.nix
44
flake.nix
|
@ -5,29 +5,49 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
|
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
outputs =
|
||||||
|
{ self, nixpkgs }:
|
||||||
let
|
let
|
||||||
supportedSystems = [ "x86_64-linux" ];
|
supportedSystems = [ "x86_64-linux" ];
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells = forAllSystems
|
devShells = forAllSystems (
|
||||||
(system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs { inherit system; };
|
||||||
inherit system;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = with pkgs; mkShell
|
default =
|
||||||
{
|
let
|
||||||
|
inherit (pkgs)
|
||||||
|
mkShell
|
||||||
|
buildGoModule
|
||||||
|
acl
|
||||||
|
xorg
|
||||||
|
;
|
||||||
|
in
|
||||||
|
mkShell {
|
||||||
packages = [
|
packages = [
|
||||||
clang
|
(buildGoModule rec {
|
||||||
|
pname = "ego";
|
||||||
|
version = "flake";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
vendorHash = null; # we have no dependencies :3
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
"-s"
|
||||||
|
"-w"
|
||||||
|
"-X"
|
||||||
|
"main.Version=v${version}"
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
acl
|
acl
|
||||||
xorg.libxcb
|
xorg.libxcb
|
||||||
(pkgs.writeShellScriptBin "build" ''
|
];
|
||||||
go build -v -ldflags '-s -w -X main.Version=flake'
|
})
|
||||||
'')
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue