78 lines
2.2 KiB
Nix
78 lines
2.2 KiB
Nix
{
|
|
inputs = {
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
};
|
|
|
|
outputs = inputs:
|
|
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
|
systems = ["x86_64-linux" "aarch64-linux"];
|
|
perSystem = {
|
|
lib,
|
|
self',
|
|
pkgs,
|
|
system,
|
|
...
|
|
}: let
|
|
name = "fullscreen-rotate";
|
|
uuid = "${name}@henryhiles.com";
|
|
extDir = "share/gnome-shell/extensions/${uuid}";
|
|
in {
|
|
_module.args.pkgs = import inputs.nixpkgs {inherit system;};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [nodejs];
|
|
};
|
|
|
|
packages.default = pkgs.buildNpmPackage (finalAttrs: {
|
|
pname = name;
|
|
version = "1.0.1";
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [typescript];
|
|
npmDepsHash = "sha256-t2WNmLP6ip1sraRgQRsETuarw3D2bDVMfuhzQtpR/z4=";
|
|
|
|
buildPhase = ''
|
|
tsc
|
|
cp metadata.json dist/
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/${extDir}
|
|
cp -r dist/* $out/${extDir}
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "https://git.federated.nexus/Henry-Hiles/fullscreen-rotate";
|
|
description = "An extension to automatically rotate the screen when a window is fullscreened, useful for GNOME Shell Mobile.";
|
|
license = lib.licenses.gpl3Only;
|
|
maintainers = [lib.maintainers.quadradical];
|
|
};
|
|
});
|
|
|
|
apps = let
|
|
file = "/tmp/${uuid}.zip";
|
|
zip = "env -C ${self'.packages.default}/${extDir} ${lib.getExe pkgs.zip} ${file} -FS9r .";
|
|
in {
|
|
default = {
|
|
type = "app";
|
|
program = pkgs.writeShellScriptBin "build" ''
|
|
${zip}
|
|
gnome-extensions install --force ${file}
|
|
dbus-run-session -- gnome-shell --nested --wayland
|
|
'';
|
|
};
|
|
build = {
|
|
type = "app";
|
|
program = let
|
|
file = "/tmp/${uuid}.zip";
|
|
in
|
|
pkgs.writeShellScriptBin "build" ''
|
|
${zip}
|
|
cp ${file} .
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|