refactor: prepare for multi machine config
This commit is contained in:
parent
844b0cfdfb
commit
fe5efac384
126 changed files with 59 additions and 50 deletions
30
common/default.nix
Normal file
30
common/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
({ nixpkgs, ... }: {
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_CA.UTF-8";
|
||||
console = {
|
||||
keyMap = "ca";
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
nix = {
|
||||
# Edit nix.conf
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
auto-optimise-store = true;
|
||||
warn-dirty = false;
|
||||
};
|
||||
|
||||
# Minimize dowloads of indirect nixpkgs flakes
|
||||
registry.nixpkgs = {
|
||||
flake = nixpkgs;
|
||||
exact = false;
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./overlays/list.nix
|
||||
];
|
||||
})
|
10
common/overlays/blueberry.nix
Normal file
10
common/overlays/blueberry.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
final: prev: {
|
||||
blueberry = prev.blueberry.overrideAttrs (o: {
|
||||
patches = (o.patches or [ ]) ++ [
|
||||
./patches/wayland.patch
|
||||
];
|
||||
buildInputs = (o.buildInputs or [ ]) ++ [
|
||||
prev.libappindicator
|
||||
];
|
||||
});
|
||||
}
|
50
common/overlays/dracula-theme.nix
Normal file
50
common/overlays/dracula-theme.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
final: prev: {
|
||||
dracula-theme = prev.dracula-theme.overrideAttrs (oldAttrs: rec {
|
||||
|
||||
plymouth = prev.fetchFromGitHub {
|
||||
owner = "dracula";
|
||||
repo = "plymouth";
|
||||
rev = "37aa09b27ecee4a825b43d2c1d20b502e8f19c96";
|
||||
hash = "sha256-7YwkBzkAND9lfH2ewuwna1zUkQStBBx4JHGw3/+svhA=";
|
||||
};
|
||||
|
||||
src = prev.fetchFromGitHub {
|
||||
owner = "dracula";
|
||||
repo = "gtk";
|
||||
rev = "84dd7a3021938ceec8a0ee292a8561f8a6d47ebe";
|
||||
hash = "sha256-xHf+f0RGMtbprJX+3c0cmp5LKkf0V7BHKcoiAW60du8=";
|
||||
};
|
||||
|
||||
preInstallPhase = ''
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -a ${plymouth}/dracula ./dracula
|
||||
chmod 777 ./dracula
|
||||
sed -i "s@\/usr\/@$out\/@" ./dracula/dracula.plymouth
|
||||
|
||||
mkdir -p $out/share/plymouth/themes
|
||||
cp -a ./dracula $out/share/plymouth/themes/
|
||||
|
||||
mkdir -p $out/share/themes/Dracula
|
||||
cp -a {assets,cinnamon,gnome-shell,gtk-2.0,gtk-3.0,gtk-3.20,gtk-4.0,index.theme,metacity-1,unity,xfwm4} $out/share/themes/Dracula
|
||||
|
||||
cp -a kde/{color-schemes,plasma} $out/share/
|
||||
cp -a kde/kvantum $out/share/Kvantum
|
||||
|
||||
mkdir -p $out/share/aurorae/themes
|
||||
cp -a kde/aurorae/* $out/share/aurorae/themes/
|
||||
|
||||
mkdir -p $out/share/sddm/themes
|
||||
cp -a kde/sddm/* $out/share/sddm/themes/
|
||||
|
||||
mkdir -p $out/share/icons/Dracula-cursors
|
||||
mv kde/cursors/Dracula-cursors/index.theme $out/share/icons/Dracula-cursors/cursor.theme
|
||||
mv kde/cursors/Dracula-cursors/cursors $out/share/icons/Dracula-cursors/cursors
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
});
|
||||
}
|
23
common/overlays/list.nix
Normal file
23
common/overlays/list.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ neovim-nightly-overlay, ... }:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import ./swayosd.nix)
|
||||
(import ./blueberry.nix)
|
||||
(import ./dracula-theme.nix)
|
||||
|
||||
(final: prev: {
|
||||
input-emulator = final.callPackage ./pkgs/input-emulator.nix {};
|
||||
})
|
||||
|
||||
(final: prev: {
|
||||
pam-fprint-grosshack = final.callPackage ./pkgs/pam-fprint-grosshack.nix {};
|
||||
})
|
||||
|
||||
(final: prev: {
|
||||
coloryou = final.callPackage ./pkgs/coloryou/default.nix {};
|
||||
})
|
||||
|
||||
neovim-nightly-overlay.overlay
|
||||
];
|
||||
}
|
21
common/overlays/patches/swayosd.patch
Normal file
21
common/overlays/patches/swayosd.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
diff --git a/data/meson.build b/data/meson.build
|
||||
index 1ceaa11..68decdf 100644
|
||||
--- a/data/meson.build
|
||||
+++ b/data/meson.build
|
||||
@@ -42,11 +42,7 @@
|
||||
configure_file(
|
||||
|
||||
# Systemd service unit
|
||||
systemd = dependency('systemd', required: false)
|
||||
-if systemd.found()
|
||||
- systemd_service_install_dir = systemd.get_variable(pkgconfig :'systemdsystemunitdir')
|
||||
-else
|
||||
- systemd_service_install_dir = join_paths(libdir, 'systemd', 'system')
|
||||
-endif
|
||||
+systemd_service_install_dir = join_paths(libdir, 'systemd', 'system')
|
||||
|
||||
configure_file(
|
||||
configuration: conf_data,
|
||||
--
|
||||
2.41.0
|
||||
|
95
common/overlays/patches/wayland.patch
Normal file
95
common/overlays/patches/wayland.patch
Normal file
|
@ -0,0 +1,95 @@
|
|||
# https://github.com/linuxmint/blueberry/issues/120
|
||||
--- /usr/lib/blueberry/blueberry-tray.py.org 2021-12-13 01:02:56.923349069 -0800
|
||||
+++ /usr/lib/blueberry/blueberry-tray.py 2021-12-13 02:21:23.253300141 -0800
|
||||
@@ -5,8 +5,8 @@
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
gi.require_version('GnomeBluetooth', '1.0')
|
||||
-gi.require_version('XApp', '1.0')
|
||||
-from gi.repository import Gtk, Gdk, GnomeBluetooth, Gio, XApp
|
||||
+gi.require_version('AppIndicator3', '0.1')
|
||||
+from gi.repository import AppIndicator3, Gtk, Gdk, GnomeBluetooth, Gio
|
||||
import rfkillMagic
|
||||
import setproctitle
|
||||
import subprocess
|
||||
@@ -53,12 +53,16 @@
|
||||
self.model.connect('row-deleted', self.update_icon_callback)
|
||||
self.model.connect('row-inserted', self.update_icon_callback)
|
||||
|
||||
- self.icon = XApp.StatusIcon()
|
||||
- self.icon.set_name("blueberry")
|
||||
- self.icon.set_tooltip_text(_("Bluetooth"))
|
||||
- self.icon.connect("activate", self.on_statusicon_activated)
|
||||
- self.icon.connect("button-release-event", self.on_statusicon_released)
|
||||
-
|
||||
+ self.paired_devices = {}
|
||||
+
|
||||
+ self.icon = AppIndicator3.Indicator.new(
|
||||
+ 'BlueBerry',
|
||||
+ 'blueberry',
|
||||
+ AppIndicator3.IndicatorCategory.SYSTEM_SERVICES
|
||||
+ )
|
||||
+ self.icon.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
|
||||
+ self.icon.set_menu(self.build_menu())
|
||||
+
|
||||
self.update_icon_callback(None, None, None)
|
||||
|
||||
def on_settings_changed_cb(self, setting, key, data=None):
|
||||
@@ -71,21 +75,23 @@
|
||||
return
|
||||
|
||||
if self.rfkill.hard_block or self.rfkill.soft_block:
|
||||
- self.icon.set_icon_name(self.tray_disabled_icon)
|
||||
- self.icon.set_tooltip_text(_("Bluetooth is disabled"))
|
||||
+ self.icon.set_title(_("Bluetooth is disabled"))
|
||||
+ self.icon.set_icon(self.tray_disabled_icon)
|
||||
+ self.icon.set_menu(self.build_menu())
|
||||
else:
|
||||
- self.icon.set_icon_name(self.tray_icon)
|
||||
+ self.icon.set_icon(self.tray_icon)
|
||||
+ self.icon.set_menu(self.build_menu())
|
||||
self.update_connected_state()
|
||||
|
||||
def update_connected_state(self):
|
||||
self.get_devices()
|
||||
|
||||
if len(self.connected_devices) > 0:
|
||||
- self.icon.set_icon_name(self.tray_active_icon)
|
||||
- self.icon.set_tooltip_text(_("Bluetooth: Connected to %s") % (", ".join(self.connected_devices)))
|
||||
+ self.icon.set_title(_("Bluetooth: Connected to %s") % (", ".join(self.connected_devices)))
|
||||
+ self.icon.set_icon(self.tray_active_icon)
|
||||
else:
|
||||
- self.icon.set_icon_name(self.tray_icon)
|
||||
- self.icon.set_tooltip_text(_("Bluetooth"))
|
||||
+ self.icon.set_title(_("Bluetooth"))
|
||||
+ self.icon.set_icon(self.tray_icon)
|
||||
|
||||
def get_devices(self):
|
||||
self.connected_devices = []
|
||||
@@ -117,13 +118,11 @@
|
||||
|
||||
iter = self.model.iter_next(iter)
|
||||
|
||||
- def on_statusicon_activated(self, icon, button, time):
|
||||
- if button == Gdk.BUTTON_PRIMARY:
|
||||
- subprocess.Popen(["blueberry"])
|
||||
+ def start_blueberry(self, _ignored):
|
||||
+ subprocess.Popen(["blueberry"])
|
||||
|
||||
- def on_statusicon_released(self, icon, x, y, button, time, position):
|
||||
- if button == 3:
|
||||
+ def build_menu(self):
|
||||
menu = Gtk.Menu()
|
||||
|
||||
if not self.rfkill.hard_block:
|
||||
if self.rfkill.soft_block:
|
||||
@@ -168,7 +170,7 @@
|
||||
menu.append(item)
|
||||
|
||||
menu.show_all()
|
||||
- icon.popup_menu(menu, x, y, button, time, position)
|
||||
+ return menu
|
||||
|
||||
def toggle_connect_cb(self, item, data = None):
|
||||
proxy = self.paired_devices[data]
|
||||
|
1
common/overlays/pkgs/coloryou/LICENSE
Normal file
1
common/overlays/pkgs/coloryou/LICENSE
Normal file
File diff suppressed because one or more lines are too long
45
common/overlays/pkgs/coloryou/coloryou.py
Executable file
45
common/overlays/pkgs/coloryou/coloryou.py
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
The original script:
|
||||
https://github.com/dharmx/vile/blob/7d486c128c7e553912673755f97b118aaab0193d/src/shell/playerctl.py#L2
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from material_color_utilities_python import themeFromImage, hexFromArgb, Image
|
||||
|
||||
def range_type(value_string):
|
||||
value = int(value_string)
|
||||
if value not in range(0, 101):
|
||||
raise argparse.ArgumentTypeError("%s is out of range, choose in [0-100]" % value)
|
||||
return value
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='coloryou',
|
||||
description='This program extract Material You colors from an image. It returns them as a JSON object for scripting.')
|
||||
|
||||
parser.add_argument("image_path", help="A full path to your image", type=str)
|
||||
parser.add_argument('-i', '--image', dest='image', default=40, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the main image accent.")
|
||||
|
||||
parser.add_argument('-b', '--button', dest='button', default=90, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the button accent.")
|
||||
|
||||
parser.add_argument('-t', '--text', dest='text', default=10, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the button text accent.")
|
||||
|
||||
parser.add_argument('-o', '--hover', dest='hover', default=80, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the hovering effect accent.")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
img = Image.open(args.image_path)
|
||||
basewidth = 64
|
||||
wpercent = (basewidth/float(img.size[0]))
|
||||
hsize = int((float(img.size[1])*float(wpercent)))
|
||||
img = img.resize((basewidth,hsize),Image.Resampling.LANCZOS)
|
||||
|
||||
theme = themeFromImage(img).get("palettes").get("primary")
|
||||
parsed_colors = {"imageAccent": hexFromArgb(theme.tone(args.image)),
|
||||
"buttonAccent": hexFromArgb(theme.tone(args.button)),
|
||||
"buttonText": hexFromArgb(theme.tone(args.text)),
|
||||
"hoverAccent": hexFromArgb(theme.tone(args.hover))}
|
||||
|
||||
print(json.dumps(parsed_colors))
|
20
common/overlays/pkgs/coloryou/default.nix
Normal file
20
common/overlays/pkgs/coloryou/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ python3Packages }:
|
||||
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "coloryou";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ utils material-color-utilities ];
|
||||
|
||||
postInstall = ''
|
||||
mv -v $out/bin/coloryou.py $out/bin/coloryou
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
Get Material You colors from an image.
|
||||
'';
|
||||
};
|
||||
}
|
2
common/overlays/pkgs/coloryou/requirements.txt
Normal file
2
common/overlays/pkgs/coloryou/requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
material-color-utilities
|
||||
utils
|
7
common/overlays/pkgs/coloryou/setup.py
Normal file
7
common/overlays/pkgs/coloryou/setup.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from distutils.core import setup
|
||||
|
||||
setup(
|
||||
name='coloryou',
|
||||
version='0.0.1',
|
||||
scripts=['coloryou.py',],
|
||||
)
|
8
common/overlays/pkgs/coloryou/shell.nix
Normal file
8
common/overlays/pkgs/coloryou/shell.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
with import <nixpkgs> {};
|
||||
with pkgs.python311Packages;
|
||||
|
||||
buildPythonPackage rec {
|
||||
name = "coloryou";
|
||||
src = ./.;
|
||||
propagatedBuildInputs = [ material-color-utilities utils ];
|
||||
}
|
28
common/overlays/pkgs/input-emulator.nix
Normal file
28
common/overlays/pkgs/input-emulator.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ stdenv
|
||||
, meson
|
||||
, ninja
|
||||
, pkg-config
|
||||
, cmake
|
||||
, bash-completion
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "input-emulator";
|
||||
version = "6c35040e6fc4f65ce0519ee76d00d60490bcb987";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tio";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-Im0RADqRwlZ/RiZFSVp+HwnWoLdcpRp0Ej6RP0GY0+c=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
cmake
|
||||
bash-completion
|
||||
];
|
||||
}
|
45
common/overlays/pkgs/pam-fprint-grosshack.nix
Normal file
45
common/overlays/pkgs/pam-fprint-grosshack.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ stdenv
|
||||
, meson
|
||||
, ninja
|
||||
, pkg-config
|
||||
, glib
|
||||
, libfprint
|
||||
, polkit
|
||||
, dbus
|
||||
, systemd
|
||||
, pam
|
||||
, libpam-wrapper
|
||||
, fetchFromGitLab
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "pam-fprint-grosshack";
|
||||
version = "v0.3.0";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "mishakmak";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-obczZbf/oH4xGaVvp3y3ZyDdYhZnxlCWvL0irgEYIi0=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
glib
|
||||
libfprint
|
||||
polkit
|
||||
dbus
|
||||
systemd
|
||||
pam
|
||||
libpam-wrapper
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
"-Dpam_modules_dir=${placeholder "out"}/lib/security"
|
||||
"-Dsysconfdir=${placeholder "out"}/etc"
|
||||
"-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/system-services"
|
||||
"-Dsystemd_system_unit_dir=${placeholder "out"}/lib/systemd/system"
|
||||
];
|
||||
}
|
27
common/overlays/swayosd.nix
Normal file
27
common/overlays/swayosd.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
final: prev: {
|
||||
swayosd = prev.swayosd.overrideAttrs (oldAttrs: rec {
|
||||
|
||||
src = prev.fetchFromGitHub {
|
||||
owner = "ErikReider";
|
||||
repo = "SwayOSD";
|
||||
rev = "8159c9e9962ce19f6fb78201d4d34e5817f53b45";
|
||||
hash = "sha256-kGd4/eQkhvxEL3/LToBDjE/JIR8m6w9vdFUrRTyylCE=";
|
||||
};
|
||||
|
||||
cargoDeps = oldAttrs.cargoDeps.overrideAttrs (prev.lib.const {
|
||||
name = "swayosd-vendor.tar.gz";
|
||||
inherit src;
|
||||
outputHash = "sha256-gRhhPDUFPcDS1xo7JzCpZtd1Al1kEkx2dXf92cc2bUo=";
|
||||
#outputHash = prev.lib.fakeHash;
|
||||
});
|
||||
|
||||
buildInputs = (oldAttrs.buildInputs or [ ]) ++ [
|
||||
prev.systemd
|
||||
];
|
||||
|
||||
patches = [
|
||||
./patches/swayosd.patch
|
||||
];
|
||||
});
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue