support nix

This commit is contained in:
dongsu8142
2023-07-23 13:41:04 +09:00
parent d30f2e9a91
commit 609b4c5903
5 changed files with 174 additions and 0 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ _build
build
run.sh
tmp
result

48
flake.lock generated Normal file
View File

@@ -0,0 +1,48 @@
{
"nodes": {
"dongsu8142-nur": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1690083492,
"narHash": "sha256-UoIG+sl44U38FTmM2+m4X2Qi5aivjITcUxAkVHouZl4=",
"owner": "dongsu8142",
"repo": "nur",
"rev": "7f5c7067a482e96fe3787e07a54e21041a4d15c0",
"type": "github"
},
"original": {
"owner": "dongsu8142",
"repo": "nur",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1690031011,
"narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "12303c652b881435065a98729eb7278313041e49",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"dongsu8142-nur": "dongsu8142-nur",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View File

@@ -0,0 +1,31 @@
{
description = "A customizable and extensible shell for Hyprland";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
dongsu8142-nur = {
url = "github:dongsu8142/nur";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
self,
nixpkgs,
...
}: let
lib = nixpkgs.lib;
genSystems = lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
pkgsFor = genSystems (system:
import nixpkgs {
inherit system;
}
);
in {
packages = genSystems (system: {
default = pkgsFor.${system}.callPackage ./nix/default.nix { inherit inputs; };
});
};
}

68
nix/default.nix Normal file
View File

@@ -0,0 +1,68 @@
{
lib,
stdenv,
system,
inputs,
buildNpmPackage,
fetchFromGitHub,
nodePackages,
meson,
pkg-config,
ninja,
gobject-introspection,
gtk3,
libpulseaudio
}:
let
custom = ./custom;
in
stdenv.mkDerivation {
pname = "ags";
version = "1.0.0";
src = buildNpmPackage {
name = "ags";
src = fetchFromGitHub {
owner = "Aylur";
repo = "ags";
rev = "refs/heads/main";
sha256 = "sha256-ht9kA5uNOH09xWnsnpUOZ+F2SXps605zxxip54WE420=";
fetchSubmodules = true;
};
dontBuild = true;
npmDepsHash = "sha256-e1YYtWiO/dN7w2s+En3+3gc98R/hM5pJnTK7kCCH8Mc=";
installPhase = ''
mkdir $out
cp -r * $out
'';
};
patches = [
./lib-path.patch
];
nativeBuildInputs = [
nodePackages.typescript
meson
pkg-config
ninja
];
buildInputs = [
gobject-introspection
inputs.dongsu8142-nur.packages.${system}.gtk-gjs
gtk3
libpulseaudio
];
meta = with lib; {
description = "A customizable and extensible shell for Hyprland";
homepage = "https://github.com/Aylur/ags";
platforms = [ "x86_64-linux" "aarch64-linux" ];
license = licenses.gpl3;
};
}

26
nix/lib-path.patch Normal file
View File

@@ -0,0 +1,26 @@
diff --git a/meson.build b/meson.build
index 63b3e6d..62fc8b8 100644
--- a/meson.build
+++ b/meson.build
@@ -16,7 +16,7 @@ subproject('gvc',
default_options: [
'package_name=' + APP,
'pkgdatadir=' + get_option('datadir') / APP,
- 'pkglibdir=' + get_option('libdir') / APP,
+ 'pkglibdir=' + get_option('libdir'),
'static=false',
'introspection=true',
'alsa=false'
diff --git a/src/meson.build b/src/meson.build
index 44ee0a5..d96615a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -27,7 +27,7 @@ app_launcher = configure_file(
output : APP,
configuration: {
'GJS': find_program('gjs').full_path(),
- 'GVC_GIR': get_option('prefix') / get_option('libdir') / APP,
+ 'GVC_GIR': get_option('prefix') / get_option('libdir'),
'PACKAGE_NAME': APP,
'PACKAGE_VERSION': meson.project_version(),
'PREFIX': get_option('prefix'),