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

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