Working with nix

This commit is contained in:
Henry Hiles 2025-08-10 16:21:07 -04:00
commit 442b0f567d
No known key found for this signature in database
4 changed files with 26 additions and 53 deletions

View file

@ -9,27 +9,33 @@
systems = ["x86_64-linux" "aarch64-linux"];
perSystem = {
lib,
self',
pkgs,
system,
...
}: {
}: let
name = "auto-rotate";
uuid = "${name}@henryhiles.com";
extDir = "share/gnome-shell/extensions/${uuid}";
in {
_module.args.pkgs = import inputs.nixpkgs {inherit system;};
packages.default = pkgs.stdenv.mkDerivation {
pname = "auto-rotate";
packages.default = pkgs.buildNpmPackage (finalAttrs: {
pname = name;
version = "1.0.0";
src = ./.;
nativeBuildInputs = with pkgs; [nodejs glib.dev typescript zip];
nativeBuildInputs = with pkgs; [typescript];
npmDepsHash = "sha256-YlKPinb6wmpo6kL/lL7DQnhVmnR9zJaIOKGzBg9kvRM=";
buildPhase = ''
npm install
tsc
cp metadata.json dist/
'';
installPhase = ''
cp -r dist/* $out/
cp metadata.json $out/
mkdir -p $out/${extDir}
cp -r dist/* $out/${extDir}
'';
meta = {
@ -38,23 +44,18 @@
license = lib.licenses.gpl3Only;
maintainers = [lib.maintainers.quadradical];
};
};
});
# apps.build = {
# type = "app";
# program = pkgs.writeShellApplication {
# name = "build";
# runtimeInputs = ;
# text = let
# name = "auto-rotate";
# in ''
# npm install
# tsc
# cp metadata.json dist/
# env -C dist zip ../${name}.zip -9r .
# '';
# };
# };
apps.install = {
type = "app";
program = let
file = "/tmp/${uuid}.zip";
in
pkgs.writeShellScriptBin "build" ''
env -C ${self'.packages.default}/${extDir} ${lib.getExe pkgs.zip} ${file} -FS9r .
gnome-extensions install --force ${file}
'';
};
};
};
}