feat: a lot of stuff
This commit is contained in:
parent
9806ee2a4e
commit
bc60f155aa
19 changed files with 250 additions and 20 deletions
|
|
@ -20,6 +20,9 @@
|
||||||
devenv.enable = true;
|
devenv.enable = true;
|
||||||
virtualisation.enable = true;
|
virtualisation.enable = true;
|
||||||
games.enable = true;
|
games.enable = true;
|
||||||
|
ratbag.enable = true;
|
||||||
|
|
||||||
|
ai.enable = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@
|
||||||
devenv.enable = true;
|
devenv.enable = true;
|
||||||
virtualisation.enable = true;
|
virtualisation.enable = true;
|
||||||
games.enable = true;
|
games.enable = true;
|
||||||
|
ratbag.enable = true;
|
||||||
|
|
||||||
|
ai.enable = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@
|
||||||
devenv.enable = true;
|
devenv.enable = true;
|
||||||
virtualisation.enable = true;
|
virtualisation.enable = true;
|
||||||
games.enable = true;
|
games.enable = true;
|
||||||
|
ratbag.enable = true;
|
||||||
|
|
||||||
|
ai.enable = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ... }: lib.mkIf config.bchmnn.audio.enable {
|
{ pkgs, config, lib, ... }: lib.mkIf config.bchmnn.audio.enable {
|
||||||
# Enable pipewire - audio
|
# Enable pipewire - audio
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -7,5 +7,12 @@
|
||||||
alsa.support32Bit = true;
|
alsa.support32Bit = true;
|
||||||
jack.enable = true;
|
jack.enable = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
|
wireplumber.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
alsa-utils
|
||||||
|
pulseaudio
|
||||||
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,14 @@
|
||||||
enable = mkEnableOption "games";
|
enable = mkEnableOption "games";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ai = {
|
||||||
|
enable = mkEnableOption "ai";
|
||||||
|
};
|
||||||
|
|
||||||
|
ratbag = {
|
||||||
|
enable = mkEnableOption "ratbag";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -69,19 +77,21 @@
|
||||||
./nix-ld.nix
|
./nix-ld.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
./nvidia.nix
|
./nvidia.nix
|
||||||
|
./ollama.nix
|
||||||
./opengl.nix
|
./opengl.nix
|
||||||
./openssh.nix
|
./openssh.nix
|
||||||
./openvpn.nix
|
./openvpn.nix
|
||||||
./power.nix
|
./power.nix
|
||||||
./packages.nix
|
./packages.nix
|
||||||
./printing.nix
|
./printing.nix
|
||||||
|
./ratbag.nix
|
||||||
./rr.nix
|
./rr.nix
|
||||||
./security.nix
|
./security.nix
|
||||||
./shell.nix
|
./shell.nix
|
||||||
./steam.nix
|
./steam.nix
|
||||||
./syncthing.nix
|
./syncthing.nix
|
||||||
|
./tts.nix
|
||||||
./udisks2.nix
|
./udisks2.nix
|
||||||
./unfree.nix
|
|
||||||
./virtualisation.nix
|
./virtualisation.nix
|
||||||
./xdg-portal.nix
|
./xdg-portal.nix
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,12 @@ in
|
||||||
services.keyd = {
|
services.keyd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
keyboards.default = {
|
keyboards.default = {
|
||||||
ids = [ "*" "-04fe:0020" ];
|
ids = [
|
||||||
|
"*"
|
||||||
|
"-04fe:0020" # HHKB
|
||||||
|
"-046d:102a" # Logitech G700s
|
||||||
|
"-046d:c07c" # Logitech G700s Rechargeable Gaming Mouse
|
||||||
|
];
|
||||||
settings = {
|
settings = {
|
||||||
main = {
|
main = {
|
||||||
leftalt = "layer(meta)";
|
leftalt = "layer(meta)";
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,25 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs = {
|
||||||
(self: super: {
|
overlays = [
|
||||||
bun-baseline = (super.callPackage ../overlays/bun-baseline.nix { });
|
(self: super: {
|
||||||
mfcl3750cdwlpr = (super.callPackage ../overlays/mfcl3750cdw.nix { }).driver;
|
bun-baseline = (super.callPackage ../overlays/bun-baseline.nix { });
|
||||||
mfcl3750cdwcupswrapper = (super.callPackage ../overlays/mfcl3750cdw.nix { }).cupswrapper;
|
mfcl3750cdwlpr = (super.callPackage ../overlays/mfcl3750cdw.nix { }).driver;
|
||||||
})
|
mfcl3750cdwcupswrapper = (super.callPackage ../overlays/mfcl3750cdw.nix { }).cupswrapper;
|
||||||
];
|
pppdf = (super.python3Packages.callPackage ../overlays/pppdf { });
|
||||||
|
})
|
||||||
# allow EOL version electron for obsidian
|
];
|
||||||
# TODO: remove
|
config = {
|
||||||
nixpkgs.config.permittedInsecurePackages = [
|
allowUnfree = true;
|
||||||
"electron-25.9.0"
|
allowUnfreePredicate = (_: true);
|
||||||
];
|
# allow EOL version electron for obsidian
|
||||||
|
# TODO: remove
|
||||||
|
permittedInsecurePackages = [
|
||||||
|
"electron-25.9.0"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "23.05";
|
system.stateVersion = "23.05";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
modules/ollama.nix
Normal file
6
modules/ollama.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ lib, config, ... }: lib.mkIf config.bchmnn.ai.enable {
|
||||||
|
services.ollama = {
|
||||||
|
enable = true;
|
||||||
|
acceleration = if config.bchmnn.nvidia.enable then "cuda" else null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
environment.systemPackages = with pkgs; with config.bchmnn; [
|
environment.systemPackages = with pkgs; with config.bchmnn; [
|
||||||
pciutils # a collection of programs for inspecting and manipulating configuration of pci devices
|
pciutils # a collection of programs for inspecting and manipulating configuration of pci devices
|
||||||
usbutils # tools for working with usb devices, such as lsusb
|
usbutils # tools for working with usb devices, such as lsusb
|
||||||
|
lshw # provide detailed information on the hardware configuration of the machine
|
||||||
git # distributed version control system
|
git # distributed version control system
|
||||||
gnumake # a tool to control the generation of non-source files from sources
|
gnumake # a tool to control the generation of non-source files from sources
|
||||||
mercurial # a fast, lightweight scm system for very large distributed projects
|
mercurial # a fast, lightweight scm system for very large distributed projects
|
||||||
|
|
|
||||||
3
modules/ratbag.nix
Normal file
3
modules/ratbag.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
services.ratbagd.enable = true;
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
oci-containers = {
|
oci-containers = {
|
||||||
backend = "podman";
|
|
||||||
containers = {
|
containers = {
|
||||||
flare-solvarr = {
|
flare-solvarr = {
|
||||||
image = "ghcr.io/flaresolverr/flaresolverr:latest";
|
image = "ghcr.io/flaresolverr/flaresolverr:latest";
|
||||||
|
|
|
||||||
17
modules/tts.nix
Normal file
17
modules/tts.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ lib, config, ... }: lib.mkIf config.bchmnn.ai.enable {
|
||||||
|
|
||||||
|
virtualisation = {
|
||||||
|
oci-containers = {
|
||||||
|
containers = {
|
||||||
|
coqui-ai-tts = {
|
||||||
|
image = "ghcr.io/coqui-ai/tts:latest";
|
||||||
|
autoStart = true;
|
||||||
|
ports = ["127.0.0.1:5002:5002"];
|
||||||
|
entrypoint = "/bin/bash";
|
||||||
|
cmd = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{ ... }: {
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
}
|
|
||||||
|
|
@ -10,11 +10,20 @@
|
||||||
# required for containers under podman-compose to be able to talk to each other.
|
# required for containers under podman-compose to be able to talk to each other.
|
||||||
defaultNetwork.settings.dns_enabled = true;
|
defaultNetwork.settings.dns_enabled = true;
|
||||||
};
|
};
|
||||||
|
oci-containers = {
|
||||||
|
backend = "podman";
|
||||||
|
};
|
||||||
|
containers = {
|
||||||
|
enable = true;
|
||||||
|
cdi.dynamic.nvidia.enable = config.bchmnn.nvidia.enable;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
dconf.enable = true;
|
dconf.enable = true;
|
||||||
virt-manager.enable = true;
|
virt-manager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [ virtiofsd ];
|
environment.systemPackages = with pkgs; [ virtiofsd ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
26
overlays/pppdf/default.nix
Normal file
26
overlays/pppdf/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{ pkgs, lib, buildPythonApplication, python3Packages }:
|
||||||
|
buildPythonApplication {
|
||||||
|
pname = "pppdf";
|
||||||
|
version = "1.0.0";
|
||||||
|
src = ./pppdf.py;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.wrapGAppsHook
|
||||||
|
pkgs.gobject-introspection
|
||||||
|
];
|
||||||
|
|
||||||
|
propagatedBuildInputs = with python3Packages; [ pkgs.gtk3 pygobject3 notify2 pikepdf ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
format = "other";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -D $src $out/bin/pppdf
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "PDF Postprocessor";
|
||||||
|
license = licenses.mit;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
107
overlays/pppdf/pppdf.py
Normal file
107
overlays/pppdf/pppdf.py
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import math
|
||||||
|
import os
|
||||||
|
|
||||||
|
try:
|
||||||
|
import notify2
|
||||||
|
except:
|
||||||
|
print('Missing library: notify2')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
notify2.init('pppdf')
|
||||||
|
# notify2.Notification('pppdf', f'Working dir: {os.getcwd()}').show()
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pikepdf
|
||||||
|
except:
|
||||||
|
notify2.Notification('pppdf', 'Missing library: pikepdf').show()
|
||||||
|
print('Missing library: pikepdf')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import gi
|
||||||
|
gi.require_version("Gtk", "3.0")
|
||||||
|
from gi.repository import Gtk
|
||||||
|
except:
|
||||||
|
notify2.Notification('pppdf', 'Missing library: gi').show()
|
||||||
|
print('Missing library: gi')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if len(sys.argv) != 5:
|
||||||
|
notify2.Notification('pppdf', 'Error: invalid arguments.').show()
|
||||||
|
print('Error: invalid arguments.')
|
||||||
|
print(f'Usage: {sys.argv[0]} <mime> <keep_original=true|false> <file> <mode=zip|rzip>')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
mime = sys.argv[1]
|
||||||
|
keep = sys.argv[2]
|
||||||
|
source = sys.argv[3]
|
||||||
|
mode = sys.argv[4]
|
||||||
|
|
||||||
|
if mime != 'application/pdf':
|
||||||
|
notify2.Notification('pppdf', 'Error: Only support for pdf.').show()
|
||||||
|
print('Error: Only support for pdf.')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def pppdf_zip():
|
||||||
|
try:
|
||||||
|
with pikepdf.open(source) as pdf:
|
||||||
|
|
||||||
|
target = pikepdf.Pdf.new()
|
||||||
|
|
||||||
|
n = len(pdf.pages)
|
||||||
|
if mode == "zip":
|
||||||
|
pattern = [i // 2 if i % 2 == 0 else math.ceil(n / 2) + i // 2 for i in range(n)]
|
||||||
|
else:
|
||||||
|
pattern = [i // 2 if i % 2 == 0 else n - (i // 2) - 1 for i in range(n)]
|
||||||
|
print(pattern)
|
||||||
|
for i in pattern:
|
||||||
|
target.pages.append(pdf.pages[i])
|
||||||
|
|
||||||
|
if keep != "false":
|
||||||
|
pdf.save(source + ".orig")
|
||||||
|
target.save(source)
|
||||||
|
notify2.Notification('pppdf', f'Success: {source}').show()
|
||||||
|
except Exception as error:
|
||||||
|
notify2.Notification('pppdf', f'Error: {error}').show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Dialog(Gtk.Window):
|
||||||
|
def __init__(self):
|
||||||
|
Gtk.Window.__init__(self, title="pppdf")
|
||||||
|
|
||||||
|
self.set_border_width(6)
|
||||||
|
label = Gtk.Label(label=f"Do you want to zip {source}?")
|
||||||
|
|
||||||
|
btn_cancel = Gtk.Button(label="Cancel")
|
||||||
|
btn_ok = Gtk.Button(label="Ok")
|
||||||
|
btn_cancel.connect("clicked", self.on_btn_cancel_clicked)
|
||||||
|
btn_ok.connect("clicked", self.on_btn_ok_clicked)
|
||||||
|
|
||||||
|
buttons = Gtk.Box(spacing=6)
|
||||||
|
buttons.pack_start(btn_cancel, True, True, 0)
|
||||||
|
buttons.pack_start(btn_ok, True, True, 0)
|
||||||
|
|
||||||
|
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
|
||||||
|
|
||||||
|
vbox.pack_start(label, True, True, 0)
|
||||||
|
vbox.pack_start(buttons, True, True, 0)
|
||||||
|
|
||||||
|
self.add(vbox)
|
||||||
|
|
||||||
|
def on_btn_cancel_clicked(self, widget):
|
||||||
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
def on_btn_ok_clicked(self, widget):
|
||||||
|
pppdf_zip()
|
||||||
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
win = Dialog()
|
||||||
|
win.connect("destroy", Gtk.main_quit)
|
||||||
|
win.show_all()
|
||||||
|
Gtk.main()
|
||||||
|
|
||||||
21
users/gandalf/modules/audio.nix
Normal file
21
users/gandalf/modules/audio.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
xdg.configFile."wireplumber/wireplumber.conf.d/51-scarlett-samplerate.conf" = {
|
||||||
|
text = ''
|
||||||
|
monitor.alsa.rules = [
|
||||||
|
{
|
||||||
|
matches = [
|
||||||
|
{
|
||||||
|
node.nick = "Scarlett 2i2 USB"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
actions = {
|
||||||
|
update-props = {
|
||||||
|
audio.rate = 44100
|
||||||
|
api.acp.probe-rate = 44100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./audio.nix
|
||||||
./dconf.nix
|
./dconf.nix
|
||||||
./fzf.nix
|
./fzf.nix
|
||||||
./gui
|
./gui
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
gnome.nautilus # the file manager for gnome
|
gnome.nautilus # the file manager for gnome
|
||||||
gnome.simple-scan # simple scanning utility
|
gnome.simple-scan # simple scanning utility
|
||||||
|
pppdf
|
||||||
feh # a light-weight image viewer
|
feh # a light-weight image viewer
|
||||||
vlc # cross-platform media player and streaming server
|
vlc # cross-platform media player and streaming server
|
||||||
zathura # a highly customizable and functional pdf viewer
|
zathura # a highly customizable and functional pdf viewer
|
||||||
|
|
@ -41,9 +42,14 @@
|
||||||
|
|
||||||
] ++ lib.optionals nixosConfig.bchmnn.printing.enable [
|
] ++ lib.optionals nixosConfig.bchmnn.printing.enable [
|
||||||
system-config-printer # graphical user interface for cups administration
|
system-config-printer # graphical user interface for cups administration
|
||||||
|
|
||||||
] ++ lib.optionals nixosConfig.bchmnn.games.enable [
|
] ++ lib.optionals nixosConfig.bchmnn.games.enable [
|
||||||
openjdk17 # the open-source java development kit
|
openjdk17 # the open-source java development kit
|
||||||
prismlauncher # a free, open source launcher for minecraft
|
prismlauncher # a free, open source launcher for minecraft
|
||||||
|
|
||||||
|
] ++ lib.optionals nixosConfig.bchmnn.ratbag.enable [
|
||||||
|
piper # gtk frontend for ratbagd mouse config daemon
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue