Compare commits

..

2 commits

Author SHA1 Message Date
chayleaf 95c0cc7134
home/hosts/phone: init (wip) 2023-12-24 14:27:43 +07:00
chayleaf e9122a4e7f
update coop-ofd; add cerspotter to impermanence 2023-12-22 23:19:42 +07:00
31 changed files with 600 additions and 238 deletions

View file

@ -25,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703247585, "lastModified": 1703252072,
"narHash": "sha256-EHtgF4H68e7Ft1+ICiInUmEfBIfKW7tLHAapp868WHQ=", "narHash": "sha256-IY/0CeFhaKMBcNUmGXwsPazeKu2rGqCa4IHXSmHy5u0=",
"owner": "chayleaf", "owner": "chayleaf",
"repo": "coop-ofd", "repo": "coop-ofd",
"rev": "02ce0fe10c22de27d02aff22f926bd26ee60c0ab", "rev": "c18e676934884181ad8687e069d28db3c7d1cdfb",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -142,9 +142,13 @@
}; };
home.user = [ ./home/hosts/nixmsi.nix ]; home.user = [ ./home/hosts/nixmsi.nix ];
}; };
phone = { phone = rec {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ ./system/devices/oneplus-6-phone.nix ]; modules = [ ./system/devices/oneplus-6-phone.nix ];
home.common.extraSpecialArgs = {
notlua = inputs.notlua.lib.${system};
};
home.user = [ ./home/hosts/phone.nix ];
}; };
}; };
@ -169,8 +173,10 @@
hydraJobs = { hydraJobs = {
server.${config.server.system} = self.nixosConfigurations.server.config.system.build.toplevel; server.${config.server.system} = self.nixosConfigurations.server.config.system.build.toplevel;
workstation.${config.nixmsi.system} = self.nixosConfigurations.nixmsi.config.system.build.toplevel;
router.${config.router-emmc.system} = self.nixosConfigurations.router-emmc.config.system.build.toplevel; router.${config.router-emmc.system} = self.nixosConfigurations.router-emmc.config.system.build.toplevel;
phone.${config.phone.system} = self.nixosConfigurations.phone.config.system.build.toplevel;
phone-home.${config.phone.system} = self.homeConfigurations."user@phone".activation-script;
workstation.${config.nixmsi.system} = self.nixosConfigurations.nixmsi.config.system.build.toplevel;
workstation-home.${config.nixmsi.system} = self.homeConfigurations."user@nixmsi".activation-script; workstation-home.${config.nixmsi.system} = self.homeConfigurations."user@nixmsi".activation-script;
}; };

View file

@ -1,43 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./gui.nix
];
programs.firefox = {
enable = true;
package = pkgs.wrapFirefox pkgs.librewolf-unwrapped {
inherit (pkgs.librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
wmClass = "LibreWolf";
libName = "librewolf";
nativeMessagingHosts = with pkgs; [ keepassxc ];
};
profiles.chayleaf = {
extensions = (with config.nur.repos.rycee.firefox-addons; [
cookies-txt
don-t-fuck-with-paste
greasemonkey
keepassxc-browser
libredirect
localcdn
noscript
privacy-pass
protondb-for-steam
return-youtube-dislikes
rust-search-extension
search-by-image
sponsorblock
steam-database
ublock-origin
unpaywall
vimium-c
youtube-shorts-block
]) ++ (with pkgs.firefoxAddons; [
fastforwardteam
middle-mouse-button-scroll
rikaitan
youtube-nonstop
]);
};
};
}

View file

@ -1,129 +0,0 @@
{ config, pkgs, ... }:
{
services.playerctld.enable = config.wayland.windowManager.sway.enable;
programs.waybar = {
enable = config.wayland.windowManager.sway.enable;
package = pkgs.waybar.override {
withMediaPlayer = true;
};
/*).overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "chayleaf";
repo = "Waybar";
rev = "3091cf4a009e92665325c0dd61adf5ab367786a3";
sha256 = "sha256-zH4hbQ8+9TYRVW/XYqmAVsi0vsSPn1LPqXxr0gi0j1E=";
};
});*/
settings = [{
layer = "bottom";
# position = "bottom";
ipc = true;
height = 40;
modules-left = [ "sway/workspaces" "sway/mode" "idle_inhibitor" "mpris" ];
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "󰅶";
deactivated = "󰾪";
};
};
mpris = {
tooltip = true;
format = "{player_icon} {dynamic}";
format-paused = "{status_icon} {dynamic}";
interval = 1;
ellipsis = "";
# tooltip-format = "{dynamic}";
album-len = 44;
artist-len = 44;
title-len = 44;
dynamic-len = 44;
player-icons = {
default = "";
mpd = "";
};
status-icons.paused = "";
};
"sway/workspaces" = {
disable-scroll = true;
format = "{value}{icon}";
format-icons = {
default = "";
urgent = " ";
"2" = " 󰵅";
"3" = " ";
"4" = " ";
"5" = " ";
};
persistent-workspaces = {
"1" = [ ]; "2" = [ ]; "3" = [ ];
};
};
"sway/mode" = {
tooltip = false;
};
modules-center = [ "sway/window" ];
#fixed-center = false;
"sway/window" = {
format = "{title}";
max-length = 50;
# tooltip = false;
icon = true;
rewrite = {
kitty = "";
zsh = "";
nheko = "";
Nextcloud = "";
"(.*) LibreWolf" = "$1";
"(.*) - KeePassXC" = "$1";
};
};
modules-right = [ "memory" "cpu" "tray" "wireplumber" "clock" "sway/language" ];
cpu = {
# format = "{usage}% ";
format = "{icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}{icon8}{icon9}{icon10}{icon11}{icon12}{icon13}{icon14}{icon15}";
format-icons = ["" "" "" "" "" "" "" ""];
};
memory = {
format = "{used}G";
};
tray = {
icon-size = 26;
spacing = 5;
};
wireplumber = {
format = "{volume}%";
format-muted = "";
tooltip = false;
};
clock = {
interval = 5;
format = "{:%Y-%m-%d %H:%M:%S}";
tooltip-format = "<tt><small>{calendar}</small></tt>";
calendar = {
mode = "year";
# TODO: make this work
mode-mon-col = 3;
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
};
"sway/language" = {
tooltip = false;
# make sure it isn't pushed away when other modules get too big
min-length = 2;
};
}];
style = ./waybar.css;
};
home.packages = with pkgs; [
playerctl
];
}

View file

@ -6,12 +6,12 @@
{ {
imports = [ imports = [
../common/general.nix ../modules/general.nix
../common/firefox.nix ../modules/firefox.nix
../common/i3-sway.nix ../modules/i3-sway.nix
../common/nvim.nix ../modules/nvim.nix
../common/helix.nix ../modules/helix.nix
../common/kakoune.nix ../modules/kakoune.nix
inputs.nur.nixosModules.nur inputs.nur.nixosModules.nur
]; ];
@ -42,28 +42,10 @@
home.stateVersion = "22.11"; home.stateVersion = "22.11";
home.username = "user"; home.username = "user";
home.homeDirectory = "/home/user"; home.homeDirectory = "/home/user";
termShell = { terminals = [ "kitty" ];
enable = true;
path = "${pkgs.fish}/bin/fish";
};
# xsession.windowManager.i3.enable = true; # xsession.windowManager.i3.enable = true;
wayland.windowManager.sway.enable = true; wayland.windowManager.sway.enable = true;
terminals = [ "kitty" "urxvt" ];
services.mpd = {
enable = true;
network.startWhenNeeded = true;
};
services.mpdris2 = {
enable = true;
};
programs.ncmpcpp = {
enable = true;
};
services.kdeconnect.enable = true; services.kdeconnect.enable = true;
systemd.user.services.kdeconnect.Service = {
Restart = lib.mkForce "always";
RestartSec = "30";
};
home.sessionVariables = { home.sessionVariables = {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${pkgs.proton-ge}"; STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${pkgs.proton-ge}";
CARGO_PROFILE_DEV_INCREMENTAL = "true"; CARGO_PROFILE_DEV_INCREMENTAL = "true";

38
home/hosts/phone.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs
, inputs,
...
}:
{
imports = [
../modules/general.nix
../modules/firefox.nix
../modules/i3-sway.nix
../modules/nvim.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;
home.stateVersion = "23.11";
home.username = "user";
home.homeDirectory = "/home/user";
terminals = [ "foot" "kitty" ];
wayland.windowManager.sway.enable = true;
services.kdeconnect.enable = true;
home.packages = with pkgs; [
squeekboard
techmino
tdesktop
];
}

75
home/modules/firefox.nix Normal file
View file

@ -0,0 +1,75 @@
{ config
, pkgs
, lib
, ...
}:
{
imports = [
./gui.nix
];
home.file.".mozilla/firefox/profiles.ini".target = ".librewolf/profiles.ini";
programs.firefox = {
enable = true;
package = pkgs.wrapFirefox pkgs.librewolf-unwrapped {
inherit (pkgs.librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
wmClass = "LibreWolf";
libName = "librewolf";
nativeMessagingHosts = with pkgs; [ keepassxc ];
};
profiles.chayleaf = lib.mkMerge [
{
extensions = (with config.nur.repos.rycee.firefox-addons; [
cookies-txt
don-t-fuck-with-paste
greasemonkey
keepassxc-browser
libredirect
localcdn
noscript
privacy-pass
protondb-for-steam
return-youtube-dislikes
rust-search-extension
search-by-image
sponsorblock
steam-database
ublock-origin
unpaywall
vimium-c
youtube-shorts-block
]) ++ (with pkgs.firefoxAddons; [
fastforwardteam
middle-mouse-button-scroll
rikaitan
youtube-nonstop
]);
settings = lib.mkIf config.phone.enable {
"dom.w3c.touch_events.enabled" = true;
"apz.allow_zooming" = true;
"apz.allow_double_tap_zooming" = true;
"dom.w3c_touch_events.legacy_apis.enabled" = true;
"browser.tabs.inTitlebar" = 1;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"browser.urlbar.clickSelectsAll" = true;
"toolkit.cosmeticAnimations.enabled" = false;
"browser.download.animateNotifications" = false;
};
}
(let
concatFiles = dir:
builtins.concatStringsSep ""
(map
(k: lib.optionalString (!lib.hasInfix ".before-ff" k) (builtins.readFile "${dir}/${k}"))
(builtins.attrNames (builtins.readDir dir)));
in lib.mkIf config.phone.enable {
userChrome =
concatFiles "${pkgs.mobile-config-firefox}/etc/mobile-config-firefox/common"
+ concatFiles "${pkgs.mobile-config-firefox}/etc/mobile-config-firefox/userChrome";
userContent =
concatFiles "${pkgs.mobile-config-firefox}/etc/mobile-config-firefox/common"
+ concatFiles "${pkgs.mobile-config-firefox}/etc/mobile-config-firefox/userContent";
})
];
};
}

View file

@ -234,6 +234,23 @@
# settings = { # settings = {
# }; # };
#}; #};
termShell = {
enable = true;
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 {
Service = {
Restart = lib.mkForce "always";
RestartSec = "30";
};
};
# some packages require a pointer theme # some packages require a pointer theme
home.pointerCursor.gtk.enable = true; home.pointerCursor.gtk.enable = true;

View file

@ -1,6 +1,6 @@
{ options, config, pkgs, lib, ... }: { options, config, pkgs, lib, ... }:
let let
modifier = "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 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; };
audioNext = pkgs.writeShellScript "playerctl-next" '' audioNext = pkgs.writeShellScript "playerctl-next" ''
@ -35,7 +35,7 @@ audioPrev = pkgs.writeShellScript "playerctl-prev" ''
fi fi
''; '';
barConfig = { barConfig = {
mode = "dock"; mode = "overlay";
hiddenState = "hide"; hiddenState = "hide";
position = "bottom"; position = "bottom";
workspaceButtons = true; workspaceButtons = true;
@ -80,6 +80,11 @@ commonConfig = {
inherit modifier; inherit modifier;
startup = [ startup = [
{ command = toString (pkgs.writeShellScript "init-wm" '' { command = toString (pkgs.writeShellScript "init-wm" ''
${lib.optionalString config.phone.enable ''
${pkgs.squeekboard}/bin/squeekboard&
${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji&
${pkgs.systemd}/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
''}
${pkgs.home-daemon}/bin/home-daemon system76-scheduler& ${pkgs.home-daemon}/bin/home-daemon system76-scheduler&
${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&) ${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/Nextcloud/keepass.kdbx&)
# nextcloud and nheko need secret service access # nextcloud and nheko need secret service access
@ -232,7 +237,7 @@ in
extraConfig = '' extraConfig = ''
title_align center title_align center
''; '';
config = let swayConfig = { config = commonConfig // {
bars = [ bars = [
{ {
command = "${config.programs.waybar.package}/bin/waybar"; command = "${config.programs.waybar.package}/bin/waybar";
@ -308,7 +313,7 @@ in
"--inhibited --no-repeat --allow-other --release Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc stoptalking"; "--inhibited --no-repeat --allow-other --release Scroll_Lock" = "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}+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" = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
"--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; "--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
"--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute"; "--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
@ -340,7 +345,8 @@ in
}; };
}; };
menu = "${rofiSway}/bin/rofi -show drun"; menu = "${rofiSway}/bin/rofi -show drun";
}; in commonConfig // swayConfig; workspaceLayout = "tabbed";
};
# export WLR_RENDERER=vulkan # export WLR_RENDERER=vulkan
extraSessionCommands = lib.optionalString config.wayland.windowManager.sway.vulkan '' extraSessionCommands = lib.optionalString config.wayland.windowManager.sway.vulkan ''
export WLR_RENDERER=vulkan export WLR_RENDERER=vulkan
@ -358,9 +364,15 @@ in
export XDG_SESSION_DESKTOP=sway export XDG_SESSION_DESKTOP=sway
''; '';
}; };
services.swayidle = let swaylock-start = toString (pkgs.writeShellScript "swaylock-start" '' services.swayidle = let
${pkgs.procps}/bin/pgrep -fx "${pkgs.swaylock}/bin/swaylock -f" || ${pkgs.swaylock}/bin/swaylock -f swaylock =
''); in { if config.phone.enable
then "${pkgs.schlock}/bin/schlock -f /secrets/schlock.pin"
else "${pkgs.swaylock}/bin/swaylock -f";
swaylock-start = toString (pkgs.writeShellScript "swaylock-start" ''
${pkgs.procps}/bin/pgrep -fx "${swaylock}" || ${swaylock}
'');
in {
enable = config.wayland.windowManager.sway.enable; enable = config.wayland.windowManager.sway.enable;
events = [ events = [
{ event = "before-sleep"; command = swaylock-start; } { event = "before-sleep"; command = swaylock-start; }
@ -466,7 +478,13 @@ in
}; };
terminal = config.terminalBin; terminal = config.terminalBin;
extraConfig = { extraConfig = {
modi = [ "steam:${pkgs.rofi-steam-game-list}/bin/rofi-steam-game-list" "drun" "run" "ssh" ]; modi = lib.optionals (!config.phone.enable) [
"steam:${pkgs.rofi-steam-game-list}/bin/rofi-steam-game-list"
] ++ [
"drun"
"run"
"ssh"
];
icon-theme = "hicolor"; icon-theme = "hicolor";
drun-match-fields = [ "name" "generic" "exec" "keywords" ]; drun-match-fields = [ "name" "generic" "exec" "keywords" ];
show-icons = true; show-icons = true;

View file

@ -1,5 +1,12 @@
{ lib, config, ... }: { lib, config, ... }:
with lib; { with lib; {
options.phone = {
enable = mkOption {
type = types.bool;
default = false;
description = "whether this is a phone";
};
};
options.rustAnalyzerAndroidSettings = mkOption { options.rustAnalyzerAndroidSettings = mkOption {
type = with types; attrs; type = with types; attrs;
description = "Additional cargo arguments for rust-analyzer's RustAndroid command"; description = "Additional cargo arguments for rust-analyzer's RustAndroid command";
@ -89,7 +96,7 @@ with lib; {
config.colors.brMagenta = builtins.elemAt config.colors.base 13; config.colors.brMagenta = builtins.elemAt config.colors.base 13;
config.colors.brCyan = builtins.elemAt config.colors.base 14; config.colors.brCyan = builtins.elemAt config.colors.base 14;
config.colors.brWhite = builtins.elemAt config.colors.base 15; config.colors.brWhite = builtins.elemAt config.colors.base 15;
options.termShell = mkOption { options.termShell = {
enable = mkOption { enable = mkOption {
description = "Use a separate shell for gui terminal"; description = "Use a separate shell for gui terminal";
type = types.bool; type = types.bool;

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
supportTerminal = term: builtins.elem term config.terminals; supportTerminal = term: builtins.elem term config.terminals;
getTerminalBin = term: lib.getExe { getTerminalBin = term: {
alacritty = "${pkgs.alacritty}/bin/alacritty"; alacritty = "${pkgs.alacritty}/bin/alacritty";
foot = "${pkgs.foot}/bin/footclient"; foot = "${pkgs.foot}/bin/footclient";
kitty = "${pkgs.kitty}/bin/kitty"; kitty = "${pkgs.kitty}/bin/kitty";
@ -123,7 +123,9 @@ in {
"*antialias" = true; "*antialias" = true;
"*autohint" = true; "*autohint" = true;
}; };
home.file.".Xdefaults".source = lib.mkIf config.programs.urxvt.enable config.home.file."${config.home.homeDirectory}/.Xresources".source; home.file.".Xdefaults" = lib.mkIf config.programs.urxvt.enable {
source = config.home.file."${config.home.homeDirectory}/.Xresources".source;
};
programs.foot = { programs.foot = {
enable = supportTerminal "foot"; enable = supportTerminal "foot";
server.enable = true; server.enable = true;

View file

@ -11,10 +11,18 @@
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: Noto Sans Mono, "Symbols Nerd Font Mono", monospace; font-family: Noto Sans Mono, "Symbols Nerd Font Mono", monospace;
font-size: 19; font-size: 19px;
min-height: 0; min-height: 0;
} }
#custom-a { font-size: 40px; }
#custom-b { font-size: 40px; }
#custom-c { font-size: 40px; }
#custom-d { font-size: 40px; }
#custom-e { font-size: 40px; }
#custom-f { font-size: 40px; }
#custom-g { font-size: 40px; }
#mpris { #mpris {
padding-left: 3px; padding-left: 3px;
font-family: "Noto Sans Mono CJK JP", "Noto Sans Mono", "Symbols Nerd Font Mono", monospace; font-family: "Noto Sans Mono CJK JP", "Noto Sans Mono", "Symbols Nerd Font Mono", monospace;

225
home/modules/waybar.nix Normal file
View file

@ -0,0 +1,225 @@
{ config
, pkgs
, lib
, ...
}:
{
services.playerctld.enable = config.wayland.windowManager.sway.enable;
programs.waybar = {
enable = config.wayland.windowManager.sway.enable;
package = pkgs.waybar.override {
withMediaPlayer = true;
};
/*).overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "chayleaf";
repo = "Waybar";
rev = "3091cf4a009e92665325c0dd61adf5ab367786a3";
sha256 = "sha256-zH4hbQ8+9TYRVW/XYqmAVsi0vsSPn1LPqXxr0gi0j1E=";
};
});*/
settings = lib.toList {
layer = "top";
position = "top";
ipc = true;
height = 40;
modules-left = [
"sway/workspaces"
"sway/mode"
"idle_inhibitor"
]
++ lib.optional (!config.phone.enable) "mpris";
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "󰅶";
deactivated = "󰾪";
};
};
mpris = {
tooltip = true;
format = "{player_icon} {dynamic}";
format-paused = "{status_icon} {dynamic}";
interval = 1;
ellipsis = "";
# tooltip-format = "{dynamic}";
album-len = 44;
artist-len = 44;
title-len = 44;
dynamic-len = 44;
player-icons = {
default = "";
mpd = "";
};
status-icons.paused = "";
};
"sway/workspaces" = {
disable-scroll = true;
format = "{value}{icon}";
format-icons = {
default = "";
urgent = " ";
} // lib.optionalAttrs (!config.phone.enable) {
"2" = " 󰵅";
"3" = " ";
"4" = " ";
"5" = " ";
};
persistent-workspaces = {
"1" = [ ]; "2" = [ ]; "3" = [ ];
};
};
"sway/mode" = {
tooltip = false;
};
modules-center = [ "sway/window" ];
#fixed-center = false;
"sway/window" = {
format = "{title}";
max-length = 50;
# tooltip = false;
icon = true;
rewrite = {
kitty = "";
zsh = "";
nheko = "";
Nextcloud = "";
"(.*) LibreWolf" = "$1";
"(.*) - KeePassXC" = "$1";
};
};
modules-right = [
"memory"
]
++ lib.optional (!config.phone.enable) "cpu"
++ [
"tray"
(if config.phone.enable then "pulseaudio" else "wireplumber")
]
++ lib.optional (!config.phone.enable) "clock"
++ [ "sway/language" ]
++ lib.optional config.phone.enable "battery";
battery = {
format = "{capacity}%";
};
cpu = {
# format = "{usage}% ";
format = "{icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}{icon8}{icon9}{icon10}{icon11}{icon12}{icon13}{icon14}{icon15}";
format-icons = ["" "" "" "" "" "" "" ""];
};
memory = {
format = "{used}G";
};
tray = {
icon-size = 26;
spacing = 5;
};
wireplumber = {
format = "{volume}%";
format-muted = "";
tooltip = false;
};
pulseaudio = {
format = "{volume}%";
format-muted = "";
tooltip = false;
};
clock = {
interval = 5;
format = "{:%Y-%m-%d %H:%M:%S}";
tooltip-format = "<tt><small>{calendar}</small></tt>";
calendar = {
mode = "year";
# TODO: make this work
mode-mon-col = 3;
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
};
"sway/language" = {
tooltip = false;
# make sure it isn't pushed away when other modules get too big
min-length = 2;
};
} ++ lib.optionals config.phone.enable [
{
layer = "top";
position = "top";
ipc = true;
height = 40;
clock = {
interval = 5;
format = "{:%Y-%m-%d %H:%M:%S}";
};
cpu = {
# format = "{usage}% ";
format = "{icon0}{icon1}{icon2}{icon3}{icon4}{icon5}{icon6}{icon7}{icon8}{icon9}{icon10}{icon11}{icon12}{icon13}{icon14}{icon15}";
format-icons = ["" "" "" "" "" "" "" ""];
};
modules-left = [ "cpu" ];
modules-right = [ "clock" ];
}
{
layer = "top";
position = "bottom";
ipc = true;
height = 80;
modules-left = [ "custom/a" "custom/b" "custom/c" ];
modules-right = [ "custom/d""custom/e" "custom/f" ];
# 2 btns: keyboards
# 1 btn: close
#
"custom/a" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " A ";
on-click = "${config.home.homeDirectory}/scripts/a.sh";
};
"custom/b" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " 󰌌 ";
on-click = pkgs.writeShellScript "toggle-keyboard.sh" ''
pkill -x -SIGRTMIN wvkbd-mobintl
'';
};
"custom/c" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " C ";
on-click = "${config.home.homeDirectory}/scripts/c.sh";
};
"custom/d" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " D ";
on-click = "${config.home.homeDirectory}/scripts/d.sh";
};
"custom/e" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " 󰌌 ";
on-click = pkgs.writeShellScript "toggle-keyboard.sh" ''
if ${pkgs.systemd}/bin/busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible | ${pkgs.gnugrep}/bin/grep true; then
${pkgs.systemd}/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
else
${pkgs.systemd}/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
fi
'';
};
"custom/f" = {
interval = "once"; exec = "${pkgs.coreutils}/bin/echo a"; exec-if = "${pkgs.coreutils}/bin/true";
format = " X ";
on-click = "${pkgs.sway}/bin/swaymsg kill";
};
}
];
style = ./waybar.css;
};
home.packages = with pkgs; [
playerctl
];
}

View file

@ -114,6 +114,7 @@ in
kvmfrOverlay = kvmfr: kvmfr.overrideAttrs (old: { kvmfrOverlay = kvmfr: kvmfr.overrideAttrs (old: {
inherit (pkgs'.looking-glass-client) version src; inherit (pkgs'.looking-glass-client) version src;
}); });
mobile-config-firefox = callPackage ./mobile-config-firefox { };
ping-exporter = callPackage ./ping-exporter { }; ping-exporter = callPackage ./ping-exporter { };
proton-ge = pkgs.stdenvNoCC.mkDerivation { proton-ge = pkgs.stdenvNoCC.mkDerivation {
inherit (sources.proton-ge) pname version src; inherit (sources.proton-ge) pname version src;
@ -129,6 +130,7 @@ in
version = "unstable-" + sources.searxng.date; version = "unstable-" + sources.searxng.date;
postInstall = builtins.replaceStrings [ "/botdetection" ] [ "" ] old.postInstall; postInstall = builtins.replaceStrings [ "/botdetection" ] [ "" ] old.postInstall;
})); }));
schlock = callPackage ./schlock { };
techmino = callPackage ./techmino { }; techmino = callPackage ./techmino { };
firefoxAddons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; }); firefoxAddons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; });

View file

@ -0,0 +1,31 @@
{ lib
, stdenv
, fetchFromGitLab
}:
stdenv.mkDerivation rec {
pname = "mobile-config-firefox";
version = "4.2.0";
src = fetchFromGitLab {
owner = "postmarketOS";
repo = "mobile-config-firefox";
rev = version;
hash = "sha256-JEfgB+dqfy97n4FC2N6eHDV0aRFAhmFujYJHYa3kENE=";
};
makeFlags = [ "DESTDIR=$(out)" "FIREFOX_DIR=/lib/firefox" ];
postInstall = ''
rm -rf "$out/usr"
'';
meta = with lib; {
description = "Mobile and privacy friendly configuration for Firefox (distro-independent";
homepage = "https://gitlab.com/postmarketOS/mobile-config-firefox";
license = licenses.mpl20;
maintainers = with maintainers; [ chayleaf ];
mainProgram = "mobile-config-firefox";
platforms = platforms.all;
};
}

56
pkgs/schlock/default.nix Normal file
View file

@ -0,0 +1,56 @@
{ lib
, stdenv
, fetchFromGitHub
, meson
, ninja
, pkg-config
, scdoc
, cairo
, gdk-pixbuf
, libsodium
, libxkbcommon
, wayland
, wayland-protocols
}:
stdenv.mkDerivation {
pname = "schlock";
version = "unstable-2022-02-02";
src = fetchFromGitHub {
owner = "telent";
repo = "schlock";
rev = "f3dde16f074fd5b7482a253b9d26b4ead66dea82";
hash = "sha256-Ot86vALt1kkzbBocwh9drCycbRIw2jMKJU4ODe9PYQM=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
scdoc
];
buildInputs = [
cairo
gdk-pixbuf
libsodium
libxkbcommon
wayland
wayland-protocols
];
mesonFlags = [
"-Dgdk-pixbuf=enabled"
"-Dman-pages=enabled"
];
meta = with lib; {
description = "";
homepage = "https://github.com/telent/schlock";
license = licenses.mit;
maintainers = with maintainers; [ chayleaf ];
mainProgram = "schlock";
platforms = platforms.all;
};
}

View file

@ -38,10 +38,15 @@ in
requires = [ "dbus.socket" ]; requires = [ "dbus.socket" ];
serviceConfig.ExecStart = "${pkgs.q6voiced}/bin/q6voiced hw:0,6"; serviceConfig.ExecStart = "${pkgs.q6voiced}/bin/q6voiced hw:0,6";
}; };
environment.etc."wireplumber/main.lua.d/51-qcom-sdm845.lua".source = pkgs.fetchurl { systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = pkgs.runCommand "wireplumber-config" {} ''
cp -a "${pkgs.wireplumber}/share/wireplumber" "$out"
chmod +w "$out" "$out/main.lua.d"
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/0aa9524204e9c9c002c860b87c972bc2ebf025f3/device/community/soc-qcom-sdm845/51-qcom-sdm845.lua";
hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk="; hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk=";
}; }} "$out/main.lua.d/51-qcom-sdm845.lua"
'';
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;
services.udev.extraRules = '' services.udev.extraRules = ''
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT}=="1", SUBSYSTEMS=="input", ATTRS{name}=="spmi_haptics", TAG+="uaccess", ENV{FEEDBACKD_TYPE}="vibra" SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT}=="1", SUBSYSTEMS=="input", ATTRS{name}=="spmi_haptics", TAG+="uaccess", ENV{FEEDBACKD_TYPE}="vibra"
@ -108,16 +113,23 @@ in
boot.initrd.postMountCommands = '' boot.initrd.postMountCommands = ''
pkill -x buffyboard pkill -x buffyboard
''; '';
services.getty.extraArgs = [ "--skip-login" ]; common.gettyAutologin = true;
services.getty.loginProgram = let systemd.services.buffyboard = {
lockfile = "/tmp/buffyboard-lock.lock"; description = "buffyboard";
in pkgs.writeShellScript "login-with-buffyboard-once" '' wantedBy = [ "multi-user.target" ];
if [ ! -f '${lockfile}' ]; then serviceConfig = {
${pkgs.coreutils}/bin/touch '${lockfile}' ExecStart = "${pkgs.buffyboard}/bin/buffyboard";
${pkgs.buffyboard}/bin/buffyboard 2>/dev/null & Restart = "always";
fi RestartSec = "1";
exec ${pkgs.shadow}/bin/login -f user };
''; };
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 { (lib.mkIf cfg.rndis.enable {
boot.initrd.kernelModules = [ "configfs" "libcomposite" ]; boot.initrd.kernelModules = [ "configfs" "libcomposite" ];

View file

@ -49,7 +49,7 @@ in {
mkdir -p "$out"/share/alsa/ucm2/{OnePlus,conf.d/sdm845,lib} mkdir -p "$out"/share/alsa/ucm2/{OnePlus,conf.d/sdm845,lib}
mv ucm2/lib/card-init.conf "$out/share/alsa/ucm2/lib/" mv ucm2/lib/card-init.conf "$out/share/alsa/ucm2/lib/"
mv ucm2/OnePlus/enchilada "$out/share/alsa/ucm2/OnePlus/" mv ucm2/OnePlus/enchilada "$out/share/alsa/ucm2/OnePlus/"
ln -s ../../OnePlus/enchilada/enchilada.conf "$out/share/alsa/ucm2/conf.d/sdm845/OnePlus 6.conf" ln -s ../../OnePlus/enchilada/enchilada.conf "$out/share/alsa/ucm2/conf.d/sdm845/oneplus-OnePlus6-Unknown.conf"
''; '';
# to overwrite card-init.conf # to overwrite card-init.conf
meta.priority = -10; meta.priority = -10;

View file

@ -1,12 +1,36 @@
{ pkgs { pkgs
, lib , lib
# , config , config
, ... , ...
}: }:
{ {
imports = [ ./options.nix ];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
systemd.network.links."40-wlan0" = {
matchConfig.OriginalName = "wlan0";
linkConfig.MACAddressPolicy = "none";
linkConfig.MACAddress = config.phone.mac;
};
sound.enable = true;
services.logind.powerKey = "ignore";
services.logind.powerKeyLongPress = "poweroff";
hardware.sensor.iio.enable = true;
services.pipewire.enable = false;
hardware.pulseaudio.enable = lib.mkForce true;
users.users.${config.common.mainUsername}.extraGroups = [
"dialout"
"feedbackd"
"video"
] ++ lib.optional (config.networking.modemmanager.enable || config.networking.networkmanager.enable) "networkmanager";
common.minimal = false;
services.sshd.enable = true;
services.tlp.enable = true;
# kde connect # kde connect
networking.firewall.allowedTCPPortRanges = [ networking.firewall.allowedTCPPortRanges = [
{ from = 1714; to = 1764; } { from = 1714; to = 1764; }
@ -15,12 +39,20 @@
{ from = 1714; to = 1764; } { from = 1714; to = 1764; }
]; ];
common.minimal = false; programs.calls.enable = true;
environment.systemPackages = with pkgs; [
# IM and SMS
chatty
];
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 xdg-desktop-portal-wlr ];
}; };
services.sshd.enable = true; # services.xserver.desktopManager.phosh = {
# users.users.${config.common.mainUsername}.extraGroups = [ "video" "feedbackd" "dialout" ]; # enable = true;
# group = "users";
# user = config.common.mainUsername;
# };
} }

View file

@ -0,0 +1,12 @@
{ lib
, ...
}:
{
options.phone = {
mac = lib.mkOption {
description = "mac address";
type = lib.types.str;
};
};
}

View file

@ -11,6 +11,13 @@ in {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://${lib.quoteListenAddr settings.server.HTTP_ADDR}:${toString settings.server.HTTP_PORT}"; locations."/".proxyPass = "http://${lib.quoteListenAddr settings.server.HTTP_ADDR}:${toString settings.server.HTTP_PORT}";
locations."= /robots.txt".extraConfig = ''
return 200 ${builtins.toJSON ''
User-agent: *
Disallow: /mirrors/nixpkgs
Disallow: /chayleaf/nixpkgs
''};
'';
}; };
services.forgejo = { services.forgejo = {
enable = true; enable = true;

View file

@ -8,17 +8,17 @@ let
"m.server" = "matrix.${cfg.domainName}:443"; "m.server" = "matrix.${cfg.domainName}:443";
}; };
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";
}; };
matrixServerConfigResponse = '' matrixServerConfigResponse = ''
add_header Content-Type application/json; add_header Content-Type application/json;
return 200 '${builtins.toJSON matrixServerJson}'; return 200 ${builtins.toJSON (builtins.toJSON matrixServerJson)};
''; '';
matrixClientConfigResponse = '' matrixClientConfigResponse = ''
add_header Content-Type application/json; add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON matrixClientJson}'; return 200 ${builtins.toJSON (builtins.toJSON matrixClientJson)};
''; '';
matrixAddr = "::1"; matrixAddr = "::1";
matrixPort = 8008; matrixPort = 8008;

View file

@ -123,6 +123,7 @@ in {
wget wget
kitty.terminfo kitty.terminfo
foot.terminfo
# rxvt-unicode-unwrapped.terminfo # rxvt-unicode-unwrapped.terminfo
]; ];
programs.fish.enable = true; programs.fish.enable = true;
@ -200,6 +201,7 @@ in {
security.polkit.enable = true; security.polkit.enable = true;
security.rtkit.enable = true; security.rtkit.enable = true;
services.dbus.enable = true; services.dbus.enable = true;
programs.dconf.enable = true;
}) })
]; ];

View file

@ -74,6 +74,8 @@ in {
] ++ lib.optionals config.programs.ccache.enable [ ] ++ lib.optionals config.programs.ccache.enable [
{ directory = config.programs.ccache.cacheDir; user = "root"; group = "nixbld"; mode = "0770"; } { directory = config.programs.ccache.cacheDir; user = "root"; group = "nixbld"; mode = "0770"; }
{ directory = /var/cache/sccache; user = "root"; group = "nixbld"; mode = "0770"; } { directory = /var/cache/sccache; user = "root"; group = "nixbld"; mode = "0770"; }
] ++ lib.optionals config.services.certspotter.enable [
{ directory = /var/lib/certspotter; user = "certspotter"; group = "certspotter"; mode = "0755"; }
] ++ lib.optionals (config.services.coop-ofd.enable or false) [ ] ++ lib.optionals (config.services.coop-ofd.enable or false) [
{ directory = /var/lib/private/coop-ofd; mode = "0750"; } { directory = /var/lib/private/coop-ofd; mode = "0750"; }
] ++ lib.optionals config.services.dovecot2.enable [ ] ++ lib.optionals config.services.dovecot2.enable [