Compare commits

..

No commits in common. "99a0e413ae672ac7febb2a9de32f77664ad34005" and "42026bb41a37aed9cdad19c8195c0d9c7be878de" have entirely different histories.

34 changed files with 434 additions and 1059 deletions

View file

@ -102,7 +102,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 = inputs.nixpkgs.lib // import ./lib.nix { inherit (nixpkgs) lib; }; lib = 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 +114,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 (config.flake or nixpkgs) (builtins.removeAttrs config ["flake"] // { mkPkgs = config: import nixpkgs (config // {
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,20 +136,6 @@
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 = [
@ -183,7 +169,6 @@
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 {
@ -209,16 +194,13 @@
# 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 ? {}, ... }:
(args.flake or base-inputs.nixpkgs).lib.nixosSystem { 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 lib; inherit inputs 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, ... }: {
@ -237,21 +219,16 @@
++ 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.extraSpecialArgs = { home-manager.useGlobalPkgs = false;
inputs = inputs // lib.optionalAttrs (args?flake) { home-manager.useUserPackages = false;
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" ]); }

View file

@ -1,43 +0,0 @@
{ 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

@ -24,7 +24,6 @@
}; };
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

@ -64,16 +64,15 @@
}); });
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# utils # utils
gnused mktemp fzf coreutils-full findutils xdg-utils whois curl gnused mktemp fzf coreutils-full findutils xdg-utils gnupg whois curl
file unzip gnutar man file mediainfo unzip gnutar man rclone
# for preview # for preview
# exa - TODO: replace with eza wrapper? # exa - TODO: replace with eza wrapper?
libarchive atool bat libarchive atool glow
# for opening # for opening
p7zip p7zip unrar-wrapper
] ++ lib.optionals (!config.minimal) [ ] ++ lib.optionals (!config.minimal) [
gnupg odt2txt w3m sshfs trash-cli unrar-wrapper odt2txt w3m sshfs trash-cli
mediainfo rclone bat glow
]; ];
plugins = { plugins = {
src = pluginSrc; src = pluginSrc;
@ -118,7 +117,7 @@
lfs.enable = true; lfs.enable = true;
}; };
bat = { bat = {
enable = !config.minimal; enable = true;
}; };
bottom = { bottom = {
enable = true; enable = true;
@ -315,8 +314,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 unzip p7zip unrar-wrapper
] ++ lib.optionals (!config.minimal) [ ] ++ lib.optionals (!config.minimal) [
appimage-run unrar-wrapper appimage-run
]; ];
} }

View file

@ -1,27 +1,28 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ ./terminal.nix ]; imports = [ ./terminal.nix ];
config = lib.mkMerge [ systemd.user.services.fcitx5-daemon = {
(lib.mkIf (!config.minimal) { Unit.After = "graphical-session-pre.target";
xdg.configFile."alsoft.conf".text = '' Service = {
[general] Restart = "on-failure";
hrtf = true RestartSec = 3;
stereo-encoding = hrtf };
drivers = pipewire,pulseaudio,jack,alsa,oss, };
periods = 2 i18n.inputMethod = let fcitx5-qt = pkgs.libsForQt5.fcitx5-qt; in {
hrtf-paths = ${pkgs.openal}/share/openal/hrtf enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-lua fcitx5-gtk fcitx5-mozc fcitx5-configtool fcitx5-qt ];
[decoder] };
hq-mode = true
[pipewire]
rt-mix = true
[pulse]
allow-moves = true
'';
home.sessionVariables = { home.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
SDL_IM_MODULE = "fcitx";
XIM_SERVERS = "fcitx";
INPUT_METHOD = "fcitx";
SUDO_ASKPASS = pkgs.writeScript "sudo-askpass" ''
#! ${pkgs.bash}/bin/bash
${pkgs.libsecret}/bin/secret-tool lookup root password
'';
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";
@ -42,6 +43,26 @@ config = lib.mkMerge [
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" ];
@ -180,69 +201,16 @@ config = lib.mkMerge [
}; };
}; };
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 = lib.mkIf (!config.minimal) { iconTheme = {
package = pkgs.papirus-icon-theme; package = pkgs.papirus-icon-theme;
name = "Papirus-Dark"; name = "Papirus-Dark";
}; };
theme = lib.mkIf (!config.minimal) { theme = {
package = pkgs.breeze-gtk; package = pkgs.breeze-gtk;
name = "Breeze-Dark"; name = "Breeze-Dark";
}; };
@ -266,6 +234,13 @@ config = lib.mkMerge [
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";
@ -277,15 +252,27 @@ config = lib.mkMerge [
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
xdg-utils imagemagick ffmpeg-full 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)
++ lib.optional config.services.kdeconnect.enable kdeconnect; # nyxt qutebrowser
}];
# 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 = if config.wayland.windowManager.sway.enable then pkgs.rofi.override { plugins = config.programs.rofi.plugins; } else pkgs.rofi; rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; };
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)
@ -54,7 +54,7 @@ dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
''; '';
lock-script = pkgs.writeShellScript "lock-start" '' lock-script = pkgs.writeShellScript "lock-start" ''
${swaylock-start} ${swaylock-start}
${lib.optionalString (config.phone.enable && config.phone.suspend) ${lib.optionalString config.phone.enable
# suspend if nothing is playing and no ssh sessions are active # suspend if nothing is playing and no ssh sessions are active
'' ''
if ${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null; then if ${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null; then
@ -118,29 +118,25 @@ 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.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 ${pkgs.procps}/bin/pkill -x nextcloud
${pkgs.procps}/bin/pkill -x nextcloud ${pkgs.nextcloud-client}/bin/nextcloud --background&
${pkgs.nextcloud-client}/bin/nextcloud --background& ${pkgs.procps}/bin/pkill -x nheko
${pkgs.procps}/bin/pkill -x nheko ${pkgs.nheko}/bin/nheko&
${pkgs.nheko}/bin/nheko& ${pkgs.procps}/bin/pkill -x telegram-desktop
${pkgs.procps}/bin/pkill -x telegram-desktop ${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 = {
@ -200,7 +196,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 = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute"; XF86AudioMicMute = "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%+";
} }
@ -215,11 +211,13 @@ genKeybindings = (default_options: kb:
.imports) .imports)
.options.keybindings.default) .options.keybindings.default)
); );
in { in
# TODO merge with colors in gui.nix and terminal.nix {
imports = [ ./options.nix ./gui.nix ./waybar.nix ]; # TODO merge with colors in gui.nix and terminal.nix
config = lib.mkMerge [ imports = [ ./options.nix ./gui.nix ./waybar.nix ];
(lib.mkIf (!config.minimal) { home.sessionVariables = {
_JAVA_AWT_WM_NONREPARENTING = "1";
};
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;
@ -232,11 +230,6 @@ config = lib.mkMerge [
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;
package = pkgs.mako.overrideAttrs (old: { package = pkgs.mako.overrideAttrs (old: {
@ -255,19 +248,18 @@ config = lib.mkMerge [
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 = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5"; XF86AudioRaiseVolume = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
XF86AudioLowerVolume = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; XF86AudioLowerVolume = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
XF86AudioMute = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute"; XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
XF86AudioPlay = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause"; XF86AudioPlay = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
XF86AudioNext = lib.mkIf (!config.minimal) "exec ${audioNext}"; XF86AudioNext = "exec ${audioNext}";
XF86AudioPrev = lib.mkIf (!config.minimal) "exec ${audioPrev}"; XF86AudioPrev = "exec ${audioPrev}";
}; };
terminal = config.terminalBinX; terminal = config.terminalBinX;
}; in commonConfig // i3Config; }; in commonConfig // i3Config;
@ -405,17 +397,17 @@ config = lib.mkMerge [
# 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" = lib.mkIf (!config.minimal) "exec ${pkgs.mumble}/bin/mumble rpc starttalking"; "--inhibited --no-repeat --allow-other Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc starttalking";
"--inhibited --no-repeat --allow-other --release Scroll_Lock" = lib.mkIf (!config.minimal) "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}+${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" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5"; "--locked XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
"--locked XF86AudioLowerVolume" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5"; "--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
"--locked XF86AudioMute" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute"; "--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
"--locked --inhibited XF86AudioPlay" = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "--locked --inhibited XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"--locked --inhibited XF86AudioNext" = lib.mkIf (!config.minimal) "exec ${audioNext}"; "--locked --inhibited XF86AudioNext" = "exec ${audioNext}";
"--locked --inhibited XF86AudioPrev" = lib.mkIf (!config.minimal) "exec ${audioPrev}"; "--locked --inhibited XF86AudioPrev" = "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}
@ -478,10 +470,10 @@ config = lib.mkMerge [
# after-resume, lock, unlock # after-resume, lock, unlock
]; ];
timeouts = [ timeouts = [
{ timeout = if config.phone.enable && !config.minimal then 30 else 300; { timeout = if config.phone.enable 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 && !config.minimal then 60 else 600; { timeout = if config.phone.enable then 60 else 600;
command = toString lock-script; } command = toString lock-script; }
]; ];
}; };
@ -525,7 +517,12 @@ config = lib.mkMerge [
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; [ wl-clipboard ]); home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [
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";
@ -593,5 +590,4 @@ config = lib.mkMerge [
steal-focus = true; steal-focus = true;
}; };
}; };
}];
} }

View file

@ -81,7 +81,6 @@
nodePackages_latest.vscode-langservers-extracted nodePackages_latest.vscode-langservers-extracted
nil nil
marksman marksman
nixfmt-rfc-style
taplo taplo
ripgrep ripgrep
(python3.withPackages (p: with p; [ (python3.withPackages (p: with p; [
@ -438,9 +437,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.pylsp = { settings = {
plugins.pylsp_mypy.enabled = true; pylsp.plugins.pylsp_mypy.enabled = true;
plugins.black.enabled = true; pylsp.plugins.black.enabled = true;
}; };
}; };
svelte = { }; svelte = { };
@ -448,11 +447,7 @@
cssls = { }; cssls = { };
tsserver = { }; tsserver = { };
jsonls = { }; jsonls = { };
nil_ls = { nil_ls = { };
settings.nil = {
formatting.command = ["nixfmt"];
};
};
taplo = { }; taplo = { };
marksman = { }; marksman = { };
rust_analyzer = { rust_analyzer = {

View file

@ -10,10 +10,6 @@ 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} or (throw "Terminal not found"); }.${term};
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,22 +198,21 @@ in {
enabled_layouts = "all"; enabled_layouts = "all";
}; };
}; };
xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf" = xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf".text =
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>
<match target="scan"> <match target="scan">
<test name="family"> <test name="family">
<string>Noto Sans Mono</string> <string>Noto Sans Mono</string>
</test> </test>
<edit name="spacing"> <edit name="spacing">
<int>90</int> <int>90</int>
</edit> </edit>
</match> </match>
</fontconfig> </fontconfig>
''; '';
};
} }

View file

@ -1,102 +0,0 @@
#!/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"]
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', drv)
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(drv, 'output', ret)
cmds = []
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

@ -116,7 +116,4 @@ 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

@ -6,9 +6,7 @@
./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

@ -1,13 +0,0 @@
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

@ -1,14 +1,14 @@
{ pkgs, ... }: { pkgs, pkgs', ... }:
let let
unpatchedNixForNixPlugins = pkgs.nixVersions.nix_2_18; nixForNixPlugins = 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 unpatchedNixForNixPlugins nixForNixPlugins; inherit 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,6 +20,17 @@ 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: {
@ -31,4 +42,5 @@ in {
hash = "sha256-vXTuE83GL15mgZHegbllVAsVdDFcWWSayPfZxTJN5ys="; hash = "sha256-vXTuE83GL15mgZHegbllVAsVdDFcWWSayPfZxTJN5ys=";
}; };
}); });
nurl = pkgs.nurl.override { nix = nixForNixPlugins; };
} }

View file

@ -1,13 +0,0 @@
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

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

Binary file not shown.

View file

@ -1,149 +0,0 @@
{ 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
'';
ereader.epdc-firmware = ./kobo-clara-epdc.fw;
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,5 +1,6 @@
# device-specific non-portable config # device-specific non-portable config
{ ... { pkgs
, ...
}: }:
let let
@ -34,6 +35,7 @@ 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

@ -30,12 +30,6 @@ 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" ];
};
}; };
fileSystems = let fileSystems = let

View file

@ -39,11 +39,6 @@ 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

@ -1,12 +0,0 @@
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

@ -1,78 +0,0 @@
{ 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

@ -1,50 +0,0 @@
{ 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

@ -19,6 +19,13 @@ 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 [
@ -48,11 +55,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/wireplumber.conf.d" chmod +w "$out" "$out/main.lua.d"
ln -s ${pkgs.fetchurl { ln -s ${pkgs.fetchurl {
url = "https://gitlab.com/postmarketOS/pmaports/-/raw/a82d8636562805d71e16e93f7571cc1f6ddbeb45/device/community/soc-qcom-sdm845/51-qcom-sdm845.conf"; url = "https://gitlab.com/postmarketOS/pmaports/-/raw/0aa9524204e9c9c002c860b87c972bc2ebf025f3/device/community/soc-qcom-sdm845/51-qcom-sdm845.lua";
hash = "sha256-EM2I9hwTYnK5FepB4RBI5t8sIFQ/uqN5AuTwGepzjB0="; hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk=";
}} "$out/wireplumber.conf.d/51-qcom-sdm845.conf" }} "$out/main.lua.d/51-qcom-sdm845.lua"
''; '';
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,7 +78,6 @@ in
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux); 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;
@ -104,7 +110,82 @@ 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" ];

View file

@ -7,10 +7,142 @@
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;
mkLinux = { linux, kernelPatches, structuredExtraConfig }: linux.override { 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 = pkgs.linux_testing.override {
# TODO: uncomment # TODO: uncomment
# ignoreConfigErrors = false; # ignoreConfigErrors = false;
inherit kernelPatches; 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 = "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;
patch = ./config_fixes_611.patch;
}
];
stdenv = lib.recursiveUpdate pkgs.stdenv { stdenv = lib.recursiveUpdate pkgs.stdenv {
hostPlatform.linux-kernel.extraConfig = ""; hostPlatform.linux-kernel.extraConfig = "";
@ -20,6 +152,8 @@ let
# fix build # fix build
LENOVO_YOGA_C630_EC = no; LENOVO_YOGA_C630_EC = no;
RPMSG_QCOM_GLINK_SMEM = yes; RPMSG_QCOM_GLINK_SMEM = yes;
TOUCHSCREEN_STM_FTS_DOWNSTREAM = no;
TOUCHSCREEN_FTM4 = 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;
@ -494,148 +628,7 @@ let
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

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

View file

@ -1,58 +0,0 @@
{ 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

@ -40,7 +40,7 @@
"vm.swappiness" = 40; "vm.swappiness" = 40;
}; };
# TODO: switch back to latest # TODO: switch back to latest
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/ /*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
}; };

View file

@ -40,8 +40,6 @@
}); });
''; '';
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;

View file

@ -106,7 +106,6 @@ 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 = [
@ -168,7 +167,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" "i686-linux" ]; systems = [ "x86_64-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";
@ -182,7 +181,6 @@ 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";
@ -365,8 +363,6 @@ 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;

View file

@ -1,50 +0,0 @@
{ 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,15 +17,6 @@ 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";
@ -67,11 +58,31 @@ 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") [
@ -110,7 +121,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
@ -124,14 +135,11 @@ 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;
}
(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 = [ "--skip-login" ]; services.getty.extraArgs = lib.mkIf cfg.gettyAutologin [ "--skip-login" ];
services.getty.loginProgram = let services.getty.loginProgram = lib.mkIf cfg.gettyAutologin (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
@ -140,8 +148,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 = ''
@ -161,7 +169,7 @@ 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 = mkForceDefault pkgs.fish; users.defaultUserShell = lib.mkIf cfg.minimal (mkForceDefault pkgs.fish);
programs.vim = { programs.vim = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
@ -183,22 +191,9 @@ in {
}) })
(lib.mkIf (!cfg.minimal) { (lib.mkIf (!cfg.minimal) {
# registry is used for the new flaky nix command environment.systemPackages = with pkgs; [
nix.registry = unixtools.xxd
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" ];
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
services.pipewire = { services.pipewire = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
@ -211,20 +206,7 @@ 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

@ -1,52 +0,0 @@
{ 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;
};
}