Working with nix
This commit is contained in:
parent
3ae912d420
commit
442b0f567d
4 changed files with 26 additions and 53 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1 @@
|
|||
dist/
|
||||
.direnv/
|
||||
node_modules/
|
||||
.direnv/
|
27
Makefile
27
Makefile
|
@ -1,27 +0,0 @@
|
|||
NAME=auto-rotate
|
||||
DOMAIN=henryhiles.com
|
||||
|
||||
.PHONY: all pack install clean
|
||||
|
||||
all: dist/extension.js
|
||||
|
||||
node_modules: package.json
|
||||
npm install
|
||||
|
||||
dist/extension.js: node_modules
|
||||
tsc
|
||||
|
||||
|
||||
$(NAME).zip: dist/extension.js
|
||||
@cp metadata.json dist/
|
||||
@(cd dist && zip ../$(NAME).zip -9r .)
|
||||
|
||||
pack: $(NAME).zip
|
||||
|
||||
install: $(NAME).zip
|
||||
@touch ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||
@rm -rf ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||
@mv dist ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||
|
||||
clean:
|
||||
@rm -rf dist node_modules $(NAME).zip
|
47
flake.nix
47
flake.nix
|
@ -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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "NodeNext",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "./dist",
|
||||
"sourceMap": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue