# 按照官方的编译步骤,使用 nix 编译。 make test 编译成功,但是 make build 出现如下错误: djc@jetron-djc:/mnt/c/Users/DJC/Documents/develop/0me/headscale-0.26.1$ make build nix build error: … while calling the 'derivationStrict'builtin at <nix/derivation-internal.nix>:37:12: 36| 37| strict = derivationStrict drvAttrs; | ^ 38|
… while evaluating the derivation attribute 'name' at /nix/store/qmm7hgw60vp7vj9lma95hl329d0j3n6n-source/pkgs/stdenv/generic/make-derivation.nix:438:13: 437| // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 438| name = | ^ 439| let
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: attribute 'dirtyShortRev' missing at /nix/store/wrx2gzxp6f5sdha4kswnpn6j8sqmfbnk-source/flake.nix:15:41: 14| }: let 15| headscaleVersion = self.shortRev or self.dirtyShortRev; | ^ 16| commitHash = self.rev or self.dirtyRev; make: *** [Makefile:20: build] Error 1
解决方法:
编辑 flake.nix 文件,
将 headscaleVersion = self.shortRev or self.dirtyShortRev; 修改成:
1 2 3 4 5
headscaleVersion = if self ? shortRev then self.shortRev else if self ? dirtyShortRev then self.dirtyShortRev else "v0.26.1";
root@jetron-djc:~# nix develop path '/root' does not contain a 'flake.nix', searching up error: could not find a flake.nix file
这个错误是因为 nix develop 命令需要在包含 flake.nix 文件的目录中运行,请 cd 到你项目的目录执行 nix develop。
问题5
1 2 3 4
=== Failed === FAIL: hscontrol/db TestConstraints/no-duplicate-username-if-no-oidc-postgres (0.05s) db_test.go:404: start postgres: initdb: initdb: error: cannot be run as root initdb: hint: Please login (using, e.g., "su") as the (unprivileged) user that will own the server process.