Compare commits

...

27 commits

Author SHA1 Message Date
chayleaf 992c4b4acb
update inputs 2024-11-19 10:38:18 +07:00
chayleaf 781c8ed4a6
change update script for ci branch 2024-11-18 22:23:39 +07:00
chayleaf 5091f1a52d
unci 2024-11-18 22:23:17 +07:00
chayleaf ff839c3153
misc fixes 2024-11-01 01:26:11 +07:00
chayleaf 6d8e1d85ac
nixmsi: allow 27015 udp 2024-10-21 13:34:01 +07:00
chayleaf 8e3d0c90a8
home: use qt pinentry 2024-10-16 06:13:22 +07:00
chayleaf a7c43047b3
home/nvim: add neorg 2024-10-16 06:13:16 +07:00
chayleaf 5575582b6d
home/nvim: migrate more config to nixvim 2024-10-10 03:58:53 +07:00
chayleaf 4361c9e694
home/nvim: begin incremental migration to nixvim 2024-10-10 03:37:13 +07:00
chayleaf 7e111b4021
home/nvim: allow not setting plugin package 2024-10-10 03:31:55 +07:00
chayleaf 34ed24d470
mpv: more misc options 2024-10-09 23:57:34 +07:00
chayleaf 6f9d877667
home/nvim: switch to nixvim 2024-10-09 23:57:20 +07:00
chayleaf 21ab05153f
ereader: init
https://github.com/swaywm/sway/issues/7035 ;-;
2024-10-08 22:02:13 +07:00
chayleaf bc5a1cd0d5
tmp 2024-09-18 07:46:32 +07:00
chayleaf 42026bb41a
phone: update to 6.11 2024-09-18 07:46:02 +07:00
chayleaf dccb67d5e5
server: temporarily switch to linux 6.9 2024-09-13 23:03:03 +07:00
chayleaf d779d0f809
home: remove useless script 2024-09-13 23:02:43 +07:00
chayleaf 06cb7740fd
nixmsi: misc system changes 2024-09-13 23:02:23 +07:00
chayleaf f616572430
home/nixmsi: force vdpau hwenc 2024-09-13 23:01:38 +07:00
chayleaf 5d7d19eeb1
server: fix matrix stuff 2024-09-13 23:01:22 +07:00
chayleaf bd0f0b2720
home: mobile patches for mako and rofi-wayland 2024-08-24 17:39:25 +07:00
chayleaf 319538d866
mpv: dont use gpu-next 2024-08-24 04:14:12 +07:00
chayleaf 5ba73e92a8
server: enable matrix-sliding-sync 2024-08-24 03:01:12 +07:00
chayleaf 45191559c7
home/phone: enable swayidle 2024-08-23 11:42:07 +07:00
chayleaf cc4ae20674
server: minor performance tuning 2024-08-23 10:48:53 +07:00
chayleaf 8f19644b3e
update inputs 2024-08-23 10:42:20 +07:00
chayleaf ff493a9ed9
Revert "server: temporarily switch to newer kernel"
This reverts commit 449f873faa.
2024-08-23 10:42:18 +07:00
68 changed files with 3364 additions and 89432 deletions

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,9 @@
inputs = { inputs = {
nix-community-infra.url = "github:nix-community/infra"; nix-community-infra.url = "github:nix-community/infra";
nixpkgs-kernel.url = "github:NixOS/nixpkgs/c7b821ba2e1e635ba5a76d299af62821cbcb09f3"; nixpkgs-kernel.url = "github:NixOS/nixpkgs/a58bc8ad779655e790115244571758e8de055e3d";
nixpkgs-kernel2.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:chayleaf/nixpkgs/ci";
nixpkgs.url = "github:chayleaf/nixpkgs"; nixvim.url = "github:nix-community/nixvim";
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
nix-index-database = { nix-index-database = {
url = "github:nix-community/nix-index-database"; url = "github:nix-community/nix-index-database";
@ -30,7 +30,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager = { home-manager = {
url = "github:chayleaf/home-manager"; url = "github:chayleaf/home-manager/ci";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-gaming = { nix-gaming = {
@ -52,6 +52,7 @@
nixos-mailserver = { nixos-mailserver = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-24_05.follows = "nixpkgs";
}; };
unbound-rust-mod = { unbound-rust-mod = {
url = "github:chayleaf/unbound-rust-mod"; url = "github:chayleaf/unbound-rust-mod";
@ -102,7 +103,7 @@
# Private home-manager config for hostname and username # Private home-manager config for hostname and username
getPrivUser = hostname: user: (getPriv hostname).${user} or { }; getPrivUser = hostname: user: (getPriv hostname).${user} or { };
# extended lib # extended lib
lib = nixpkgs.lib // import ./lib.nix { inherit (nixpkgs) lib; }; lib = inputs.nixpkgs.lib // import ./lib.nix { inherit (nixpkgs) lib; };
# can't use callPackage ./pkgs here, idk why; use import instead # can't use callPackage ./pkgs here, idk why; use import instead
overlay' = args: self: super: import (if args.pluginsOverlay or false then ./pkgs/nix-plugins-overlay.nix else ./pkgs) ({ overlay' = args: self: super: import (if args.pluginsOverlay or false then ./pkgs/nix-plugins-overlay.nix else ./pkgs) ({
pkgs = super; pkgs = super;
@ -114,8 +115,8 @@
nix-plugins-overlay = overlay' { pluginsOverlay = true; }; nix-plugins-overlay = overlay' { pluginsOverlay = true; };
all-overlays = [ nix-plugins-overlay overlay ]; all-overlays = [ nix-plugins-overlay overlay ];
# I override some settings down the line, but overlays always stay the same # I override some settings down the line, but overlays always stay the same
mkPkgs = config: import nixpkgs (config // { mkPkgs = config: import (config.flake or nixpkgs) (builtins.removeAttrs config ["flake"] // {
overlays = config.overlays or [ ] ++ all-overlays; overlays = config.overlays or ([ ] ++ all-overlays);
}); });
# this is actual config, it gets processed below # this is actual config, it gets processed below
config = let config = let
@ -136,6 +137,20 @@
in { in {
router-emmc = mkBpiR3 "emmc" routerConfig; router-emmc = mkBpiR3 "emmc" routerConfig;
router-sd = mkBpiR3 "sd" routerConfig; router-sd = mkBpiR3 "sd" routerConfig;
ereader = {
# TODO uncom
flake = inputs.nixpkgs-kernel;
system = "aarch64-linux";
modules = [
./system/devices/kobo-clara-hd-ereader.nix
{
nixpkgs.crossSystem.system = "armv7l-linux";
# nixpkgs.localSystem.system = "aarch64-linux";
}
];
home.user = [ ./home/hosts/ereader.nix ];
home.common.enableNixosModule = true;
};
server = { server = {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
@ -146,6 +161,7 @@
nixmsi = rec { nixmsi = rec {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ ./system/devices/msi-delta-15-workstation.nix ]; modules = [ ./system/devices/msi-delta-15-workstation.nix ];
home.common.modules = [ inputs.nixvim.homeManagerModules.default ];
home.common.extraSpecialArgs = { home.common.extraSpecialArgs = {
notlua = inputs.notlua.lib.${system}; notlua = inputs.notlua.lib.${system};
}; };
@ -154,6 +170,7 @@
phone = rec { phone = rec {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ ./system/devices/oneplus-6-phone.nix ]; modules = [ ./system/devices/oneplus-6-phone.nix ];
home.common.modules = [ inputs.nixvim.homeManagerModules.default ];
home.common.extraSpecialArgs = { home.common.extraSpecialArgs = {
notlua = inputs.notlua.lib.${system}; notlua = inputs.notlua.lib.${system};
}; };
@ -169,6 +186,7 @@
packages = lib.genAttrs [ packages = lib.genAttrs [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"armv7l-linux"
] (system: let self = overlay' { isOverlay = false; } (mkPkgs { inherit system; } // self) (import nixpkgs { inherit system; }); in self); ] (system: let self = overlay' { isOverlay = false; } (mkPkgs { inherit system; } // self) (import nixpkgs { inherit system; }); in self);
nixosImages.router = let pkgs = mkPkgs { inherit (config.router-emmc) system; }; in { nixosImages.router = let pkgs = mkPkgs { inherit (config.router-emmc) system; }; in {
emmcImage = pkgs.callPackage ./system/hardware/bpi-r3/image.nix { emmcImage = pkgs.callPackage ./system/hardware/bpi-r3/image.nix {
@ -194,19 +212,21 @@
# this is the system config processing part # this is the system config processing part
nixosConfigurations = lib.flip builtins.mapAttrs config (hostname: args @ { modules, nixpkgs ? {}, home ? {}, ... }: nixosConfigurations = lib.flip builtins.mapAttrs config (hostname: args @ { modules, nixpkgs ? {}, home ? {}, ... }:
lib.nixosSystem { (args.flake or base-inputs.nixpkgs).lib.nixosSystem {
inherit (args) system; inherit (args) system;
# allow modules to access nixpkgs directly, use customized lib, # allow modules to access nixpkgs directly, use customized lib,
# and pass nixos-harware to let hardware modules import parts of nixos-hardware # and pass nixos-harware to let hardware modules import parts of nixos-hardware
specialArgs = { specialArgs = {
inherit inputs lib; inherit lib;
hardware = inputs.nixos-hardware.nixosModules; hardware = inputs.nixos-hardware.nixosModules;
inputs = inputs // lib.optionalAttrs (args?flake) {
nixpkgs = args.flake;
};
} // args.specialArgs or { }; } // args.specialArgs or { };
modules = [ modules = [
({ config, ... }: { ({ config, ... }: {
_module.args = { _module.args = {
pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays ++ config.nixpkgs.overlays; }; pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays ++ config.nixpkgs.overlays; };
pkgs-kernel2 = import inputs.nixpkgs-kernel2 { inherit (args) system; overlays = all-overlays ++ config.nixpkgs.overlays; };
}; };
}) })
(getPrivSys hostname) (getPrivSys hostname)
@ -220,16 +240,21 @@
++ lib.optionals (home != { } && home.common.enableNixosModule or false) [ ++ lib.optionals (home != { } && home.common.enableNixosModule or false) [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ home-manager = builtins.removeAttrs (home.common or { }) [ "nixpkgs" "nix" "enableNixosModule" ]; } { home-manager = builtins.removeAttrs (home.common or { }) [ "nixpkgs" "nix" "enableNixosModule" ]; }
{ # set both to false to match behavior with standalone home-manager {
home-manager.useGlobalPkgs = false; home-manager.extraSpecialArgs = {
home-manager.useUserPackages = false; inputs = inputs // lib.optionalAttrs (args?flake) {
nixpkgs = args.flake;
};
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users = builtins.mapAttrs (username: modules: { home-manager.users = builtins.mapAttrs (username: modules: {
imports = modules ++ [ imports = modules ++ [
{ nixpkgs = home.common.nixpkgs or { }; # { nixpkgs = home.common.nixpkgs or { };
nix = home.common.nix or { }; } # nix = home.common.nix or { }; }
({ config, pkgs, lib, ...}: { # ({ config, pkgs, lib, ...}: {
nixpkgs.overlays = all-overlays; # nixpkgs.overlays = all-overlays;
nix.package = lib.mkDefault pkgs.nixForNixPlugins; }) # nix.package = lib.mkDefault pkgs.nixForNixPlugins; })
(getPrivUser hostname username) (getPrivUser hostname username)
]; ];
}) (builtins.removeAttrs home [ "common" ]); } }) (builtins.removeAttrs home [ "common" ]); }

43
home/hosts/ereader.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs
, inputs
, ...
}:
{
imports = [
../modules/general.nix
../modules/i3-sway.nix
inputs.nur.nixosModules.nur
];
nix.settings = {
trusted-public-keys = [
"binarycache.pavluk.org:Vk0ms/vSqoOV2JXeNVOroc8EfilgVxCCUtpCShGIKsQ="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
trusted-substituters = [
"https://binarycache.pavluk.org"
"https://cache.nixos.org"
];
};
phone.enable = true;
minimal = true;
home.stateVersion = "23.11";
home.username = "user";
home.homeDirectory = "/home/user";
terminals = [ "foot" ];
wayland.windowManager.sway.enable = true;
# terminals = [ "kitty" ];
# xsession.windowManager.i3.enable = true;
# services.kdeconnect.enable = true;
home.packages = with pkgs; [
# TODO fix
koreader
(calibre.override {
speechSupport = false;
})
wvkbd
];
}

View file

@ -55,6 +55,7 @@
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold"; CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = "-C link-arg=--ld-path=${pkgs.mold}/bin/mold";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
firefox-devedition
anki-bin anki-bin
(gimp.overrideAttrs (old: { doCheck = false; })) krita blender-hip (gimp.overrideAttrs (old: { doCheck = false; })) krita blender-hip
kdenlive glaxnimate mediainfo kdenlive glaxnimate mediainfo
@ -91,4 +92,5 @@
rawMouse=yes rawMouse=yes
escapeKey=KEY_RIGHTALT escapeKey=KEY_RIGHTALT
''; '';
programs.mpv.config.hwdec = lib.mkForce "vdpau";
} }

View file

@ -24,6 +24,7 @@
}; };
phone.enable = true; phone.enable = true;
phone.suspend = false;
home.stateVersion = "23.11"; home.stateVersion = "23.11";
home.username = "user"; home.username = "user";
home.homeDirectory = "/home/user"; home.homeDirectory = "/home/user";

View file

@ -46,10 +46,10 @@
ublock-origin ublock-origin
unpaywall unpaywall
vimium-c vimium-c
yomitan
youtube-shorts-block youtube-shorts-block
]) ++ (with pkgs.firefoxAddons; [ ]) ++ (with pkgs.firefoxAddons; [
fastforwardteam fastforwardteam
rikaitan
youtube-nonstop youtube-nonstop
]); ]);
search.default = "search.pavluk.org"; search.default = "search.pavluk.org";

View file

@ -17,7 +17,7 @@
enableSshSupport = true; enableSshSupport = true;
maxCacheTtl = 72000; maxCacheTtl = 72000;
maxCacheTtlSsh = 72000; maxCacheTtlSsh = 72000;
pinentryPackage = pkgs.pinentry.tty; pinentryPackage = if config.minimal then pkgs.pinentry.tty else pkgs.pinentry.qt;
}; };
home.shellAliases = { home.shellAliases = {
s = "sudo -A"; s = "sudo -A";
@ -64,15 +64,16 @@
}); });
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# utils # utils
gnused mktemp fzf coreutils-full findutils xdg-utils gnupg whois curl gnused mktemp fzf coreutils-full findutils xdg-utils whois curl
file mediainfo unzip gnutar man rclone file unzip gnutar man
# for preview # for preview
# exa - TODO: replace with eza wrapper? # exa - TODO: replace with eza wrapper?
bat libarchive atool glow libarchive atool
# for opening # for opening
p7zip unrar-wrapper p7zip
] ++ lib.optionals (!config.minimal) [ ] ++ lib.optionals (!config.minimal) [
odt2txt w3m sshfs trash-cli gnupg odt2txt w3m sshfs trash-cli unrar-wrapper
mediainfo rclone bat glow
]; ];
plugins = { plugins = {
src = pluginSrc; src = pluginSrc;
@ -117,7 +118,7 @@
lfs.enable = true; lfs.enable = true;
}; };
bat = { bat = {
enable = true; enable = !config.minimal;
}; };
bottom = { bottom = {
enable = true; enable = true;
@ -314,8 +315,8 @@
rclone sshfs fuse rclone sshfs fuse
file jq python3Full killall file jq python3Full killall
comma nix-output-monitor comma nix-output-monitor
unzip p7zip unrar-wrapper unzip p7zip
] ++ lib.optionals (!config.minimal) [ ] ++ lib.optionals (!config.minimal) [
appimage-run appimage-run unrar-wrapper
]; ];
} }

View file

@ -1,28 +1,27 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ./terminal.nix ]; imports = [ ./terminal.nix ];
systemd.user.services.fcitx5-daemon = { config = lib.mkMerge [
Unit.After = "graphical-session-pre.target"; (lib.mkIf (!config.minimal) {
Service = { xdg.configFile."alsoft.conf".text = ''
Restart = "on-failure"; [general]
RestartSec = 3; hrtf = true
}; stereo-encoding = hrtf
}; drivers = pipewire,pulseaudio,jack,alsa,oss,
i18n.inputMethod = let fcitx5-qt = pkgs.libsForQt5.fcitx5-qt; in { periods = 2
enabled = "fcitx5"; hrtf-paths = ${pkgs.openal}/share/openal/hrtf
fcitx5.addons = with pkgs; [ fcitx5-lua fcitx5-gtk fcitx5-mozc fcitx5-configtool fcitx5-qt ];
}; [decoder]
home.sessionVariables = { hq-mode = true
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx"; [pipewire]
XMODIFIERS = "@im=fcitx"; rt-mix = true
SDL_IM_MODULE = "fcitx";
XIM_SERVERS = "fcitx"; [pulse]
INPUT_METHOD = "fcitx"; allow-moves = true
SUDO_ASKPASS = pkgs.writeScript "sudo-askpass" ''
#! ${pkgs.bash}/bin/bash
${pkgs.libsecret}/bin/secret-tool lookup root password
''; '';
home.sessionVariables = {
SDL_AUDIODRIVER = "pipewire,pulse,dsound"; SDL_AUDIODRIVER = "pipewire,pulse,dsound";
# SDL 3 # SDL 3
SDL_AUDIO_DRIVER = "pipewire,pulseaudio,dsound"; SDL_AUDIO_DRIVER = "pipewire,pulseaudio,dsound";
@ -43,26 +42,6 @@
ffmpeg ffmpegthumbnailer nsxiv imagemagick ffmpeg ffmpegthumbnailer nsxiv imagemagick
zathura /*libreoffice*/ fontpreview djvulibre poppler_utils zathura /*libreoffice*/ fontpreview djvulibre poppler_utils
] ++ lib.optionals (!config.programs.mpv.enable) [ mpv ]; ] ++ lib.optionals (!config.programs.mpv.enable) [ mpv ];
xdg.configFile."alsoft.conf".text = ''
[general]
hrtf = true
stereo-encoding = hrtf
drivers = pipewire,pulseaudio,jack,alsa,oss,
periods = 2
hrtf-paths = ${pkgs.openal}/share/openal/hrtf
[decoder]
hq-mode = true
[pipewire]
rt-mix = true
[pulse]
allow-moves = true
'';
xdg.userDirs.enable = true;
programs.mpv = { programs.mpv = {
enable = true; enable = true;
defaultProfiles = [ "gpu-hq" ]; defaultProfiles = [ "gpu-hq" ];
@ -139,6 +118,14 @@
"1" = "add volume -1"; "1" = "add volume -1";
"2" = "add volume 1"; "2" = "add volume 1";
"3" = "add contrast -1";
"4" = "add contrast 1";
"5" = "add brightness -1";
"6" = "add brightness 1";
"7" = "add saturation -1";
"8" = "add saturation 1";
"9" = "add gamma -1";
"0" = "add gamma 1";
s = "cycle sub"; s = "cycle sub";
v = "cycle video"; v = "cycle video";
a = "cycle audio"; a = "cycle audio";
@ -162,7 +149,7 @@
config = { config = {
osc = "no"; osc = "no";
hwdec = "vaapi"; hwdec = "vaapi";
vo = "gpu-next,gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,"; vo = "gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,";
alang = "jpn,en,ru"; alang = "jpn,en,ru";
slang = "jpn,en,ru"; slang = "jpn,en,ru";
vlang = "jpn,en,ru"; vlang = "jpn,en,ru";
@ -187,10 +174,11 @@
input-default-bindings = false; input-default-bindings = false;
}; };
# profiles = { }; # profiles = { };
package = pkgs.wrapMpv (pkgs.mpv-unwrapped.override { package = pkgs.mpv-unwrapped.wrapper {
mpv = pkgs.mpv-unwrapped.override {
# many features aren't supported by normal ffmpeg # many features aren't supported by normal ffmpeg
ffmpeg = pkgs.ffmpeg-full; ffmpeg = pkgs.ffmpeg-full;
}) { };
scripts = with pkgs.mpvScripts; [ scripts = with pkgs.mpvScripts; [
thumbnail thumbnail
mpris mpris
@ -200,16 +188,69 @@
}; };
}; };
services.gammastep.enable = true; services.gammastep.enable = true;
services.mpd = {
enable = true;
network.startWhenNeeded = true;
};
services.mpdris2 = {
enable = true;
};
programs.yt-dlp.enable = true;
home.packages = with pkgs; [
qt5ct qgnomeplatform
qbittorrent mumble
keepassxc nheko nextcloud-client
# cli tools
imagemagick ffmpeg-full
# might check out some day (tm)
# nyxt qutebrowser
# for working with nix
nix-init
nvfetcher
config.nur.repos.rycee.mozilla-addons-to-nix
];
})
(lib.mkIf (!config.minimal) {
systemd.user.services.fcitx5-daemon = {
Unit.After = "graphical-session-pre.target";
Service = {
Restart = "on-failure";
RestartSec = 3;
};
};
i18n.inputMethod = let fcitx5-qt = pkgs.libsForQt5.fcitx5-qt; in {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-lua fcitx5-gtk fcitx5-mozc fcitx5-configtool fcitx5-qt ];
};
home.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
SDL_IM_MODULE = "fcitx";
XIM_SERVERS = "fcitx";
INPUT_METHOD = "fcitx";
};
})
{
home.sessionVariables = {
SUDO_ASKPASS = pkgs.writeScript "sudo-askpass" ''
#! ${pkgs.bash}/bin/bash
${pkgs.libsecret}/bin/secret-tool lookup root password
'';
};
xdg.userDirs.enable = true;
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
gtk = { gtk = {
enable = true; enable = true;
font.name = "Noto Sans"; font.name = "Noto Sans";
font.size = 10; font.size = 10;
iconTheme = { iconTheme = lib.mkIf (!config.minimal) {
package = pkgs.papirus-icon-theme; package = pkgs.papirus-icon-theme;
name = "Papirus-Dark"; name = "Papirus-Dark";
}; };
theme = { theme = lib.mkIf (!config.minimal) {
package = pkgs.breeze-gtk; package = pkgs.breeze-gtk;
name = "Breeze-Dark"; name = "Breeze-Dark";
}; };
@ -233,13 +274,6 @@
enable = true; enable = true;
path = "${pkgs.fish}/bin/fish"; path = "${pkgs.fish}/bin/fish";
}; };
services.mpd = {
enable = true;
network.startWhenNeeded = true;
};
services.mpdris2 = {
enable = true;
};
systemd.user.services.kdeconnect = lib.mkIf config.services.kdeconnect.enable { systemd.user.services.kdeconnect = lib.mkIf config.services.kdeconnect.enable {
Service = { Service = {
Restart = lib.mkForce "always"; Restart = lib.mkForce "always";
@ -251,27 +285,15 @@
home.pointerCursor.gtk.enable = true; home.pointerCursor.gtk.enable = true;
home.pointerCursor.package = pkgs.vanilla-dmz; home.pointerCursor.package = pkgs.vanilla-dmz;
home.pointerCursor.name = "Vanilla-DMZ"; home.pointerCursor.name = "Vanilla-DMZ";
programs.yt-dlp.enable = true;
home.packages = with pkgs; [ home.packages = with pkgs; [
# wayland
grim slurp grim slurp
# gui compat stuff
qt5ct qgnomeplatform
# various programs i use
keepassxc nheko qbittorrent mumble
nextcloud-client kdeconnect
# cli tools # cli tools
imagemagick ffmpeg-full xdg-utils xdg-utils
# fonts # fonts
noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif
noto-fonts-emoji noto-fonts-extra noto-fonts-emoji noto-fonts-extra
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
# might check out some day (tm) ]
# nyxt qutebrowser ++ lib.optional config.services.kdeconnect.enable kdeconnect;
}];
# for working with nix
nix-init
nvfetcher
config.nur.repos.rycee.mozilla-addons-to-nix
];
} }

View file

@ -2,7 +2,7 @@
let let
modifier = if config.phone.enable then "Mod1" else "Mod4"; modifier = if config.phone.enable then "Mod1" else "Mod4";
rofiSway = config.programs.rofi.finalPackage; rofiSway = config.programs.rofi.finalPackage;
rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; }; rofiI3 = if config.wayland.windowManager.sway.enable then pkgs.rofi.override { plugins = config.programs.rofi.plugins; } else pkgs.rofi;
audioNext = pkgs.writeShellScript "playerctl-next" '' audioNext = pkgs.writeShellScript "playerctl-next" ''
${pkgs.playerctl}/bin/playerctl next ${pkgs.playerctl}/bin/playerctl next
PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | ${pkgs.coreutils}/bin/head -n 1) PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | ${pkgs.coreutils}/bin/head -n 1)
@ -34,6 +34,7 @@ audioPrev = pkgs.writeShellScript "playerctl-prev" ''
${pkgs.playerctl}/bin/playerctl play ${pkgs.playerctl}/bin/playerctl play
fi fi
''; '';
# TODO: only unidle mako when unlocked
swaylock = swaylock =
if config.phone.enable if config.phone.enable
then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin" then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin"
@ -44,17 +45,25 @@ swaylock-start = pkgs.writeShellScript "swaylock-start" ''
dpms-off = pkgs.writeShellScript "sway-dpms-off" '' dpms-off = pkgs.writeShellScript "sway-dpms-off" ''
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off ${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled ${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled
${config.services.mako.package}/bin/makoctl mode -a idle
''; '';
dpms-on = pkgs.writeShellScript "sway-dpms-on" '' dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on ${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled ${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled
${config.services.mako.package}/bin/makoctl mode -r idle
''; '';
lock-script = pkgs.writeShellScript "lock-start" '' lock-script = pkgs.writeShellScript "lock-start" ''
${swaylock-start} ${swaylock-start}
${lib.optionalString config.phone.enable ${lib.optionalString (config.phone.enable && config.phone.suspend)
# suspend if nothing is playing # suspend if nothing is playing and no ssh sessions are active
'' ''
${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null || /run/current-system/sw/bin/systemctl suspend if ${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null; then
exit
fi
if ${pkgs.coreutils}/bin/who -u | ${pkgs.gnugrep}/bin/grep "pts.*(" >/dev/null; then
exit
fi
/run/current-system/sw/bin/systemctl suspend
''} ''}
''; '';
barConfig = { barConfig = {
@ -109,14 +118,17 @@ commonConfig = {
${lib.optionalString config.phone.enable '' ${lib.optionalString config.phone.enable ''
${pkgs.procps}/bin/pkill -x wvkbd-mobintl ${pkgs.procps}/bin/pkill -x wvkbd-mobintl
${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji& ${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji&
${lib.optionalString (!config.minimal) ''
${pkgs.procps}/bin/pkill -x squeekboard ${pkgs.procps}/bin/pkill -x squeekboard
${pkgs.squeekboard}/bin/squeekboard& ${pkgs.squeekboard}/bin/squeekboard&
''}
/run/current-system/sw/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true /run/current-system/sw/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
''} ''}
${pkgs.procps}/bin/pkill -x home-daemon ${pkgs.procps}/bin/pkill -x home-daemon
${pkgs.home-daemon}/bin/home-daemon system76-scheduler ${lib.optionalString (!config.phone.enable) "empty-sound"}& ${pkgs.home-daemon}/bin/home-daemon system76-scheduler ${lib.optionalString (!config.phone.enable) "empty-sound"}&
${lib.optionalString (!config.minimal) ''
${pkgs.procps}/bin/pkill -x keepassxc ${pkgs.procps}/bin/pkill -x keepassxc
${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/var/local.kdbx &) ${pkgs.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/var/local.kdbx &)
# sleep to give keepassxc time to take the input # sleep to give keepassxc time to take the input
sleep 1 sleep 1
# nextcloud and nheko need secret service access # nextcloud and nheko need secret service access
@ -128,6 +140,7 @@ commonConfig = {
${pkgs.tdesktop}/bin/telegram-desktop -startintray& ${pkgs.tdesktop}/bin/telegram-desktop -startintray&
# and final sleep just in case # and final sleep just in case
sleep 1 sleep 1
''}
''); } ''); }
]; ];
colors = { colors = {
@ -187,7 +200,7 @@ genKeybindings = (default_options: kb:
kb // { kb // {
"${modifier}+Shift+g" = "floating toggle"; "${modifier}+Shift+g" = "floating toggle";
"${modifier}+g" = "focus mode_toggle"; "${modifier}+g" = "focus mode_toggle";
XF86AudioMicMute = "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute"; XF86AudioMicMute = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute";
XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+"; XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
} }
@ -202,13 +215,11 @@ genKeybindings = (default_options: kb:
.imports) .imports)
.options.keybindings.default) .options.keybindings.default)
); );
in in {
{
# TODO merge with colors in gui.nix and terminal.nix # TODO merge with colors in gui.nix and terminal.nix
imports = [ ./options.nix ./gui.nix ./waybar.nix ]; imports = [ ./options.nix ./gui.nix ./waybar.nix ];
home.sessionVariables = { config = lib.mkMerge [
_JAVA_AWT_WM_NONREPARENTING = "1"; (lib.mkIf (!config.minimal) {
};
xdg.configFile."xdg-desktop-portal-wlr/config".source = (pkgs.formats.ini {}).generate "xdg-desktop-portal-wlr.ini" { xdg.configFile."xdg-desktop-portal-wlr/config".source = (pkgs.formats.ini {}).generate "xdg-desktop-portal-wlr.ini" {
screencast = { screencast = {
max_fps = 60; max_fps = 60;
@ -221,28 +232,42 @@ in
systemd.user.services = lib.mkIf config.wayland.windowManager.sway.enable { systemd.user.services = lib.mkIf config.wayland.windowManager.sway.enable {
gammastep.Unit.ConditionEnvironment = "WAYLAND_DISPLAY"; gammastep.Unit.ConditionEnvironment = "WAYLAND_DISPLAY";
}; };
})
{
home.sessionVariables = {
_JAVA_AWT_WM_NONREPARENTING = "1";
};
services.mako = { services.mako = {
enable = lib.mkDefault config.wayland.windowManager.sway.enable; enable = lib.mkDefault config.wayland.windowManager.sway.enable;
# ms package = pkgs.mako.overrideAttrs (old: {
defaultTimeout = 7500; patches = old.patches or []
++ (lib.mapAttrsToList (k: v: ../../pkgs/mako/${k}) (builtins.readDir ../../pkgs/mako));
});
defaultTimeout = 10000;
font = "Noto Sans Mono 12"; font = "Noto Sans Mono 12";
extraConfig = ''
max-history=50
[mode=idle]
freeze=1
'';
}; };
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
config = let i3Config = { config = let i3Config = {
bars = [ bars = [
(barConfig // { (barConfig // {
mode = "dock";
statusCommand = "${pkgs.i3status}/bin/i3status"; statusCommand = "${pkgs.i3status}/bin/i3status";
}) })
]; ];
menu = "${rofiI3}/bin/rofi -show drun"; menu = "${rofiI3}/bin/rofi -show drun";
keybindings = genKeybindings options.xsession.windowManager.i3 { keybindings = genKeybindings options.xsession.windowManager.i3 {
"${modifier}+c" = "exec ${rofiI3}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history"; "${modifier}+c" = "exec ${rofiI3}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history";
XF86AudioRaiseVolume = "exec ${pkgs.pamixer}/bin/pamixer --increase 5"; XF86AudioRaiseVolume = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
XF86AudioLowerVolume = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; XF86AudioLowerVolume = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute"; XF86AudioMute = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
XF86AudioPlay = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; XF86AudioPlay = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause";
XF86AudioNext = "exec ${audioNext}"; XF86AudioNext = lib.mkIf (!config.minimal) "exec ${audioNext}";
XF86AudioPrev = "exec ${audioPrev}"; XF86AudioPrev = lib.mkIf (!config.minimal) "exec ${audioPrev}";
}; };
terminal = config.terminalBinX; terminal = config.terminalBinX;
}; in commonConfig // i3Config; }; in commonConfig // i3Config;
@ -273,9 +298,9 @@ in
sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU="; sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU=";
})*/ })*/
] ++ lib.optionals config.phone.enable ] ++ lib.optionals config.phone.enable
(map (lib.mapAttrsToList
(x: ../../pkgs/sway/${x}) (k: v: ../../pkgs/sway/${k})
(builtins.filter (lib.hasInfix "-mobile-") (builtins.attrNames (builtins.readDir ../../pkgs/sway)))); (lib.filterAttrs (k: v: lib.hasInfix "-mobile-" k) (builtins.readDir ../../pkgs/sway)));
}); });
inherit (cfg) extraSessionCommands extraOptions; inherit (cfg) extraSessionCommands extraOptions;
withBaseWrapper = cfg.wrapperFeatures.base; withBaseWrapper = cfg.wrapperFeatures.base;
@ -292,8 +317,9 @@ in
${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE || true ${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE || true
/run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE || true /run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE || true
/run/current-system/sw/bin/systemctl --user start xdg-desktop-portal-gtk.service || true /run/current-system/sw/bin/systemctl --user start xdg-desktop-portal-gtk.service || true
${pkgs.procps}/bin/pgrep -f run-waybar | ${pkgs.gnugrep}/bin/grep -v "$$" | xargs kill
while true; do while true; do
${config.programs.waybar.package}/bin/waybar > ~/var/waybar.log 2>&1 ${config.programs.waybar.package}/bin/waybar "$@" > ~/var/waybar.log 2>&1
sleep 5 || true sleep 5 || true
done done
''); '');
@ -379,17 +405,17 @@ in
# and if stoptalking isn't called for some reason, calling it one time stops being enough # and if stoptalking isn't called for some reason, calling it one time stops being enough
"exec ${pkgs.mumble}/bin/mumble rpc stoptalking && ${pkgs.mumble}/bin/mumble rpc stoptalking") "exec ${pkgs.mumble}/bin/mumble rpc stoptalking && ${pkgs.mumble}/bin/mumble rpc stoptalking")
//*/ { //*/ {
"--inhibited --no-repeat --allow-other Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc starttalking"; "--inhibited --no-repeat --allow-other Scroll_Lock" = lib.mkIf (!config.minimal) "exec ${pkgs.mumble}/bin/mumble rpc starttalking";
"--inhibited --no-repeat --allow-other --release Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc stoptalking"; "--inhibited --no-repeat --allow-other --release Scroll_Lock" = lib.mkIf (!config.minimal) "exec ${pkgs.mumble}/bin/mumble rpc stoptalking";
"${modifier}+c" = "exec ${rofiSway}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history"; "${modifier}+c" = "exec ${rofiSway}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history";
"${modifier}+Print" = "exec ${grimshot}/bin/grimshot copy area"; "${modifier}+Print" = "exec ${grimshot}/bin/grimshot copy area";
"${modifier}+${if modifier == "Mod1" then "Mod4" else "Mod1"}+Print" = "exec ${grimshot}/bin/grimshot copy window"; "${modifier}+${if modifier == "Mod1" then "Mod4" else "Mod1"}+Print" = "exec ${grimshot}/bin/grimshot copy window";
"--locked XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer --increase 5"; "--locked XF86AudioRaiseVolume" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
"--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; "--locked XF86AudioLowerVolume" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
"--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute"; "--locked XF86AudioMute" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
"--locked --inhibited XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "--locked --inhibited XF86AudioPlay" = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"--locked --inhibited XF86AudioNext" = "exec ${audioNext}"; "--locked --inhibited XF86AudioNext" = lib.mkIf (!config.minimal) "exec ${audioNext}";
"--locked --inhibited XF86AudioPrev" = "exec ${audioPrev}"; "--locked --inhibited XF86AudioPrev" = lib.mkIf (!config.minimal) "exec ${audioPrev}";
"--locked --inhibited --release XF86PowerOff" = lib.mkIf config.phone.enable "exec ${pkgs.writeShellScript "power-key" '' "--locked --inhibited --release XF86PowerOff" = lib.mkIf config.phone.enable "exec ${pkgs.writeShellScript "power-key" ''
if ${config.wayland.windowManager.sway.package}/bin/swaymsg -rt get_outputs | ${pkgs.jq}/bin/jq ".[].power" | ${pkgs.gnugrep}/bin/grep true; then if ${config.wayland.windowManager.sway.package}/bin/swaymsg -rt get_outputs | ${pkgs.jq}/bin/jq ".[].power" | ${pkgs.gnugrep}/bin/grep true; then
${dpms-off} ${dpms-off}
@ -399,10 +425,14 @@ in
''}"; ''}";
}); });
startup = [ startup = [
{ /*{
always = true; always = true;
command = "${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; /run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; /run/current-system/sw/bin/systemctl --user reset-failed && /run/current-system/sw/bin/systemctl --user start sway-session.target && ${pkgs.sway}/bin/swaymsg -mt subscribe '[]' || true && /run/current-system/sw/bin/systemctl --user stop sway-session.target"; command = pkgs.writeShellScript "dbus-upd.sh" ''
} ${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE
/run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
/run/current-system/sw/bin/systemctl --user reset-failed";
'';
}*/
{ {
command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist"; command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist";
} }
@ -442,16 +472,16 @@ in
''; '';
}; };
services.swayidle = { services.swayidle = {
enable = config.wayland.windowManager.sway.enable && !config.phone.enable; enable = config.wayland.windowManager.sway.enable;
events = [ events = [
{ event = "before-sleep"; command = toString swaylock-start; } { event = "before-sleep"; command = toString swaylock-start; }
# after-resume, lock, unlock # after-resume, lock, unlock
]; ];
timeouts = [ timeouts = [
{ timeout = if config.phone.enable then 30 else 300; { timeout = if config.phone.enable && !config.minimal then 30 else 300;
command = toString dpms-off; command = toString dpms-off;
resumeCommand = toString dpms-on; } resumeCommand = toString dpms-on; }
{ timeout = if config.phone.enable then 60 else 600; { timeout = if config.phone.enable && !config.minimal then 60 else 600;
command = toString lock-script; } command = toString lock-script; }
]; ];
}; };
@ -495,16 +525,16 @@ in
text-wrong-color = text-color; text-wrong-color = text-color;
ring-wrong-color = "#e64e4e"; # deep-ish red ring-wrong-color = "#e64e4e"; # deep-ish red
}; };
home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [ home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [ wl-clipboard ]);
wl-clipboard
xdg-desktop-portal
# xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
]);
programs.rofi = { programs.rofi = {
enable = true; enable = true;
font = "Noto Sans Mono 16"; font = "Noto Sans Mono 16";
package = lib.mkIf config.wayland.windowManager.sway.enable pkgs.rofi-wayland; package = lib.mkIf config.wayland.windowManager.sway.enable (pkgs.rofi-wayland.override {
rofi-unwrapped = pkgs.rofi-wayland-unwrapped.overrideAttrs (old: {
patches = old.patches or []
++ (lib.mapAttrsToList (k: v: ../../pkgs/rofi-wayland/${k}) (builtins.readDir ../../pkgs/rofi-wayland));
});
});
plugins = with pkgs; [ plugins = with pkgs; [
rofi-calc rofi-calc
]; ];
@ -563,4 +593,5 @@ in
steal-focus = true; steal-focus = true;
}; };
}; };
}];
} }

View file

@ -13,13 +13,14 @@
*/ */
# welcome to my cursed DSL # welcome to my cursed DSL
programs.neovim = let programs.nixvim = let
notlua-nvim = notlua.neovim { inherit (config.programs.neovim) plugins extraLuaPackages; }; notlua-nvim = notlua.neovim {
plugins = config.programs.nixvim.extraPlugins;
inherit (config.programs.nixvim) extraLuaPackages;
};
inherit (notlua.keywords) inherit (notlua.keywords)
AND APPLY CALL DEFUN AND APPLY CALL DEFUN ELSE EQ GE IDX IF
ELSE EQ GE IDX IF LE LET LETREC MERGE OR PROP RETURN SET;
LE LET LETREC OR
PROP RETURN SET;
inherit (notlua.utils) compile; inherit (notlua.utils) compile;
inherit (notlua-nvim.stdlib) vim string require print; inherit (notlua-nvim.stdlib) vim string require print;
inherit (notlua-nvim.keywords) REQ REQ'; inherit (notlua-nvim.keywords) REQ REQ';
@ -54,7 +55,14 @@
in (lib.mapAttrsToList (k: {rhs, desc}: keymapSetSingle (opts' // { in (lib.mapAttrsToList (k: {rhs, desc}: keymapSetSingle (opts' // {
lhs = k; inherit rhs; lhs = k; inherit rhs;
})) keys) ++ [ })) keys) ++ [
(which-key.register (lib.mapAttrs (k: v: [v.rhs v.desc]) keys) opts') (which-key.add (MERGE
({
inherit mode;
remap = !noremap;
} // builtins.removeAttrs opts ["keys" "noremap"])
(lib.mapAttrsToList (k: v: (MERGE [ k v.rhs ] { inherit (v) desc; })) keys)
) null)
# (which-key.register (lib.mapAttrs (k: v: [v.rhs v.desc]) keys) opts')
]; ];
keymapSetNs = args: keymapSetMulti (args // { mode = "n"; }); keymapSetNs = args: keymapSetMulti (args // { mode = "n"; });
kmSetNs = keys: keymapSetNs { inherit keys; }; kmSetNs = keys: keymapSetNs { inherit keys; };
@ -63,103 +71,14 @@
which-key = REQ "which-key"; which-key = REQ "which-key";
luasnip = REQ "luasnip"; luasnip = REQ "luasnip";
in {
enable = true;
defaultEditor = true;
package = pkgs.neovim-unwrapped;
extraPackages = with pkgs; [
rust-analyzer
nodePackages_latest.bash-language-server shellcheck
nodePackages_latest.typescript-language-server
# nodePackages_latest.svelte-language-server
clang-tools_latest
nodePackages_latest.vscode-langservers-extracted
nil
marksman
taplo
ripgrep
(python3.withPackages (p: with p; [
python-lsp-server
python-lsp-black
pylsp-mypy
python-lsp-server.optional-dependencies.pyflakes
python-lsp-server.optional-dependencies.mccabe
python-lsp-server.optional-dependencies.pycodestyle
]))
];
# extraPython3Packages = pyPkgs: with pyPkgs; [
# ];
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraLuaConfig = compile "main" [ plugins = let ps = pkgs.vimPlugins; in [
(kmSetNs { { plugin = ps.vim-svelte; }
"<C-X>" = {
rhs = DEFUN (vim.fn.system [ "chmod" "+x" (vim.fn.expand "%") ]);
desc = "chmod +x %";
};
})
(SET (vimg "vimsyn_embed") "l")
(LET (vim.api.nvim_create_augroup "nvimrc" { clear = true; }) (group:
lib.mapAttrsToList (k: v: vim.api.nvim_create_autocmd k { inherit group; callback = v; }) {
BufReadPre = DEFUN (SET vim.o.foldmethod "syntax");
BufEnter = { buf, ... }:
LET (vim.filetype.match { inherit buf; }) (filetype: [
(IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" "mail" ])) (
LET vim.o.colorcolumn (old_colorcolumn: [
(SET vim.o.colorcolumn "73")
(vim.api.nvim_create_autocmd "BufLeave" {
buffer = buf;
callback = DEFUN [
(SET vim.o.colorcolumn old_colorcolumn)
# return true = delete autocommand
(RETURN true)
];
})
])
))
(IF (APPLY OR (map (EQ filetype) [ "markdown" "mail" ])) (
(SET (IDX vim.bo buf).textwidth 72)
))
]);
BufWinEnter = { buf, ... }:
LET (vim.filetype.match { inherit buf; }) (filetype: [
(CALL (PROP vim.cmd "folddoc") "foldopen!")
(IF (EQ filetype "gitcommit") (
vim.cmd {
cmd = "normal"; bang = true;
args = [ "gg" ];
}
) ELSE (LET
(IDX (vim.api.nvim_buf_get_mark buf "\"") 1)
(vim.api.nvim_buf_line_count buf)
(pos: cnt:
IF (AND (GE pos 1) (LE pos cnt))
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "g`\"" ];
})
/*ELIF*/ (GE pos 1)
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "g$" ];
})
ELSE
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "gg" ];
})
)))
]);
}
))
];
plugins = let ps = pkgs.vimPlugins; in map (x: if x?config && x?plugin then { type = "lua"; } // x else x) [
ps.vim-svelte
# vim-nix isn't necessary for syntax highlighting, but it improves overall editing experience # vim-nix isn't necessary for syntax highlighting, but it improves overall editing experience
ps.vim-nix { plugin = ps.vim-nix; }
{ plugin = pkgs.vimUtils.buildVimPluginFrom2Nix { # the latest version of vscode-nvim has breaking changes and i'm too lazy to migrate
# FIXME: migrate
{ plugin = pkgs.vimUtils.buildVimPlugin {
pname = "vscode-nvim"; pname = "vscode-nvim";
version = "2023-02-10"; version = "2023-02-10";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -169,7 +88,7 @@
sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI="; sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI=";
}; };
}; };
config = compile "vscode_nvim" [ config = [
((REQ "vscode").setup { ((REQ "vscode").setup {
transparent = true; transparent = true;
color_overrides = { color_overrides = {
@ -192,14 +111,12 @@
bg = "NONE"; bg = "NONE";
}) })
]; } ]; }
{ plugin = ps.nvim-web-devicons; { settings.plugins.web-devicons.enable = true; }
config = compile "nvim_web_devicons" ((REQ "nvim-web-devicons").setup { }); } { settings.plugins.nvim-tree.enable = true;
{ plugin = ps.nvim-tree-lua; settings.globalOpts.termguicolors = true;
config = compile "nvim_tree_lua" (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [ settings.globals.loaded_netrw = 1;
(SET (vimg "loaded_netrw") 1) settings.globals.loaded_netrwPlugin = 1;
(SET (vimg "loaded_netrwPlugin") 1) config = (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [
(SET vim.o.termguicolors true)
(nvim-tree.setup { }) # :help nvim-tree-setup
(kmSetNs { (kmSetNs {
"<C-N>" = { "<C-N>" = {
rhs = nvim-tree-api.tree.toggle; rhs = nvim-tree-api.tree.toggle;
@ -207,9 +124,10 @@
}; };
}) })
])); } ])); }
ps.vim-sleuth { settings.plugins.sleuth.enable = true; }
ps.luasnip { settings.plugins.luasnip.enable = true; }
{ plugin = ps.nvim-cmp; { plugin = ps.nvim-cmp;
settings.plugins.cmp.enable = false;
config = let config = let
border = (name: [ border = (name: [
[ "" name ] [ "" name ]
@ -221,7 +139,7 @@
[ "" name ] [ "" name ]
[ "" name ] [ "" name ]
]); ]);
in compile "nvim_cmp" (LET (REQ "cmp") (REQ "lspkind") (cmp: lspkind: in (LET (REQ "cmp") (REQ "lspkind") (cmp: lspkind:
# call is required because cmp.setup is a table # call is required because cmp.setup is a table
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -280,14 +198,16 @@
sources = cmp.config.sources [ sources = cmp.config.sources [
{ name = "nvim_lsp"; } { name = "nvim_lsp"; }
{ name = "luasnip"; } { name = "luasnip"; }
{ name = "neorg"; }
]; ];
} }
)); } )); }
ps.lspkind-nvim { settings.plugins.lspkind.enable = true; }
ps.cmp_luasnip { settings.plugins.cmp_luasnip.enable = true; }
ps.cmp-nvim-lsp { settings.plugins.cmp-nvim-lsp.enable = true; }
{ plugin = ps.nvim-autopairs; { plugin = ps.nvim-autopairs;
config = compile "nvim_autopairs" (LET settings.plugins.nvim-autopairs.enable = false;
config = (LET
(REQ "cmp") (REQ "nvim-autopairs.completion.cmp") (REQ "nvim-autopairs") (REQ "cmp") (REQ "nvim-autopairs.completion.cmp") (REQ "nvim-autopairs")
(cmp: cmp-autopairs: nvim-autopairs: (cmp: cmp-autopairs: nvim-autopairs:
[ [
@ -296,9 +216,9 @@
}) })
(cmp.event.on cmp.event "confirm_done" (cmp-autopairs.on_confirm_done { })) (cmp.event.on cmp.event "confirm_done" (cmp-autopairs.on_confirm_done { }))
])); } ])); }
{ plugin = ps.comment-nvim; { settings.plugins.comment.enable = true;
config = compile "comment_nvim" [ config = [
((REQ "Comment").setup { }) # ((REQ "Comment").setup { })
(kmSetNs { (kmSetNs {
"<space>/" = { "<space>/" = {
# metatables...... # metatables......
@ -314,7 +234,8 @@
}) })
]; } ]; }
{ plugin = ps.nvim-lspconfig; { plugin = ps.nvim-lspconfig;
config = compile "nvim_lspconfig" ( settings.plugins.lsp.enable = false;
config = (
let lsp = name: builtins.seq let lsp = name: builtins.seq
# ensure an lsp exists (otherwise lspconfig will still create an empty config for some reason) # ensure an lsp exists (otherwise lspconfig will still create an empty config for some reason)
(REQ "lspconfig.server_configurations.${name}") (REQ "lspconfig.server_configurations.${name}")
@ -432,9 +353,9 @@
clangd = { }; clangd = { };
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md # https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
pylsp = { pylsp = {
settings = { settings.pylsp = {
pylsp.plugins.pylsp_mypy.enabled = true; plugins.pylsp_mypy.enabled = true;
pylsp.plugins.black.enabled = true; plugins.black.enabled = true;
}; };
}; };
svelte = { }; svelte = { };
@ -442,7 +363,11 @@
cssls = { }; cssls = { };
tsserver = { }; tsserver = { };
jsonls = { }; jsonls = { };
nil_ls = { }; nil_ls = {
settings.nil = {
formatting.command = ["nixfmt"];
};
};
taplo = { }; taplo = { };
marksman = { }; marksman = { };
rust_analyzer = { rust_analyzer = {
@ -453,12 +378,163 @@
]) # END ]) # END
)) # END )) # END
]); } ]); }
{ plugin = ps.which-key-nvim; { settings.plugins.which-key.enable = true;
config = compile "which_key_nvim" [ settings.globalOpts.timeout = true;
(SET vim.o.timeout true) settings.globalOpts.timeoutlen = 500; }
(SET vim.o.timeoutlen 500) { settings.plugins.treesitter = {
(which-key.setup { }) enable = true;
]; } grammarPackages = with pkgs.tree-sitter-grammars; [
tree-sitter-norg
tree-sitter-norg-meta
]; ];
settings.highlight.enable = true;
}; }
{ settings.plugins.image = {
enable = true;
backend = "kitty";
integrations = {
markdown = {
enabled = true;
downloadRemoteImages = false;
}; };
neorg = {
enabled = true;
downloadRemoteImages = true;
};
};
}; }
{ settings.plugins.telescope.enable = true; }
{ plugin = ps.neorg;
# TODO: remove when bumping inputs https://github.com/nix-community/nixvim/issues/1395
settings.extraLuaPackages = (x: with x; [
lua-utils-nvim
pathlib-nvim
nvim-nio
]);
config = (REQ "neorg").setup {
load = {
"core.defaults" = { };
"core.completion".config = {
engine = "nvim-cmp";
};
"core.concealer" = { };
"core.dirman".config = {
workspaces.ws = "~/notes";
default_workspace = "ws";
};
"core.esupports.metagen".config = {
author = "chayleaf";
timezone = "utc";
type = "empty";
};
"core.integrations.nvim-cmp" = { };
"core.integrations.image" = { };
"core.integrations.treesitter".config = {
# install_parsers = false;
};
"core.journal".config = {
workspace = "ws";
};
"core.keybinds" = { };
"core.latex.renderer" = { };
};
}; }
{ plugin = ps.neorg-telescope; }
];
in lib.mkMerge ((builtins.concatLists (map (x: lib.toList (x.settings or [ ])) plugins)) ++ lib.toList {
enable = true;
defaultEditor = true;
package = pkgs.neovim-unwrapped;
extraPackages = with pkgs; [
rust-analyzer
nodePackages_latest.bash-language-server shellcheck
nodePackages_latest.typescript-language-server
# nodePackages_latest.svelte-language-server
clang-tools_latest
nodePackages_latest.vscode-langservers-extracted
nil
marksman
nixfmt-rfc-style
taplo
ripgrep
(python3.withPackages (p: with p; [
python-lsp-server
python-lsp-black
pylsp-mypy
python-lsp-server.optional-dependencies.pyflakes
python-lsp-server.optional-dependencies.mccabe
python-lsp-server.optional-dependencies.pycodestyle
]))
];
# extraPython3Packages = pyPkgs: with pyPkgs; [
# ];
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraConfigLua = compile "main" (
builtins.concatLists (map (x: lib.toList (x.config or [ ])) plugins) ++ [
(kmSetNs {
"<C-X>" = {
rhs = DEFUN (vim.fn.system [ "chmod" "+x" (vim.fn.expand "%") ]);
desc = "chmod +x %";
};
})
(SET (vimg "vimsyn_embed") "l")
(LET (vim.api.nvim_create_augroup "nvimrc" { clear = true; }) (group:
lib.mapAttrsToList (k: v: vim.api.nvim_create_autocmd k { inherit group; callback = v; }) {
BufReadPre = DEFUN (SET vim.o.foldmethod "syntax");
BufEnter = { buf, ... }:
LET (vim.filetype.match { inherit buf; }) (filetype: [
(IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" "mail" ])) (
LET vim.o.colorcolumn (old_colorcolumn: [
(SET vim.o.colorcolumn "73")
(vim.api.nvim_create_autocmd "BufLeave" {
buffer = buf;
callback = DEFUN [
(SET vim.o.colorcolumn old_colorcolumn)
# return true = delete autocommand
(RETURN true)
];
})
])
))
(IF (APPLY OR (map (EQ filetype) [ "markdown" "mail" ])) (
(SET (IDX vim.bo buf).textwidth 72)
))
]);
BufWinEnter = { buf, ... }:
LET (vim.filetype.match { inherit buf; }) (filetype: [
(CALL (PROP vim.cmd "folddoc") "foldopen!")
(IF (EQ filetype "gitcommit") (
vim.cmd {
cmd = "normal"; bang = true;
args = [ "gg" ];
}
) ELSE (LET
(IDX (vim.api.nvim_buf_get_mark buf "\"") 1)
(vim.api.nvim_buf_line_count buf)
(pos: cnt:
IF (AND (GE pos 1) (LE pos cnt))
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "g`\"" ];
})
/*ELIF*/ (GE pos 1)
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "g$" ];
})
ELSE
(vim.cmd {
cmd = "normal"; bang = true;
args = [ "gg" ];
})
)))
]);
}
))
]);
extraPlugins = builtins.filter (x: x != null) (map (x: x.plugin or null) plugins);
});
} }

View file

@ -10,6 +10,10 @@ with lib; {
default = false; default = false;
description = "whether this is a phone"; description = "whether this is a phone";
}; };
suspend = mkOption {
type = types.bool;
default = true;
};
}; };
options.rustAnalyzerAndroidSettings = mkOption { options.rustAnalyzerAndroidSettings = mkOption {
type = with types; attrs; type = with types; attrs;

View file

@ -6,7 +6,7 @@ let
foot = "${pkgs.foot}/bin/footclient"; foot = "${pkgs.foot}/bin/footclient";
kitty = "${pkgs.kitty}/bin/kitty"; kitty = "${pkgs.kitty}/bin/kitty";
urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt"; urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt";
}.${term}; }.${term} or (throw "Terminal not found");
color = builtins.elemAt config.colors.base; color = builtins.elemAt config.colors.base;
hex = x: if builtins.isFunction x then (y: "#" + (x y)) else ("#" + x); hex = x: if builtins.isFunction x then (y: "#" + (x y)) else ("#" + x);
shell = lib.mkIf config.termShell.enable (lib.mkDefault config.termShell.path); shell = lib.mkIf config.termShell.enable (lib.mkDefault config.termShell.path);
@ -198,10 +198,10 @@ in {
enabled_layouts = "all"; enabled_layouts = "all";
}; };
}; };
xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf".text = xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf" =
lib.mkIf lib.mkIf
(supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono") (supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono") {
'' text = ''
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig> <fontconfig>
@ -215,4 +215,5 @@ in {
</match> </match>
</fontconfig> </fontconfig>
''; '';
};
} }

View file

@ -20,9 +20,15 @@
}; };
});*/ });*/
settings = let settings = let
layer = if config.phone.enable then "overlay" else "top"; layer = "bottom";
in lib.optionals config.phone.enable [ in lib.optionals config.phone.enable [
{ {
modes.dock = {
inherit layer;
exclusive = true;
passthrough = false;
visible = true;
};
inherit layer; inherit layer;
position = "top"; position = "top";
ipc = true; ipc = true;
@ -40,6 +46,12 @@
modules-right = [ "clock" ]; modules-right = [ "clock" ];
} }
] ++ lib.toList { ] ++ lib.toList {
modes.dock = {
inherit layer;
exclusive = true;
passthrough = false;
visible = true;
};
inherit layer; inherit layer;
position = "top"; position = "top";
ipc = true; ipc = true;
@ -171,7 +183,13 @@
}; };
} ++ lib.optionals config.phone.enable [ } ++ lib.optionals config.phone.enable [
{ {
inherit layer; modes.dock = {
layer = "overlay";
exclusive = true;
passthrough = false;
visible = true;
};
layer = "overlay";
position = "bottom"; position = "bottom";
ipc = true; ipc = true;
height = 80; height = 80;

104
nixos-rebuild.py Executable file
View file

@ -0,0 +1,104 @@
#!/usr/bin/env python3
# because nixos-rebuild --target-host is too flaky
import json
import os
import subprocess
import sys
with open(os.path.expanduser("~/var/addresses.json"), "rt") as f:
opts = json.loads(f.read())
def main():
args = sys.argv
cfg = args[1]
if "@" in cfg:
cfg, addr = cfg.split("@")
else:
addr = opts["addresses"][cfg]
build_host = opts["build_host"].get(cfg)
act = args[2]
assert act in ["boot", "switch", "test", "build"]
args = args[3:]
args.extend(
[
"--option",
"extra-builtins-file",
os.path.dirname(__file__) + "/extra-builtins.nix",
]
)
attr_path = f".#nixosConfigurations.{cfg}.config.system.build.toplevel"
copy_args = []
do_copy = True
if build_host is not None:
build_host = addr if cfg == build_host else opts["addresses"][build_host]
cmd = ["nix", "eval", "--json", attr_path + ".drvPath"] + args
ret = subprocess.run(cmd, check=True, encoding="utf-8", stdout=subprocess.PIPE)
drv = json.loads(ret.stdout)
print('copying', drv, 'to build host')
cmd = [
"nix",
"copy",
drv,
"--derivation",
"--to",
"ssh-ng://root@" + build_host,
] + args
subprocess.run(cmd, check=True)
print('building', drv)
cmd = ["nix", "build", f"'{drv}^*'", "--no-link", "--json"] + args
ret = subprocess.run(
["ssh", "root@" + build_host],
input=" ".join(cmd) + "\n",
check=True,
encoding="utf-8",
stdout=subprocess.PIPE,
)
if cfg == build_host:
do_copy = False
else:
copy_args.extend(["--from", "ssh-ng://root@" + build_host])
else:
print('building', attr_path)
cmd = ["nix", "build", attr_path, "--no-link", "--json"] + args
ret = subprocess.run(cmd, check=True, encoding="utf-8", stdout=subprocess.PIPE)
ret = json.loads(ret.stdout)[0]["outputs"]["out"]
print('output', ret)
cmds = []
if act in ["build"]:
return
if act in ["boot", "switch"]:
cmds.append(["nix-env", "-p", "/nix/var/nix/profiles/system", "--set", ret])
cmds.append(
["env", "NIXOS_INSTALL_BOOTLOADER=", ret + "/bin/switch-to-configuration", act]
)
if addr is None:
for cmd in cmds:
print('running', *cmd)
cmd = ["sudo", "-A"] + cmd
subprocess.run(cmd, check=True)
else:
if do_copy:
print('copying', ret, 'to', addr)
print(*(["nix", "copy", ret, "--no-check-sigs", "--to", "ssh-ng://root@" + addr] + copy_args + args))
subprocess.run(
["nix", "copy", ret, "--no-check-sigs", "--to", "ssh-ng://root@" + addr]
+ copy_args
+ args,
check=True,
)
print('running', *cmd)
subprocess.run(
["ssh", "root@" + addr],
input="\n".join(" ".join(cmd) for cmd in cmds) + "\n",
check=True,
encoding="utf-8",
)
if __name__ == "__main__":
try:
main()
except subprocess.CalledProcessError:
sys.exit(1)

View file

@ -22,24 +22,24 @@
"pinned": false, "pinned": false,
"src": { "src": {
"name": null, "name": null,
"sha256": "sha256-4jh3mDm1GpR9tQBkzx9BRsJ5awNrBgRzylyRB04LqIE=", "sha256": "sha256-jDWZ4m5aUALhs/EhGwrFa/3dbrLE3Lrn2BAnGC7TbIk=",
"type": "url", "type": "url",
"url": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-7/GE-Proton9-7.tar.gz" "url": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-20/GE-Proton9-20.tar.gz"
}, },
"version": "GE-Proton9-7" "version": "GE-Proton9-20"
}, },
"searxng": { "searxng": {
"cargoLocks": null, "cargoLocks": null,
"date": "2024-06-07", "date": "2024-11-17",
"extract": null, "extract": null,
"name": "searxng", "name": "searxng",
"passthru": null, "passthru": null,
"pinned": false, "pinned": false,
"src": { "src": {
"sha256": "sha256-WWbpfZZei3kOdN607/J2M1oSzbPZKaLbsU5gO2kIc90=", "sha256": "sha256-dXALuiPCzK0Az64Fj9ygsNFoPKf0oJ2LyZDeg00Bfyo=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/searxng/searxng/archive/f5eb56b63f250c7804e5e1cf4426e550bc933906.tar.gz" "url": "https://github.com/searxng/searxng/archive/10d3af84b833ab2f2d1095efa3a7ba240ffb32fc.tar.gz"
}, },
"version": "f5eb56b63f250c7804e5e1cf4426e550bc933906" "version": "10d3af84b833ab2f2d1095efa3a7ba240ffb32fc"
} }
} }

View file

@ -12,19 +12,19 @@
}; };
proton-ge = { proton-ge = {
pname = "proton-ge"; pname = "proton-ge";
version = "GE-Proton9-7"; version = "GE-Proton9-20";
src = fetchurl { src = fetchurl {
url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-7/GE-Proton9-7.tar.gz"; url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-20/GE-Proton9-20.tar.gz";
sha256 = "sha256-4jh3mDm1GpR9tQBkzx9BRsJ5awNrBgRzylyRB04LqIE="; sha256 = "sha256-jDWZ4m5aUALhs/EhGwrFa/3dbrLE3Lrn2BAnGC7TbIk=";
}; };
}; };
searxng = { searxng = {
pname = "searxng"; pname = "searxng";
version = "f5eb56b63f250c7804e5e1cf4426e550bc933906"; version = "10d3af84b833ab2f2d1095efa3a7ba240ffb32fc";
src = fetchTarball { src = fetchTarball {
url = "https://github.com/searxng/searxng/archive/f5eb56b63f250c7804e5e1cf4426e550bc933906.tar.gz"; url = "https://github.com/searxng/searxng/archive/10d3af84b833ab2f2d1095efa3a7ba240ffb32fc.tar.gz";
sha256 = "sha256-WWbpfZZei3kOdN607/J2M1oSzbPZKaLbsU5gO2kIc90="; sha256 = "sha256-dXALuiPCzK0Az64Fj9ygsNFoPKf0oJ2LyZDeg00Bfyo=";
}; };
date = "2024-06-07"; date = "2024-11-17";
}; };
} }

View file

@ -116,4 +116,7 @@ in
# hardware stuff # hardware stuff
hw.bpi-r3 = import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; }; hw.bpi-r3 = import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; };
hw.oneplus-enchilada = import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; }; hw.oneplus-enchilada = import ../system/hardware/oneplus-enchilada/pkgs.nix { inherit inputs pkgs pkgs' lib sources; };
hw.kobo-clara = import ../system/hardware/kobo-clara/pkgs.nix { inherit pkgs pkgs' lib sources; };
# wlroots = throw "a";
# sway-unwrapped = throw "a";
} }

View file

@ -23,13 +23,13 @@
}; };
"rikaitan" = buildFirefoxXpiAddon { "rikaitan" = buildFirefoxXpiAddon {
pname = "rikaitan"; pname = "rikaitan";
version = "24.5.21.0"; version = "24.11.4.1";
addonId = "tatsu@autistici.org"; addonId = "tatsu@autistici.org";
url = "https://addons.mozilla.org/firefox/downloads/file/4291845/rikaitan-24.5.21.0.xpi"; url = "https://addons.mozilla.org/firefox/downloads/file/4387983/rikaitan-24.11.4.1.xpi";
sha256 = "a2a94d88af04023f14daaafda1f6ca7a7197f2ab92ada08ee2e9e4292d57a391"; sha256 = "583ce8ff3fc39e7bed139540a2c1b00871f429dd6c165fe9b181a5b095347549";
meta = with lib; meta = with lib;
{ {
homepage = "https://github.com/Ajatt-Tools/rikaitan"; homepage = "https://rikaitan.github.io/";
description = "Japanese dictionary with Anki integration and flashcard creation support."; description = "Japanese dictionary with Anki integration and flashcard creation support.";
license = licenses.gpl3; license = licenses.gpl3;
mozPermissions = [ mozPermissions = [
@ -38,6 +38,7 @@
"unlimitedStorage" "unlimitedStorage"
"declarativeNetRequest" "declarativeNetRequest"
"scripting" "scripting"
"contextMenus"
"http://*/*" "http://*/*"
"https://*/*" "https://*/*"
"file://*/*" "file://*/*"

View file

@ -25,10 +25,13 @@
, xorg , xorg
, xvfb-run , xvfb-run
, dbus , dbus
, gnome , adwaita-icon-theme
, alsa-lib , alsa-lib
, glib , glib
, glib-networking , glib-networking
, libiff
, libilbm
, cfitsio
}: }:
let let
@ -36,20 +39,17 @@ let
pygobject3 pygobject3
]); ]);
in gimp.overrideAttrs (old: rec { in gimp.overrideAttrs (old: rec {
version = "2_99_16+date=2023-07-05"; version = "2_99_18+date=2024-02-18";
outputs = [ "out" "dev" "devdoc" ]; outputs = [ "out" "dev" "devdoc" ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "GNOME"; owner = "GNOME";
repo = "gimp"; repo = "gimp";
rev = "d3c5536ac85bb84e1beaba68aea12cf28062e08c"; rev = "f94c4cb5dbf9766b27ecb5016b7a39497cc74ddc";
hash = "sha256-ZKCZXt+8Jj9sETezlOXY17Kr2DeFc6O6zh97XCjfhiE="; hash = "sha256-rQd/EwGk6AFQ4dQCx2Jys60mcDvaLSkXeVsrjTJw8wg=";
}; };
patches = [ patches = [
(substituteAll { (substituteAll {
src = fetchpatch { src = ./hardcode-plugin-interpreters.patch;
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/86947c8f83a3bd593eefb8e5f433f0d045c3d9a7/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch";
hash = "sha256-uk4u+WK+p3U0NyCVa2Ua+o2nLaHZzo0jP3muGPu55ak=";
};
python_interpreter = python.interpreter; python_interpreter = python.interpreter;
}) })
(substituteAll { (substituteAll {
@ -64,6 +64,7 @@ in gimp.overrideAttrs (old: rec {
hash = "sha256-8jqQmfbOARMPNIsBfNKpMIeK4dXoAme7rUJeQZwh4PM="; hash = "sha256-8jqQmfbOARMPNIsBfNKpMIeK4dXoAme7rUJeQZwh4PM=";
}) })
./floating-paste.patch ./floating-paste.patch
./fix-docs.patch
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
@ -88,10 +89,13 @@ in gimp.overrideAttrs (old: rec {
json-glib json-glib
python python
xorg.libXmu xorg.libXmu
gnome.adwaita-icon-theme adwaita-icon-theme
(luajit.withPackages (ps: [ ps.lgi ])) (luajit.withPackages (ps: [ ps.lgi ]))
alsa-lib alsa-lib
gjs gjs
libiff
libilbm
cfitsio
]; ];
configureFlags = [ ]; configureFlags = [ ];
mesonFlags = [ mesonFlags = [
@ -100,7 +104,6 @@ in gimp.overrideAttrs (old: rec {
"-Dcheck-update=no" "-Dcheck-update=no"
"-Dappdata-test=disabled" "-Dappdata-test=disabled"
]; ];
enableParallelBuilding = false;
env = old.env // { GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules"; }; env = old.env // { GIO_EXTRA_MODULES = "${glib-networking}/lib/gio/modules"; };
preConfigure = ""; preConfigure = "";
postPatch = '' postPatch = ''
@ -123,11 +126,11 @@ in gimp.overrideAttrs (old: rec {
meson test --timeout-multiplier 4 --print-errorlogs meson test --timeout-multiplier 4 --print-errorlogs
runHook postCheck runHook postCheck
''; '';
doCheck = false;
preFixup = '' preFixup = ''
gappsWrapperArgs+=(\ gappsWrapperArgs+=(\
--prefix PATH : "${lib.makeBinPath [ graphviz ]}:$out/bin" \ --prefix PATH : "${lib.makeBinPath [ graphviz ]}:$out/bin" \
--suffix XDG_DATA_DIRS : "${gnome.adwaita-icon-theme}/share" \ --suffix XDG_DATA_DIRS : "${adwaita-icon-theme}/share" \
) )
''; '';
postFixup = '' postFixup = ''

24
pkgs/gimp/fix-docs.patch Normal file
View file

@ -0,0 +1,24 @@
diff --git a/devel-docs/reference/gimp-ui/meson.build b/devel-docs/reference/gimp-ui/meson.build
index 89fd608..4be5ce6 100644
--- a/devel-docs/reference/gimp-ui/meson.build
+++ b/devel-docs/reference/gimp-ui/meson.build
@@ -19,7 +19,6 @@ gimp_ui_docs = custom_target('gimp-ui-docs',
gi_docgen,
'generate',
'--quiet',
- '--fatal-warnings',
'--config', gimp_ui_doc_toml,
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
diff --git a/devel-docs/reference/gimp/meson.build b/devel-docs/reference/gimp/meson.build
index 1701723..d3f33d7 100644
--- a/devel-docs/reference/gimp/meson.build
+++ b/devel-docs/reference/gimp/meson.build
@@ -18,7 +18,6 @@ gimp_docs = custom_target('gimp-docs',
gi_docgen,
'generate',
'--quiet',
- '--fatal-warnings',
'--config', gimp_doc_toml,
'--output-dir=@OUTPUT@',
'--no-namespace-dir',

View file

@ -0,0 +1,10 @@
diff --git a/plug-ins/python/pygimp.interp.in b/plug-ins/python/pygimp.interp.in
index 28cccf0..3a89862 100644
--- a/plug-ins/python/pygimp.interp.in
+++ b/plug-ins/python/pygimp.interp.in
@@ -2,4 +2,4 @@ python=@PYTHON_PATH@python.exe
python3=@PYTHON_PATH@python.exe
/usr/bin/python=@PYTHON_PATH@python.exe
/usr/bin/python3=@PYTHON_PATH@python.exe
-:Python:E::py::python3:
+:Python:E::py::@python_interpreter@:

View file

@ -6,7 +6,9 @@
./fix-painting-api-crashes.patch ./fix-painting-api-crashes.patch
./painting-api-options.patch ./painting-api-options.patch
./painting-api-pressure.patch ./painting-api-pressure.patch
./line-painting-api-qpointf.patch
]; }); ]; });
}).overrideAttrs (old: { }).overrideAttrs (old: {
patched = true;
buildInputs = old.buildInputs ++ [ python3Packages.requests ]; buildInputs = old.buildInputs ++ [ python3Packages.requests ];
}) })

View file

@ -0,0 +1,13 @@
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
index 986cc54169..04499fa38f 100644
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
@@ -82,7 +82,7 @@ public Q_SLOTS:
int index() const;
QUuid uniqueId() const;
- void paintLine(const QPoint pointOne, const QPoint pointTwo, double pressureOne = 1.0, double pressureTwo = 1.0, const QString strokeStyle = "ForegroundColor");
+ void paintLine(const QPointF pointOne, const QPointF pointTwo, double pressureOne = 1.0, double pressureTwo = 1.0, const QString strokeStyle = "ForegroundColor");
void paintRectangle(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
void paintPolygon(const QList<QPointF> points, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
void paintEllipse(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");

View file

@ -0,0 +1,210 @@
From 85bbcf7e18136f788cf76bb6f345ade84a5e536e Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 10:49:21 +0700
Subject: [PATCH 1/5] add on-long-touch option
---
config.c | 21 +++++++++++++++++++++
doc/mako.5.scd | 15 ++++++++++++++-
include/config.h | 7 ++++---
include/notification.h | 2 +-
include/wayland.h | 1 +
notification.c | 8 ++++++--
wayland.c | 3 ++-
7 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/config.c b/config.c
index 70be717..87db932 100644
--- a/config.c
+++ b/config.c
@@ -129,6 +129,9 @@ void init_default_style(struct mako_style *style) {
style->button_bindings.right.action = MAKO_BINDING_DISMISS;
style->button_bindings.middle.action = MAKO_BINDING_NONE;
style->touch_binding.action = MAKO_BINDING_DISMISS;
+ style->long_touch_binding.action = MAKO_BINDING_INVOKE_ACTION;
+ style->long_touch_binding.action_name = strdup(DEFAULT_ACTION_KEY);
+ style->long_press_duration = 500;
// Everything in the default config is explicitly specified.
memset(&style->spec, true, sizeof(struct mako_style_spec));
@@ -148,6 +151,7 @@ void finish_style(struct mako_style *style) {
finish_binding(&style->button_bindings.middle);
finish_binding(&style->button_bindings.right);
finish_binding(&style->touch_binding);
+ finish_binding(&style->long_touch_binding);
finish_binding(&style->notify_binding);
free(style->icon_path);
free(style->font);
@@ -385,6 +389,16 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
target->spec.touch_binding = true;
}
+ if (style->spec.long_touch_binding) {
+ copy_binding(&target->long_touch_binding, &style->long_touch_binding);
+ target->spec.long_touch_binding = true;
+ }
+
+ if (style->spec.long_press_duration) {
+ target->long_press_duration = style->long_press_duration;
+ target->spec.long_press_duration = true;
+ }
+
if (style->spec.notify_binding) {
copy_binding(&target->notify_binding, &style->notify_binding);
target->spec.notify_binding = true;
@@ -660,6 +674,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
return true;
} else if (strcmp(name, "anchor") == 0) {
return spec->anchor = parse_anchor(value, &style->anchor);
+ } else if (strcmp(name, "long-press-duration") == 0) {
+ return spec->long_press_duration = parse_int_ge(value, &style->long_press_duration, 0);
} else if (has_prefix(name, "on-")) {
struct mako_binding binding = {0};
if (strcmp(value, "none") == 0) {
@@ -697,6 +713,9 @@ static bool apply_style_option(struct mako_style *style, const char *name,
} else if (strcmp(name, "on-touch") == 0) {
copy_binding(&style->touch_binding, &binding);
style->spec.touch_binding = true;
+ } else if (strcmp(name, "on-long-touch") == 0) {
+ copy_binding(&style->long_touch_binding, &binding);
+ style->spec.long_touch_binding = true;
} else if (strcmp(name, "on-notify") == 0) {
copy_binding(&style->notify_binding, &binding);
style->spec.notify_binding = true;
@@ -886,6 +905,8 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
{"on-button-right", required_argument, 0, 0},
{"on-button-middle", required_argument, 0, 0},
{"on-touch", required_argument, 0, 0},
+ {"on-long-touch", required_argument, 0, 0},
+ {"long-press-duration", required_argument, 0, 0},
{0},
};
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
index 91378ba..fff19ed 100644
--- a/doc/mako.5.scd
+++ b/doc/mako.5.scd
@@ -57,10 +57,23 @@ Supported options:
Default: dismiss
*on-touch*=_action_
- Performs the action when tapped via a touch device.
+ Performs the action when tapped via a touch device if the tap
+ duration is less than *long-press-duration*.
Default: dismiss
+*on-long-touch*=_action_
+ Performs the action when tapped via a touch device if the press
+ duration is greater or equal to *long-press-duration*.
+
+ Default: invoke-default-action
+
+*long-press-duration*=_time_
+ Specifies the cutoff time (in milliseconds) for a press to be
+ considered a long press.
+
+ Default: 500
+
*on-notify*=_action_
Performs the action when the notification is opened.
diff --git a/include/config.h b/include/config.h
index 013923a..5ff541c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -42,14 +42,14 @@ struct mako_style_spec {
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
- icon_location, max_visible, layer, output, anchor;
+ icon_location, max_visible, layer, output, anchor, long_press_duration;
struct {
bool background, text, border, progress;
} colors;
struct {
bool left, right, middle;
} button_bindings;
- bool touch_binding, notify_binding;
+ bool touch_binding, long_touch_binding, notify_binding;
};
@@ -98,7 +98,8 @@ struct mako_style {
struct {
struct mako_binding left, right, middle;
} button_bindings;
- struct mako_binding touch_binding, notify_binding;
+ struct mako_binding touch_binding, long_touch_binding, notify_binding;
+ int32_t long_press_duration;
};
struct mako_config {
diff --git a/include/notification.h b/include/notification.h
index 9a395ba..a02d855 100644
--- a/include/notification.h
+++ b/include/notification.h
@@ -101,7 +101,7 @@ size_t format_notification(struct mako_notification *notif, const char *format,
void notification_handle_button(struct mako_notification *notif, uint32_t button,
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
void notification_handle_touch(struct mako_notification *notif,
- const struct mako_binding_context *ctx);
+ const struct mako_binding_context *ctx, int32_t duration_ms);
void notification_execute_binding(struct mako_notification *notif,
const struct mako_binding *binding, const struct mako_binding_context *ctx);
void insert_notification(struct mako_state *state, struct mako_notification *notif);
diff --git a/include/wayland.h b/include/wayland.h
index cc00500..c8767be 100644
--- a/include/wayland.h
+++ b/include/wayland.h
@@ -35,6 +35,7 @@ struct mako_seat {
struct wl_touch *wl_touch;
struct {
int32_t x, y;
+ uint32_t time;
struct mako_surface *surface;
} pts[MAX_TOUCHPOINTS];
} touch;
diff --git a/notification.c b/notification.c
index 8c0c8a7..7d3db2f 100644
--- a/notification.c
+++ b/notification.c
@@ -446,8 +446,12 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
}
void notification_handle_touch(struct mako_notification *notif,
- const struct mako_binding_context *ctx) {
- notification_execute_binding(notif, &notif->style.touch_binding, ctx);
+ const struct mako_binding_context *ctx, int32_t duration_ms) {
+ if (duration_ms >= notif->style.long_press_duration) {
+ notification_execute_binding(notif, &notif->style.long_touch_binding, ctx);
+ } else {
+ notification_execute_binding(notif, &notif->style.touch_binding, ctx);
+ }
}
/*
diff --git a/wayland.c b/wayland.c
index eeefb30..d247779 100644
--- a/wayland.c
+++ b/wayland.c
@@ -122,6 +122,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
}
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
+ seat->touch.pts[id].time = time;
seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
}
@@ -144,7 +145,7 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch,
wl_list_for_each(notif, &state->notifications, link) {
if (hotspot_at(&notif->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
struct mako_surface *surface = notif->surface;
- notification_handle_touch(notif, &ctx);
+ notification_handle_touch(notif, &ctx, time - seat->touch.pts[id].time);
set_dirty(surface);
break;
}
--
2.45.2

View file

@ -0,0 +1,151 @@
From 7365261e130016e884371d2e288b83e16a9dcb48 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 13:50:38 +0700
Subject: [PATCH 2/5] consider long press done even before release
---
include/notification.h | 16 ++++++++++------
include/wayland.h | 1 +
notification.c | 22 ++++++++++++++++++++++
wayland.c | 15 ++++++++++++++-
4 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/include/notification.h b/include/notification.h
index a02d855..b1482ec 100644
--- a/include/notification.h
+++ b/include/notification.h
@@ -19,6 +19,12 @@ struct mako_hotspot {
int32_t width, height;
};
+struct mako_binding_context {
+ struct mako_surface *surface;
+ struct mako_seat *seat;
+ uint32_t serial;
+};
+
struct mako_notification {
struct mako_state *state;
struct mako_surface *surface;
@@ -38,6 +44,8 @@ struct mako_notification {
char *body;
int32_t requested_timeout;
struct wl_list actions; // mako_action::link
+ struct mako_timer *long_press_timer;
+ struct mako_binding_context long_press_ctx;
enum mako_notification_urgency urgency;
char *category;
@@ -70,12 +78,6 @@ struct mako_hidden_format_data {
size_t count;
};
-struct mako_binding_context {
- struct mako_surface *surface;
- struct mako_seat *seat;
- uint32_t serial;
-};
-
typedef char *(*mako_format_func_t)(char variable, bool *markup, void *data);
bool hotspot_at(struct mako_hotspot *hotspot, int32_t x, int32_t y);
@@ -100,6 +102,8 @@ size_t format_notification(struct mako_notification *notif, const char *format,
char *buf);
void notification_handle_button(struct mako_notification *notif, uint32_t button,
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
+void notification_handle_touch_start(struct mako_notification *notif,
+ const struct mako_binding_context *ctx);
void notification_handle_touch(struct mako_notification *notif,
const struct mako_binding_context *ctx, int32_t duration_ms);
void notification_execute_binding(struct mako_notification *notif,
diff --git a/include/wayland.h b/include/wayland.h
index c8767be..d4d39c4 100644
--- a/include/wayland.h
+++ b/include/wayland.h
@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <wayland-client-protocol.h>
+#include "mako.h"
#define MAX_TOUCHPOINTS 10
diff --git a/notification.c b/notification.c
index 7d3db2f..32e7f7b 100644
--- a/notification.c
+++ b/notification.c
@@ -41,6 +41,8 @@ void reset_notification(struct mako_notification *notif) {
destroy_timer(notif->timer);
notif->timer = NULL;
+ destroy_timer(notif->long_press_timer);
+ notif->long_press_timer = NULL;
free(notif->app_name);
free(notif->app_icon);
@@ -447,6 +449,8 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
void notification_handle_touch(struct mako_notification *notif,
const struct mako_binding_context *ctx, int32_t duration_ms) {
+ destroy_timer(notif->long_press_timer);
+ notif->long_press_timer = NULL;
if (duration_ms >= notif->style.long_press_duration) {
notification_execute_binding(notif, &notif->style.long_touch_binding, ctx);
} else {
@@ -454,6 +458,24 @@ void notification_handle_touch(struct mako_notification *notif,
}
}
+void handle_notification_touch_timer(void *data) {
+ struct mako_notification *notif = data;
+ notif->long_press_timer = NULL;
+ struct mako_binding_context ctx = notif->long_press_ctx;
+ notification_execute_binding(notif, &notif->style.long_touch_binding, &ctx);
+ set_dirty(ctx.surface);
+}
+
+void notification_handle_touch_start(struct mako_notification *notif,
+ const struct mako_binding_context *ctx) {
+ if (notif->long_press_timer) {
+ return;
+ }
+ notif->long_press_ctx = *ctx;
+ notif->long_press_timer = add_event_loop_timer(&notif->state->event_loop, 500,
+ handle_notification_touch_timer, notif);
+}
+
/*
* Searches through the notifications list and returns the next position at
* which to insert. If no results for the specified urgency are found,
diff --git a/wayland.c b/wayland.c
index d247779..6d8b6ff 100644
--- a/wayland.c
+++ b/wayland.c
@@ -120,10 +120,23 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
if (id >= MAX_TOUCHPOINTS) {
return;
}
+ struct mako_state *state = seat->state;
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
seat->touch.pts[id].time = time;
- seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
+ seat->touch.pts[id].surface = get_surface(state, wl_surface);
+
+ struct mako_notification *notif;
+ const struct mako_binding_context ctx = {
+ .surface = seat->touch.pts[id].surface,
+ .seat = seat,
+ .serial = serial,
+ };
+ wl_list_for_each(notif, &state->notifications, link) {
+ if (hotspot_at(&notif->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
+ notification_handle_touch_start(notif, &ctx);
+ }
+ }
}
static void touch_handle_up(void *data, struct wl_touch *wl_touch,
--
2.45.2

View file

@ -0,0 +1,284 @@
From 0b53bc7fb9494bc7a804a1d088c6b4137d6eef6d Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 08:47:49 +0700
Subject: [PATCH 3/5] dynamic timeouts
Compute notification timeouts on every config change, rather than only
on notification creation.
---
criteria.c | 50 ++++++++++++++++++++++++++++++++++++++----
dbus/mako.c | 2 +-
dbus/xdg.c | 21 +-----------------
event-loop.c | 22 +++----------------
include/criteria.h | 4 ++--
include/event-loop.h | 2 +-
include/notification.h | 1 +
notification.c | 2 ++
render.c | 4 ++--
9 files changed, 59 insertions(+), 49 deletions(-)
diff --git a/criteria.c b/criteria.c
index 9db3966..3108a38 100644
--- a/criteria.c
+++ b/criteria.c
@@ -418,15 +418,38 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
return criteria;
}
-// Iterate through `criteria_list`, applying the style from each matching
+static void timespec_add(struct timespec *t, int delta_ms) {
+ static const long ms = 1000000, s = 1000000000;
+
+ int delta_ms_low = delta_ms % 1000;
+ int delta_s_high = delta_ms / 1000;
+
+ t->tv_sec += delta_s_high;
+
+ t->tv_nsec += (long)delta_ms_low * ms;
+ if (t->tv_nsec >= s) {
+ t->tv_nsec -= s;
+ ++t->tv_sec;
+ }
+}
+
+static void handle_notification_timer(void *data) {
+ struct mako_notification *notif = data;
+ struct mako_surface *surface = notif->surface;
+ notif->timer = NULL;
+
+ close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
+ set_dirty(surface);
+}
+
+// Iterate through the criteria list, applying the style from each matching
// criteria to `notif`. Returns the number of criteria that matched, or -1 if
// a failure occurs.
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
- struct mako_notification *notif) {
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif) {
ssize_t match_count = 0;
struct mako_criteria *criteria;
- wl_list_for_each(criteria, criteria_list, link) {
+ wl_list_for_each(criteria, &state->config.criteria, link) {
if (!match_criteria(criteria, notif)) {
continue;
}
@@ -447,6 +470,25 @@ ssize_t apply_each_criteria(struct wl_list *criteria_list,
}
}
+ int32_t expire_timeout = notif->requested_timeout;
+ if (expire_timeout < 0 || notif->style.ignore_timeout) {
+ expire_timeout = notif->style.default_timeout;
+ }
+
+ if (expire_timeout > 0) {
+ struct timespec at = notif->at;
+ timespec_add(&at, expire_timeout);
+ if (notif->timer) {
+ notif->timer->at = at;
+ } else {
+ notif->timer = add_event_loop_timer(&state->event_loop, &at,
+ handle_notification_timer, notif);
+ }
+ } else if (notif->timer) {
+ destroy_timer(notif->timer);
+ notif->timer = NULL;
+ }
+
if (!notif->surface) {
notif->surface = create_surface(notif->state, notif->style.output,
notif->style.layer, notif->style.anchor);
diff --git a/dbus/mako.c b/dbus/mako.c
index 4c95881..8f3c874 100644
--- a/dbus/mako.c
+++ b/dbus/mako.c
@@ -305,7 +305,7 @@ static void reapply_config(struct mako_state *state) {
finish_style(&notif->style);
init_empty_style(&notif->style);
- apply_each_criteria(&state->config.criteria, notif);
+ apply_each_criteria(state, notif);
// Having to do this for every single notification really hurts... but
// it does do The Right Thing (tm).
diff --git a/dbus/xdg.c b/dbus/xdg.c
index 1f91431..650dff7 100644
--- a/dbus/xdg.c
+++ b/dbus/xdg.c
@@ -81,15 +81,6 @@ static int handle_get_capabilities(sd_bus_message *msg, void *data,
return 0;
}
-static void handle_notification_timer(void *data) {
- struct mako_notification *notif = data;
- struct mako_surface *surface = notif->surface;
- notif->timer = NULL;
-
- close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
- set_dirty(surface);
-}
-
static int handle_notify(sd_bus_message *msg, void *data,
sd_bus_error *ret_error) {
struct mako_state *state = data;
@@ -382,7 +373,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
insert_notification(state, notif);
}
- int match_count = apply_each_criteria(&state->config.criteria, notif);
+ int match_count = apply_each_criteria(state, notif);
if (match_count == -1) {
// We encountered an allocation failure or similar while applying
// criteria. The notification may be partially matched, but the worst
@@ -398,16 +389,6 @@ static int handle_notify(sd_bus_message *msg, void *data,
return -1;
}
- int32_t expire_timeout = notif->requested_timeout;
- if (expire_timeout < 0 || notif->style.ignore_timeout) {
- expire_timeout = notif->style.default_timeout;
- }
-
- if (expire_timeout > 0) {
- notif->timer = add_event_loop_timer(&state->event_loop, expire_timeout,
- handle_notification_timer, notif);
- }
-
if (notif->style.icons) {
notif->icon = create_icon(notif);
}
diff --git a/event-loop.c b/event-loop.c
index 99c1f4a..92c627a 100644
--- a/event-loop.c
+++ b/event-loop.c
@@ -74,21 +74,6 @@ void finish_event_loop(struct mako_event_loop *loop) {
}
}
-static void timespec_add(struct timespec *t, int delta_ms) {
- static const long ms = 1000000, s = 1000000000;
-
- int delta_ms_low = delta_ms % 1000;
- int delta_s_high = delta_ms / 1000;
-
- t->tv_sec += delta_s_high;
-
- t->tv_nsec += (long)delta_ms_low * ms;
- if (t->tv_nsec >= s) {
- t->tv_nsec -= s;
- ++t->tv_sec;
- }
-}
-
static bool timespec_less(struct timespec *t1, struct timespec *t2) {
if (t1->tv_sec != t2->tv_sec) {
return t1->tv_sec < t2->tv_sec;
@@ -124,7 +109,7 @@ static void update_event_loop_timer(struct mako_event_loop *loop) {
}
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
- int delay_ms, mako_event_loop_timer_func_t func, void *data) {
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data) {
struct mako_timer *timer = calloc(1, sizeof(struct mako_timer));
if (timer == NULL) {
fprintf(stderr, "allocation failed\n");
@@ -133,10 +118,9 @@ struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
timer->event_loop = loop;
timer->func = func;
timer->user_data = data;
- wl_list_insert(&loop->timers, &timer->link);
+ timer->at = *at;
- clock_gettime(CLOCK_MONOTONIC, &timer->at);
- timespec_add(&timer->at, delay_ms);
+ wl_list_insert(&loop->timers, &timer->link);
update_event_loop_timer(loop);
return timer;
diff --git a/include/criteria.h b/include/criteria.h
index 2f03514..58c36ef 100644
--- a/include/criteria.h
+++ b/include/criteria.h
@@ -7,6 +7,7 @@
#include <wayland-client.h>
#include "config.h"
#include "types.h"
+#include "mako.h"
struct mako_config;
struct mako_notification;
@@ -53,8 +54,7 @@ bool parse_criteria(const char *string, struct mako_criteria *criteria);
bool apply_criteria_field(struct mako_criteria *criteria, char *token);
struct mako_criteria *global_criteria(struct mako_config *config);
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
- struct mako_notification *notif);
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif);
struct mako_criteria *create_criteria_from_notification(
struct mako_notification *notif, struct mako_criteria_spec *spec);
diff --git a/include/event-loop.h b/include/event-loop.h
index 95c8d36..cd63e98 100644
--- a/include/event-loop.h
+++ b/include/event-loop.h
@@ -47,7 +47,7 @@ bool init_event_loop(struct mako_event_loop *loop, sd_bus *bus,
void finish_event_loop(struct mako_event_loop *loop);
int run_event_loop(struct mako_event_loop *loop);
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
- int delay_ms, mako_event_loop_timer_func_t func, void *data);
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data);
void destroy_timer(struct mako_timer *timer);
diff --git a/include/notification.h b/include/notification.h
index b1482ec..2775d88 100644
--- a/include/notification.h
+++ b/include/notification.h
@@ -56,6 +56,7 @@ struct mako_notification {
struct mako_hotspot hotspot;
struct mako_timer *timer;
+ struct timespec at;
};
struct mako_action {
diff --git a/notification.c b/notification.c
index 32e7f7b..b78bd09 100644
--- a/notification.c
+++ b/notification.c
@@ -68,6 +68,8 @@ void reset_notification(struct mako_notification *notif) {
destroy_icon(notif->icon);
notif->icon = NULL;
+
+ clock_gettime(CLOCK_MONOTONIC, &notif->at);
}
struct mako_notification *create_notification(struct mako_state *state) {
diff --git a/render.c b/render.c
index 5b68632..44b78a0 100644
--- a/render.c
+++ b/render.c
@@ -355,7 +355,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
// Immediately before rendering we need to re-match all of the criteria
// so that matches against the anchor and output work even if the
// output was automatically assigned by the compositor.
- int rematch_count = apply_each_criteria(&state->config.criteria, notif);
+ int rematch_count = apply_each_criteria(state, notif);
if (rematch_count == -1) {
// We encountered an allocation failure or similar while applying
// criteria. The notification may be partially matched, but the
@@ -427,7 +427,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
struct mako_notification *hidden_notif = create_notification(state);
hidden_notif->surface = surface;
hidden_notif->hidden = true;
- apply_each_criteria(&state->config.criteria, hidden_notif);
+ apply_each_criteria(state, hidden_notif);
struct mako_style *style = &hidden_notif->style;
--
2.45.2

View file

@ -0,0 +1,192 @@
From e2cb0d80c643b03a61f69f85454c9ed06eda5c3e Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 09:19:34 +0700
Subject: [PATCH 4/5] implement notification time freezing
---
config.c | 8 +++++++
criteria.c | 49 +++++++++++++++++++++++++++++++++++-------
doc/mako.5.scd | 6 ++++++
include/config.h | 4 +++-
include/notification.h | 2 ++
notification.c | 1 +
6 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/config.c b/config.c
index 87db932..79dc58a 100644
--- a/config.c
+++ b/config.c
@@ -105,6 +105,7 @@ void init_default_style(struct mako_style *style) {
style->actions = true;
style->default_timeout = 0;
style->ignore_timeout = false;
+ style->freeze = false;
style->colors.background = 0x285577FF;
style->colors.text = 0xFFFFFFFF;
@@ -305,6 +306,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
target->spec.ignore_timeout = true;
}
+ if (style->spec.freeze) {
+ target->freeze = style->freeze;
+ target->spec.freeze = true;
+ }
+
if (style->spec.colors.background) {
target->colors.background = style->colors.background;
target->spec.colors.background = true;
@@ -637,6 +643,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
} else if (strcmp(name, "ignore-timeout") == 0) {
return spec->ignore_timeout =
parse_boolean(value, &style->ignore_timeout);
+ } else if (strcmp(name, "freeze") == 0) {
+ return spec->freeze = parse_boolean(value, &style->freeze);
} else if (strcmp(name, "group-by") == 0) {
return spec->group_criteria_spec =
parse_criteria_spec(value, &style->group_criteria_spec);
diff --git a/criteria.c b/criteria.c
index 3108a38..523a467 100644
--- a/criteria.c
+++ b/criteria.c
@@ -418,21 +418,39 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
return criteria;
}
-static void timespec_add(struct timespec *t, int delta_ms) {
- static const long ms = 1000000, s = 1000000000;
+static void timespec_from_ms(struct timespec *t, long time_ms) {
+ static const long ms = 1000000;
- int delta_ms_low = delta_ms % 1000;
- int delta_s_high = delta_ms / 1000;
+ t->tv_sec = time_ms / 1000;
+ t->tv_nsec = (time_ms % 1000) * ms;
+}
+
+static void timespec_add(struct timespec *t, struct timespec *u) {
+ static const long s = 1000000000;
- t->tv_sec += delta_s_high;
+ t->tv_sec += u->tv_sec;
+ t->tv_nsec += u->tv_nsec;
- t->tv_nsec += (long)delta_ms_low * ms;
if (t->tv_nsec >= s) {
t->tv_nsec -= s;
++t->tv_sec;
}
}
+static void timespec_sub(struct timespec *t, struct timespec *u) {
+ static const long s = 1000000000;
+
+ t->tv_sec -= u->tv_sec;
+ t->tv_nsec += s;
+ t->tv_nsec -= u->tv_nsec;
+
+ if (t->tv_nsec >= s) {
+ t->tv_nsec -= s;
+ } else {
+ --t->tv_sec;
+ }
+}
+
static void handle_notification_timer(void *data) {
struct mako_notification *notif = data;
struct mako_surface *surface = notif->surface;
@@ -474,10 +492,25 @@ ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *
if (expire_timeout < 0 || notif->style.ignore_timeout) {
expire_timeout = notif->style.default_timeout;
}
+ if (notif->frozen != notif->style.freeze) {
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ if (notif->style.freeze) {
+ notif->froze_at = now;
+ } else {
+ timespec_sub(&now, &notif->froze_at);
+ timespec_add(&notif->at, &now);
+ }
+ notif->frozen = notif->style.freeze;
+ }
+ if (notif->frozen) {
+ expire_timeout = 0;
+ }
if (expire_timeout > 0) {
- struct timespec at = notif->at;
- timespec_add(&at, expire_timeout);
+ struct timespec at = notif->at, delta;
+ timespec_from_ms(&delta, expire_timeout);
+ timespec_add(&at, &delta);
if (notif->timer) {
notif->timer->at = at;
} else {
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
index fff19ed..c0be528 100644
--- a/doc/mako.5.scd
+++ b/doc/mako.5.scd
@@ -421,6 +421,12 @@ associated command-line option.
Default: 0
+*freeze*=0|1
+ Whether to freeze this notification's active timeout, stopping it from
+ progressing. This can be used for pausing notifications while you're away.
+
+ Default: 0
+
# COLORS
Colors can be specified as _#RRGGBB_ or _#RRGGBBAA_.
diff --git a/include/config.h b/include/config.h
index 5ff541c..53116e1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -42,7 +42,8 @@ struct mako_style_spec {
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
- icon_location, max_visible, layer, output, anchor, long_press_duration;
+ icon_location, max_visible, layer, output, anchor, long_press_duration,
+ freeze;
struct {
bool background, text, border, progress;
} colors;
@@ -76,6 +77,7 @@ struct mako_style {
bool actions;
int default_timeout; // in ms
bool ignore_timeout;
+ bool freeze;
struct {
uint32_t background;
diff --git a/include/notification.h b/include/notification.h
index 2775d88..a631b49 100644
--- a/include/notification.h
+++ b/include/notification.h
@@ -57,6 +57,8 @@ struct mako_notification {
struct mako_hotspot hotspot;
struct mako_timer *timer;
struct timespec at;
+ struct timespec froze_at;
+ bool frozen;
};
struct mako_action {
diff --git a/notification.c b/notification.c
index b78bd09..ce0bafd 100644
--- a/notification.c
+++ b/notification.c
@@ -70,6 +70,7 @@ void reset_notification(struct mako_notification *notif) {
notif->icon = NULL;
clock_gettime(CLOCK_MONOTONIC, &notif->at);
+ notif->frozen = false;
}
struct mako_notification *create_notification(struct mako_state *state) {
--
2.45.2

View file

@ -0,0 +1,64 @@
From cf4c99d9fa92e397b3860a71d293957741abc7c2 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 14:22:23 +0700
Subject: [PATCH 5/5] cherry-pick fixup
---
criteria.c | 4 ++--
include/criteria.h | 3 +++
notification.c | 6 +++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/criteria.c b/criteria.c
index 523a467..2514da9 100644
--- a/criteria.c
+++ b/criteria.c
@@ -418,14 +418,14 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
return criteria;
}
-static void timespec_from_ms(struct timespec *t, long time_ms) {
+void timespec_from_ms(struct timespec *t, long time_ms) {
static const long ms = 1000000;
t->tv_sec = time_ms / 1000;
t->tv_nsec = (time_ms % 1000) * ms;
}
-static void timespec_add(struct timespec *t, struct timespec *u) {
+void timespec_add(struct timespec *t, struct timespec *u) {
static const long s = 1000000000;
t->tv_sec += u->tv_sec;
diff --git a/include/criteria.h b/include/criteria.h
index 58c36ef..48f256d 100644
--- a/include/criteria.h
+++ b/include/criteria.h
@@ -60,4 +60,7 @@ struct mako_criteria *create_criteria_from_notification(
bool validate_criteria(struct mako_criteria *criteria);
+void timespec_add(struct timespec *t, struct timespec *u);
+void timespec_from_ms(struct timespec *t, long time_ms);
+
#endif
diff --git a/notification.c b/notification.c
index ce0bafd..730176f 100644
--- a/notification.c
+++ b/notification.c
@@ -475,7 +475,11 @@ void notification_handle_touch_start(struct mako_notification *notif,
return;
}
notif->long_press_ctx = *ctx;
- notif->long_press_timer = add_event_loop_timer(&notif->state->event_loop, 500,
+ struct timespec at, delta;
+ clock_gettime(CLOCK_MONOTONIC, &at);
+ timespec_from_ms(&delta, 500);
+ timespec_add(&at, &delta);
+ notif->long_press_timer = add_event_loop_timer(&notif->state->event_loop, &at,
handle_notification_touch_timer, notif);
}
--
2.45.2

View file

@ -1,14 +1,14 @@
{ pkgs, pkgs', ... }: { pkgs, ... }:
let let
nixForNixPlugins = pkgs.nixVersions.nix_2_18; unpatchedNixForNixPlugins = pkgs.nixVersions.nix_2_18;
nixForNixPlugins = unpatchedNixForNixPlugins.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ ./rename-nix-plugin-files.patch ];
# some tests fail on bcachefs due to insufficient permissions
doInstallCheck = false;
});
in { in {
inherit nixForNixPlugins; inherit unpatchedNixForNixPlugins nixForNixPlugins;
nix = nixForNixPlugins;
nixVersions = pkgs.nixVersions // {
stable = nixForNixPlugins;
unstable = nixForNixPlugins;
};
# Various patches to change Nix version of existing packages so they don't error out because of nix-plugins in nix.conf # Various patches to change Nix version of existing packages so they don't error out because of nix-plugins in nix.conf
/*nix-plugins = (pkgs.nix-plugins.override { nix = nixForNixPlugins; }).overrideAttrs (old: { /*nix-plugins = (pkgs.nix-plugins.override { nix = nixForNixPlugins; }).overrideAttrs (old: {
version = "13.0.0"; version = "13.0.0";
@ -20,17 +20,6 @@ in {
}) })
]; ];
});*/ });*/
harmonia = (pkgs.harmonia.override { nixVersions.nix_2_21 = nixForNixPlugins; }).overrideAttrs (old: rec {
version = "0.7.3";
src = old.src.override {
rev = "refs/tags/${old.pname}-v${version}";
hash = "sha256-XtnK54HvZMKZGSCrVD0FO5PQLMo3Vkj8ezUlsfqStq0=";
};
cargoDeps = pkgs'.rustPlatform.importCargoLock { lockFile = "${src}/Cargo.lock"; };
});
nix-init = pkgs.nix-init.override { nix = nixForNixPlugins; };
nix-serve = pkgs.nix-serve.override { nix = nixForNixPlugins; };
nix-serve-ng = pkgs.nix-serve-ng.override { nix = nixForNixPlugins; };
hydra_unstable = (pkgs.hydra_unstable.override { hydra_unstable = (pkgs.hydra_unstable.override {
nix = nixForNixPlugins; nix = nixForNixPlugins;
}).overrideAttrs (old: { }).overrideAttrs (old: {
@ -42,5 +31,4 @@ in {
hash = "sha256-vXTuE83GL15mgZHegbllVAsVdDFcWWSayPfZxTJN5ys="; hash = "sha256-vXTuE83GL15mgZHegbllVAsVdDFcWWSayPfZxTJN5ys=";
}; };
}); });
nurl = pkgs.nurl.override { nix = nixForNixPlugins; };
} }

View file

@ -0,0 +1,13 @@
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index dba7d78ef..f102f08f9 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -959,7 +959,7 @@ public:
"Number of seconds between checking free disk space."};
PluginFilesSetting pluginFiles{
- this, {}, "plugin-files",
+ this, {}, "plugin-files-2",
R"(
A list of plugin files to be loaded by Nix. Each of these files will
be dlopened by Nix, allowing them to affect execution through static

View file

@ -0,0 +1,181 @@
From 637fe90e0c69d77d2ad24576d924b041525fd941 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 12:10:16 +0700
Subject: [PATCH 1/3] wip touch support
---
include/wayland-internal.h | 7 +++
source/wayland/display.c | 115 +++++++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+)
diff --git a/include/wayland-internal.h b/include/wayland-internal.h
index e6d248ce..77aaaf9d 100644
--- a/include/wayland-internal.h
+++ b/include/wayland-internal.h
@@ -84,6 +84,8 @@ typedef struct {
uint32_t layer_height;
} wayland_stuff;
+#define MAX_TOUCHPOINTS 10
+
struct _wayland_seat {
wayland_stuff *context;
uint32_t global_name;
@@ -99,6 +101,11 @@ struct _wayland_seat {
uint32_t pointer_serial;
struct wl_keyboard *keyboard;
struct wl_pointer *pointer;
+ struct wl_touch *touch;
+ struct {
+ int32_t x, start_y, move_y;
+ uint32_t start_time, move_time;
+ } touches[MAX_TOUCHPOINTS];
#ifdef HAVE_WAYLAND_CURSOR_SHAPE
struct wp_cursor_shape_device_v1 *cursor_shape_device;
diff --git a/source/wayland/display.c b/source/wayland/display.c
index 6cdc7d2f..381c402d 100644
--- a/source/wayland/display.c
+++ b/source/wayland/display.c
@@ -526,6 +526,101 @@ static const struct wl_keyboard_listener wayland_keyboard_listener = {
.repeat_info = wayland_keyboard_repeat_info,
};
+static void wayland_touch_down(void *data, struct wl_touch *wl_touch,
+ uint32_t serial, uint32_t time, struct wl_surface *wl_surface,
+ int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
+ wayland_seat *self = data;
+ if (id >= MAX_TOUCHPOINTS) {
+ return;
+ }
+ self->touches[id].x = wl_fixed_to_int(surface_x);
+ self->touches[id].start_y = self->touches[id].move_y = wl_fixed_to_int(surface_y);
+ self->touches[id].start_time = self->touches[id].move_time = time;
+ RofiViewState *state = rofi_view_get_active();
+
+ if (state == NULL) {
+ return;
+ }
+ rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
+ FALSE);
+}
+
+static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
+ uint32_t serial, uint32_t time, int32_t id) {
+ wayland_seat *self = data;
+ if (id >= MAX_TOUCHPOINTS) {
+ return;
+ }
+ gboolean is_move =
+ time - self->touches[id].start_time > 500
+ || self->touches[id].start_time != self->touches[id].move_time;
+ if (is_move) {
+ return;
+ }
+ RofiViewState *state = rofi_view_get_active();
+
+ if (state == NULL) {
+ return;
+ }
+ //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
+ // FALSE);
+ nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
+ KEY_ENTER + 8,
+ NK_BINDINGS_KEY_STATE_PRESS);
+ rofi_view_maybe_update(state);
+}
+
+static int32_t y_offset_to_line_offset(int32_t y_offset) {
+ static const int32_t line_height = 20;
+ return -(y_offset / line_height);
+}
+
+static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
+ uint32_t time, int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
+ wayland_seat *self = data;
+ if (id >= MAX_TOUCHPOINTS) {
+ return;
+ }
+ RofiViewState *state = rofi_view_get_active();
+
+ if (state == NULL) {
+ return;
+ }
+ int32_t x = wl_fixed_to_int(surface_x);
+ int32_t y = wl_fixed_to_int(surface_y);
+
+ int last_pos = y_offset_to_line_offset(self->touches[id].move_y - self->touches[id].start_y);
+ int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
+
+ if (cur_pos != last_pos) {
+ rofi_view_handle_mouse_motion(state, x, y, FALSE);
+ nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
+ NK_BINDINGS_SCROLL_AXIS_VERTICAL,
+ cur_pos - last_pos);
+ self->touches[id].x = x;
+ self->touches[id].move_y = y;
+ self->touches[id].move_time = time;
+ rofi_view_maybe_update(state);
+ }
+}
+
+static void wayland_touch_frame(void *data, struct wl_touch *wl_touch) { }
+static void wayland_touch_cancel(void *data, struct wl_touch *wl_touch) { }
+static void wayland_touch_shape(void *data, struct wl_touch *wl_touch,
+ int32_t id, wl_fixed_t major, wl_fixed_t minor) { }
+static void wayland_touch_orientation(void *data, struct wl_touch *wl_touch,
+ int32_t id, wl_fixed_t orientation) { }
+
+static const struct wl_touch_listener wayland_touch_listener = {
+ .down = wayland_touch_down,
+ .up = wayland_touch_up,
+ .motion = wayland_touch_motion,
+ .frame = wayland_touch_frame,
+ .cancel = wayland_touch_cancel,
+ .shape = wayland_touch_shape,
+ .orientation = wayland_touch_orientation,
+};
+
static gboolean wayland_cursor_reload_theme(guint scale);
static void wayland_cursor_set_image(int i) {
@@ -1081,9 +1176,20 @@ static void wayland_pointer_release(wayland_seat *self) {
self->pointer = NULL;
}
+static void wayland_touch_release(wayland_seat *self) {
+ if (self->touch == NULL) {
+ return;
+ }
+
+ wl_touch_release(self->touch);
+
+ self->touch = NULL;
+}
+
static void wayland_seat_release(wayland_seat *self) {
wayland_keyboard_release(self);
wayland_pointer_release(self);
+ wayland_touch_release(self);
wl_seat_release(self->seat);
@@ -1113,6 +1219,15 @@ static void wayland_seat_capabilities(void *data, struct wl_seat *seat,
wayland_pointer_release(self);
}
+ if ((capabilities & WL_SEAT_CAPABILITY_TOUCH) &&
+ (self->touch == NULL)) {
+ self->touch = wl_seat_get_touch(self->seat);
+ wl_touch_add_listener(self->touch, &wayland_touch_listener, self);
+ } else if ((!(capabilities & WL_SEAT_CAPABILITY_TOUCH)) &&
+ (self->touch != NULL)) {
+ wayland_touch_release(self);
+ }
+
if (wayland->data_device_manager != NULL) {
self->data_device = wl_data_device_manager_get_data_device(
wayland->data_device_manager, seat);
--
2.45.2

View file

@ -0,0 +1,24 @@
From 3d02857ec8ab68ae243e651874203e88e6788ae7 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 13:22:34 +0700
Subject: [PATCH 2/3] still scroll after the tap moves outside the rofi window
---
source/wayland/display.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/source/wayland/display.c b/source/wayland/display.c
index 381c402d..5154589a 100644
--- a/source/wayland/display.c
+++ b/source/wayland/display.c
@@ -593,7 +593,6 @@ static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
if (cur_pos != last_pos) {
- rofi_view_handle_mouse_motion(state, x, y, FALSE);
nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
NK_BINDINGS_SCROLL_AXIS_VERTICAL,
cur_pos - last_pos);
--
2.45.2

View file

@ -0,0 +1,45 @@
From 8b417bc6304c30bafb56113b868ecac2ffc0ed08 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 13:29:32 +0700
Subject: [PATCH 3/3] exit on long tap
---
source/wayland/display.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/source/wayland/display.c b/source/wayland/display.c
index 5154589a..cfd883b3 100644
--- a/source/wayland/display.c
+++ b/source/wayland/display.c
@@ -551,10 +551,8 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
if (id >= MAX_TOUCHPOINTS) {
return;
}
- gboolean is_move =
- time - self->touches[id].start_time > 500
- || self->touches[id].start_time != self->touches[id].move_time;
- if (is_move) {
+ gboolean has_moved = self->touches[id].start_time != self->touches[id].move_time;
+ if (has_moved) {
return;
}
RofiViewState *state = rofi_view_get_active();
@@ -562,10 +560,12 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
if (state == NULL) {
return;
}
- //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
- // FALSE);
+ int key = KEY_ENTER;
+ if (time - self->touches[id].start_time > 200) {
+ key = KEY_ESC;
+ }
nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
- KEY_ENTER + 8,
+ key + 8,
NK_BINDINGS_KEY_STATE_PRESS);
rofi_view_maybe_update(state);
}
--
2.45.2

View file

@ -29,6 +29,7 @@ stdenv.mkDerivation {
ninja ninja
pkg-config pkg-config
scdoc scdoc
wayland
]; ];
buildInputs = [ buildInputs = [
@ -36,8 +37,8 @@ stdenv.mkDerivation {
gdk-pixbuf gdk-pixbuf
libsodium libsodium
libxkbcommon libxkbcommon
wayland
wayland-protocols wayland-protocols
wayland
]; ];
mesonFlags = [ mesonFlags = [

View file

@ -1,7 +1,7 @@
From c4690b1496ca34c416869d2932abfa112a93f188 Mon Sep 17 00:00:00 2001 From c4690b1496ca34c416869d2932abfa112a93f188 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org> From: chayleaf <chayleaf-git@pavluk.org>
Date: Wed, 14 Aug 2024 08:17:44 +0700 Date: Wed, 14 Aug 2024 08:17:44 +0700
Subject: [PATCH 1/2] mobile: don't idle_notify for volume keys Subject: [PATCH 1/4] mobile: don't idle_notify for volume keys
--- ---
sway/input/keyboard.c | 4 +++- sway/input/keyboard.c | 4 +++-
@ -23,5 +23,5 @@ index 8927287f..d42f62b0 100644
server.session_lock.locked; server.session_lock.locked;
struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor =
-- --
2.44.1 2.45.2

View file

@ -1,15 +1,15 @@
From 0d352dff09bab4536d2e182538641af1c6d2a1ef Mon Sep 17 00:00:00 2001 From ffec4e61168224d5b57241ae863a6970ce969a47 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org> From: chayleaf <chayleaf-git@pavluk.org>
Date: Wed, 14 Aug 2024 07:32:11 +0700 Date: Wed, 14 Aug 2024 07:32:11 +0700
Subject: [PATCH 2/2] mobile: reverse layer order Subject: [PATCH 2/4] mobile: reverse layer order
This makes exclusive anchored layers that were added first be first This makes exclusive anchored layers that were added first be first
--- ---
sway/desktop/layer_shell.c | 12 ++++++------ sway/desktop/layer_shell.c | 2 +-
1 file changed, 6 insertions(+), 6 deletions(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 8c6cedfe..4afca0b7 100644 index 8c6cedfe..41a638ee 100644
--- a/sway/desktop/layer_shell.c --- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c
@@ -129,7 +129,7 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list, @@ -129,7 +129,7 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
@ -21,26 +21,6 @@ index 8c6cedfe..4afca0b7 100644
struct wlr_layer_surface_v1 *layer = sway_layer->layer_surface; struct wlr_layer_surface_v1 *layer = sway_layer->layer_surface;
struct wlr_layer_surface_v1_state *state = &layer->current; struct wlr_layer_surface_v1_state *state = &layer->current;
if (exclusive != (state->exclusive_zone > 0)) { if (exclusive != (state->exclusive_zone > 0)) {
@@ -214,14 +214,14 @@ void arrange_layers(struct sway_output *output) {
wlr_output_effective_resolution(output->wlr_output,
&usable_area.width, &usable_area.height);
- // Arrange exclusive surfaces from top->bottom
- arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
- &usable_area, true);
- arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
+ // Arrange exclusive surfaces from bottom->top
+ arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
&usable_area, true);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
&usable_area, true);
- arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
+ arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
+ &usable_area, true);
+ arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&usable_area, true);
if (memcmp(&usable_area, &output->usable_area,
-- --
2.44.1 2.45.2

View file

@ -0,0 +1,25 @@
From 2bc4fabd214939f24c7f980e80fe5f3f0c6ff687 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Fri, 23 Aug 2024 05:35:57 +0700
Subject: [PATCH 3/4] mobile: swaybar: bottom -> overlay layer
---
swaybar/bar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 021fc3bd..7f44799d 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -103,7 +103,7 @@ static void add_layer_surface(struct swaybar_output *output) {
output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
bar->layer_shell, output->surface, output->output,
hidden || overlay ? ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY :
- ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel");
+ ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "panel");
assert(output->layer_surface);
zwlr_layer_surface_v1_add_listener(output->layer_surface,
&layer_surface_listener, output);
--
2.45.2

View file

@ -0,0 +1,138 @@
From 7ce9a5b2ded14623e6ff56311f4336fba4d22c7f Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Fri, 23 Aug 2024 05:34:58 +0700
Subject: [PATCH 4/4] mobile: dont occupy exclusive layers with fullscreen
---
include/sway/desktop.h | 5 ++++
sway/desktop/layer_shell.c | 2 +-
sway/tree/container.c | 4 ++--
sway/tree/view.c | 48 +++++++++++++++++++++++++++++++-------
4 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/include/sway/desktop.h b/include/sway/desktop.h
index 7f2f5b3e..c20f5ee6 100644
--- a/include/sway/desktop.h
+++ b/include/sway/desktop.h
@@ -11,3 +11,8 @@ void desktop_damage_whole_container(struct sway_container *con);
void desktop_damage_box(struct wlr_box *box);
void desktop_damage_view(struct sway_view *view);
+
+void apply_exclusive(struct wlr_box *usable_area,
+ uint32_t anchor, int32_t exclusive,
+ int32_t margin_top, int32_t margin_right,
+ int32_t margin_bottom, int32_t margin_left);
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 41a638ee..79833ef3 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -50,7 +50,7 @@ struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
} while (true);
}
-static void apply_exclusive(struct wlr_box *usable_area,
+void apply_exclusive(struct wlr_box *usable_area,
uint32_t anchor, int32_t exclusive,
int32_t margin_top, int32_t margin_right,
int32_t margin_bottom, int32_t margin_left) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 8c344a6d..8034029e 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1132,7 +1132,7 @@ static void container_fullscreen_workspace(struct sway_container *con) {
con->saved_height = con->pending.height;
if (con->pending.workspace) {
- con->pending.workspace->fullscreen = con;
+ // con->pending.workspace->fullscreen = con;
struct sway_seat *seat;
struct sway_workspace *focus_ws;
wl_list_for_each(seat, &server.input->seats, link) {
@@ -1159,7 +1159,7 @@ static void container_fullscreen_global(struct sway_container *con) {
}
set_fullscreen(con, true);
- root->fullscreen_global = con;
+ // root->fullscreen_global = con;
con->saved_x = con->pending.x;
con->saved_y = con->pending.y;
con->saved_width = con->pending.width;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 65ca0c9c..032f7994 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -34,6 +34,7 @@
#include "sway/xdg_decoration.h"
#include "pango.h"
#include "stringop.h"
+#include "sway/layers.h"
void view_init(struct sway_view *view, enum sway_view_type type,
const struct sway_view_impl *impl) {
@@ -239,6 +240,23 @@ static bool gaps_to_edge(struct sway_view *view) {
return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
}
+void calculate_exclusive(struct sway_output *output, struct wlr_box *usable_area) {
+ struct sway_layer_surface *sway_layer;
+ for (int i = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; i <= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; ++i) {
+ struct wl_list *list = &output->layers[i];
+ wl_list_for_each_reverse(sway_layer, list, link) {
+ struct wlr_layer_surface_v1 *layer = sway_layer->layer_surface;
+ struct wlr_layer_surface_v1_state *state = &layer->current;
+ if (state->exclusive_zone <= 0) {
+ continue;
+ }
+ apply_exclusive(usable_area, state->anchor, state->exclusive_zone,
+ state->margin.top, state->margin.right,
+ state->margin.bottom, state->margin.left);
+ }
+ }
+}
+
void view_autoconfigure(struct sway_view *view) {
struct sway_container *con = view->container;
struct sway_workspace *ws = con->pending.workspace;
@@ -250,16 +268,30 @@ void view_autoconfigure(struct sway_view *view) {
struct sway_output *output = ws ? ws->output : NULL;
if (con->pending.fullscreen_mode == FULLSCREEN_WORKSPACE) {
- con->pending.content_x = output->lx;
- con->pending.content_y = output->ly;
- con->pending.content_width = output->width;
- con->pending.content_height = output->height;
+ struct wlr_box box = {
+ .x = output->lx,
+ .y = output->ly,
+ .width = output->width,
+ .height = output->height,
+ };
+ calculate_exclusive(output, &box);
+ con->pending.content_x = box.x;
+ con->pending.content_y = box.y;
+ con->pending.content_width = box.width;
+ con->pending.content_height = box.height;
return;
} else if (con->pending.fullscreen_mode == FULLSCREEN_GLOBAL) {
- con->pending.content_x = root->x;
- con->pending.content_y = root->y;
- con->pending.content_width = root->width;
- con->pending.content_height = root->height;
+ struct wlr_box box = {
+ .x = root->x,
+ .y = root->y,
+ .width = root->width,
+ .height = root->height,
+ };
+ calculate_exclusive(output, &box);
+ con->pending.content_x = box.x;
+ con->pending.content_y = box.y;
+ con->pending.content_width = box.width;
+ con->pending.content_height = box.height;
return;
}
--
2.45.2

View file

@ -0,0 +1,148 @@
{ config
, pkgs
, inputs
, lib
, ...
}:
let
# uuids.enc = "e2abdea5-71dc-4a9e-aff3-242117342d60";
uuids.boot = "49b5ab26-a8f4-4873-a235-da2b3608e870";
uuids.swap = "b7eb326b-69d8-4347-a2dc-549ec6201e7f";
uuids.root = "99cda95f-f866-42a0-883f-343ad3662920";
parts = builtins.mapAttrs (k: v: "/dev/disk/by-uuid/${v}") uuids;
in
{
imports = [
../hardware/kobo-clara
../hosts/ereader
];
fonts.enableDefaultPackages = false;
# defaults without noto-fonts-color-emoji
fonts.packages = with pkgs; [
dejavu_fonts
freefont_ttf
gyre-fonts # TrueType substitutes for standard PostScript fonts
liberation_ttf
unifont
];
nixpkgs.overlays = [
(self: super: let
overrideFfmpeg = ffmpeg: ffmpeg.override {
withAlsa = false;
withJack = false;
withMp3lame = false;
withOgg = false;
withOpus = false;
withPulse = false;
withSpeex = false;
withVaapi = false;
withVdpau = false;
withVorbis = false;
};
in {
ffmpeg = overrideFfmpeg super.ffmpeg;
waybar = super.waybar.override {
hyprlandSupport = false;
jackSupport = false;
mpdSupport = false;
mprisSupport = false;
pipewireSupport = false;
pulseSupport = false;
sndioSupport = false;
cavaSupport = false;
wireplumberSupport = false;
};
awesome = super.awesome.overrideAttrs (old: {
# broken cross tests
doCheck = false;
});
# ffmpeg isnt actually used in wlroots anymore, remove the useless dependency
wlroots_0_17 = super.wlroots_0_17.overrideAttrs (old: {
buildInputs = builtins.filter (x: x.pname != "ffmpeg") old.buildInputs;
});
# heif/avif support isnt worth an extra rust dependency
imagemagick = super.imagemagick.override {
libheifSupport = false;
};
jasper = super.jasper.override {
enableHEIFCodec = false;
};
# no audio, so no need to bring in the audio libs
SDL2 = super.SDL2.override {
alsaSupport = false;
pipewireSupport = false;
pulseaudioSupport = false;
};
openalSoft = super.openalSoft.override {
alsaSupport = false;
pipewireSupport = false;
pulseSupport = false;
};
openal = super.openal.override {
alsaSupport = false;
pipewireSupport = false;
pulseSupport = false;
};
# luajit has to be built on a system with 32-bit pointer width when targeting 32-bit systems
luajit = (import inputs.nixpkgs { system = "i686-linux"; }).pkgsCross.armv7l-hf-multiplatform.luajit;
# fix cross https://github.com/NixOS/nixpkgs/pull/328919/
texinfo = super.texinfo.overrideAttrs (old: {
configureFlags = old.configureFlags
++ lib.optional
(self.stdenv.hostPlatform != self.stdenv.buildPlatform)
"texinfo_cv_sys_iconv_converts_euc_cn=yes";
});
koreader = super.koreader.overrideAttrs (old: {
src = self.fetchurl {
url = "https://github.com/koreader/koreader/releases/download/v${old.version}/koreader-${old.version}-armhf.deb";
hash = "sha256-LgeWQcHm5Qq/7MUuidjily0WsOFZAWGWeO52jNHWKMw=";
};
meta = old.meta // {
platforms = [ "armv7l-linux" ];
};
});
})
];
networking.wireless.iwd.enable = true;
fileSystems = let
neededForBoot = true;
in {
"/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot;
options = [ "defaults" "size=2G" "mode=755" ]; };
"/persist" =
{ device = parts.root; fsType = "btrfs"; inherit neededForBoot;
options = [ "discard=async" "compress=zstd:15" ]; };
"/boot" = { device = parts.boot; fsType = "ext4"; };
};
swapDevices = [ { device = parts.swap; } ];
boot.resumeDevice = parts.swap;
system.build.rootfsImage = pkgs.callPackage "${pkgs.path}/nixos/lib/make-btrfs-fs.nix" {
storePaths = config.system.build.toplevel;
compressImage = true;
volumeLabel = "NIX_ROOTFS";
uuid = uuids.root;
};
system.build.bootFiles = pkgs.runCommand "kobo-clara-boot-files" {} ''
mkdir -p "$out"
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d $out -g 0
'';
impermanence = {
enable = true;
path = /persist;
directories = [
{ directory = /home/${config.common.mainUsername}; user = config.common.mainUsername; group = "users"; mode = "0700"; }
{ directory = /root; mode = "0700"; }
{ directory = /nix; }
{ directory = /secrets; mode = "0000"; }
];
};
}

View file

@ -1,6 +1,5 @@
# device-specific non-portable config # device-specific non-portable config
{ pkgs { ...
, ...
}: }:
let let
@ -35,7 +34,6 @@ in
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_testing;
boot.kernelParams = [ "boot.shell_on_fail" ]; boot.kernelParams = [ "boot.shell_on_fail" ];
fileSystems = { fileSystems = {

View file

@ -5,7 +5,7 @@
let let
uuids.enc = "e2abdea5-71dc-4a9e-aff3-242117342d60"; uuids.enc = "e2abdea5-71dc-4a9e-aff3-242117342d60";
uuids.boot = "9DA3-28AC"; uuids.boot = "9DA3-28AC";
uuids.bch = "ac343ffb-407c-4966-87bf-a0ef1075e93d"; uuids.root = "5fadc23c-f374-442d-8b05-fb76611c9eb7";
parts = builtins.mapAttrs (k: v: "/dev/disk/by-uuid/${v}") uuids; parts = builtins.mapAttrs (k: v: "/dev/disk/by-uuid/${v}") uuids;
in in
@ -30,9 +30,13 @@ in
device = parts.enc; device = parts.enc;
allowDiscards = true; allowDiscards = true;
}; };
network.ssh = {
enable = true;
port = 22;
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
hostKeys = [ "/secrets/initrd/ssh_host_ed25519_key" "/secrets/initrd/ssh_host_rsa_key" ];
};
}; };
boot.supportedFilesystems = [ "bcachefs" ];
fileSystems = let fileSystems = let
neededForBoot = true; neededForBoot = true;
@ -40,8 +44,8 @@ in
"/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot; "/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot;
options = [ "defaults" "size=2G" "mode=755" ]; }; options = [ "defaults" "size=2G" "mode=755" ]; };
"/persist" = "/persist" =
{ device = "UUID=${uuids.bch}"; fsType = "bcachefs"; inherit neededForBoot; { device = parts.root; fsType = "btrfs"; inherit neededForBoot;
options = [ "errors=ro" ]; }; options = [ "discard=async" "compress=zstd:15" ]; };
"/boot" = { device = parts.boot; fsType = "vfat"; inherit neededForBoot; }; "/boot" = { device = parts.boot; fsType = "vfat"; inherit neededForBoot; };
}; };

View file

@ -39,6 +39,11 @@ in
networking.useDHCP = false; networking.useDHCP = false;
networking.useNetworkd = true; networking.useNetworkd = true;
networking.resolvconf.extraConfig = let
ip = cidr: builtins.head (lib.splitString "/" cidr);
in ''
name_servers='${ip router-config.router-settings.network} ${ip router-config.router-settings.network6}'
'';
systemd.network = { systemd.network = {
enable = true; enable = true;
links."10-mac" = { links."10-mac" = {

View file

@ -9,7 +9,7 @@
generic-extlinux-compatible.enable = true; generic-extlinux-compatible.enable = true;
}; };
boot.kernelPackages = pkgs-kernel.linuxPackagesFor (pkgs-kernel.ccachePkgs.buildLinuxWithCcache pkgs-kernel.hw.bpi-r3.linux); boot.kernelPackages = pkgs-kernel.linuxPackagesFor pkgs-kernel.hw.bpi-r3.linux;
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb"; hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3.dtb";

View file

@ -308,7 +308,8 @@ in rec {
# keys that are unused in this case # keys that are unused in this case
# used because i got bitten by config keys changing once # used because i got bitten by config keys changing once
SND_AC97_POWER_SAVE_DEFAULT.optional = lib.mkForce true; SND_HDA_POWER_SAVE_DEFAULT.optional = lib.mkForce true; SND_AC97_POWER_SAVE_DEFAULT.optional = lib.mkForce true; SND_HDA_POWER_SAVE_DEFAULT.optional = lib.mkForce true;
SND_USB_AUDIO_MIDI_V2.tristate = lib.mkForce null; SND_USB_AUDIO_MIDI_V2.tristate = lib.mkForce null; SND_HDA_CODEC_CS8409.tristate = lib.mkForce null;
DRM_DISPLAY_DP_AUX_CEC.tristate = lib.mkForce null; DRM_DISPLAY_DP_AUX_CHARDEV.tristate = lib.mkForce null;
DRM_ACCEL.tristate = lib.mkForce null; DRM_AMD_ACP.tristate = lib.mkForce null; DRM_AMD_SECURE_DISPLAY.tristate = lib.mkForce null; DRM_ACCEL.tristate = lib.mkForce null; DRM_AMD_ACP.tristate = lib.mkForce null; DRM_AMD_SECURE_DISPLAY.tristate = lib.mkForce null;
DRM_DP_CEC.tristate = lib.mkForce null; DRM_NOUVEAU_SVM.tristate = lib.mkForce null; MEM_SOFT_DIRTY.tristate = lib.mkForce null; DRM_DP_CEC.tristate = lib.mkForce null; DRM_NOUVEAU_SVM.tristate = lib.mkForce null; MEM_SOFT_DIRTY.tristate = lib.mkForce null;
PM_TRACE.tristate = lib.mkForce null; RAS_CEC.tristate = lib.mkForce null; SND_AC97_POWER_SAVE_DEFAULT.tristate = lib.mkForce null; PM_TRACE.tristate = lib.mkForce null; RAS_CEC.tristate = lib.mkForce null; SND_AC97_POWER_SAVE_DEFAULT.tristate = lib.mkForce null;

View file

@ -0,0 +1,12 @@
Note: **the dtb depends on board revision** (and may brick your device
if you use the wrong dtb)
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/firmware-kobo-clara
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/device-kobo-clara
https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/linux-kobo-clara-mainline
https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/u-boot-kobo-clara
https://github.com/jwrdegoede/rtl8189ES_linux

View file

@ -0,0 +1,78 @@
{ pkgs
, config
, lib
, ...
}:
let
pkgs' = pkgs.hw.kobo-clara;
in
{
options = {
ereader.epdc-firmware = lib.mkOption {
type = lib.types.path;
};
};
config = lib.mkMerge [
{
boot.loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
boot.kernelPackages = pkgs.linuxPackagesFor pkgs'.linux;
boot.initrd.preLVMCommands = ''
echo 0 > /sys/class/graphics/fbcon/cursor_blink
(cd /sys/bus/platform/devices && echo *epdc >/sys/bus/platform/drivers/mxc_epdc/bind)
'';
boot.consoleLogLevel = 7;
hardware.deviceTree.enable = true;
hardware.deviceTree.filter = "imx6sll-kobo-clarahd.dtb";
hardware.firmware = [
(pkgs.runCommand "epdc-firmware" { } ''
mkdir -p $out/lib/firmware/imx/epdc
cp ${config.ereader.epdc-firmware} $out/lib/firmware/imx/epdc/epdc.fw
'')
];
# boot.initrd.extraFiles."lib/firmware/imx/epdc/epdc.fw".source = pkgs.copyPathToStore config.ereader.epdc-firmware;
nixpkgs.overlays = [
(self: super: {
makeModulesClosure = args: (super.makeModulesClosure args).overrideAttrs (old: {
builder = pkgs.writeShellScript "builder.sh" ''
source ${old.builder}
cd "$firmware"
mkdir -p "$out/lib/firmware/imx"
cp --no-preserve=mode -vrL lib/firmware/imx/* "$out/lib/firmware/imx/"
'';
});
})
];
hardware.enableRedistributableFirmware = true;
boot.initrd.kernelModules = [ "tps6518x_hwmon" "tps6518x_regulator" "mxc_epdc_drm" ];
boot.initrd.availableKernelModules = [ "mmc_block" "dm_mod" ];
boot.kernelParams = [ "console=ttymxc0,115200" "detect_clara_rev" ];
# "dtb=/${config.hardware.deviceTree.name}"
boot.initrd.compressor = "zstd";
boot.postBootCommands = ''
if [ -f ${toString config.impermanence.path}/nix-path-registration ]; then
${config.nix.package.out}/bin/nix-store --load-db < ${toString config.impermanence.path}/nix-path-registration
mkdir -p /etc
touch /etc/NIXOS
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
rm -f ${toString config.impermanence.path}/nix-path-registration
fi
'';
system.build.uboot = pkgs'.uboot;
boot.initrd.includeDefaultModules = false;
}
(lib.mkIf config.phone.buffyboard.enable {
common.gettyAutologin = true;
})
];
}

View file

@ -0,0 +1,50 @@
{ pkgs
, lib
, ...
}:
{
uboot = pkgs.buildUBoot {
defconfig = "mx6sllclarahd_defconfig";
extraConfig = ''
CONFIG_FASTBOOT_OEM_RUN=y
CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_IS_IN_MMC=n
CONFIG_ENV_EXT4_INTERFACE=mmc
CONFIG_ENV_EXT4_DEVICE_AND_PART=0:1
CONFIG_ENV_EXT4_FILE=/uboot.env
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
detect_clara_rev
run distro_bootcmd
setenv stdin usbacm
setenv stdout usbacm
setenv stderr usbacm
''};"
'';
# fastboot 0
src = pkgs.fetchFromGitHub {
owner = "akemnade";
repo = "u-boot-fslc";
hash = "sha256-MUAiiXTfxt/o/6rnoI7A76IMRPDUhXodjnguKwQKrVs=";
rev = "3247fa27aed27bb5ac24bd9966fd7dadd9c4c373";
};
version = "2023.10";
extraMeta.platforms = [ "armv7l-linux" ];
filesToInstall = [ "u-boot-dtb.imx" ];
};
linux = (pkgs.buildLinux rec {
version = "6.9.0";
modDirVersion = lib.versions.pad 3 version;
src = pkgs.fetchFromGitHub {
owner = "akemnade";
repo = "linux";
rev = "4b0c49001732b93f6787c44e090b8e8f72e6fe6a";
hash = "sha256-rCiznEHDqrOW+CEI1I9HdHNSsVYCb7iJGE+7PKJ8H6A=";
};
defconfig = "kobo_defconfig";
}).overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.lzop ];
});
}

View file

@ -0,0 +1,28 @@
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 7d32fca64996..49307428e89c 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -1402,8 +1402,9 @@ CONFIG_MTK_SVS=m
CONFIG_QCOM_AOSS_QMP=y
CONFIG_QCOM_COMMAND_DB=y
CONFIG_QCOM_GENI_SE=y
-CONFIG_QCOM_LLCC=m
-CONFIG_QCOM_OCMEM=m
+CONFIG_QCOM_LLCC=y
+CONFIG_QCOM_OCMEM=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_QCOM_PMIC_GLINK=m
CONFIG_QCOM_RMTFS_MEM=m
CONFIG_QCOM_RPMH=y
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index dda2ada215b7..d4822991110f 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -166,6 +166,7 @@ config QCOM_PIL_INFO
config QCOM_RPROC_COMMON
tristate
+ default y
select AUXILIARY_BUS
config QCOM_Q6V5_COMMON

View file

@ -19,13 +19,6 @@ in
options.phone = { options.phone = {
adb.enable = lib.mkEnableOption "adb"; adb.enable = lib.mkEnableOption "adb";
rndis.enable = lib.mkEnableOption "rndis" // {
default = true;
};
buffyboard.enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
}; };
config = lib.mkMerge [ config = lib.mkMerge [
@ -37,6 +30,10 @@ in
]; ];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
mobile.quirks.qualcomm.sdm845-modem.enable = true; mobile.quirks.qualcomm.sdm845-modem.enable = true;
specialisation.nomodem.configuration = {
mobile.quirks.qualcomm.sdm845-modem.enable = lib.mkForce false;
systemd.services.q6voiced.enable = false;
};
mobile.quirks.audio.alsa-ucm-meld = true; mobile.quirks.audio.alsa-ucm-meld = true;
environment.systemPackages = [ hw.alsa-ucm-conf ]; environment.systemPackages = [ hw.alsa-ucm-conf ];
systemd.services.q6voiced = { systemd.services.q6voiced = {
@ -51,11 +48,11 @@ in
# https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/community/soc-qcom-sdm845/ # https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/community/soc-qcom-sdm845/
/*systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = pkgs.runCommand "wireplumber-config" {} '' /*systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = pkgs.runCommand "wireplumber-config" {} ''
cp -a "${pkgs.wireplumber}/share/wireplumber" "$out" cp -a "${pkgs.wireplumber}/share/wireplumber" "$out"
chmod +w "$out" "$out/main.lua.d" chmod +w "$out" "$out/wireplumber.conf.d"
ln -s ${pkgs.fetchurl { ln -s ${pkgs.fetchurl {
url = "https://gitlab.com/postmarketOS/pmaports/-/raw/0aa9524204e9c9c002c860b87c972bc2ebf025f3/device/community/soc-qcom-sdm845/51-qcom-sdm845.lua"; url = "https://gitlab.com/postmarketOS/pmaports/-/raw/a82d8636562805d71e16e93f7571cc1f6ddbeb45/device/community/soc-qcom-sdm845/51-qcom-sdm845.conf";
hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk="; hash = "sha256-EM2I9hwTYnK5FepB4RBI5t8sIFQ/uqN5AuTwGepzjB0=";
}} "$out/main.lua.d/51-qcom-sdm845.lua" }} "$out/wireplumber.conf.d/51-qcom-sdm845.conf"
''; '';
systemd.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = config.systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR;*/ systemd.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = config.systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR;*/
networking.modemmanager.enable = !config.networking.networkmanager.enable; networking.modemmanager.enable = !config.networking.networkmanager.enable;
@ -71,9 +68,10 @@ in
criticalPowerAction = "PowerOff"; criticalPowerAction = "PowerOff";
}; };
hardware.firmware = lib.mkAfter [ hw.firmware ]; hardware.firmware = lib.mkAfter [ hw.firmware ];
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux_ccache); boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux);
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;
hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb"; hardware.deviceTree.name = "qcom/sdm845-oneplus-enchilada.dtb";
systemd.services.ModemManager.serviceConfig.ExecStart = [ "" "${pkgs.modemmanager}/bin/ModemManager --test-quick-suspend-resume" ];
# loglevel=7 console=ttyMSM0,115200 is a way to delay boot # loglevel=7 console=ttyMSM0,115200 is a way to delay boot
# see https://gitlab.freedesktop.org/drm/msm/-/issues/46 # see https://gitlab.freedesktop.org/drm/msm/-/issues/46
boot.consoleLogLevel = 7; boot.consoleLogLevel = 7;
@ -106,82 +104,7 @@ in
]; ];
} }
(lib.mkIf cfg.buffyboard.enable { (lib.mkIf cfg.buffyboard.enable {
boot.initrd.kernelModules = [ "uinput" "evdev" ];
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.buffyboard}/bin/buffyboard
cp -a ${pkgs.libinput.out}/share $out/
'';
boot.initrd.extraUdevRulesCommands = ''
cp -v ${config.systemd.package}/lib/udev/rules.d/60-input-id.rules $out/
cp -v ${config.systemd.package}/lib/udev/rules.d/60-persistent-input.rules $out/
cp -v ${config.systemd.package}/lib/udev/rules.d/70-touchpad.rules $out/
'';
boot.initrd.preLVMCommands = ''
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
ln -s "$(dirname "$(dirname "$(which buffyboard)")")"/share /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
buffyboard 2>/dev/null &
'';
boot.initrd.postMountCommands = ''
pkill -x buffyboard
'';
common.gettyAutologin = true; common.gettyAutologin = true;
systemd.services.buffyboard = {
description = "buffyboard";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.buffyboard}/bin/buffyboard";
Restart = "always";
RestartSec = "1";
};
};
security.sudo.extraRules = [
{ groups = [ "users" ];
commands = [
{ command = "/run/current-system/sw/bin/systemctl stop buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/systemctl start buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
]; }
];
})
(lib.mkIf cfg.rndis.enable {
boot.initrd.kernelModules = [ "configfs" "libcomposite" ];
boot.specialFileSystems = {
"/sys/kernel/config" = {
device = "configfs";
fsType = "configfs";
options = [ "nosuid" "noexec" "nodev" ];
};
};
boot.initrd.preLVMCommands = ''
mkdir -p /sys/kernel/config/usb_gadget/g1/strings/0x409
cd /sys/kernel/config/usb_gadget/g1
echo 0x18D1 > idVendor
echo 0xD001 > idProduct
echo oneplus-enchilada > strings/0x409/product
echo NixOS > strings/0x409/manufacturer
echo 0123456789 > strings/0x409/serialnumber
mkdir -p configs/c.1/strings/0x409
echo "USB network" > configs/c.1/strings/0x409/configuration
mkdir -p functions/ncm.usb0 || mkdir -p functions/rndis.usb0
ln -s functions/ncm.usb0 configs/c.1/ || ln -s functions/rndis.usb0 configs/c.1/
ls /sys/class/udc/ | head -n1 > UDC
cd /
ifconfig rndis0 172.16.42.1 || ifconfig usb0 172.16.42.1 || ifconfig eth0 172.16.42.1
'';
boot.initrd.network.enable = true;
boot.initrd.network.udhcpc.enable = false;
boot.initrd.network.ssh = {
enable = true;
port = 22;
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
hostKeys = [ "/secrets/initrd/ssh_host_ed25519_key" "/secrets/initrd/ssh_host_rsa_key" ];
};
}) })
(lib.mkIf cfg.adb.enable { (lib.mkIf cfg.adb.enable {
boot.initrd.kernelModules = [ "configfs" "libcomposite" "g_ffs" ]; boot.initrd.kernelModules = [ "configfs" "libcomposite" "g_ffs" ];

File diff suppressed because it is too large Load diff

View file

@ -7,131 +7,10 @@
let let
inherit (inputs) mobile-nixos; inherit (inputs) mobile-nixos;
mobile-pkgs = import "${mobile-nixos}/overlay/overlay.nix" pkgs' pkgs; mobile-pkgs = import "${mobile-nixos}/overlay/overlay.nix" pkgs' pkgs;
in { mkLinux = { linux, kernelPatches, structuredExtraConfig }: linux.override {
inherit (mobile-pkgs) mkbootimg qrtr;
pd-mapper = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/pd-mapper.nix" { };
tqftpserv = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/tqftpserv.nix" { };
rmtfs = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/rmtfs.nix" {
inherit (mobile-pkgs) qmic;
};
adbd = pkgs'.callPackage "${mobile-nixos}/overlay/adbd" {
libhybris = pkgs'.callPackage "${mobile-nixos}/overlay/libhybris" {
inherit (mobile-pkgs) android-headers;
};
};
q6voiced = pkgs.stdenv.mkDerivation {
pname = "q6voiced";
version = "unstable-2022-07-08";
src = pkgs.fetchFromGitLab {
owner = "postmarketOS";
repo = "q6voiced";
rev = "736138bfc9f7b455a96679e2d67fd922a8f16464";
hash = "sha256-7k5saedIALHlsFHalStqzKrqAyFKx0ZN9FhLTdxAmf4=";
};
buildInputs = with pkgs; [ dbus tinyalsa ];
nativeBuildInputs = with pkgs; [ pkg-config ];
buildPhase = ''cc $(pkg-config --cflags --libs dbus-1) -ltinyalsa -o q6voiced q6voiced.c'';
installPhase = ''install -m555 -Dt "$out/bin" q6voiced'';
meta.license = lib.licenses.mit;
};
alsa-ucm-conf = pkgs.stdenvNoCC.mkDerivation {
pname = "alsa-ucm-conf-enchilada";
version = "unstable-2022-12-08";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "alsa-ucm-conf";
rev = "aaa7889f7a6de640b4d78300e118457335ad16c0";
hash = "sha256-2P5ZTrI1vCJ99BcZVPlkH4sv1M6IfAlaXR6ZjAdy4HQ=";
};
installPhase = ''
substituteInPlace ucm2/lib/card-init.conf --replace '"/bin' '"/run/current-system/sw/bin'
mkdir -p "$out"/share/alsa/ucm2/{OnePlus,conf.d/sdm845,lib}
mv ucm2/lib/card-init.conf "$out/share/alsa/ucm2/lib/"
mv ucm2/OnePlus/enchilada "$out/share/alsa/ucm2/OnePlus/"
ln -s ../../OnePlus/enchilada/enchilada.conf "$out/share/alsa/ucm2/conf.d/sdm845/oneplus-OnePlus6-Unknown.conf"
'';
# to overwrite card-init.conf
meta.priority = -10;
};
uboot = pkgs.buildUBoot {
defconfig = "qcom_defconfig";
version = "unstable-2023-12-11";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "u-boot";
rev = "977b9279c610b862f9ef84fb3addbebb7c42166a";
hash = "sha256-ksI7qxozIjJ5E8uAJkX8ZuaaOHdv76XOzITaA8Vp/QA=";
};
makeFlags = [ "DEVICE_TREE=sdm845-oneplus-enchilada" ];
extraConfig = ''
CONFIG_BOOTDELAY=5
'';
extraMeta.platforms = [ "aarch64-linux" ];
patches = [ ];
filesToInstall = [ "u-boot-nodtb.bin" "u-boot-dtb.bin" "u-boot.dtb" ];
};
ubootImage = pkgs.stdenvNoCC.mkDerivation {
name = "u-boot-enchilada.img";
nativeBuildInputs = [
# available from mobile-nixos's overlay
pkgs'.mkbootimg
pkgs'.gzip
];
src = pkgs'.ubootEnchilada;
dontBuild = true;
dontFixup = true;
installPhase = ''
gzip u-boot-nodtb.bin
cat u-boot.dtb >> u-boot-nodtb.bin.gz
mkbootimg \
--base 0x0 \
--kernel_offset 0x8000 \
--ramdisk_offset 0x01000000 \
--tags_offset 0x100 \
--pagesize 4096 \
--kernel u-boot-nodtb.bin.gz \
-o "$out"
'';
};
firmware = pkgs.stdenvNoCC.mkDerivation {
name = "firmware-oneplus-sdm845";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "firmware-oneplus-sdm845";
rev = "176ca713448c5237a983fb1f158cf3a5c251d775";
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4=";
};
installPhase = ''
cp -a . "$out"
cd "$out/lib/firmware/postmarketos"
find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {}
cd "$out/usr"
find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {}
cd ..
find "$out/lib/firmware/postmarketos" "$out/usr" | tac | xargs rmdir
'';
dontStrip = true;
# not actually redistributable, but who cares
meta.license = lib.licenses.unfreeRedistributableFirmware;
};
linux = pkgs.linux_latest.override {
# TODO: uncomment # TODO: uncomment
# ignoreConfigErrors = false; # ignoreConfigErrors = false;
kernelPatches = [ inherit kernelPatches;
{
name = "linux_6_9";
patch = ./linux_6_9.patch;
}
{
name = "config_fixes";
patch = ./config_fixes.patch;
}
];
stdenv = lib.recursiveUpdate pkgs.stdenv { stdenv = lib.recursiveUpdate pkgs.stdenv {
hostPlatform.linux-kernel.extraConfig = ""; hostPlatform.linux-kernel.extraConfig = "";
@ -141,9 +20,6 @@ in {
# fix build # fix build
LENOVO_YOGA_C630_EC = no; LENOVO_YOGA_C630_EC = no;
RPMSG_QCOM_GLINK_SMEM = yes; RPMSG_QCOM_GLINK_SMEM = yes;
# useless lines, remove on update
DM_MIRROR = no;
DM_ZERO = no;
# for adb and stuff (doesn't have to be built-in, but it's easier that way) # for adb and stuff (doesn't have to be built-in, but it's easier that way)
USB_FUNCTIONFS = yes; USB_FUNCTIONFS = yes;
USB_LIBCOMPOSITE = yes; USB_LIBCOMPOSITE = yes;
@ -162,8 +38,12 @@ in {
USB_F_HID = yes; USB_F_HID = yes;
USB_CONFIGFS = yes; USB_CONFIGFS = yes;
USB_CONFIGFS_F_HID = yes; USB_CONFIGFS_F_HID = yes;
REGULATOR_QCOM_USB_VBUS = module;
LEDS_TRIGGER_ONESHOT = yes;
LEDS_TRIGGER_BACKLIGHT = yes;
LEDS_TRIGGER_ACTIVITY = yes;
# adapted from https://gitlab.com/sdm845-mainline/linux/-/blob/caf9d678d34f70173bf236584dfb819164283833/arch/arm64/configs/sdm845.config # adapted from https://gitlab.com/sdm845-mainline/linux/-/blob/3e9f7c18a3f681b52b7ea87765be267cd1e8b870/arch/arm64/configs/sdm845.config
# enchilada-specific # enchilada-specific
DRM_PANEL_SAMSUNG_SOFEF00 = yes; DRM_PANEL_SAMSUNG_SOFEF00 = yes;
BATTERY_BQ27XXX = module; BATTERY_BQ27XXX = module;
@ -196,6 +76,7 @@ in {
LEDS_TRIGGER_PATTERN = yes; LEDS_TRIGGER_PATTERN = yes;
LEDS_CLASS_MULTICOLOR = module; LEDS_CLASS_MULTICOLOR = module;
LEDS_QCOM_LPG = module; LEDS_QCOM_LPG = module;
I2C_QCOM_GENI = yes;
LEDS_QCOM_FLASH = module; LEDS_QCOM_FLASH = module;
SLIMBUS = yes; SLIMBUS = yes;
SLIM_QCOM_CTRL = yes; SLIM_QCOM_CTRL = yes;
@ -206,6 +87,7 @@ in {
QCOM_SPMI_RRADC = module; QCOM_SPMI_RRADC = module;
DRM = yes; DRM = yes;
DRM_MSM = yes; DRM_MSM = yes;
VIDEO_VIVID = module;
REGULATOR_QCOM_LABIBB = yes; REGULATOR_QCOM_LABIBB = yes;
BACKLIGHT_QCOM_WLED = yes; BACKLIGHT_QCOM_WLED = yes;
INPUT_QCOM_SPMI_HAPTICS = module; INPUT_QCOM_SPMI_HAPTICS = module;
@ -216,11 +98,13 @@ in {
DMABUF_HEAPS_CMA = yes; DMABUF_HEAPS_CMA = yes;
DMABUF_HEAPS_SYSTEM = yes; DMABUF_HEAPS_SYSTEM = yes;
HZ_1000 = yes; HZ_1000 = yes;
UCLAMP_TASK = yes;
UCLAMP_TASK_GROUP = yes;
RPMSG_CHAR = yes; RPMSG_CHAR = yes;
QCOM_Q6V5_ADSP = module; QCOM_Q6V5_ADSP = module;
BT_RFCOMM = yes; BT_RFCOMM = module;
BT_RFCOMM_TTY = yes; BT_RFCOMM_TTY = yes;
BT_BNEP = yes; BT_BNEP = module;
BT_BNEP_MC_FILTER = yes; BT_BNEP_MC_FILTER = yes;
BT_BNEP_PROTO_FILTER = yes; BT_BNEP_PROTO_FILTER = yes;
BT_HS = yes; BT_HS = yes;
@ -261,6 +145,10 @@ in {
USB_ONBOARD_HUB = no; # breaks USB on qualcomm rb2... which i don't need, but i guess this won't hurt either way USB_ONBOARD_HUB = no; # breaks USB on qualcomm rb2... which i don't need, but i guess this won't hurt either way
INTERCONNECT_QCOM_QCM2290 = yes; INTERCONNECT_QCOM_QCM2290 = yes;
BRIDGE_NETFILTER = module; BRIDGE_NETFILTER = module;
NEW_LEDS = yes;
LEDS_CLASS = yes;
CMA = yes;
CMA_SIZE_MBYTES = lib.mkForce (freeform "256");
# CONFIG END (essentially) # CONFIG END (essentially)
# the rest of the config is just disabling unneeded stuff, feel free to ignore this # the rest of the config is just disabling unneeded stuff, feel free to ignore this
@ -542,12 +430,6 @@ in {
HISI_PMU = no; HISI_PMU = no;
INTERCONNECT_QCOM_MSM8996 = no; INTERCONNECT_QCOM_MSM8996 = no;
INTERCONNECT_QCOM_QCS404 = no; INTERCONNECT_QCOM_QCS404 = no;
INTERCONNECT_QCOM_SC7180 = no;
INTERCONNECT_QCOM_SM8150 = no;
INTERCONNECT_QCOM_SM8350 = no;
INTERCONNECT_QCOM_SM8450 = no;
INTERCONNECT_QCOM_SM8550 = no;
INTERCONNECT_QCOM_SC8280XP = no;
ARCH_NPCM = no; ARCH_NPCM = no;
PINCTRL_SC8280XP = no; PINCTRL_SC8280XP = no;
BCM_SBA_RAID = no; BCM_SBA_RAID = no;
@ -560,25 +442,12 @@ in {
SND_SOC_SC7280 = no; SND_SOC_SC7280 = no;
SND_SOC_WCD938X_SDW = no; SND_SOC_WCD938X_SDW = no;
MMC_SDHCI_OF_DWCMSHC = no; MMC_SDHCI_OF_DWCMSHC = no;
SC_GCC_8180X = no;
IOMMU_IO_PGTABLE_DART = no; IOMMU_IO_PGTABLE_DART = no;
INTERCONNECT_QCOM_SC8180X = no;
MEMORY_HOTPLUG = lib.mkForce no; MEMORY_HOTPLUG = lib.mkForce no;
MELLANOX_PLATFORM = no; MELLANOX_PLATFORM = no;
CHROME_PLATFORMS = lib.mkForce no;
PINCTRL_SM8150 = no;
SM_GCC_8150 = no;
SM_VIDEOCC_8150 = no; SM_VIDEOCC_8150 = no;
SM_GPUCC_8150 = no;
SM_GPUCC_8350 = no; SM_GPUCC_8350 = no;
SM_VIDEOCC_8350 = no; SM_VIDEOCC_8350 = no;
PINCTRL_SM8350 = no;
SM_GCC_8350 = no;
SM_DISPCC_8450 = no;
PINCTRL_SM8550 = no;
PINCTRL_SM8550_LPASS_LPI = no;
SM_DISPCC_8550 = no;
SM_TCSRCC_8550 = no;
# keys that are unused in this case # keys that are unused in this case
# (builtin aarch64-linux config is unused too, but i cant disable it) # (builtin aarch64-linux config is unused too, but i cant disable it)
@ -625,7 +494,148 @@ in {
XEN_BALLOON_MEMORY_HOTPLUG.tristate = lib.mkForce null; XEN_DOM0.tristate = lib.mkForce null; XEN_EFI.tristate = lib.mkForce null; XEN_BALLOON_MEMORY_HOTPLUG.tristate = lib.mkForce null; XEN_DOM0.tristate = lib.mkForce null; XEN_EFI.tristate = lib.mkForce null;
XEN_HAVE_PVMMU.tristate = lib.mkForce null; XEN_MCE_LOG.tristate = lib.mkForce null; XEN_PVH.tristate = lib.mkForce null; XEN_HAVE_PVMMU.tristate = lib.mkForce null; XEN_MCE_LOG.tristate = lib.mkForce null; XEN_PVH.tristate = lib.mkForce null;
XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null; XEN_PVHVM.tristate = lib.mkForce null; XEN_SAVE_RESTORE.tristate = lib.mkForce null; XEN_SYS_HYPERVISOR.tristate = lib.mkForce null;
} // structuredExtraConfig;
}; };
in {
inherit (mobile-pkgs) mkbootimg qrtr;
pd-mapper = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/pd-mapper.nix" { };
tqftpserv = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/tqftpserv.nix" { };
rmtfs = pkgs'.callPackage "${mobile-nixos}/overlay/qrtr/rmtfs.nix" {
inherit (mobile-pkgs) qmic;
};
adbd = pkgs'.callPackage "${mobile-nixos}/overlay/adbd" {
libhybris = pkgs'.callPackage "${mobile-nixos}/overlay/libhybris" {
inherit (mobile-pkgs) android-headers;
};
};
q6voiced = pkgs.stdenv.mkDerivation {
pname = "q6voiced";
version = "unstable-2022-07-08";
src = pkgs.fetchFromGitLab {
owner = "postmarketOS";
repo = "q6voiced";
rev = "736138bfc9f7b455a96679e2d67fd922a8f16464";
hash = "sha256-7k5saedIALHlsFHalStqzKrqAyFKx0ZN9FhLTdxAmf4=";
};
buildInputs = with pkgs; [ dbus tinyalsa ];
nativeBuildInputs = with pkgs; [ pkg-config ];
buildPhase = ''cc $(pkg-config --cflags --libs dbus-1) -ltinyalsa -o q6voiced q6voiced.c'';
installPhase = ''install -m555 -Dt "$out/bin" q6voiced'';
meta.license = lib.licenses.mit;
};
alsa-ucm-conf = pkgs.stdenvNoCC.mkDerivation {
pname = "alsa-ucm-conf-enchilada";
version = "unstable-2022-12-08";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "alsa-ucm-conf";
rev = "aaa7889f7a6de640b4d78300e118457335ad16c0";
hash = "sha256-2P5ZTrI1vCJ99BcZVPlkH4sv1M6IfAlaXR6ZjAdy4HQ=";
};
installPhase = ''
substituteInPlace ucm2/lib/card-init.conf --replace '"/bin' '"/run/current-system/sw/bin'
mkdir -p "$out"/share/alsa/ucm2/{OnePlus,conf.d/sdm845,lib}
mv ucm2/lib/card-init.conf "$out/share/alsa/ucm2/lib/"
mv ucm2/OnePlus/enchilada "$out/share/alsa/ucm2/OnePlus/"
ln -s ../../OnePlus/enchilada/enchilada.conf "$out/share/alsa/ucm2/conf.d/sdm845/oneplus-OnePlus6-Unknown.conf"
'';
# to overwrite card-init.conf
meta.priority = -10;
};
uboot = pkgs.buildUBoot {
defconfig = "qcom_defconfig";
version = "unstable-2023-12-11";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "u-boot";
rev = "977b9279c610b862f9ef84fb3addbebb7c42166a";
hash = "sha256-ksI7qxozIjJ5E8uAJkX8ZuaaOHdv76XOzITaA8Vp/QA=";
};
makeFlags = [ "DEVICE_TREE=sdm845-oneplus-enchilada" ];
extraConfig = ''
CONFIG_BOOTDELAY=5
'';
extraMeta.platforms = [ "aarch64-linux" ];
patches = [ ];
filesToInstall = [ "u-boot-nodtb.bin" "u-boot-dtb.bin" "u-boot.dtb" ];
};
ubootImage = pkgs.stdenvNoCC.mkDerivation {
name = "u-boot-enchilada.img";
nativeBuildInputs = [
# available from mobile-nixos's overlay
pkgs'.mkbootimg
pkgs'.gzip
];
src = pkgs'.ubootEnchilada;
dontBuild = true;
dontFixup = true;
installPhase = ''
gzip u-boot-nodtb.bin
cat u-boot.dtb >> u-boot-nodtb.bin.gz
mkbootimg \
--base 0x0 \
--kernel_offset 0x8000 \
--ramdisk_offset 0x01000000 \
--tags_offset 0x100 \
--pagesize 4096 \
--kernel u-boot-nodtb.bin.gz \
-o "$out"
'';
};
firmware = pkgs.stdenvNoCC.mkDerivation {
name = "firmware-oneplus-sdm845";
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "firmware-oneplus-sdm845";
rev = "176ca713448c5237a983fb1f158cf3a5c251d775";
hash = "sha256-ZrBvYO+MY0tlamJngdwhCsI1qpA/2FXoyEys5FAYLj4=";
};
installPhase = ''
cp -a . "$out"
cd "$out/lib/firmware/postmarketos"
find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {}
cd "$out/usr"
find . -type f,l | xargs -i bash -c 'mkdir -p "$(dirname "../$1")" && mv "$1" "../$1"' -- {}
cd ..
find "$out/lib/firmware/postmarketos" "$out/usr" | tac | xargs rmdir
'';
dontStrip = true;
# not actually redistributable, but who cares
meta.license = lib.licenses.unfreeRedistributableFirmware;
};
linux = mkLinux {
linux = pkgs.linux_testing;
kernelPatches = [
{ name = "linux_6_11";
patch = pkgs.fetchpatch {
url = "https://github.com/chayleaf/linux-sdm845/compare/v6.11-rc2...7223c2b9c8917c0e315ee7ec53cee27cc1054b16.diff";
hash = "sha256-BxRBmB89wxXXD09FP6dZi1bsn7/fCihQRbnAUOJwEvc=";
}; }
{ name = "config_fixes";
patch = ./config_fixes_611.patch; }
];
structuredExtraConfig = with lib.kernel; {
TOUCHSCREEN_STM_FTS_DOWNSTREAM = no;
TOUCHSCREEN_FTM4 = no;
};
};
linux_6_9 = mkLinux {
linux = pkgs.linux_6_9;
kernelPatches = [
{ name = "linux_6_9";
patch = pkgs.fetchpatch {
url = "https://github.com/chayleaf/linux-sdm845/compare/v6.9.12...1ffe541f384cdfee347bf92773a740677de1b824.diff";
hash = "sha256-6TMiXaZy8YEB2vmrpXwAKklHYhvlA/TklCQv95iyMNY=";
}; }
{ name = "config_fixes";
patch = ./config_fixes.patch; }
];
structuredExtraConfig = { };
}; };
linux_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux; linux_ccache = pkgs'.ccachePkgs.buildLinuxWithCcache pkgs'.hw.oneplus-enchilada.linux;
} }

View file

@ -1,6 +1,7 @@
{ pkgs-kernel2 { pkgs
, config , config
, ... }: , ...
}:
{ {
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
@ -8,7 +9,7 @@
"phy-rockchip-naneng-combphy" "phy-rockchip-naneng-combphy"
]; ];
boot.kernelPackages = pkgs-kernel2.linuxPackagesFor pkgs-kernel2.linux_latest; boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
boot.kernelParams = [ "dtb=/${config.hardware.deviceTree.name}" ]; boot.kernelParams = [ "dtb=/${config.hardware.deviceTree.name}" ];
hardware.deviceTree.enable = true; hardware.deviceTree.enable = true;

View file

@ -0,0 +1,58 @@
{ config
, pkgs
, lib
, ...
}:
{
system.stateVersion = "23.11";
services.logind.powerKey = "ignore";
services.logind.powerKeyLongPress = "poweroff";
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if ((action.id.indexOf("org.freedesktop.login1.suspend" == 0)
|| action.id.indexOf("org.freedesktop.login1.reboot" == 0)
|| action.id.indexOf("org.freedesktop.login1.power-off" == 0)
|| action.id.indexOf("org.freedesktop.inhibit") == 0)
&& subject.user == "${config.common.mainUsername}")
{
return polkit.Result.YES;
}
});
'';
systemd.services.disable-fbcon-blink = {
script = "echo 0 > /sys/class/graphics/fbcon/cursor_blink";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
wantedBy = [ "multi-user.target" ];
};
phone.buffyboard.enable = true;
phone.rndis.enable = true;
common.minimal = true;
common.binaryCache.enable = true;
services.dbus.enable = true;
services.sshd.enable = true;
services.tlp.enable = true;
users.defaultUserShell = pkgs.bash;
# kde connect
networking.firewall.allowedTCPPortRanges = [
{ from = 1714; to = 1764; }
];
networking.firewall.allowedUDPPortRanges = [
{ from = 1714; to = 1764; }
];
# services.xserver.displayManager.startx.enable = true;
# services.xserver.windowManager.awesome.enable = true;
programs.sway.enable = true;
xdg.portal.enable = lib.mkForce false;
xdg.portal.wlr.enable = lib.mkForce false;
services.upower.enable = true;
}

View file

@ -39,8 +39,8 @@
"vm.dirty_background_ratio" = 2; "vm.dirty_background_ratio" = 2;
"vm.swappiness" = 40; "vm.swappiness" = 40;
}; };
# TODO: uncomment when iwlwifi gets fixed, whenever that will be (broken in 6.5.5) # TODO: switch back to latest
# kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/ /*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
}; };
@ -55,9 +55,9 @@
hardware = { hardware = {
opentabletdriver.enable = true; opentabletdriver.enable = true;
steam-hardware.enable = true; steam-hardware.enable = true;
opengl.driSupport32Bit = true; graphics.enable32Bit = true;
# needed for sway WLR_RENDERER=vulkan # needed for sway WLR_RENDERER=vulkan
opengl.extraPackages = with pkgs; [ vulkan-validation-layers ]; graphics.extraPackages = with pkgs; [ vulkan-validation-layers ];
}; };
# see modules/vfio.nix # see modules/vfio.nix
@ -81,6 +81,7 @@
7777 7777
9887 9887
]; ];
networking.firewall.allowedUDPPorts = [ 27015 ];
# kde connect # kde connect
networking.firewall.allowedTCPPortRanges = [ networking.firewall.allowedTCPPortRanges = [
{ from = 1714; to = 1764; } { from = 1714; to = 1764; }
@ -128,7 +129,7 @@
services.printing.drivers = [ pkgs.hplip ]; services.printing.drivers = [ pkgs.hplip ];
# from nix-gaming # from nix-gaming
services.pipewire.lowLatency = { services.pipewire.lowLatency = {
enable = false; enable = true;
# 96 is mostly fine but has some xruns # 96 is mostly fine but has some xruns
# 128 has xruns every now and then too # 128 has xruns every now and then too
quantum = 128; quantum = 128;
@ -138,7 +139,7 @@
programs.sway.enable = true; programs.sway.enable = true;
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
}; };
programs.ccache.enable = true; programs.ccache.enable = true;

View file

@ -15,7 +15,6 @@
linkConfig.MACAddress = config.phone.mac; linkConfig.MACAddress = config.phone.mac;
}; };
sound.enable = true;
services.logind.powerKey = "ignore"; services.logind.powerKey = "ignore";
services.logind.powerKeyLongPress = "poweroff"; services.logind.powerKeyLongPress = "poweroff";
hardware.sensor.iio.enable = true; hardware.sensor.iio.enable = true;
@ -41,6 +40,8 @@
}); });
''; '';
phone.buffyboard.enable = true;
phone.rndis.enable = true;
common.minimal = false; common.minimal = false;
services.sshd.enable = true; services.sshd.enable = true;
services.tlp.enable = true; services.tlp.enable = true;
@ -62,6 +63,7 @@
programs.sway.enable = true; programs.sway.enable = true;
xdg.portal = { xdg.portal = {
enable = true; enable = true;
wlr.enable = lib.mkForce false;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
}; };
# services.xserver.desktopManager.phosh = { # services.xserver.desktopManager.phosh = {

View file

@ -528,6 +528,10 @@ in {
lans = [ "br0" "wg1" ]; lans = [ "br0" "wg1" ];
wans = [ vpn_iface "veth-wan-a" ]; wans = [ vpn_iface "veth-wan-a" ];
logPrefix = "lan "; logPrefix = "lan ";
# I'll leave this here in case i get weird ipv6 issues again
# inetSnatRules = with notnft.dsl; with payload; [
# [(is.eq meta.protocol (f: f.ip6)) (is.eq meta.iifname "br0") (is.eq meta.oifname "br0") masquerade]
# ];
netdevIngressWanRules = with notnft.dsl; with payload; [ netdevIngressWanRules = with notnft.dsl; with payload; [
# check oif only from vpn # check oif only from vpn
# dont check it from veth-wan-a because of dnat fuckery and because we already check packets coming from wan there # dont check it from veth-wan-a because of dnat fuckery and because we already check packets coming from wan there

View file

@ -62,8 +62,23 @@ in {
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
REGISTER_EMAIL_CONFIRM = true; REGISTER_EMAIL_CONFIRM = true;
}; };
cache = {
ADAPTER = "redis";
HOST = "redis+socket://${config.services.redis.servers.forgejo.unixSocket}";
}; };
}; };
};
systemd.services.forgejo = {
wants = [ "redis-forgejo.service" ];
after = [ "redis-forgejo.service" ];
};
users.users.forgejo.extraGroups = [ config.services.redis.servers.forgejo.user ];
services.redis.servers.forgejo = {
enable = true;
};
services.nginx.virtualHosts."cloud.${cfg.domainName}" = { services.nginx.virtualHosts."cloud.${cfg.domainName}" = {
quic = true; quic = true;
@ -82,6 +97,7 @@ in {
dbtype = "pgsql"; dbtype = "pgsql";
dbhost = "/run/postgresql"; dbhost = "/run/postgresql";
}; };
phpOptions."opcache.interned_strings_buffer" = "16";
settings.overwriteprotocol = "https"; settings.overwriteprotocol = "https";
hostName = "cloud.${cfg.domainName}"; hostName = "cloud.${cfg.domainName}";
https = true; https = true;

View file

@ -106,6 +106,7 @@ in {
nix.settings.allowed-users = [ "nix-serve" "harmonia" ] ++ lib.optionals config.services.hydra.enable [ "hydra" "hydra-www" ]; nix.settings.allowed-users = [ "nix-serve" "harmonia" ] ++ lib.optionals config.services.hydra.enable [ "hydra" "hydra-www" ];
# make sure only hydra has access to this file # make sure only hydra has access to this file
# so normal nix evals don't have access to builtins # so normal nix evals don't have access to builtins
# nix.checkConfig = false;
nix.settings.extra-builtins-file = "/secrets/nixos/extra-builtins.nix"; nix.settings.extra-builtins-file = "/secrets/nixos/extra-builtins.nix";
# required for hydra which uses restricted mode # required for hydra which uses restricted mode
nix.settings.allowed-uris = [ nix.settings.allowed-uris = [
@ -167,7 +168,7 @@ in {
maxJobs = 2; maxJobs = 2;
# TODO: switch to ssh-ng https://github.com/NixOS/hydra/issues/688 # TODO: switch to ssh-ng https://github.com/NixOS/hydra/issues/688
protocol = "ssh"; protocol = "ssh";
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" "i686-linux" ];
supportedFeatures = [ "benchmark" "big-parallel" "ca-derivations" "kvm" "nixos-test" ]; supportedFeatures = [ "benchmark" "big-parallel" "ca-derivations" "kvm" "nixos-test" ];
# hydra-queue-runner must have read access to this # hydra-queue-runner must have read access to this
sshKey = "/secrets/hydra-builder-key"; sshKey = "/secrets/hydra-builder-key";
@ -181,6 +182,7 @@ in {
systemd.services.nix-daemon.serviceConfig.Nice = "19"; systemd.services.nix-daemon.serviceConfig.Nice = "19";
nix.daemonCPUSchedPolicy = "idle"; nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle"; nix.daemonIOSchedClass = "idle";
common.useNixPlugins = true;
systemd.services.hydra-evaluator = lib.mkIf config.services.hydra.enable { systemd.services.hydra-evaluator = lib.mkIf config.services.hydra.enable {
# https://github.com/NixOS/hydra/issues/1186 # https://github.com/NixOS/hydra/issues/1186
environment.GC_DONT_GC = "1"; environment.GC_DONT_GC = "1";
@ -281,7 +283,13 @@ in {
job_name = "local_medium_freq"; job_name = "local_medium_freq";
scrape_interval = "15m"; scrape_interval = "15m";
static_configs = [ { static_configs = [ {
targets = [ "127.0.0.1:9548" "127.0.0.1:9198" "127.0.0.1:9173" ]; targets = [
"127.0.0.1:9548"
"127.0.0.1:9198"
(let cfg = config.services.matrix-appservice-discord.settings.metrics;
in "${lib.quoteListenAddr cfg.host}:${toString cfg.port}")
config.services.matrix-sliding-sync.settings.SYNCV3_PROM
];
labels.machine = "server"; labels.machine = "server";
} ]; } ];
} }
@ -357,12 +365,17 @@ in {
} }
]; ];
}; };
# don't mess with my dns god damn it
services.resolved.enable = false;
# TODO: enable # TODO: enable
services.matrix-appservice-discord.settings.metrics = { services.matrix-appservice-discord.settings.metrics = {
enable = true; enable = true;
host = "127.0.0.1"; host = "127.0.0.1";
port = 9173; port = 9173;
}; };
services.matrix-sliding-sync = {
settings.SYNCV3_PROM = "[::]:8011";
};
services.matrix-synapse.settings = { services.matrix-synapse.settings = {
enable_metrics = true; enable_metrics = true;
federation_metrics_domains = [ "matrix.org" ]; federation_metrics_domains = [ "matrix.org" ];

View file

@ -27,6 +27,11 @@ in {
hostName = "mail.${cfg.domainName}"; hostName = "mail.${cfg.domainName}";
maxAttachmentSize = 100; maxAttachmentSize = 100;
plugins = [ "persistent_login" ]; plugins = [ "persistent_login" ];
extraConfig = ''
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
}; };
mailserver = { mailserver = {
enable = true; enable = true;

View file

@ -11,6 +11,7 @@ let
matrixClientJson = { matrixClientJson = {
"m.homeserver".base_url = "https://matrix.${cfg.domainName}"; "m.homeserver".base_url = "https://matrix.${cfg.domainName}";
"m.identity_server".base_url = "https://vector.im"; "m.identity_server".base_url = "https://vector.im";
"org.matrix.msc3575.proxy".url = "https://matrix.${cfg.domainName}";
}; };
matrixServerConfigResponse = '' matrixServerConfigResponse = ''
add_header Content-Type application/json; add_header Content-Type application/json;
@ -41,7 +42,8 @@ in {
locations = { locations = {
"= /.well-known/matrix/server".extraConfig = matrixServerConfigResponse; "= /.well-known/matrix/server".extraConfig = matrixServerConfigResponse;
"= /.well-known/matrix/client".extraConfig = matrixClientConfigResponse; "= /.well-known/matrix/client".extraConfig = matrixClientConfigResponse;
"/".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}"; "~ ^/(_matrix(?!/maubot)|_synapse/client|$)".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}";
"~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/)".proxyPass = "http://${config.services.matrix-sliding-sync.settings.SYNCV3_BINDADDR}";
}; };
}; };
@ -71,9 +73,12 @@ in {
}; };
}; };
environment.systemPackages = with pkgs; [ matrix-synapse-tools.rust-synapse-compress-state ];
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
extraConfigFiles = [ "/var/lib/matrix-synapse/config.yaml" ]; extraConfigFiles = [ "/var/lib/matrix-synapse/config.yaml" ];
log.root.level = "WARNING";
settings = { settings = {
app_service_config_files = [ app_service_config_files = [
"/var/lib/heisenbridge/registration.yml" "/var/lib/heisenbridge/registration.yml"
@ -109,4 +114,13 @@ in {
}]; }];
}; };
}; };
services.matrix-sliding-sync = {
enable = true;
environmentFile = "/secrets/sliding-sync/env";
settings = {
SYNCV3_BINDADDR = "[::]:8010";
SYNCV3_SERVER = "https://matrix.pavluk.org";
};
};
} }

View file

@ -9,7 +9,7 @@ in {
services.nginx.virtualHosts."matrix.${cfg.domainName}".locations = let services.nginx.virtualHosts."matrix.${cfg.domainName}".locations = let
inherit (config.services.maubot) settings; inherit (config.services.maubot) settings;
in { in {
"/_matrix/maubot/" = { "^~ /_matrix/maubot/" = {
proxyPass = "http://${lib.quoteListenAddr settings.server.hostname}:${toString settings.server.port}"; proxyPass = "http://${lib.quoteListenAddr settings.server.hostname}:${toString settings.server.port}";
proxyWebsockets = true; proxyWebsockets = true;
}; };

View file

@ -0,0 +1,50 @@
{ config
, lib
, pkgs
, ...
}:
let
cfg = config.phone;
in
{
options.phone.buffyboard = {
enable = lib.mkEnableOption "buffyboard";
};
config = lib.mkIf cfg.buffyboard.enable {
boot.initrd.kernelModules = [ "uinput" "evdev" ];
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.buffyboard}/bin/buffyboard
cp -a ${pkgs.libinput.out}/share $out/
'';
boot.initrd.extraUdevRulesCommands = ''
cp -v ${config.systemd.package}/lib/udev/rules.d/60-input-id.rules $out/
cp -v ${config.systemd.package}/lib/udev/rules.d/60-persistent-input.rules $out/
cp -v ${config.systemd.package}/lib/udev/rules.d/70-touchpad.rules $out/
'';
boot.initrd.preLVMCommands = ''
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
ln -s "$(dirname "$(dirname "$(which buffyboard)")")"/share /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
buffyboard 2>/dev/null &
'';
boot.initrd.postMountCommands = ''
pkill -x buffyboard
'';
systemd.services.buffyboard = {
description = "buffyboard";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.buffyboard}/bin/buffyboard";
Restart = "always";
RestartSec = "1";
};
};
security.sudo.extraRules = [
{ groups = [ "users" ];
commands = [
{ command = "/run/current-system/sw/bin/systemctl stop buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
{ command = "/run/current-system/sw/bin/systemctl start buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
]; }
];
};
}

View file

@ -17,6 +17,15 @@ in {
default = true; default = true;
description = "whether this is a minimal (no DE/WM) system"; description = "whether this is a minimal (no DE/WM) system";
}; };
useNixPlugins = mkOption {
type = types.bool;
default = !cfg.minimal;
};
binaryCache.enable = mkOption {
type = types.bool;
default = !cfg.minimal;
description = "enable binary cache";
};
mainUsername = mkOption { mainUsername = mkOption {
type = types.str; type = types.str;
default = "user"; default = "user";
@ -58,31 +67,11 @@ in {
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 30d"; options = "--delete-older-than 30d";
}; };
package = pkgs.nixForNixPlugins;
extraOptions = ''
plugin-files = ${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so
'';
}; };
systemd.services.nix-daemon.serviceConfig.LimitSTACKSoft = "infinity"; systemd.services.nix-daemon.serviceConfig.LimitSTACKSoft = "infinity";
nix.daemonCPUSchedPolicy = lib.mkDefault "idle"; nix.daemonCPUSchedPolicy = lib.mkDefault "idle";
nix.daemonIOSchedClass = lib.mkDefault "idle"; nix.daemonIOSchedClass = lib.mkDefault "idle";
# registry is used for the new flaky nix command
nix.registry =
builtins.mapAttrs
(_: v: { flake = v; })
(lib.filterAttrs (_: v: v?outputs) inputs);
# add import'able flake inputs (like nixpkgs) to nix path
# nix path is used for old nix commands (like nix-build, nix-shell)
environment.etc = lib.mapAttrs'
(name: value: {
name = "nix/inputs/${name}";
value.source = value.outPath or "${value}";
})
(lib.filterAttrs (_: v: builtins.pathExists "${v}/default.nix") inputs);
nix.nixPath = [ "/etc/nix/inputs" ];
boot.kernelParams = lib.optionals (cfg.resolution != null) [ boot.kernelParams = lib.optionals (cfg.resolution != null) [
"consoleblank=60" "consoleblank=60"
] ++ lib.optionals (cfg.resolution == "1920x1080") [ ] ++ lib.optionals (cfg.resolution == "1920x1080") [
@ -121,7 +110,7 @@ in {
rsync rsync
tmux tmux
wget wget
] ++ lib.optionals (!builtins.elem pkgs.system ["armv7l-linux"]) [
kitty.terminfo kitty.terminfo
foot.terminfo foot.terminfo
# rxvt-unicode-unwrapped.terminfo # rxvt-unicode-unwrapped.terminfo
@ -135,11 +124,30 @@ in {
# nixos-hardware uses mkDefault here, so we use slightly higher priority # nixos-hardware uses mkDefault here, so we use slightly higher priority
services.libinput.enable = mkForceDefault (!cfg.minimal); services.libinput.enable = mkForceDefault (!cfg.minimal);
programs.fuse.userAllowOther = true; programs.fuse.userAllowOther = true;
# registry is used for the new flaky nix command
nix.registry =
builtins.mapAttrs
(_: v: { flake = v; })
(lib.filterAttrs (k: v: (k != "self" || !cfg.minimal) && v?outputs) inputs);
# add import'able flake inputs (like nixpkgs) to nix path
# nix path is used for old nix commands (like nix-build, nix-shell)
environment.etc = lib.mapAttrs'
(name: value: {
name = "nix/inputs/${name}";
value.source = value.outPath or "${value}";
})
(lib.filterAttrs (k: v: (k != "self" || !cfg.minimal) && builtins.pathExists "${v}/default.nix") inputs);
}
(lib.mkIf cfg.gettyAutologin {
# autologin once after boot # autologin once after boot
# --skip-login means directly call login instead of first asking for username # --skip-login means directly call login instead of first asking for username
# (normally login asks for username too, but getty prefers to do it by itself for whatever reason) # (normally login asks for username too, but getty prefers to do it by itself for whatever reason)
services.getty.extraArgs = lib.mkIf cfg.gettyAutologin [ "--skip-login" ]; services.getty.extraArgs = [ "--skip-login" ];
services.getty.loginProgram = lib.mkIf cfg.gettyAutologin (let services.getty.loginProgram = let
lockfile = "/tmp/login-once.lock"; lockfile = "/tmp/login-once.lock";
in with pkgs; writeShellScript "login-once" '' in with pkgs; writeShellScript "login-once" ''
if [ -f '${lockfile}' ]; then if [ -f '${lockfile}' ]; then
@ -148,8 +156,8 @@ in {
${coreutils}/bin/touch '${lockfile}' ${coreutils}/bin/touch '${lockfile}'
exec ${shadow}/bin/login -f user exec ${shadow}/bin/login -f user
fi fi
''); '';
} })
(lib.mkIf cfg.minimal { (lib.mkIf cfg.minimal {
programs.fish.interactiveShellInit = '' programs.fish.interactiveShellInit = ''
@ -169,10 +177,11 @@ in {
# conflicts with bash module's mkDefault # conflicts with bash module's mkDefault
# only override on minimal systems because on non-minimal systems # only override on minimal systems because on non-minimal systems
# my fish config doesn't work well in fb/drm console # my fish config doesn't work well in fb/drm console
users.defaultUserShell = lib.mkIf cfg.minimal (mkForceDefault pkgs.fish); users.defaultUserShell = mkForceDefault pkgs.fish;
programs.vim = { programs.vim = {
defaultEditor = lib.mkDefault true; enable = lib.mkDefault true;
defaultEditor = lib.mkDefault config.programs.vim.enable;
package = pkgs.vim-full.customize { package = pkgs.vim-full.customize {
vimrcConfig.customRC = '' vimrcConfig.customRC = ''
syntax on syntax on
@ -190,9 +199,7 @@ in {
}) })
(lib.mkIf (!cfg.minimal) { (lib.mkIf (!cfg.minimal) {
environment.systemPackages = with pkgs; [ nix.nixPath = [ "/etc/nix/inputs" ];
unixtools.xxd
];
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
services.pipewire = { services.pipewire = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
@ -205,7 +212,20 @@ in {
security.rtkit.enable = true; security.rtkit.enable = true;
services.dbus.enable = true; services.dbus.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;
})
(lib.mkIf (!cfg.useNixPlugins) {
nix.package = pkgs.unpatchedNixForNixPlugins;
})
(lib.mkIf cfg.useNixPlugins {
nix.package = pkgs.nixForNixPlugins;
nix.settings.plugin-files-2 = "${pkgs.nix-plugins.override { nix = config.nix.package; }}/lib/nix/plugins/libnix-extra-builtins.so";
environment.systemPackages = with pkgs; [
unixtools.xxd
];
})
(lib.mkIf cfg.binaryCache.enable {
nix.settings = { nix.settings = {
netrc-file = "/secrets/netrc"; netrc-file = "/secrets/netrc";
substituters = [ substituters = [

View file

@ -133,9 +133,12 @@ in {
{ directory = /var/lib/${config.services.prometheus.stateDir}; user = "prometheus"; group = "prometheus"; mode = "0755"; } { directory = /var/lib/${config.services.prometheus.stateDir}; user = "prometheus"; group = "prometheus"; mode = "0755"; }
] ++ lib.optionals (config.services.qbittorrent-nox.enable or false) [ ] ++ lib.optionals (config.services.qbittorrent-nox.enable or false) [
{ directory = /var/lib/qbittorrent-nox; mode = "0755"; } { directory = /var/lib/qbittorrent-nox; mode = "0755"; }
] ++ lib.optionals (config.services.redis.servers.rspamd.enable or false) [ ] ++ (lib.mapAttrsToList
{ directory = /var/lib/redis-rspamd; user = "redis-rspamd"; group = "redis-rspamd"; mode = "0700"; } (k: v: let
] ++ lib.optionals config.services.roundcube.enable [ name = if k == "" then "redis" else "redis-${k}";
in { directory = /var/lib/${name}; inherit (v) user; group = v.user; mode = "0700"; })
(lib.filterAttrs (k: v: v.enable or false) config.services.redis.servers))
++ lib.optionals config.services.roundcube.enable [
{ directory = /var/lib/roundcube; user = "roundcube"; group = "roundcube"; mode = "0700"; } { directory = /var/lib/roundcube; user = "roundcube"; group = "roundcube"; mode = "0700"; }
] ++ lib.optionals config.services.rspamd.enable [ ] ++ lib.optionals config.services.rspamd.enable [
{ directory = /var/lib/rspamd; user = "rspamd"; group = "rspamd"; mode = "0700"; } { directory = /var/lib/rspamd; user = "rspamd"; group = "rspamd"; mode = "0700"; }

View file

@ -10,7 +10,7 @@ in {
options.services.qbittorrent-nox = { options.services.qbittorrent-nox = {
enable = lib.mkEnableOption "qbittorrent-nox"; enable = lib.mkEnableOption "qbittorrent-nox";
package = lib.mkPackageOptionMD pkgs "qbittorrent-nox" { }; package = lib.mkPackageOption pkgs "qbittorrent-nox" { };
ui.addToFirewall = lib.mkOption { ui.addToFirewall = lib.mkOption {
description = "Add the web UI port to firewall"; description = "Add the web UI port to firewall";

52
system/modules/rndis.nix Normal file
View file

@ -0,0 +1,52 @@
{ lib
, config
, ...
}:
let
cfg = config.phone;
in
{
options = {
phone.rndis.enable = lib.mkEnableOption "rndis";
};
config = lib.mkIf cfg.rndis.enable {
boot.initrd.kernelModules = [ "configfs" "libcomposite" ];
boot.initrd.availableKernelModules = [ "usb_f_rndis" "usb_f_ncm" ];
boot.specialFileSystems = {
"/sys/kernel/config" = {
device = "configfs";
fsType = "configfs";
options = [ "nosuid" "noexec" "nodev" ];
};
};
boot.initrd.preLVMCommands = ''
if ! mountpoint /sys/kernel/config; then
specialMount configfs /sys/kernel/config nosuid,noexec,nodev configfs
fi
mkdir -p /sys/kernel/config/usb_gadget/g1/strings/0x409
cd /sys/kernel/config/usb_gadget/g1
echo 0x18D1 > idVendor
echo 0xD001 > idProduct
echo nixos-device > strings/0x409/product
echo NixOS > strings/0x409/manufacturer
echo 0123456789 > strings/0x409/serialnumber
mkdir -p configs/c.1/strings/0x409
echo "USB network" > configs/c.1/strings/0x409/configuration
mkdir -p functions/ncm.usb0 || mkdir -p functions/rndis.usb0
ln -s functions/ncm.usb0 configs/c.1/ || ln -s functions/rndis.usb0 configs/c.1/
ls /sys/class/udc/ | head -n1 > UDC
cd /
ifconfig rndis0 172.16.42.1 || ifconfig usb0 172.16.42.1 || ifconfig eth0 172.16.42.1
'';
boot.initrd.network.enable = true;
boot.initrd.network.udhcpc.enable = false;
};
}

View file

@ -151,7 +151,7 @@ in {
'') '')
cfg.lookingGlass.ivshmem)); cfg.lookingGlass.ivshmem));
hardware = { hardware = {
opengl.enable = true; graphics.enable = true;
} // lib.optionalAttrs (cfg.enable && !cfg.nvidiaGpu && options?hardware.amdgpu.loadInInitrd) { } // lib.optionalAttrs (cfg.enable && !cfg.nvidiaGpu && options?hardware.amdgpu.loadInInitrd) {
# disable early KMS so GPU can be properly unbound # disable early KMS so GPU can be properly unbound
# can't use mkif because the option may not even exist # can't use mkif because the option may not even exist

View file

@ -7,9 +7,9 @@ mozilla-addons-to-nix \
./pkgs/firefox-addons/addons.json \ ./pkgs/firefox-addons/addons.json \
./pkgs/firefox-addons/generated.nix || echo "failed to update firefox addons" ./pkgs/firefox-addons/generated.nix || echo "failed to update firefox addons"
nix flake update nix flake update
if [ -z ${SUDO_ASKPASS+x} ]; then #if [ -z ${SUDO_ASKPASS+x} ]; then
sudo nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix" # sudo nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
else #else
sudo -A nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix" # sudo -A nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
fi #fi
home-manager switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix" #home-manager switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"