Skip to content

Commit

Permalink
chore: add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
acristoffers committed Mar 1, 2024
1 parent 6bca908 commit 8d927db
Show file tree
Hide file tree
Showing 8 changed files with 4,066 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
result
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
description = "A Gnome extension to mimic macOS's Rectangle tiling.";

inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
flake-utils.url = github:numtide/flake-utils;

gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, gitignore }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (gitignore.lib) gitignoreSource;
pkgs = (import nixpkgs) { inherit system; };
nodejs = pkgs.nodejs;
node2nixOutput = import ./nix { inherit pkgs nodejs system; };
nodeDeps = node2nixOutput.nodeDependencies;
buildDependencies = with pkgs; [
busybox
glib
nodejs
typescript
zip
];
in
{
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
packages.default = pkgs.stdenv.mkDerivation {
name = "gnome-extensions-rectangle";
version = "master";
src = gitignoreSource ./.;
nativeBuildInputs = buildDependencies;
dontCheck = true;
dontConfigure = true;
dontFixup = true;
buildPhase = ''
runHook preBuild
ln -sf ${nodeDeps}/lib/node_modules ./node_modules
make pack
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/gnome-shell/extensions/[email protected]
unzip rectangle.zip -d $out/share/gnome-shell/extensions/[email protected]
cp rectangle.zip $out/
runHook postInstall
'';
};
devShell = pkgs.mkShell {
packages = buildDependencies;
};
}
);
}
17 changes: 17 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file has been generated by node2nix 1.11.1. Do not edit!

{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:

let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-package.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}
Loading

0 comments on commit 8d927db

Please sign in to comment.