summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2023-02-12 18:39:54 +0100
committerQuentin Aristote <quentin@aristote.fr>2023-02-15 22:13:57 +0100
commit365a7368718fc52964eb487058a34c7a124e6989 (patch)
tree2f9e0fe71b2edebd0a695d69025430b558da7b74
parent6ea803da80558e269564c99070e92e285cf977ff (diff)
add pkgs
-rw-r--r--flake.nix5
-rw-r--r--pkgs/barista/default.nix36
-rw-r--r--pkgs/default.nix29
-rw-r--r--pkgs/firefox/addons/addons.json16
-rw-r--r--pkgs/firefox/addons/default.nix182
-rw-r--r--pkgs/firefox/user-js/arkenfox.nix8
-rw-r--r--pkgs/fontMetadata/fontawesome.nix16
-rw-r--r--pkgs/fontMetadata/materialDesignIcons.nix17
-rw-r--r--pkgs/gitignore/default.nix16
-rw-r--r--pkgs/icons/default.nix15
-rwxr-xr-xpkgs/icons/generate-package.sh11
-rw-r--r--pkgs/icons/icons.txt3
-rw-r--r--pkgs/lib/home-manager/default.nix11
-rw-r--r--pkgs/lockscreen/default.nix28
14 files changed, 392 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 69149df..52d1b15 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,8 @@
{
- outputs = { self }: {
+ outputs = { self, flake-utils }: {
nixosModules.personal = import ./modules/nixos;
+ overlays.personal = self: super: {
+ personal = import ./pkgs self;
+ };
};
}
diff --git a/pkgs/barista/default.nix b/pkgs/barista/default.nix
new file mode 100644
index 0000000..4c38e46
--- /dev/null
+++ b/pkgs/barista/default.nix
@@ -0,0 +1,36 @@
+{ buildGoModule, fetchFromGitHub, wirelesstools, fontawesomeMetadata, materialDesignIconsMetadata, i3statusGo ? null }:
+
+let useDefaultConfig = i3statusGo == null;
+in buildGoModule {
+ name = "barista";
+ version = "autorelease";
+
+ src = fetchFromGitHub {
+ owner = "soumya92";
+ repo = "barista";
+ rev = "c8725f1d8765e36869eb54272f29c770ce1f2f67";
+ sha256 = "19nvwrr8baf8k0pp7ph07hmjcrxm7kv5j4f2rsfa8m7hgcyarjp4";
+ };
+
+ patchPhase = ''
+ mkdir main
+ '' + (if useDefaultConfig then # use samples/i3status/i3status.go as config
+ ''
+ mv samples/i3status/i3status.go main/i3status.go
+ '' else # import config and patch font loading
+ ''
+ cp ${i3statusGo} main/i3status.go
+ substituteInPlace main/i3status.go \
+ --replace 'fontawesome.Load()' 'fontawesome.Load("${fontawesomeMetadata}")'
+ --replace 'mdi.Load()' 'mdi.Load("${materialDesignIconsMetadata})'
+ '') + # patch call to iwgetid
+ ''
+ substituteInPlace modules/wlan/wlan.go \
+ --replace 'iwgetid' '${wirelesstools}/bin/iwgetid'
+ '';
+
+ subPackages = [ "main/i3status.go" ];
+
+ vendorSha256 = "1q8bmgv7aac29yvpvgh6hi4c33ydj7f54l7xn7jg2sjbac4f8kbk";
+}
+
diff --git a/pkgs/default.nix b/pkgs/default.nix
new file mode 100644
index 0000000..addce58
--- /dev/null
+++ b/pkgs/default.nix
@@ -0,0 +1,29 @@
+pkgs:
+
+let
+ firefoxAddons = pkgs.callPackage ./firefox/addons { };
+ gitignores = pkgs.callPackage ./gitignore { };
+ icons = pkgs.callPackage ./icons { };
+ personal =
+ # lib
+ {
+ lib.home-manager = import ./lib/home-manager { };
+ } //
+ # firefox packages
+ firefoxAddons // {
+ arkenfoxUserJs = ./firefox/user-js/arkenfox.nix;
+ } //
+ # font metadata
+ {
+ fontawesomeMetadata = pkgs.callPackage ./fontMetadata/fontawesome.nix { };
+ materialDesignIconsMetadata =
+ pkgs.callPackage ./fontMetadata/materialDesignIcons.nix { };
+ } //
+ # miscellaneous
+ {
+ barista = pkgs.callPackage ./barista {
+ inherit (personal) fontawesomeMetadata materialDesignIconsMetadata;
+ };
+ lockscreen = pkgs.callPackage ./lockscreen { };
+ } // gitignores // icons;
+in personal
diff --git a/pkgs/firefox/addons/addons.json b/pkgs/firefox/addons/addons.json
new file mode 100644
index 0000000..d39900d
--- /dev/null
+++ b/pkgs/firefox/addons/addons.json
@@ -0,0 +1,16 @@
+[
+ { "slug": "canvasblocker" },
+ { "slug": "clearurls" },
+ { "slug": "neat-url" },
+ { "slug": "redirector" },
+ { "slug": "smart-referer" },
+ { "slug": "temporary-containers" },
+ { "slug": "ublock-origin" },
+
+ { "slug": "darkreader" },
+ { "slug": "add-custom-search-engine" },
+ { "slug": "multi-account-containers" },
+ { "slug": "tree-style-tab" },
+ { "slug": "unpaywall" },
+ { "slug": "url-in-title" }
+]
diff --git a/pkgs/firefox/addons/default.nix b/pkgs/firefox/addons/default.nix
new file mode 100644
index 0000000..f87acb5
--- /dev/null
+++ b/pkgs/firefox/addons/default.nix
@@ -0,0 +1,182 @@
+{ buildFirefoxXpiAddon, fetchurl, lib, stdenv }:
+ {
+ "add-custom-search-engine" = buildFirefoxXpiAddon {
+ pname = "add-custom-search-engine";
+ version = "4.2";
+ addonId = "{af37054b-3ace-46a2-ac59-709e4412bec6}";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3812756/add_custom_search_engine-4.2.xpi";
+ sha256 = "86aaf173514ec2da55556eb339a9d7c115c6e070c5433ebff8db31baa8e165d5";
+ meta = with lib;
+ {
+ description = "Add a custom search engine to the list of available search engines in the search bar and URL bar.";
+ license = licenses.mpl20;
+ platforms = platforms.all;
+ };
+ };
+ "canvasblocker" = buildFirefoxXpiAddon {
+ pname = "canvasblocker";
+ version = "1.8";
+ addonId = "CanvasBlocker@kkapsner.de";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3910598/canvasblocker-1.8.xpi";
+ sha256 = "817a6181be877668eca1d0fef9ecf789c898e6d7d93dca7e29479d40f986c844";
+ meta = with lib;
+ {
+ homepage = "https://github.com/kkapsner/CanvasBlocker/";
+ description = "Alters some JS APIs to prevent fingerprinting.";
+ license = licenses.mpl20;
+ platforms = platforms.all;
+ };
+ };
+ "clearurls" = buildFirefoxXpiAddon {
+ pname = "clearurls";
+ version = "1.24.1";
+ addonId = "{74145f27-f039-47ce-a470-a662b129930a}";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3927638/clearurls-1.24.1.xpi";
+ sha256 = "41259fc4c330261e19ff4d38734eb5fdad92e7a358a16175383e31c62d50f06b";
+ meta = with lib;
+ {
+ homepage = "https://clearurls.xyz/";
+ description = "Removes tracking elements from URLs";
+ license = licenses.lgpl3;
+ platforms = platforms.all;
+ };
+ };
+ "darkreader" = buildFirefoxXpiAddon {
+ pname = "darkreader";
+ version = "4.9.52";
+ addonId = "addon@darkreader.org";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3968561/darkreader-4.9.52.xpi";
+ sha256 = "418deb0a0aa6ee3e23c31babd57a5c1fc207945356f0617e8dd955496d80b46d";
+ meta = with lib;
+ {
+ homepage = "https://darkreader.org/";
+ description = "Dark mode for every website. Take care of your eyes, use dark theme for night and daily browsing.";
+ license = licenses.mit;
+ platforms = platforms.all;
+ };
+ };
+ "multi-account-containers" = buildFirefoxXpiAddon {
+ pname = "multi-account-containers";
+ version = "8.0.7";
+ addonId = "@testpilot-containers";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3932862/multi_account_containers-8.0.7.xpi";
+ sha256 = "0e60e00c13dcc372b43ddb2e5428c2e3c1e79d2b23d7166df82d45245edc4f10";
+ meta = with lib;
+ {
+ homepage = "https://github.com/mozilla/multi-account-containers/#readme";
+ description = "Firefox Multi-Account Containers lets you keep parts of your online life separated into color-coded tabs. Cookies are separated by container, allowing you to use the web with multiple accounts and integrate Mozilla VPN for an extra layer of privacy.";
+ license = licenses.mpl20;
+ platforms = platforms.all;
+ };
+ };
+ "neat-url" = buildFirefoxXpiAddon {
+ pname = "neat-url";
+ version = "5.0.0";
+ addonId = "neaturl@hugsmile.eu";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3557562/neat_url-5.0.0.xpi";
+ sha256 = "0b41899ea0eb424517bbe7ce067eae22de0ff659a0f171671e604edef86cfa2c";
+ meta = with lib;
+ {
+ homepage = "http://hugsmile.eu";
+ description = "Remove garbage from URLs.";
+ license = licenses.gpl2;
+ platforms = platforms.all;
+ };
+ };
+ "redirector" = buildFirefoxXpiAddon {
+ pname = "redirector";
+ version = "3.5.3";
+ addonId = "redirector@einaregilsson.com";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3535009/redirector-3.5.3.xpi";
+ sha256 = "eddbd3d5944e748d0bd6ecb6d9e9cf0e0c02dced6f42db21aab64190e71c0f71";
+ meta = with lib;
+ {
+ homepage = "http://einaregilsson.com/redirector/";
+ description = "Automatically redirects to user-defined urls on certain pages";
+ license = licenses.mit;
+ platforms = platforms.all;
+ };
+ };
+ "smart-referer" = buildFirefoxXpiAddon {
+ pname = "smart-referer";
+ version = "0.2.15";
+ addonId = "smart-referer@meh.paranoid.pk";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3470999/smart_referer-0.2.15.xpi";
+ sha256 = "4751ab905c4d9d13b1f21c9fc179efed7d248e3476effb5b393268b46855bf1a";
+ meta = with lib;
+ {
+ homepage = "https://gitlab.com/smart-referer/smart-referer";
+ description = "Improve your privacy by limiting Referer information leak!";
+ platforms = platforms.all;
+ };
+ };
+ "temporary-containers" = buildFirefoxXpiAddon {
+ pname = "temporary-containers";
+ version = "1.9.2";
+ addonId = "{c607c8df-14a7-4f28-894f-29e8722976af}";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3723251/temporary_containers-1.9.2.xpi";
+ sha256 = "3340a08c29be7c83bd0fea3fc27fde71e4608a4532d932114b439aa690e7edc0";
+ meta = with lib;
+ {
+ homepage = "https://github.com/stoically/temporary-containers";
+ description = "Open tabs, websites, and links in automatically managed disposable containers which isolate the data websites store (cookies, storage, and more) from each other, enhancing your privacy and security while you browse.";
+ license = licenses.mit;
+ platforms = platforms.all;
+ };
+ };
+ "tree-style-tab" = buildFirefoxXpiAddon {
+ pname = "tree-style-tab";
+ version = "3.8.26";
+ addonId = "treestyletab@piro.sakura.ne.jp";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3975864/tree_style_tab-3.8.26.xpi";
+ sha256 = "fad45a87897df26613c89403f8dc0eb22eea55faeb98119810e8c1856114e4c1";
+ meta = with lib;
+ {
+ homepage = "http://piro.sakura.ne.jp/xul/_treestyletab.html.en";
+ description = "Show tabs like a tree.";
+ platforms = platforms.all;
+ };
+ };
+ "ublock-origin" = buildFirefoxXpiAddon {
+ pname = "ublock-origin";
+ version = "1.43.0";
+ addonId = "uBlock0@raymondhill.net";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3961087/ublock_origin-1.43.0.xpi";
+ sha256 = "ab2d4fa8dfc4f50841093830ff131d7a6e99052ba6e7359f8592e84f39c18a16";
+ meta = with lib;
+ {
+ homepage = "https://github.com/gorhill/uBlock#ublock-origin";
+ description = "Finally, an efficient wide-spectrum content blocker. Easy on CPU and memory.";
+ license = licenses.gpl3;
+ platforms = platforms.all;
+ };
+ };
+ "unpaywall" = buildFirefoxXpiAddon {
+ pname = "unpaywall";
+ version = "3.98";
+ addonId = "{f209234a-76f0-4735-9920-eb62507a54cd}";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3816853/unpaywall-3.98.xpi";
+ sha256 = "6893bea86d3c4ed7f1100bf0e173591b526a062f4ddd7be13c30a54573c797fb";
+ meta = with lib;
+ {
+ homepage = "https://unpaywall.org/products/extension";
+ description = "Get free text of research papers as you browse, using Unpaywall's index of ten million legal, open-access articles.";
+ license = licenses.mit;
+ platforms = platforms.all;
+ };
+ };
+ "url-in-title" = buildFirefoxXpiAddon {
+ pname = "url-in-title";
+ version = "0.5";
+ addonId = "{fcdb71fb-c9e5-48a3-9d04-e32713f5da88}";
+ url = "https://addons.mozilla.org/firefox/downloads/file/792317/url_in_title-0.5.xpi";
+ sha256 = "5db99d775cef3c3da069b7e8e1b1e7d68c3720236c99827d85c4e78d3c35dbd7";
+ meta = with lib;
+ {
+ homepage = "https://github.com/cloutierjo/titleUrl";
+ description = "Add the current host name to the windows title bar. It adds the possibility to recognize the window from other application that work based on windows titles like KeePass's autotype.";
+ license = licenses.gpl3;
+ platforms = platforms.all;
+ };
+ };
+ }
diff --git a/pkgs/firefox/user-js/arkenfox.nix b/pkgs/firefox/user-js/arkenfox.nix
new file mode 100644
index 0000000..c464f34
--- /dev/null
+++ b/pkgs/firefox/user-js/arkenfox.nix
@@ -0,0 +1,8 @@
+{ fetchurl }:
+
+let version = "109.0";
+in fetchurl {
+ url =
+ "https://raw.githubusercontent.com/arkenfox/user.js/${version}/user.js";
+ sha256 = "sha256:+GJgFyfmFqbD3eepN9udJImT9H3Z9T+xnXPrHuSwIH4=";
+}
diff --git a/pkgs/fontMetadata/fontawesome.nix b/pkgs/fontMetadata/fontawesome.nix
new file mode 100644
index 0000000..a54537e
--- /dev/null
+++ b/pkgs/fontMetadata/fontawesome.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+ name = "fontawesome-metadata";
+ src = fetchFromGitHub {
+ owner = "FortAwesome";
+ repo = "Font-Awesome";
+ rev = "d79d85c3fad85ad1885e87ed558f4afd6fce8289";
+ sha256 = "1sqj64vmnpysy0mc4w7b393030dzlk2vn2i1a0bzi8zlbsrccm88";
+ };
+
+ installPhase = ''
+ mkdir -p $out
+ cp --parent metadata/icons.yml $out
+ '';
+}
diff --git a/pkgs/fontMetadata/materialDesignIcons.nix b/pkgs/fontMetadata/materialDesignIcons.nix
new file mode 100644
index 0000000..fb24f3c
--- /dev/null
+++ b/pkgs/fontMetadata/materialDesignIcons.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+ name = "material-design-icons-metadata";
+
+ src = fetchFromGitHub {
+ owner = "Templarian";
+ repo = "MaterialDesign-Webfont";
+ rev = "34bdb8135d3307eac87bcbd7377c5ae344f09b42";
+ sha256 = "0mg6g262qjhjrkc9xjlv3s8a7qfh1wglfbg513d414xh3zlms4cl";
+ };
+
+ installPhase = ''
+ mkdir -p $out
+ cp --parent scss/_variables.scss $out
+ '';
+}
diff --git a/pkgs/gitignore/default.nix b/pkgs/gitignore/default.nix
new file mode 100644
index 0000000..fbf2d2e
--- /dev/null
+++ b/pkgs/gitignore/default.nix
@@ -0,0 +1,16 @@
+{ fetchurl }:
+
+let
+ fetch-gitignore = module: sha256:
+ let url = "https://www.toptal.com/developers/gitignore/api/" + module;
+ name = module + ".gitignore";
+ in fetchurl { inherit url sha256 name; };
+in {
+ emacsGitignore = fetch-gitignore "emacs"
+ "sha256:34LaJsGa5fFSMjE7l8JgQAmH8f07jcQmsaOdPVctHMk=";
+ linuxGitignore = fetch-gitignore "linux"
+ "sha256:Az39kpxJ1pG0T+3KUwx217+f+L8FQEWzwvRFSty8cJU=";
+ direnvGitignore = fetch-gitignore "direnv"
+ "sha256:CK47JLrsjf9yyjGAUfhjxLns0r1jDYgSBsp6LN0Yut8=";
+ fetcherGitignore = fetch-gitignore;
+}
diff --git a/pkgs/icons/default.nix b/pkgs/icons/default.nix
new file mode 100644
index 0000000..3f1f3bf
--- /dev/null
+++ b/pkgs/icons/default.nix
@@ -0,0 +1,15 @@
+{ fetchurl }:
+{
+ netflixIcon = fetchurl {
+ url = "https://www.vectorlogo.zone/logos/netflix/netflix-icon.svg";
+ sha256 = "0b4gqhw9y62fm72x61q03yzbllgfxpkjbbsdvj7d5wg3jshjkgdb";
+ };
+ mubiIcon = fetchurl {
+ url = "https://mubi.com/logo";
+ sha256 = "1h6qi579dcmd7l9mmwq2c4y67lbpkfjwq19kivfnfxwr38f769h4";
+ };
+ deezerIcon = fetchurl {
+ url = "https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/deezer.svg";
+ sha256 = "1qcj1gqz8gc9cwlj4cl6yj5ik1vz4ya6qcncr5fbciprzaaf3pg9";
+ };
+}
diff --git a/pkgs/icons/generate-package.sh b/pkgs/icons/generate-package.sh
new file mode 100755
index 0000000..bf34c84
--- /dev/null
+++ b/pkgs/icons/generate-package.sh
@@ -0,0 +1,11 @@
+icons=$(cat icons.txt)
+
+echo '{ fetchurl }:' | tee default.nix
+echo '{' | tee -a default.nix
+while read -r line; do
+ name=$(echo $line | cut -f1 -d' ')
+ url=$(echo $line | cut -f2 -d' ')
+ sha256=$(nix-prefetch-url $url 2>/dev/null)
+ echo -e "\t${name}Icon = fetchurl {\n\t\turl = \"$url\";\n\t\tsha256 = \"$sha256\";\n\t};" | tee -a default.nix
+done <<< $icons
+echo '}' | tee -a default.nix
diff --git a/pkgs/icons/icons.txt b/pkgs/icons/icons.txt
new file mode 100644
index 0000000..388daa2
--- /dev/null
+++ b/pkgs/icons/icons.txt
@@ -0,0 +1,3 @@
+netflix https://www.vectorlogo.zone/logos/netflix/netflix-icon.svg
+mubi https://mubi.com/logo
+deezer https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/deezer.svg
diff --git a/pkgs/lib/home-manager/default.nix b/pkgs/lib/home-manager/default.nix
new file mode 100644
index 0000000..62db998
--- /dev/null
+++ b/pkgs/lib/home-manager/default.nix
@@ -0,0 +1,11 @@
+{ }:
+
+{
+ serviceWithTimer = name: { Unit, Service, Timer, Install, ... }@config: {
+ services.${name} = { inherit (config) Unit Install Service; };
+ timers.${name} = {
+ inherit (config) Unit Install;
+ Timer = config.Timer // { Unit = "${name}.service"; };
+ };
+ };
+}
diff --git a/pkgs/lockscreen/default.nix b/pkgs/lockscreen/default.nix
new file mode 100644
index 0000000..dd68b79
--- /dev/null
+++ b/pkgs/lockscreen/default.nix
@@ -0,0 +1,28 @@
+{ runCommand, imagemagick, i3lock-color, lib, backgroundImage ? null, resolution ? "1920x1080" }:
+
+let useBackgroundImage = backgroundImage != null;
+in runCommand "lockscreen" { envVariable = true; } (''
+ mkdir -p $out/{bin,share}
+'' + (lib.optionalString useBackgroundImage ''
+ ${imagemagick}/bin/convert ${backgroundImage} -resize ${resolution} -blur 0x5 RGB:$out/share/lockscreen.png
+'') + ''
+ echo > $out/bin/lockscreen.sh \
+ "export PATH=$PATH
+ ${i3lock-color}/bin/i3lock-color \\
+ '' + (lib.optionalString useBackgroundImage ''
+ --raw ${resolution}:rgb \\
+ --image $out/share/lockscreen.png \\
+ '') + ''
+ --no-unlock-indicator \\
+ --composite \\
+ --clock \\
+ --ignore-empty-password \\
+ --time-color=FFFFFFFF \\
+ --date-color=00000000 \\
+ --time-size=100"
+ '' + (lib.optionalString useBackgroundImage ''
+ chmod 444 $out/share/lockscreen.png
+ '') + ''
+ chmod 555 $out/bin/lockscreen.sh
+ chmod 555 $out/{bin,share}
+ '')