flake: add ${projname} var instead of a literal
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-07 22:47:43 +02:00
parent 06485ba003
commit f58122320b
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -19,6 +19,8 @@
outputs = { self, nixgl, nix-filter, nixpkgs, ... }:
let
projname = "go-xkcdreader";
# to work with older version of flakes
lastModifiedDate =
self.lastModifiedDate or self.lastModified or "19700101";
@ -54,7 +56,7 @@
in
rec {
go-xkcdreader = with pkgs; buildGoModule rec {
pname = "go-xkcdreader";
pname = "${projname}";
buildInputs = [
gcc
libglvnd # instead of libGL
@ -107,7 +109,7 @@
meta = {
description = "an offline-capable xkcd webcomic reader written in Go";
homepage = "https://git.dotya.ml/wanderer/go-xkcdreader";
homepage = "https://git.dotya.ml/wanderer/${projname}";
license = lib.licenses.gpl3;
maintainers = [ "wanderer" ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
@ -121,7 +123,7 @@
go-xkcdreader = {
type = "app";
program =
"${self.packages.${system}.go-xkcdreader}/bin/go-xkcdreader";
"${self.packages.${system}.${projname}}/bin/${projname}";
};
default = go-xkcdreader;
});
@ -154,7 +156,7 @@
nix-store --query --references $(nix-instantiate shell.nix) | \
xargs nix-store --realise | \
xargs nix-store --query --requisites | \
cachix push go-xkcdreader
cachix push ${projname}
'';
add-license = pkgs.writeShellScriptBin "add-license" ''
go run github.com/google/addlicense@v1.0.0 -v \
@ -165,7 +167,7 @@
{
default = with pkgs; mkShell
{
name = "go-xkcdreader-" + version;
name = "${projname}-" + version;
GOFLAGS = "-buildmode=pie -trimpath -mod=readonly -modcacherw";
GOLDFLAGS = "-s -w -X cmd.version=${version}";