Nix: Pass -Dcpu=baseline to zig build (#739)

* update flake.lock

* Nix: Pass `-Dcpu=baseline` to `zig build`
This commit is contained in:
Sage Hane 2022-11-03 18:44:01 +00:00 committed by GitHub
parent 690189a5a7
commit 6420296a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 18 deletions

View File

@ -1,5 +1,6 @@
{ pkgs ? import <nixpkgs> {}, { pkgs ? import <nixpkgs> { }
system ? builtins.currentSystem }: , system ? builtins.currentSystem
}:
let let
zig-overlay = pkgs.fetchFromGitHub { zig-overlay = pkgs.fetchFromGitHub {
@ -26,7 +27,7 @@ pkgs.stdenvNoCC.mkDerivation {
dontInstall = true; dontInstall = true;
buildPhase = '' buildPhase = ''
mkdir -p $out mkdir -p $out
zig build install -Drelease-safe=true -Ddata_version=master --prefix $out zig build install -Dcpu=baseline -Drelease-safe=true -Ddata_version=master --prefix $out
''; '';
XDG_CACHE_HOME = ".cache"; XDG_CACHE_HOME = ".cache";
} }

View File

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1667395993,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,11 +68,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1665695307, "lastModified": 1667292599,
"narHash": "sha256-Nt0ZBvRjQaZFVcYH5kwnCO6EUnSbL5zTf12NIIfHDeA=", "narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e858db900443414fd8dd2f78c3ecb47df3febc44", "rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -99,11 +99,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1665663057, "lastModified": 1667477360,
"narHash": "sha256-k42CNjlArnr64st2EBlDiZzo0jBzCs6eta7zeb2KH6w=", "narHash": "sha256-EE1UMXQr4FkQFGoOHDslqi3Q7V2BUkLMrOBeV/UJYoE=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "049f82ae9bc43f9ced8e3aa52f936b186c09c85f", "rev": "c8900204fcd5c09ab0c9b7bb7f4d04dacab3c462",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -18,11 +18,13 @@
let let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
inherit (gitignore.lib) gitignoreSource; inherit (gitignore.lib) gitignoreSource;
in flake-utils.lib.eachSystem systems (system: in
flake-utils.lib.eachSystem systems (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
zig = zig-overlay.packages.${system}.master; zig = zig-overlay.packages.${system}.master;
in rec { in
rec {
packages.default = packages.zls; packages.default = packages.zls;
packages.zls = pkgs.stdenvNoCC.mkDerivation { packages.zls = pkgs.stdenvNoCC.mkDerivation {
name = "zls"; name = "zls";
@ -33,7 +35,7 @@
dontInstall = true; dontInstall = true;
buildPhase = '' buildPhase = ''
mkdir -p $out mkdir -p $out
zig build install -Drelease-safe=true -Ddata_version=master -Dknown-folders=${known-folders}/known-folders.zig --prefix $out zig build install -Dcpu=baseline -Drelease-safe=true -Ddata_version=master -Dknown-folders=${known-folders}/known-folders.zig --prefix $out
''; '';
XDG_CACHE_HOME = ".cache"; XDG_CACHE_HOME = ".cache";
}; };