feat: add flake support

This commit is contained in:
Louis Dalibard 2024-07-10 14:03:43 +02:00
parent 88edaabc0d
commit de73c66c26

115
flake.nix
View File

@ -7,7 +7,12 @@
}; };
outputs = outputs =
inputs@{ self, nixpkgs, utils, ... }: inputs@{
self,
nixpkgs,
utils,
...
}:
utils.lib.eachSystem utils.lib.eachSystem
[ [
"x86_64-linux" "x86_64-linux"
@ -21,7 +26,9 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in
{ {
packages.kon = with pkgs; (buildGoModule rec { packages.kon =
with pkgs;
(buildGoModule rec {
pname = "kon"; pname = "kon";
version = "0.0.1"; version = "0.0.1";
@ -60,65 +67,67 @@
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libs} --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libs}
''; '';
}); });
packages.adam-gui = pkgs.symlinkJoin { name = "adam-gui"; packages.adam-gui = pkgs.symlinkJoin {
paths = with pkgs; [ name = "adam-gui";
(buildGoModule rec { version = "0.0.1";
pname = "adam-gui"; paths = with pkgs; [
version = "0.0.1"; (buildGoModule rec {
pname = "adam-gui";
version = "0.0.1";
buildInputs = [ buildInputs = [
gcc gcc
go go
] ++ libs; ] ++ libs;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
addOpenGLRunpath addOpenGLRunpath
makeWrapper makeWrapper
]; ];
subPackages = [ "." ]; subPackages = [ "." ];
src = fetchFromGitea { src = fetchFromGitea {
domain = "git.ontake.dev"; domain = "git.ontake.dev";
owner = "go"; owner = "go";
repo = "adam-gui"; repo = "adam-gui";
rev = "a64eabcfd4a85d2a3fe3e88c8f668af2c4db741d"; rev = "a64eabcfd4a85d2a3fe3e88c8f668af2c4db741d";
hash = "sha256-igJie5yYj7LndBGd5XA7GU0qWalrK5j+YM0hCFunXVY="; hash = "sha256-igJie5yYj7LndBGd5XA7GU0qWalrK5j+YM0hCFunXVY=";
}; };
vendorHash = null; vendorHash = null;
meta = with lib; { meta = with lib; {
description = "A simple GUI for ADAM branded scales"; description = "A simple GUI for ADAM branded scales";
homepage = "https://git.ontake.dev/go/adam-gui"; homepage = "https://git.ontake.dev/go/adam-gui";
license = licenses.gpl3; license = licenses.gpl3;
maintainers = [ ]; maintainers = [ ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
postInstall = '' postInstall = ''
wrapProgram "$out/bin/adam-gui" \ wrapProgram "$out/bin/adam-gui" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libs} --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath libs}
''; '';
postFixup = '' postFixup = ''
addOpenGLRunpath $out/bin/adam-gui addOpenGLRunpath $out/bin/adam-gui
''; '';
}) })
(makeDesktopItem { (makeDesktopItem {
name = "ADAM GUI"; name = "ADAM GUI";
desktopName = "ADAM GUI"; desktopName = "ADAM GUI";
exec = "adam-gui"; exec = "adam-gui";
icon = "adam-gui"; icon = "adam-gui";
comment = "A simple GUI for ADAM branded scales."; comment = "A simple GUI for ADAM branded scales.";
categories = [ categories = [
"Science" "Science"
"Utility" "Utility"
]; ];
}) })
]; ];
}; };
} }
); );
} }