Many changes

This commit is contained in:
Andrea Ciceri 2022-11-10 19:51:43 +01:00
parent 6b3c9e83f7
commit 6fcd4730a2
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
14 changed files with 189 additions and 224 deletions

View file

@ -28,28 +28,28 @@
--replace '(emacs-repository-get-branch)' '"master"'
''
+ (lib.optionalString (old ? NATIVE_FULL_AOT)
# TODO: remove when https://github.com/NixOS/nixpkgs/pull/193621 is merged
(
let
backendPath =
lib.concatStringsSep " "
(builtins.map (x: ''\"-B${x}\"'') [
# Paths necessary so the JIT compiler finds its libraries:
"${lib.getLib pkgs.libgccjit}/lib"
"${lib.getLib pkgs.libgccjit}/lib/gcc"
"${lib.getLib pkgs.stdenv.cc.libc}/lib"
# TODO: remove when https://github.com/NixOS/nixpkgs/pull/193621 is merged
(
let
backendPath =
lib.concatStringsSep " "
(builtins.map (x: ''\"-B${x}\"'') [
# Paths necessary so the JIT compiler finds its libraries:
"${lib.getLib pkgs.libgccjit}/lib"
"${lib.getLib pkgs.libgccjit}/lib/gcc"
"${lib.getLib pkgs.stdenv.cc.libc}/lib"
# Executable paths necessary for compilation (ld, as):
"${lib.getBin pkgs.stdenv.cc.cc}/bin"
"${lib.getBin pkgs.stdenv.cc.bintools}/bin"
"${lib.getBin pkgs.stdenv.cc.bintools.bintools}/bin"
]);
in ''
substituteInPlace lisp/emacs-lisp/comp.el --replace \
"(defcustom comp-libgccjit-reproducer nil" \
"(setq native-comp-driver-options '(${backendPath})) (defcustom comp-libgccjit-reproducer nil"
''
));
# Executable paths necessary for compilation (ld, as):
"${lib.getBin pkgs.stdenv.cc.cc}/bin"
"${lib.getBin pkgs.stdenv.cc.bintools}/bin"
"${lib.getBin pkgs.stdenv.cc.bintools.bintools}/bin"
]);
in ''
substituteInPlace lisp/emacs-lisp/comp.el --replace \
"(defcustom comp-libgccjit-reproducer nil" \
"(setq native-comp-driver-options '(${backendPath})) (defcustom comp-libgccjit-reproducer nil"
''
));
});
in {
programs.emacs = {
@ -86,17 +86,22 @@ in {
};
home.packages = with pkgs; let
path = pkgs.lib.makeBinPath (with pkgs; [
path = pkgs.lib.makeBinPath [
git
jq
nix
nixpkgs-fmt
git
]);
];
nixFormat = writeScriptBin "nixFormat" ''
export PATH=${pkgs.lib.escapeShellArg path}
if [[ ! "$(nix fmt $@)" ]]
customFormatter=$(nix flake show --no-write-lock-file --no-update-lock-file --json | jq 'has("formatter")')
if [[ $customFormatter == "true" ]]
then
nixpkgs-fmt $@
nix fmt <<< /dev/stdin
else
nixpkgs-fmt <<< /dev/stdin
fi
'';
in [

View file

@ -0,0 +1,64 @@
# TODO: use upstream ytmusic when updated: https://github.com/OzymandiasTheGreat/mopidy-ytmusic/issues/68
{pkgs, ...}: let
ytmusicapi = pkgs.python310Packages.buildPythonPackage rec {
pname = "ytmusicapi";
version = "0.24.0";
format = "pyproject";
src = pkgs.python310Packages.fetchPypi {
inherit pname version;
hash = "sha256-vbSWgBze3tFLEpHdh3JXij3m5R6iAhTSjrCMaSLZalY=";
};
nativeBuildInputs = with pkgs.python310Packages; [
setuptools
setuptools-scm
];
propagatedBuildInputs = with pkgs.python310Packages; [
requests
];
};
mopidy-ytmusic = pkgs.python310Packages.buildPythonApplication rec {
pname = "mopidy-ytmusic";
version = "0.3.5";
src = pkgs.python3Packages.fetchPypi {
inherit version;
pname = "Mopidy-YTMusic";
sha256 = "0pncyxfqxvznb9y4ksndbny1yf5mxh4089ak0yz86dp2qi5j99iv";
};
postPatch = ''
substituteInPlace setup.py \
--replace 'ytmusicapi>=0.20.0,<0.21.0' 'ytmusicapi>=0.20.0'
'';
propagatedBuildInputs = with pkgs; [
mopidy
ytmusicapi
python310Packages.pytube
];
pythonImportsCheck = ["mopidy_ytmusic"];
doCheck = false;
};
in {
services.mopidy = {
enable = true;
extensionPackages = [mopidy-ytmusic] ++ (with pkgs; [mopidy-mpd mopidy-mpris]);
settings = {
mpd = {
enabled = true;
hostname = "127.0.0.1";
port = 6600;
# password = "";
max_connections = 20;
connection_timeout = 60;
# zeroconf = "Mopidy MPD server on $hostname";
};
# youtube = {
# enabled = true;
# };
};
};
}

View file

@ -2,11 +2,25 @@
pkgs,
config,
...
}: {
}: let
settings = config.programs.qutebrowser.settings;
websites = {
searx = "https://searx.be";
};
colors = {
black = "#000000";
darker-gray = "#222222";
lighter-gray = "#333333";
white = "#ffffff";
dark-white = "#aaaaaa";
less-dark-white = "#cccccc";
blue = "#0000ff";
};
in {
programs.qutebrowser = {
enable = true;
searchEngines = {
DEFAULT = "https://searx.be/search?q={}&category_general=on&language=all";
searchEngines = with websites; {
DEFAULT = "${searx}/search?q={}&category_general=on&language=all";
w = "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go&ns0=1";
np = "https://search.nixos.org/packages?sort=relevance&type=packages&query={}";
no = "https://search.nixos.org/options?sort=relevance&type=options&query={}";
@ -18,23 +32,27 @@
normal = {
"<Ctrl-V>" = "spawn mpv --force-window=immediate {url}";
",l" = ''config-cycle spellcheck.languages [" it-IT "] [" en-US "]'';
"<z><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d'";
"<z><u><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --username-only";
"<z><p><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --password-only";
"<z><o><l>" = "spawn --userscript qute-pass --dmenu-invocation 'fuzzel -d' --otp-only";
};
insert = {
"<Ctrl-p>" = ''spawn --userscript qute-pass --dmenu-invocation '${pkgs.fuzzel}/bin/fuzzel --background-color=253559cc --border-radius=5 --border-width=0 -d' --password-only --unfiltered'';
};
};
settings = {
auto_save.session = true;
url.start_pages = ["https://searx.be"];
url = with websites; {
default_page = searx;
start_pages = [searx];
};
editor.command = [
"emacsclient"
"+{line}:{column}"
"{file}"
"-c"
"-F"
"'(name . \\\"{file} - editor - qutebrowser\\\"))" # this is needed to keep the Emacs frame in the correct Sway workspace
];
content.pdfjs = true;
scrolling.smooth = true;
scrolling.smooth = false;
fonts = {
default_size = "11pt";
tabs = {
@ -42,15 +60,38 @@
unselected = "13pt";
};
};
colors = {
colors = with colors; {
webpage.bg = black; # to avoid flashes when opening new tabs
tabs = {
even = {
bg = "silver";
fg = "#666666";
bg = darker-gray;
fg = dark-white;
};
odd = {
bg = "gainsboro";
fg = config.programs.qutebrowser.settings.colors.tabs.even.fg;
bg = lighter-gray;
fg = settings.colors.tabs.even.fg;
};
};
completion = {
even.bg = darker-gray;
odd.bg = settings.colors.completion.even.bg;
fg = less-dark-white;
# match.fg = "";
item.selected = {
match.fg = blue;
# bg = "";
# fg = "";
border = {
top = settings.colors.completion.even.bg;
bottom = settings.colors.completion.even.bg;
};
};
category = {
bg = lighter-gray;
border = {
top = settings.colors.completion.even.bg;
bottom = settings.colors.completion.even.bg;
};
};
};
};

View file

@ -80,5 +80,9 @@
'';
};
home.packages = with pkgs; [thefuck htop-vim dig.dnsutils];
home.packages = with pkgs; [
thefuck
htop-vim
dig.dnsutils
];
}

View file

@ -52,7 +52,6 @@
inherit bg;
};
};
#fonts = [ "Font Awesome" "Fira Code" ];
terminal = "footclient";
bars = [
{
@ -61,7 +60,7 @@
];
assigns = {
"1" = [{title = ".*Mozilla Firefox$";} {title = ".*qutebrowser$";}];
"2" = [{title = ".*Emacs$";}];
"2" = [{title = "^((?!qutebrowser-editor).)*Emacs$";}];
"3" = [{title = "Slack.*";}];
"8" = [{title = "^Franz$";}];
"9" = [{title = "^Element.*";}];
@ -69,6 +68,7 @@
floating.criteria = [
{title = "MetaMask Notification.*";}
{title = "Volume Control";} # pavucontrol
{title = "^.*editor - qutebrowser$";} # Emacs opened by qutebrowser
];
input = {
"*" = {
@ -80,14 +80,21 @@
screenshotScript = pkgs.writeShellScript "screenshot.sh" ''
filename="$HOME/shots/$(date --iso-8601=seconds).png"
coords="$(${pkgs.slurp}/bin/slurp)"
${pkgs.grim}/bin/grim -t png -g "$coords" $filename
${pkgs.grim}/bin/grim -t png -g "$coords" "$filename"
wl-copy -t image/png < $filename
'';
screenrecordingScript = pkgs.writeShellScript "screenrecorder.sh" ''
filename="$HOME/shots/recording-$(date --iso-8601=seconds).mp4"
coords="$(${pkgs.slurp}/bin/slurp)"
${pkgs.wf-recorder}/bin/wf-recorder -g "$coords" -f "$filename"
wl-copy -t video/mp4 < $filename
'';
in
lib.mkOptionDefault {
"${modifier}+x" = "exec emacsclient -c";
"${modifier}+b" = "exec qutebrowser";
"${modifier}+s" = "exec ${screenshotScript}";
"${modifier}+g" = "exec ${screenrecordingScript}";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-";
};

View file

@ -1,3 +1,4 @@
{
xdg.enable = true;
xdg.mimeApps.enable = true;
}