parent
bc5a1cd0d5
commit
99a0e413ae
49
flake.nix
49
flake.nix
|
@ -102,7 +102,7 @@
|
|||
# Private home-manager config for hostname and username
|
||||
getPrivUser = hostname: user: (getPriv hostname).${user} or { };
|
||||
# extended lib
|
||||
lib = nixpkgs.lib // import ./lib.nix { inherit (nixpkgs) lib; };
|
||||
lib = inputs.nixpkgs.lib // import ./lib.nix { inherit (nixpkgs) lib; };
|
||||
# can't use callPackage ./pkgs here, idk why; use import instead
|
||||
overlay' = args: self: super: import (if args.pluginsOverlay or false then ./pkgs/nix-plugins-overlay.nix else ./pkgs) ({
|
||||
pkgs = super;
|
||||
|
@ -114,8 +114,8 @@
|
|||
nix-plugins-overlay = overlay' { pluginsOverlay = true; };
|
||||
all-overlays = [ nix-plugins-overlay overlay ];
|
||||
# I override some settings down the line, but overlays always stay the same
|
||||
mkPkgs = config: import nixpkgs (config // {
|
||||
overlays = config.overlays or [ ] ++ all-overlays;
|
||||
mkPkgs = config: import (config.flake or nixpkgs) (builtins.removeAttrs config ["flake"] // {
|
||||
overlays = config.overlays or ([ ] ++ all-overlays);
|
||||
});
|
||||
# this is actual config, it gets processed below
|
||||
config = let
|
||||
|
@ -136,6 +136,20 @@
|
|||
in {
|
||||
router-emmc = mkBpiR3 "emmc" 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 = {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
|
@ -169,6 +183,7 @@
|
|||
packages = lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"armv7l-linux"
|
||||
] (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 {
|
||||
emmcImage = pkgs.callPackage ./system/hardware/bpi-r3/image.nix {
|
||||
|
@ -194,13 +209,16 @@
|
|||
|
||||
# this is the system config processing part
|
||||
nixosConfigurations = lib.flip builtins.mapAttrs config (hostname: args @ { modules, nixpkgs ? {}, home ? {}, ... }:
|
||||
lib.nixosSystem {
|
||||
(args.flake or base-inputs.nixpkgs).lib.nixosSystem {
|
||||
inherit (args) system;
|
||||
# allow modules to access nixpkgs directly, use customized lib,
|
||||
# and pass nixos-harware to let hardware modules import parts of nixos-hardware
|
||||
specialArgs = {
|
||||
inherit inputs lib;
|
||||
inherit lib;
|
||||
hardware = inputs.nixos-hardware.nixosModules;
|
||||
inputs = inputs // lib.optionalAttrs (args?flake) {
|
||||
nixpkgs = args.flake;
|
||||
};
|
||||
} // args.specialArgs or { };
|
||||
modules = [
|
||||
({ config, ... }: {
|
||||
|
@ -219,16 +237,21 @@
|
|||
++ lib.optionals (home != { } && home.common.enableNixosModule or false) [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{ home-manager = builtins.removeAttrs (home.common or { }) [ "nixpkgs" "nix" "enableNixosModule" ]; }
|
||||
{ # set both to false to match behavior with standalone home-manager
|
||||
home-manager.useGlobalPkgs = false;
|
||||
home-manager.useUserPackages = false;
|
||||
{
|
||||
home-manager.extraSpecialArgs = {
|
||||
inputs = inputs // lib.optionalAttrs (args?flake) {
|
||||
nixpkgs = args.flake;
|
||||
};
|
||||
};
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users = builtins.mapAttrs (username: modules: {
|
||||
imports = modules ++ [
|
||||
{ nixpkgs = home.common.nixpkgs or { };
|
||||
nix = home.common.nix or { }; }
|
||||
({ config, pkgs, lib, ...}: {
|
||||
nixpkgs.overlays = all-overlays;
|
||||
nix.package = lib.mkDefault pkgs.nixForNixPlugins; })
|
||||
# { nixpkgs = home.common.nixpkgs or { };
|
||||
# nix = home.common.nix or { }; }
|
||||
# ({ config, pkgs, lib, ...}: {
|
||||
# nixpkgs.overlays = all-overlays;
|
||||
# nix.package = lib.mkDefault pkgs.nixForNixPlugins; })
|
||||
(getPrivUser hostname username)
|
||||
];
|
||||
}) (builtins.removeAttrs home [ "common" ]); }
|
||||
|
|
43
home/hosts/ereader.nix
Normal file
43
home/hosts/ereader.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ pkgs
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../modules/general.nix
|
||||
../modules/i3-sway.nix
|
||||
inputs.nur.nixosModules.nur
|
||||
];
|
||||
|
||||
nix.settings = {
|
||||
trusted-public-keys = [
|
||||
"binarycache.pavluk.org:Vk0ms/vSqoOV2JXeNVOroc8EfilgVxCCUtpCShGIKsQ="
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
];
|
||||
trusted-substituters = [
|
||||
"https://binarycache.pavluk.org"
|
||||
"https://cache.nixos.org"
|
||||
];
|
||||
};
|
||||
|
||||
phone.enable = true;
|
||||
minimal = true;
|
||||
home.stateVersion = "23.11";
|
||||
home.username = "user";
|
||||
home.homeDirectory = "/home/user";
|
||||
terminals = [ "foot" ];
|
||||
wayland.windowManager.sway.enable = true;
|
||||
# terminals = [ "kitty" ];
|
||||
# xsession.windowManager.i3.enable = true;
|
||||
|
||||
# services.kdeconnect.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
# TODO fix
|
||||
koreader
|
||||
(calibre.override {
|
||||
speechSupport = false;
|
||||
})
|
||||
wvkbd
|
||||
];
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
};
|
||||
|
||||
phone.enable = true;
|
||||
phone.suspend = false;
|
||||
home.stateVersion = "23.11";
|
||||
home.username = "user";
|
||||
home.homeDirectory = "/home/user";
|
||||
|
|
|
@ -64,15 +64,16 @@
|
|||
});
|
||||
extraPackages = with pkgs; [
|
||||
# utils
|
||||
gnused mktemp fzf coreutils-full findutils xdg-utils gnupg whois curl
|
||||
file mediainfo unzip gnutar man rclone
|
||||
gnused mktemp fzf coreutils-full findutils xdg-utils whois curl
|
||||
file unzip gnutar man
|
||||
# for preview
|
||||
# exa - TODO: replace with eza wrapper?
|
||||
bat libarchive atool glow
|
||||
libarchive atool
|
||||
# for opening
|
||||
p7zip unrar-wrapper
|
||||
p7zip
|
||||
] ++ lib.optionals (!config.minimal) [
|
||||
odt2txt w3m sshfs trash-cli
|
||||
gnupg odt2txt w3m sshfs trash-cli unrar-wrapper
|
||||
mediainfo rclone bat glow
|
||||
];
|
||||
plugins = {
|
||||
src = pluginSrc;
|
||||
|
@ -117,7 +118,7 @@
|
|||
lfs.enable = true;
|
||||
};
|
||||
bat = {
|
||||
enable = true;
|
||||
enable = !config.minimal;
|
||||
};
|
||||
bottom = {
|
||||
enable = true;
|
||||
|
@ -314,8 +315,8 @@
|
|||
rclone sshfs fuse
|
||||
file jq python3Full killall
|
||||
comma nix-output-monitor
|
||||
unzip p7zip unrar-wrapper
|
||||
unzip p7zip
|
||||
] ++ lib.optionals (!config.minimal) [
|
||||
appimage-run
|
||||
appimage-run unrar-wrapper
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./terminal.nix ];
|
||||
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 ];
|
||||
};
|
||||
imports = [ ./terminal.nix ];
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (!config.minimal) {
|
||||
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
|
||||
'';
|
||||
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 3
|
||||
SDL_AUDIO_DRIVER = "pipewire,pulseaudio,dsound";
|
||||
|
@ -43,26 +42,6 @@
|
|||
ffmpeg ffmpegthumbnailer nsxiv imagemagick
|
||||
zathura /*libreoffice*/ fontpreview djvulibre poppler_utils
|
||||
] ++ 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 = {
|
||||
enable = true;
|
||||
defaultProfiles = [ "gpu-hq" ];
|
||||
|
@ -201,16 +180,69 @@
|
|||
};
|
||||
};
|
||||
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;
|
||||
gtk = {
|
||||
enable = true;
|
||||
font.name = "Noto Sans";
|
||||
font.size = 10;
|
||||
iconTheme = {
|
||||
iconTheme = lib.mkIf (!config.minimal) {
|
||||
package = pkgs.papirus-icon-theme;
|
||||
name = "Papirus-Dark";
|
||||
};
|
||||
theme = {
|
||||
theme = lib.mkIf (!config.minimal) {
|
||||
package = pkgs.breeze-gtk;
|
||||
name = "Breeze-Dark";
|
||||
};
|
||||
|
@ -234,13 +266,6 @@
|
|||
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";
|
||||
|
@ -252,27 +277,15 @@
|
|||
home.pointerCursor.gtk.enable = true;
|
||||
home.pointerCursor.package = pkgs.vanilla-dmz;
|
||||
home.pointerCursor.name = "Vanilla-DMZ";
|
||||
programs.yt-dlp.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
# wayland
|
||||
grim slurp
|
||||
# gui compat stuff
|
||||
qt5ct qgnomeplatform
|
||||
# various programs i use
|
||||
keepassxc nheko qbittorrent mumble
|
||||
nextcloud-client kdeconnect
|
||||
# cli tools
|
||||
imagemagick ffmpeg-full xdg-utils
|
||||
xdg-utils
|
||||
# fonts
|
||||
noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif
|
||||
noto-fonts-emoji noto-fonts-extra
|
||||
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
|
||||
# might check out some day (tm)
|
||||
# nyxt qutebrowser
|
||||
|
||||
# for working with nix
|
||||
nix-init
|
||||
nvfetcher
|
||||
config.nur.repos.rycee.mozilla-addons-to-nix
|
||||
];
|
||||
]
|
||||
++ lib.optional config.services.kdeconnect.enable kdeconnect;
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
let
|
||||
modifier = if config.phone.enable then "Mod1" else "Mod4";
|
||||
rofiSway = config.programs.rofi.finalPackage;
|
||||
rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; };
|
||||
rofiI3 = if config.wayland.windowManager.sway.enable then pkgs.rofi.override { plugins = config.programs.rofi.plugins; } else pkgs.rofi;
|
||||
audioNext = pkgs.writeShellScript "playerctl-next" ''
|
||||
${pkgs.playerctl}/bin/playerctl next
|
||||
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" ''
|
||||
${swaylock-start}
|
||||
${lib.optionalString config.phone.enable
|
||||
${lib.optionalString (config.phone.enable && config.phone.suspend)
|
||||
# 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
|
||||
|
@ -118,25 +118,29 @@ commonConfig = {
|
|||
${lib.optionalString config.phone.enable ''
|
||||
${pkgs.procps}/bin/pkill -x wvkbd-mobintl
|
||||
${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji&
|
||||
${pkgs.procps}/bin/pkill -x squeekboard
|
||||
${pkgs.squeekboard}/bin/squeekboard&
|
||||
${lib.optionalString (!config.minimal) ''
|
||||
${pkgs.procps}/bin/pkill -x 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
|
||||
''}
|
||||
${pkgs.procps}/bin/pkill -x home-daemon
|
||||
${pkgs.home-daemon}/bin/home-daemon system76-scheduler ${lib.optionalString (!config.phone.enable) "empty-sound"}&
|
||||
${pkgs.procps}/bin/pkill -x keepassxc
|
||||
${pkgs.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/var/local.kdbx &)
|
||||
# sleep to give keepassxc time to take the input
|
||||
sleep 1
|
||||
# nextcloud and nheko need secret service access
|
||||
${pkgs.procps}/bin/pkill -x nextcloud
|
||||
${pkgs.nextcloud-client}/bin/nextcloud --background&
|
||||
${pkgs.procps}/bin/pkill -x nheko
|
||||
${pkgs.nheko}/bin/nheko&
|
||||
${pkgs.procps}/bin/pkill -x telegram-desktop
|
||||
${pkgs.tdesktop}/bin/telegram-desktop -startintray&
|
||||
# and final sleep just in case
|
||||
sleep 1
|
||||
${lib.optionalString (!config.minimal) ''
|
||||
${pkgs.procps}/bin/pkill -x keepassxc
|
||||
${pkgs.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/var/local.kdbx &)
|
||||
# sleep to give keepassxc time to take the input
|
||||
sleep 1
|
||||
# nextcloud and nheko need secret service access
|
||||
${pkgs.procps}/bin/pkill -x nextcloud
|
||||
${pkgs.nextcloud-client}/bin/nextcloud --background&
|
||||
${pkgs.procps}/bin/pkill -x nheko
|
||||
${pkgs.nheko}/bin/nheko&
|
||||
${pkgs.procps}/bin/pkill -x telegram-desktop
|
||||
${pkgs.tdesktop}/bin/telegram-desktop -startintray&
|
||||
# and final sleep just in case
|
||||
sleep 1
|
||||
''}
|
||||
''); }
|
||||
];
|
||||
colors = {
|
||||
|
@ -196,7 +200,7 @@ genKeybindings = (default_options: kb:
|
|||
kb // {
|
||||
"${modifier}+Shift+g" = "floating toggle";
|
||||
"${modifier}+g" = "focus mode_toggle";
|
||||
XF86AudioMicMute = "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute";
|
||||
XF86AudioMicMute = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute";
|
||||
XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
|
||||
}
|
||||
|
@ -211,13 +215,11 @@ genKeybindings = (default_options: kb:
|
|||
.imports)
|
||||
.options.keybindings.default)
|
||||
);
|
||||
in
|
||||
{
|
||||
# TODO merge with colors in gui.nix and terminal.nix
|
||||
imports = [ ./options.nix ./gui.nix ./waybar.nix ];
|
||||
home.sessionVariables = {
|
||||
_JAVA_AWT_WM_NONREPARENTING = "1";
|
||||
};
|
||||
in {
|
||||
# TODO merge with colors in gui.nix and terminal.nix
|
||||
imports = [ ./options.nix ./gui.nix ./waybar.nix ];
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (!config.minimal) {
|
||||
xdg.configFile."xdg-desktop-portal-wlr/config".source = (pkgs.formats.ini {}).generate "xdg-desktop-portal-wlr.ini" {
|
||||
screencast = {
|
||||
max_fps = 60;
|
||||
|
@ -230,6 +232,11 @@ in
|
|||
systemd.user.services = lib.mkIf config.wayland.windowManager.sway.enable {
|
||||
gammastep.Unit.ConditionEnvironment = "WAYLAND_DISPLAY";
|
||||
};
|
||||
})
|
||||
{
|
||||
home.sessionVariables = {
|
||||
_JAVA_AWT_WM_NONREPARENTING = "1";
|
||||
};
|
||||
services.mako = {
|
||||
enable = lib.mkDefault config.wayland.windowManager.sway.enable;
|
||||
package = pkgs.mako.overrideAttrs (old: {
|
||||
|
@ -248,18 +255,19 @@ in
|
|||
config = let i3Config = {
|
||||
bars = [
|
||||
(barConfig // {
|
||||
mode = "dock";
|
||||
statusCommand = "${pkgs.i3status}/bin/i3status";
|
||||
})
|
||||
];
|
||||
menu = "${rofiI3}/bin/rofi -show drun";
|
||||
keybindings = genKeybindings options.xsession.windowManager.i3 {
|
||||
"${modifier}+c" = "exec ${rofiI3}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history";
|
||||
XF86AudioRaiseVolume = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
||||
XF86AudioLowerVolume = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
||||
XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
||||
XF86AudioPlay = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
XF86AudioNext = "exec ${audioNext}";
|
||||
XF86AudioPrev = "exec ${audioPrev}";
|
||||
XF86AudioRaiseVolume = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
||||
XF86AudioLowerVolume = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
||||
XF86AudioMute = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
||||
XF86AudioPlay = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
XF86AudioNext = lib.mkIf (!config.minimal) "exec ${audioNext}";
|
||||
XF86AudioPrev = lib.mkIf (!config.minimal) "exec ${audioPrev}";
|
||||
};
|
||||
terminal = config.terminalBinX;
|
||||
}; in commonConfig // i3Config;
|
||||
|
@ -397,17 +405,17 @@ in
|
|||
# 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")
|
||||
//*/ {
|
||||
"--inhibited --no-repeat --allow-other Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc starttalking";
|
||||
"--inhibited --no-repeat --allow-other --release Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc stoptalking";
|
||||
"--inhibited --no-repeat --allow-other Scroll_Lock" = lib.mkIf (!config.minimal) "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";
|
||||
"${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}+${if modifier == "Mod1" then "Mod4" else "Mod1"}+Print" = "exec ${grimshot}/bin/grimshot copy window";
|
||||
"--locked XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
||||
"--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
||||
"--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
||||
"--locked --inhibited XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
"--locked --inhibited XF86AudioNext" = "exec ${audioNext}";
|
||||
"--locked --inhibited XF86AudioPrev" = "exec ${audioPrev}";
|
||||
"--locked XF86AudioRaiseVolume" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
||||
"--locked XF86AudioLowerVolume" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
||||
"--locked XF86AudioMute" = lib.mkIf (!config.minimal) "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
||||
"--locked --inhibited XF86AudioPlay" = lib.mkIf (!config.minimal) "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
"--locked --inhibited XF86AudioNext" = lib.mkIf (!config.minimal) "exec ${audioNext}";
|
||||
"--locked --inhibited XF86AudioPrev" = lib.mkIf (!config.minimal) "exec ${audioPrev}";
|
||||
"--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
|
||||
${dpms-off}
|
||||
|
@ -470,10 +478,10 @@ in
|
|||
# after-resume, lock, unlock
|
||||
];
|
||||
timeouts = [
|
||||
{ timeout = if config.phone.enable then 30 else 300;
|
||||
{ timeout = if config.phone.enable && !config.minimal then 30 else 300;
|
||||
command = toString dpms-off;
|
||||
resumeCommand = toString dpms-on; }
|
||||
{ timeout = if config.phone.enable then 60 else 600;
|
||||
{ timeout = if config.phone.enable && !config.minimal then 60 else 600;
|
||||
command = toString lock-script; }
|
||||
];
|
||||
};
|
||||
|
@ -517,12 +525,7 @@ in
|
|||
text-wrong-color = text-color;
|
||||
ring-wrong-color = "#e64e4e"; # deep-ish red
|
||||
};
|
||||
home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [
|
||||
wl-clipboard
|
||||
xdg-desktop-portal
|
||||
# xdg-desktop-portal-wlr
|
||||
xdg-desktop-portal-gtk
|
||||
]);
|
||||
home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [ wl-clipboard ]);
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
font = "Noto Sans Mono 16";
|
||||
|
@ -590,4 +593,5 @@ in
|
|||
steal-focus = true;
|
||||
};
|
||||
};
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
nodePackages_latest.vscode-langservers-extracted
|
||||
nil
|
||||
marksman
|
||||
nixfmt-rfc-style
|
||||
taplo
|
||||
ripgrep
|
||||
(python3.withPackages (p: with p; [
|
||||
|
@ -437,9 +438,9 @@
|
|||
clangd = { };
|
||||
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp.plugins.pylsp_mypy.enabled = true;
|
||||
pylsp.plugins.black.enabled = true;
|
||||
settings.pylsp = {
|
||||
plugins.pylsp_mypy.enabled = true;
|
||||
plugins.black.enabled = true;
|
||||
};
|
||||
};
|
||||
svelte = { };
|
||||
|
@ -447,7 +448,11 @@
|
|||
cssls = { };
|
||||
tsserver = { };
|
||||
jsonls = { };
|
||||
nil_ls = { };
|
||||
nil_ls = {
|
||||
settings.nil = {
|
||||
formatting.command = ["nixfmt"];
|
||||
};
|
||||
};
|
||||
taplo = { };
|
||||
marksman = { };
|
||||
rust_analyzer = {
|
||||
|
|
|
@ -10,6 +10,10 @@ with lib; {
|
|||
default = false;
|
||||
description = "whether this is a phone";
|
||||
};
|
||||
suspend = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
options.rustAnalyzerAndroidSettings = mkOption {
|
||||
type = with types; attrs;
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
foot = "${pkgs.foot}/bin/footclient";
|
||||
kitty = "${pkgs.kitty}/bin/kitty";
|
||||
urxvt = "${pkgs.rxvt-unicode-emoji}/bin/urxvt";
|
||||
}.${term};
|
||||
}.${term} or (throw "Terminal not found");
|
||||
color = builtins.elemAt config.colors.base;
|
||||
hex = x: if builtins.isFunction x then (y: "#" + (x y)) else ("#" + x);
|
||||
shell = lib.mkIf config.termShell.enable (lib.mkDefault config.termShell.path);
|
||||
|
@ -198,21 +198,22 @@ in {
|
|||
enabled_layouts = "all";
|
||||
};
|
||||
};
|
||||
xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf".text =
|
||||
xdg.configFile."fontconfig/conf.d/10-kitty-fonts.conf" =
|
||||
lib.mkIf
|
||||
(supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono")
|
||||
''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<match target="scan">
|
||||
<test name="family">
|
||||
<string>Noto Sans Mono</string>
|
||||
</test>
|
||||
<edit name="spacing">
|
||||
<int>90</int>
|
||||
</edit>
|
||||
</match>
|
||||
</fontconfig>
|
||||
'';
|
||||
(supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono") {
|
||||
text = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<match target="scan">
|
||||
<test name="family">
|
||||
<string>Noto Sans Mono</string>
|
||||
</test>
|
||||
<edit name="spacing">
|
||||
<int>90</int>
|
||||
</edit>
|
||||
</match>
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
102
nixos-rebuild.py
Executable file
102
nixos-rebuild.py
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/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)
|
|
@ -116,4 +116,7 @@ in
|
|||
# hardware stuff
|
||||
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.kobo-clara = import ../system/hardware/kobo-clara/pkgs.nix { inherit pkgs pkgs' lib sources; };
|
||||
# wlroots = throw "a";
|
||||
# sway-unwrapped = throw "a";
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
./fix-painting-api-crashes.patch
|
||||
./painting-api-options.patch
|
||||
./painting-api-pressure.patch
|
||||
./line-painting-api-qpointf.patch
|
||||
]; });
|
||||
}).overrideAttrs (old: {
|
||||
patched = true;
|
||||
buildInputs = old.buildInputs ++ [ python3Packages.requests ];
|
||||
})
|
||||
|
|
13
pkgs/krita/line-painting-api-qpointf.patch
Normal file
13
pkgs/krita/line-painting-api-qpointf.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||
index 986cc54169..04499fa38f 100644
|
||||
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||
@@ -82,7 +82,7 @@ public Q_SLOTS:
|
||||
int index() const;
|
||||
QUuid uniqueId() const;
|
||||
|
||||
- void paintLine(const QPoint pointOne, const QPoint pointTwo, double pressureOne = 1.0, double pressureTwo = 1.0, const QString strokeStyle = "ForegroundColor");
|
||||
+ void paintLine(const QPointF pointOne, const QPointF pointTwo, double pressureOne = 1.0, double pressureTwo = 1.0, const QString strokeStyle = "ForegroundColor");
|
||||
void paintRectangle(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||
void paintPolygon(const QList<QPointF> points, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||
void paintEllipse(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
|
@ -1,14 +1,14 @@
|
|||
{ pkgs, pkgs', ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
nixForNixPlugins = pkgs.nixVersions.nix_2_18;
|
||||
unpatchedNixForNixPlugins = pkgs.nixVersions.nix_2_18;
|
||||
nixForNixPlugins = unpatchedNixForNixPlugins.overrideAttrs (old: {
|
||||
patches = (old.patches or [ ]) ++ [ ./rename-nix-plugin-files.patch ];
|
||||
# some tests fail on bcachefs due to insufficient permissions
|
||||
doInstallCheck = false;
|
||||
});
|
||||
in {
|
||||
inherit nixForNixPlugins;
|
||||
nix = nixForNixPlugins;
|
||||
nixVersions = pkgs.nixVersions // {
|
||||
stable = nixForNixPlugins;
|
||||
unstable = nixForNixPlugins;
|
||||
};
|
||||
inherit unpatchedNixForNixPlugins nixForNixPlugins;
|
||||
# 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: {
|
||||
version = "13.0.0";
|
||||
|
@ -20,17 +20,6 @@ in {
|
|||
})
|
||||
];
|
||||
});*/
|
||||
harmonia = (pkgs.harmonia.override { nixVersions.nix_2_21 = nixForNixPlugins; }).overrideAttrs (old: rec {
|
||||
version = "0.7.3";
|
||||
src = old.src.override {
|
||||
rev = "refs/tags/${old.pname}-v${version}";
|
||||
hash = "sha256-XtnK54HvZMKZGSCrVD0FO5PQLMo3Vkj8ezUlsfqStq0=";
|
||||
};
|
||||
cargoDeps = pkgs'.rustPlatform.importCargoLock { lockFile = "${src}/Cargo.lock"; };
|
||||
});
|
||||
nix-init = pkgs.nix-init.override { nix = nixForNixPlugins; };
|
||||
nix-serve = pkgs.nix-serve.override { nix = nixForNixPlugins; };
|
||||
nix-serve-ng = pkgs.nix-serve-ng.override { nix = nixForNixPlugins; };
|
||||
hydra_unstable = (pkgs.hydra_unstable.override {
|
||||
nix = nixForNixPlugins;
|
||||
}).overrideAttrs (old: {
|
||||
|
@ -42,5 +31,4 @@ in {
|
|||
hash = "sha256-vXTuE83GL15mgZHegbllVAsVdDFcWWSayPfZxTJN5ys=";
|
||||
};
|
||||
});
|
||||
nurl = pkgs.nurl.override { nix = nixForNixPlugins; };
|
||||
}
|
||||
|
|
13
pkgs/rename-nix-plugin-files.patch
Normal file
13
pkgs/rename-nix-plugin-files.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
|
||||
index dba7d78ef..f102f08f9 100644
|
||||
--- a/src/libstore/globals.hh
|
||||
+++ b/src/libstore/globals.hh
|
||||
@@ -959,7 +959,7 @@ public:
|
||||
"Number of seconds between checking free disk space."};
|
||||
|
||||
PluginFilesSetting pluginFiles{
|
||||
- this, {}, "plugin-files",
|
||||
+ this, {}, "plugin-files-2",
|
||||
R"(
|
||||
A list of plugin files to be loaded by Nix. Each of these files will
|
||||
be dlopened by Nix, allowing them to affect execution through static
|
|
@ -29,6 +29,7 @@ stdenv.mkDerivation {
|
|||
ninja
|
||||
pkg-config
|
||||
scdoc
|
||||
wayland
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
@ -36,8 +37,8 @@ stdenv.mkDerivation {
|
|||
gdk-pixbuf
|
||||
libsodium
|
||||
libxkbcommon
|
||||
wayland
|
||||
wayland-protocols
|
||||
wayland
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
|
|
BIN
system/devices/kobo-clara-epdc.fw
Normal file
BIN
system/devices/kobo-clara-epdc.fw
Normal file
Binary file not shown.
149
system/devices/kobo-clara-hd-ereader.nix
Normal file
149
system/devices/kobo-clara-hd-ereader.nix
Normal file
|
@ -0,0 +1,149 @@
|
|||
{ 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"; }
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
# device-specific non-portable config
|
||||
{ pkgs
|
||||
, ...
|
||||
{ ...
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -35,7 +34,6 @@ in
|
|||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_testing;
|
||||
boot.kernelParams = [ "boot.shell_on_fail" ];
|
||||
|
||||
fileSystems = {
|
||||
|
|
|
@ -30,6 +30,12 @@ in
|
|||
device = parts.enc;
|
||||
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
|
||||
|
|
|
@ -39,6 +39,11 @@ in
|
|||
|
||||
networking.useDHCP = false;
|
||||
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 = {
|
||||
enable = true;
|
||||
links."10-mac" = {
|
||||
|
|
|
@ -4,7 +4,15 @@
|
|||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs' = pkgs.hw.kobo-clara;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
ereader.epdc-firmware = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.loader = {
|
||||
|
@ -12,24 +20,44 @@
|
|||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.buildLinuxWithCcache pkgs.linux_koboClara);
|
||||
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.availableKernelModules = [ "mmc_block" "dm_mod" "tps6518x_hwmon" "tps6518x_regulator" "mxc_epdc_drm" ];
|
||||
boot.kernelParams = [ "console=ttymxc0,115200" ];
|
||||
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";
|
||||
|
||||
system.build.rootfsImage = pkgs.callPackage "${pkgs.path}/nixos/lib/make-ext4-fs.nix" {
|
||||
storePaths = config.system.build.toplevel;
|
||||
compressImage = false;
|
||||
volumeLabel = "NIX_ROOTFS";
|
||||
};
|
||||
|
||||
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
|
||||
|
@ -40,11 +68,7 @@
|
|||
fi
|
||||
'';
|
||||
|
||||
hardware.firmware = [ pkgs.firmware-kobo-clara ];
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
"firmware-kobo-clara"
|
||||
];
|
||||
system.build.uboot = pkgs.ubootKoboClara;
|
||||
system.build.uboot = pkgs'.uboot;
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
}
|
||||
(lib.mkIf config.phone.buffyboard.enable {
|
||||
|
|
|
@ -4,399 +4,47 @@
|
|||
}:
|
||||
|
||||
{
|
||||
ubootKoboClara = pkgs.buildUBoot {
|
||||
uboot = pkgs.buildUBoot {
|
||||
defconfig = "mx6sllclarahd_defconfig";
|
||||
extraConfig = ''
|
||||
CONFIG_CMD_BOOTEFI=y
|
||||
CONFIG_EFI_LOADER=y
|
||||
''; /*
|
||||
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
|
||||
load_ntxkernel
|
||||
echo Loading kernel
|
||||
load mmc 0:1 0x80800000 vmlinuz
|
||||
echo Loading DTB
|
||||
load mmc 0:1 0x83000000 imx6sll-kobo-clarahd.dtb
|
||||
echo Loading initrd
|
||||
load mmc 0:1 0x85000000 uInitrd
|
||||
echo Booting kernel
|
||||
bootz 0x80800000 0x85000000 0x83000000
|
||||
run distro_bootcmd
|
||||
setenv stdin usbacm
|
||||
setenv stdout usbacm
|
||||
setenv stderr usbacm
|
||||
''};"
|
||||
'';*/
|
||||
'';
|
||||
# fastboot 0
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "akemnade";
|
||||
repo = "u-boot-fslc";
|
||||
hash = lib.fakeHash;
|
||||
rev = "a3816f6b51b5dc9083af4142ca5f3a4e4a235336";
|
||||
hash = "sha256-MUAiiXTfxt/o/6rnoI7A76IMRPDUhXodjnguKwQKrVs=";
|
||||
rev = "3247fa27aed27bb5ac24bd9966fd7dadd9c4c373";
|
||||
};
|
||||
version = "2016.03";
|
||||
version = "2023.10";
|
||||
extraMeta.platforms = [ "armv7l-linux" ];
|
||||
patches = [ ./mt7986-default-bootcmd.patch ];
|
||||
filesToInstall = [ "u-boot.bin" "u-boot.imx" ];
|
||||
filesToInstall = [ "u-boot-dtb.imx" ];
|
||||
};
|
||||
firmware-kobo-clara = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "firmware-kobo-clara";
|
||||
version = "4.26.16704";
|
||||
src = pkgs.fetchzip {
|
||||
url = "https://download.kobobooks.com/firmwares/kobo7/Feb2021/kobo-update-${version}.zip";
|
||||
hash = lib.fakeHash;
|
||||
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=";
|
||||
};
|
||||
hwcfg = pkgs.fetchurl {
|
||||
url = "https://gitlab.com/postmarketOS/pmaports/-/raw/c1a3d0667856ff40723ec3b731dd47165df335e9/device/testing/firmware-kobo-clara/hwcfg.bin";
|
||||
hash = lib.fakeHash;
|
||||
};
|
||||
# https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/firmware-kobo-clara/APKBUILD
|
||||
installPhase = ''
|
||||
le32() {
|
||||
printf "%08x" "$1" | sed -E 's/(..)(..)(..)(..)/\\x\4\\x\3\\x\2\\x\1/'
|
||||
}
|
||||
prepend_header() {
|
||||
length=$(stat -L -c %s "$1")
|
||||
dd bs=496 count=1 if=/dev/zero
|
||||
printf '\xff\xf5\xaf\xff\x78\x56\x34\x12%b\x00\x00\x00\x00' "$(le32 "$length")"
|
||||
cat "$1"
|
||||
}
|
||||
mkdir -p "$out/share/firmware/kobo-clara"
|
||||
prepend_header hwcfg.bin > "$out/share/firmware/kobo-clara/hwcfg+header.bin"
|
||||
prepend_header upgrade/mx6sll-ntx/ntxfw-E60K00+header.bin > "$out/share/firmware/kobo-clara/ntxfw-E60K00+header.bin"
|
||||
'';
|
||||
};
|
||||
linux_koboClara = pkgs.linux_latest.override {
|
||||
kernelPatches = [
|
||||
{
|
||||
name = "linux_6_8";
|
||||
patch = pkgs.fetchpatch {
|
||||
url = "https://github.com/torvalds/linux/compare/e8f897f4afef0031fe618a8e94127a0934896aba...akemnade:linux:941e725995136bdb897f793607a3af0a915a96f8.patch";
|
||||
hash = lib.fakeHash;
|
||||
};
|
||||
}
|
||||
];
|
||||
ignoreConfigErrors = false;
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
KERNEL_LZO = yes;
|
||||
NO_HZ_IDLE = yes;
|
||||
HIGH_RES_TIMERS = yes;
|
||||
LOG_BUF_SHIFT = 18;
|
||||
CMA = yes;
|
||||
RELAY = yes;
|
||||
PERF_EVENTS = yes;
|
||||
ARCH_MULTI_V6 = yes;
|
||||
ARCH_MXC = yes;
|
||||
MACH_MX31LILLY = yes;
|
||||
MACH_MX31LITE = yes;
|
||||
MACH_PCM037 = yes;
|
||||
MACH_PCM037_EET = yes;
|
||||
MACH_MX31_3DS = yes;
|
||||
MACH_MX31MOBOARD = yes;
|
||||
MACH_QONG = yes;
|
||||
MACH_ARMADILLO5X0 = yes;
|
||||
MACH_KZM_ARM11_01 = yes;
|
||||
MACH_IMX31_DT = yes;
|
||||
MACH_IMX35_DT = yes;
|
||||
MACH_PCM043 = yes;
|
||||
MACH_MX35_3DS = yes;
|
||||
MACH_VPR200 = yes;
|
||||
SOC_IMX50 = yes;
|
||||
SOC_IMX51 = yes;
|
||||
SOC_IMX53 = yes;
|
||||
SOC_IMX6Q = yes;
|
||||
SOC_IMX6SL = yes;
|
||||
SOC_IMX6SLL = yes;
|
||||
SOC_IMX6SX = yes;
|
||||
SOC_IMX6UL = yes;
|
||||
SOC_IMX7D = yes;
|
||||
SOC_IMX7ULP = yes;
|
||||
SOC_VF610 = yes;
|
||||
SMP = yes;
|
||||
ARM_PSCI = yes;
|
||||
HIGHMEM = yes;
|
||||
FORCE_MAX_ZONEORDER = 14;
|
||||
ARM_APPENDED_DTB = yes;
|
||||
ARM_ATAG_DTB_COMPAT = yes;
|
||||
CMDLINE = "console=ttymxc0,115200";
|
||||
KEXEC = yes;
|
||||
CPU_FREQ = yes;
|
||||
CPU_FREQ_STAT = yes;
|
||||
CPU_FREQ_DEFAULT_GOV_ONDEMAND = yes;
|
||||
CPU_FREQ_GOV_POWERSAVE = yes;
|
||||
CPU_FREQ_GOV_USERSPACE = yes;
|
||||
CPU_FREQ_GOV_CONSERVATIVE = yes;
|
||||
CPUFREQ_DT = yes;
|
||||
ARM_IMX6Q_CPUFREQ = yes;
|
||||
ARM_IMX_CPUFREQ_DT = yes;
|
||||
CPU_IDLE = yes;
|
||||
ARM_CPUIDLE = yes;
|
||||
ARM_PSCI_CPUIDLE = yes;
|
||||
VFP = yes;
|
||||
NEON = yes;
|
||||
PM_DEBUG = yes;
|
||||
PM_TEST_SUSPEND = yes;
|
||||
MODULES = yes;
|
||||
MODULE_UNLOAD = yes;
|
||||
MODVERSIONS = yes;
|
||||
MODULE_SRCVERSION_ALL = yes;
|
||||
PACKET = yes;
|
||||
INET = yes;
|
||||
IP_PNP = yes;
|
||||
IP_PNP_DHCP = yes;
|
||||
NETFILTER = yes;
|
||||
CFG80211 = yes;
|
||||
MAC80211 = yes;
|
||||
RFKILL = yes;
|
||||
RFKILL_INPUT = yes;
|
||||
DEVTMPFS = yes;
|
||||
DEVTMPFS_MOUNT = yes;
|
||||
IMX_WEIM = yes;
|
||||
BLK_DEV_LOOP = yes;
|
||||
BLK_DEV_RAM = yes;
|
||||
BLK_DEV_RAM_SIZE = 65536;
|
||||
EEPROM_AT24 = yes;
|
||||
EEPROM_AT25 = yes;
|
||||
BLK_DEV_SD = yes;
|
||||
SCSI_CONSTANTS = yes;
|
||||
SCSI_LOGGING = yes;
|
||||
SCSI_SCAN_ASYNC = yes;
|
||||
NETDEVICES = yes;
|
||||
CS89x0 = yes;
|
||||
CS89x0_PLATFORM = yes;
|
||||
INPUT_EVDEV = yes;
|
||||
KEYBOARD_GPIO = yes;
|
||||
KEYBOARD_SNVS_PWRKEY = yes;
|
||||
KEYBOARD_IMX = yes;
|
||||
INPUT_TOUCHSCREEN = yes;
|
||||
TOUCHSCREEN_CYTTSP5 = yes;
|
||||
INPUT_MISC = yes;
|
||||
SERIO_SERPORT = module;
|
||||
SERIAL_IMX = yes;
|
||||
SERIAL_IMX_CONSOLE = yes;
|
||||
SERIAL_FSL_LPUART = yes;
|
||||
SERIAL_FSL_LPUART_CONSOLE = yes;
|
||||
SERIAL_DEV_BUS = yes;
|
||||
I2C_CHARDEV = yes;
|
||||
I2C_MUX = yes;
|
||||
I2C_MUX_GPIO = yes;
|
||||
I2C_ALGOPCF = module;
|
||||
I2C_ALGOPCA = module;
|
||||
I2C_GPIO = yes;
|
||||
I2C_IMX = yes;
|
||||
SPI_FSL_QUADSPI = yes;
|
||||
SPI_GPIO = yes;
|
||||
SPI_IMX = yes;
|
||||
SPI_FSL_DSPI = yes;
|
||||
GPIO_SYSFS = yes;
|
||||
GPIO_MXC = yes;
|
||||
RN5T618_POWER = module;
|
||||
POWER_RESET = yes;
|
||||
POWER_RESET_SYSCON = yes;
|
||||
POWER_RESET_SYSCON_POWEROFF = yes;
|
||||
POWER_SUPPLY = yes;
|
||||
SENSORS_MC13783_ADC = yes;
|
||||
SENSORS_GPIO_FAN = yes;
|
||||
SENSORS_IIO_HWMON = yes;
|
||||
SENSORS_TPS6518X = module;
|
||||
THERMAL = yes;
|
||||
THERMAL_STATISTICS = yes;
|
||||
THERMAL_WRITABLE_TRIPS = yes;
|
||||
CPU_THERMAL = yes;
|
||||
IMX_THERMAL = yes;
|
||||
WATCHDOG = yes;
|
||||
RN5T618_WATCHDOG = yes;
|
||||
IMX2_WDT = yes;
|
||||
MFD_RN5T618 = yes;
|
||||
MFD_TPS6518X = module;
|
||||
REGULATOR_FIXED_VOLTAGE = yes;
|
||||
REGULATOR_ANATOP = yes;
|
||||
REGULATOR_GPIO = yes;
|
||||
REGULATOR_MC13783 = yes;
|
||||
REGULATOR_MC13892 = yes;
|
||||
REGULATOR_RN5T618 = yes;
|
||||
REGULATOR_TPS6518X = module;
|
||||
IMX_IPUV3_CORE = yes;
|
||||
DRM = yes;
|
||||
DRM_PANEL_LVDS = yes;
|
||||
DRM_PANEL_SIMPLE = yes;
|
||||
DRM_PANEL_SEIKO_43WVF1G = yes;
|
||||
DRM_DW_HDMI_CEC = yes;
|
||||
DRM_MXSFB = yes;
|
||||
DRM_MXC_EPDC = module;
|
||||
FB_MODE_HELPERS = yes;
|
||||
LCD_CLASS_DEVICE = yes;
|
||||
LCD_L4F00242T03 = yes;
|
||||
LCD_PLATFORM = yes;
|
||||
BACKLIGHT_PWM = yes;
|
||||
BACKLIGHT_LM3630A = module;
|
||||
BACKLIGHT_GPIO = yes;
|
||||
FRAMEBUFFER_CONSOLE = yes;
|
||||
HID_MULTITOUCH = yes;
|
||||
USB = yes;
|
||||
USB_ANNOUNCE_NEW_DEVICES = yes;
|
||||
USB_EHCI_HCD = yes;
|
||||
USB_EHCI_MXC = yes;
|
||||
USB_STORAGE = yes;
|
||||
USB_CHIPIDEA = yes;
|
||||
USB_CHIPIDEA_UDC = yes;
|
||||
USB_CHIPIDEA_HOST = yes;
|
||||
USB_SERIAL = module;
|
||||
USB_SERIAL_GENERIC = yes;
|
||||
USB_SERIAL_FTDI_SIO = module;
|
||||
USB_SERIAL_OPTION = module;
|
||||
USB_TEST = module;
|
||||
USB_EHSET_TEST_FIXTURE = module;
|
||||
NOP_USB_XCEIV = yes;
|
||||
USB_MXS_PHY = yes;
|
||||
USB_GADGET = yes;
|
||||
USB_FSL_USB2 = yes;
|
||||
USB_CONFIGFS = module;
|
||||
USB_CONFIGFS_SERIAL = yes;
|
||||
USB_CONFIGFS_ACM = yes;
|
||||
USB_CONFIGFS_OBEX = yes;
|
||||
USB_CONFIGFS_NCM = yes;
|
||||
USB_CONFIGFS_ECM = yes;
|
||||
USB_CONFIGFS_ECM_SUBSET = yes;
|
||||
USB_CONFIGFS_RNDIS = yes;
|
||||
USB_CONFIGFS_EEM = yes;
|
||||
USB_CONFIGFS_MASS_STORAGE = yes;
|
||||
USB_CONFIGFS_F_LB_SS = yes;
|
||||
USB_CONFIGFS_F_FS = yes;
|
||||
USB_CONFIGFS_F_HID = yes;
|
||||
USB_CONFIGFS_F_PRINTER = yes;
|
||||
USB_ZERO = module;
|
||||
USB_ETH = module;
|
||||
USB_G_NCM = module;
|
||||
USB_GADGETFS = module;
|
||||
USB_FUNCTIONFS = module;
|
||||
USB_MASS_STORAGE = module;
|
||||
USB_G_SERIAL = module;
|
||||
MMC = yes;
|
||||
MMC_SDHCI = yes;
|
||||
MMC_SDHCI_PLTFM = yes;
|
||||
MMC_SDHCI_ESDHC_IMX = yes;
|
||||
NEW_LEDS = yes;
|
||||
LEDS_CLASS = yes;
|
||||
LEDS_GPIO = yes;
|
||||
LEDS_PWM = yes;
|
||||
LEDS_TRIGGERS = yes;
|
||||
LEDS_TRIGGER_TIMER = yes;
|
||||
LEDS_TRIGGER_ONESHOT = yes;
|
||||
LEDS_TRIGGER_HEARTBEAT = yes;
|
||||
LEDS_TRIGGER_BACKLIGHT = yes;
|
||||
LEDS_TRIGGER_GPIO = yes;
|
||||
LEDS_TRIGGER_DEFAULT_ON = yes;
|
||||
RTC_CLASS = yes;
|
||||
RTC_INTF_DEV_UIE_EMUL = yes;
|
||||
RTC_DRV_MXC = yes;
|
||||
RTC_DRV_MXC_V2 = yes;
|
||||
RTC_DRV_SNVS = yes;
|
||||
RTC_DRV_RC5T619 = module;
|
||||
DMADEVICES = yes;
|
||||
DMA_CMA = yes;
|
||||
FSL_EDMA = yes;
|
||||
IMX_SDMA = yes;
|
||||
MXS_DMA = yes;
|
||||
DMATEST = module;
|
||||
STAGING_MEDIA = yes;
|
||||
COMMON_CLK_PWM = yes;
|
||||
IIO = yes;
|
||||
MMA8452 = yes;
|
||||
IMX7D_ADC = yes;
|
||||
VF610_ADC = yes;
|
||||
RN5T618_ADC = module;
|
||||
PWM = yes;
|
||||
PWM_FSL_FTM = yes;
|
||||
PWM_IMX27 = yes;
|
||||
PWM_IMX_TPM = yes;
|
||||
NVMEM_IMX_OCOTP = yes;
|
||||
NVMEM_VF610_OCOTP = yes;
|
||||
NVMEM_SNVS_LPGPR = yes;
|
||||
TEE = yes;
|
||||
OPTEE = yes;
|
||||
SIOX = module;
|
||||
SIOX_BUS_GPIO = module;
|
||||
EXT2_FS = yes;
|
||||
EXT3_FS = yes;
|
||||
QUOTA = yes;
|
||||
QUOTA_NETLINK_INTERFACE = yes;
|
||||
AUTOFS4_FS = yes;
|
||||
FUSE_FS = yes;
|
||||
JOLIET = yes;
|
||||
ZISOFS = yes;
|
||||
MSDOS_FS = module;
|
||||
VFAT_FS = yes;
|
||||
JFFS2_FS = yes;
|
||||
UBIFS_FS = yes;
|
||||
SECURITYFS = yes;
|
||||
CRYPTO_DEV_FSL_CAAM = yes;
|
||||
CRYPTO_DEV_SAHARA = yes;
|
||||
CRYPTO_DEV_MXS_DCP = yes;
|
||||
CRC_CCITT = module;
|
||||
CRC_T10DIF = yes;
|
||||
CRC7 = module;
|
||||
LIBCRC32C = module;
|
||||
CMA_SIZE_MBYTES = 64;
|
||||
PRINTK_TIME = yes;
|
||||
MAGIC_SYSRQ = yes;
|
||||
DEBUG_FS = yes;
|
||||
PROVE_LOCKING = yes;
|
||||
TUN = module;
|
||||
USB_USBNET = module;
|
||||
NF_CONNTRACK = module;
|
||||
NF_CT_NETLINK = module;
|
||||
NF_CT_NETLINK_TIMEOUT = module;
|
||||
NF_TABLES = module;
|
||||
NFT_CT = module;
|
||||
NFT_LOG = module;
|
||||
NFT_LIMIT = module;
|
||||
NFT_MASQ = module;
|
||||
NFT_REDIR = module;
|
||||
NFT_NAT = module;
|
||||
NFT_TUNNEL = module;
|
||||
NFT_COMPAT = module;
|
||||
NFT_SOCKET = module;
|
||||
NFT_TPROXY = module;
|
||||
NFT_SYNPROXY = module;
|
||||
NFT_FWD_NETDEV = module;
|
||||
NETFILTER_XTABLES = module;
|
||||
NETFILTER_XT_TARGET_LOG = module;
|
||||
NETFILTER_XT_NAT = module;
|
||||
NETFILTER_XT_TARGET_NFLOG = module;
|
||||
NETFILTER_XT_TARGET_MASQUERADE = module;
|
||||
NETFILTER_XT_TARGET_TEE = module;
|
||||
NETFILTER_XT_TARGET_TCPMSS = module;
|
||||
NETFILTER_XT_MATCH_ADDRTYPE = module;
|
||||
BLK_DEV_DM = module;
|
||||
DM_CRYPT = module;
|
||||
CRYPTO_CBC = yes;
|
||||
CRYPTO_CTS = module;
|
||||
CRYPTO_ECB = yes;
|
||||
CRYPTO_LRW = module;
|
||||
CRYPTO_PCBC = module;
|
||||
CRYPTO_XTS = module;
|
||||
CRYPTO_XCBC = module;
|
||||
CRYPTO_MD5 = yes;
|
||||
CRYPTO_MICHAEL_MIC = yes;
|
||||
CRYPTO_RMD128 = module;
|
||||
CRYPTO_RMD160 = module;
|
||||
CRYPTO_RMD256 = module;
|
||||
CRYPTO_RMD320 = module;
|
||||
CRYPTO_SHA256 = yes;
|
||||
CRYPTO_TGR192 = module;
|
||||
CRYPTO_WP512 = module;
|
||||
MFD_NTXEC = yes;
|
||||
PWM_NTXEC = module;
|
||||
TOUCHSCREEN_ZFORCE = module;
|
||||
BRCMFMAC = module;
|
||||
BRCMFMAC_SDIO = yes;
|
||||
TOUCHSCREEN_EKTF2127 = module;
|
||||
RTC_DRV_NTXEC = module;
|
||||
MFD_SY7636 = module;
|
||||
REGULATOR_SY7636 = module;
|
||||
SENSORS_SY7636 = module;
|
||||
GPIO_BD71815 = module;
|
||||
GPIO_BD71828 = module;
|
||||
MFD_ROHM_BD71828 = module;
|
||||
REGULATOR_BD71815 = module;
|
||||
REGULATOR_BD71828 = module;
|
||||
COMMON_CLK_BD718XX = module;
|
||||
};
|
||||
};
|
||||
|
||||
defconfig = "kobo_defconfig";
|
||||
}).overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.lzop ];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ in
|
|||
|
||||
options.phone = {
|
||||
adb.enable = lib.mkEnableOption "adb";
|
||||
rndis.enable = lib.mkEnableOption "rndis" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
|
@ -51,11 +48,11 @@ in
|
|||
# https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/community/soc-qcom-sdm845/
|
||||
/*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"
|
||||
chmod +w "$out" "$out/wireplumber.conf.d"
|
||||
ln -s ${pkgs.fetchurl {
|
||||
url = "https://gitlab.com/postmarketOS/pmaports/-/raw/0aa9524204e9c9c002c860b87c972bc2ebf025f3/device/community/soc-qcom-sdm845/51-qcom-sdm845.lua";
|
||||
hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk=";
|
||||
}} "$out/main.lua.d/51-qcom-sdm845.lua"
|
||||
url = "https://gitlab.com/postmarketOS/pmaports/-/raw/a82d8636562805d71e16e93f7571cc1f6ddbeb45/device/community/soc-qcom-sdm845/51-qcom-sdm845.conf";
|
||||
hash = "sha256-EM2I9hwTYnK5FepB4RBI5t8sIFQ/uqN5AuTwGepzjB0=";
|
||||
}} "$out/wireplumber.conf.d/51-qcom-sdm845.conf"
|
||||
'';
|
||||
systemd.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR = config.systemd.user.services.wireplumber.environment.WIREPLUMBER_CONFIG_DIR;*/
|
||||
networking.modemmanager.enable = !config.networking.networkmanager.enable;
|
||||
|
@ -74,6 +71,7 @@ in
|
|||
boot.kernelPackages = lib.mkForce (pkgs-kernel.linuxPackagesFor hw-kernel.linux);
|
||||
hardware.deviceTree.enable = true;
|
||||
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
|
||||
# see https://gitlab.freedesktop.org/drm/msm/-/issues/46
|
||||
boot.consoleLogLevel = 7;
|
||||
|
@ -108,47 +106,6 @@ in
|
|||
(lib.mkIf cfg.buffyboard.enable {
|
||||
common.gettyAutologin = true;
|
||||
})
|
||||
(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 {
|
||||
boot.initrd.kernelModules = [ "configfs" "libcomposite" "g_ffs" ];
|
||||
|
||||
|
|
|
@ -7,142 +7,10 @@
|
|||
let
|
||||
inherit (inputs) mobile-nixos;
|
||||
mobile-pkgs = import "${mobile-nixos}/overlay/overlay.nix" pkgs' pkgs;
|
||||
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 {
|
||||
mkLinux = { linux, kernelPatches, structuredExtraConfig }: linux.override {
|
||||
# TODO: uncomment
|
||||
# ignoreConfigErrors = false;
|
||||
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;
|
||||
}
|
||||
];
|
||||
inherit kernelPatches;
|
||||
|
||||
stdenv = lib.recursiveUpdate pkgs.stdenv {
|
||||
hostPlatform.linux-kernel.extraConfig = "";
|
||||
|
@ -152,8 +20,6 @@ in {
|
|||
# fix build
|
||||
LENOVO_YOGA_C630_EC = no;
|
||||
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)
|
||||
USB_FUNCTIONFS = yes;
|
||||
USB_LIBCOMPOSITE = yes;
|
||||
|
@ -628,7 +494,148 @@ in {
|
|||
XEN_BALLOON_MEMORY_HOTPLUG.tristate = lib.mkForce null; XEN_DOM0.tristate = lib.mkForce null; XEN_EFI.tristate = lib.mkForce null;
|
||||
XEN_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;
|
||||
} // 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;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"phy-rockchip-naneng-combphy"
|
||||
];
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_9;
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
|
||||
|
||||
boot.kernelParams = [ "dtb=/${config.hardware.deviceTree.name}" ];
|
||||
hardware.deviceTree.enable = true;
|
||||
|
|
58
system/hosts/ereader/default.nix
Normal file
58
system/hosts/ereader/default.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
system.stateVersion = "23.11";
|
||||
|
||||
services.logind.powerKey = "ignore";
|
||||
services.logind.powerKeyLongPress = "poweroff";
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if ((action.id.indexOf("org.freedesktop.login1.suspend" == 0)
|
||||
|| action.id.indexOf("org.freedesktop.login1.reboot" == 0)
|
||||
|| action.id.indexOf("org.freedesktop.login1.power-off" == 0)
|
||||
|| action.id.indexOf("org.freedesktop.inhibit") == 0)
|
||||
&& subject.user == "${config.common.mainUsername}")
|
||||
{
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
||||
'';
|
||||
|
||||
systemd.services.disable-fbcon-blink = {
|
||||
script = "echo 0 > /sys/class/graphics/fbcon/cursor_blink";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
phone.buffyboard.enable = true;
|
||||
phone.rndis.enable = true;
|
||||
common.minimal = true;
|
||||
common.binaryCache.enable = true;
|
||||
services.dbus.enable = true;
|
||||
services.sshd.enable = true;
|
||||
services.tlp.enable = true;
|
||||
users.defaultUserShell = pkgs.bash;
|
||||
|
||||
# kde connect
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
{ from = 1714; to = 1764; }
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{ from = 1714; to = 1764; }
|
||||
];
|
||||
|
||||
# services.xserver.displayManager.startx.enable = true;
|
||||
# services.xserver.windowManager.awesome.enable = true;
|
||||
programs.sway.enable = true;
|
||||
xdg.portal.enable = lib.mkForce false;
|
||||
xdg.portal.wlr.enable = lib.mkForce false;
|
||||
|
||||
services.upower.enable = true;
|
||||
}
|
|
@ -40,7 +40,7 @@
|
|||
"vm.swappiness" = 40;
|
||||
};
|
||||
# TODO: switch back to latest
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
});
|
||||
'';
|
||||
|
||||
phone.buffyboard.enable = true;
|
||||
phone.rndis.enable = true;
|
||||
common.minimal = false;
|
||||
services.sshd.enable = true;
|
||||
services.tlp.enable = true;
|
||||
|
|
|
@ -106,6 +106,7 @@ in {
|
|||
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
|
||||
# so normal nix evals don't have access to builtins
|
||||
# nix.checkConfig = false;
|
||||
nix.settings.extra-builtins-file = "/secrets/nixos/extra-builtins.nix";
|
||||
# required for hydra which uses restricted mode
|
||||
nix.settings.allowed-uris = [
|
||||
|
@ -167,7 +168,7 @@ in {
|
|||
maxJobs = 2;
|
||||
# TODO: switch to ssh-ng https://github.com/NixOS/hydra/issues/688
|
||||
protocol = "ssh";
|
||||
systems = [ "x86_64-linux" ];
|
||||
systems = [ "x86_64-linux" "i686-linux" ];
|
||||
supportedFeatures = [ "benchmark" "big-parallel" "ca-derivations" "kvm" "nixos-test" ];
|
||||
# hydra-queue-runner must have read access to this
|
||||
sshKey = "/secrets/hydra-builder-key";
|
||||
|
@ -181,6 +182,7 @@ in {
|
|||
systemd.services.nix-daemon.serviceConfig.Nice = "19";
|
||||
nix.daemonCPUSchedPolicy = "idle";
|
||||
nix.daemonIOSchedClass = "idle";
|
||||
common.useNixPlugins = true;
|
||||
systemd.services.hydra-evaluator = lib.mkIf config.services.hydra.enable {
|
||||
# https://github.com/NixOS/hydra/issues/1186
|
||||
environment.GC_DONT_GC = "1";
|
||||
|
@ -363,6 +365,8 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
# don't mess with my dns god damn it
|
||||
services.resolved.enable = false;
|
||||
# TODO: enable
|
||||
services.matrix-appservice-discord.settings.metrics = {
|
||||
enable = true;
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.phone;
|
||||
in
|
||||
{
|
||||
options.phone.buffyboard = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
enable = lib.mkEnableOption "buffyboard";
|
||||
};
|
||||
config = {
|
||||
config = lib.mkIf cfg.buffyboard.enable {
|
||||
boot.initrd.kernelModules = [ "uinput" "evdev" ];
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
copy_bin_and_libs ${pkgs.buffyboard}/bin/buffyboard
|
||||
|
|
|
@ -17,6 +17,15 @@ in {
|
|||
default = true;
|
||||
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 {
|
||||
type = types.str;
|
||||
default = "user";
|
||||
|
@ -58,31 +67,11 @@ in {
|
|||
dates = "weekly";
|
||||
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";
|
||||
nix.daemonCPUSchedPolicy = 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) [
|
||||
"consoleblank=60"
|
||||
] ++ lib.optionals (cfg.resolution == "1920x1080") [
|
||||
|
@ -121,7 +110,7 @@ in {
|
|||
rsync
|
||||
tmux
|
||||
wget
|
||||
|
||||
] ++ lib.optionals (!builtins.elem pkgs.system ["armv7l-linux"]) [
|
||||
kitty.terminfo
|
||||
foot.terminfo
|
||||
# rxvt-unicode-unwrapped.terminfo
|
||||
|
@ -135,11 +124,14 @@ in {
|
|||
# nixos-hardware uses mkDefault here, so we use slightly higher priority
|
||||
services.libinput.enable = mkForceDefault (!cfg.minimal);
|
||||
programs.fuse.userAllowOther = true;
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.gettyAutologin {
|
||||
# autologin once after boot
|
||||
# --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)
|
||||
services.getty.extraArgs = lib.mkIf cfg.gettyAutologin [ "--skip-login" ];
|
||||
services.getty.loginProgram = lib.mkIf cfg.gettyAutologin (let
|
||||
services.getty.extraArgs = [ "--skip-login" ];
|
||||
services.getty.loginProgram = let
|
||||
lockfile = "/tmp/login-once.lock";
|
||||
in with pkgs; writeShellScript "login-once" ''
|
||||
if [ -f '${lockfile}' ]; then
|
||||
|
@ -148,8 +140,8 @@ in {
|
|||
${coreutils}/bin/touch '${lockfile}'
|
||||
exec ${shadow}/bin/login -f user
|
||||
fi
|
||||
'');
|
||||
}
|
||||
'';
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.minimal {
|
||||
programs.fish.interactiveShellInit = ''
|
||||
|
@ -169,7 +161,7 @@ in {
|
|||
# conflicts with bash module's mkDefault
|
||||
# only override on minimal systems because on non-minimal systems
|
||||
# my fish config doesn't work well in fb/drm console
|
||||
users.defaultUserShell = lib.mkIf cfg.minimal (mkForceDefault pkgs.fish);
|
||||
users.defaultUserShell = mkForceDefault pkgs.fish;
|
||||
|
||||
programs.vim = {
|
||||
enable = lib.mkDefault true;
|
||||
|
@ -191,9 +183,22 @@ in {
|
|||
})
|
||||
|
||||
(lib.mkIf (!cfg.minimal) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
unixtools.xxd
|
||||
];
|
||||
# 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" ];
|
||||
hardware.pulseaudio.enable = false;
|
||||
services.pipewire = {
|
||||
enable = lib.mkDefault true;
|
||||
|
@ -206,7 +211,20 @@ in {
|
|||
security.rtkit.enable = true;
|
||||
services.dbus.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 = {
|
||||
netrc-file = "/secrets/netrc";
|
||||
substituters = [
|
||||
|
|
52
system/modules/rndis.nix
Normal file
52
system/modules/rndis.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.phone;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
phone.rndis.enable = lib.mkEnableOption "rndis";
|
||||
};
|
||||
config = lib.mkIf cfg.rndis.enable {
|
||||
boot.initrd.kernelModules = [ "configfs" "libcomposite" ];
|
||||
boot.initrd.availableKernelModules = [ "usb_f_rndis" "usb_f_ncm" ];
|
||||
|
||||
boot.specialFileSystems = {
|
||||
"/sys/kernel/config" = {
|
||||
device = "configfs";
|
||||
fsType = "configfs";
|
||||
options = [ "nosuid" "noexec" "nodev" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.preLVMCommands = ''
|
||||
if ! mountpoint /sys/kernel/config; then
|
||||
specialMount configfs /sys/kernel/config nosuid,noexec,nodev configfs
|
||||
fi
|
||||
mkdir -p /sys/kernel/config/usb_gadget/g1/strings/0x409
|
||||
cd /sys/kernel/config/usb_gadget/g1
|
||||
echo 0x18D1 > idVendor
|
||||
echo 0xD001 > idProduct
|
||||
echo nixos-device > strings/0x409/product
|
||||
echo NixOS > strings/0x409/manufacturer
|
||||
echo 0123456789 > strings/0x409/serialnumber
|
||||
|
||||
mkdir -p configs/c.1/strings/0x409
|
||||
echo "USB network" > configs/c.1/strings/0x409/configuration
|
||||
|
||||
mkdir -p functions/ncm.usb0 || mkdir -p functions/rndis.usb0
|
||||
ln -s functions/ncm.usb0 configs/c.1/ || ln -s functions/rndis.usb0 configs/c.1/
|
||||
|
||||
ls /sys/class/udc/ | head -n1 > UDC
|
||||
cd /
|
||||
|
||||
ifconfig rndis0 172.16.42.1 || ifconfig usb0 172.16.42.1 || ifconfig eth0 172.16.42.1
|
||||
'';
|
||||
|
||||
boot.initrd.network.enable = true;
|
||||
boot.initrd.network.udhcpc.enable = false;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue