Compare commits
23 commits
Author | SHA1 | Date | |
---|---|---|---|
chayleaf | 6d8e1d85ac | ||
chayleaf | 8e3d0c90a8 | ||
chayleaf | a7c43047b3 | ||
chayleaf | 5575582b6d | ||
chayleaf | 4361c9e694 | ||
chayleaf | 7e111b4021 | ||
chayleaf | 34ed24d470 | ||
chayleaf | 6f9d877667 | ||
chayleaf | 21ab05153f | ||
chayleaf | bc5a1cd0d5 | ||
chayleaf | 42026bb41a | ||
chayleaf | dccb67d5e5 | ||
chayleaf | d779d0f809 | ||
chayleaf | 06cb7740fd | ||
chayleaf | f616572430 | ||
chayleaf | 5d7d19eeb1 | ||
chayleaf | bd0f0b2720 | ||
chayleaf | 319538d866 | ||
chayleaf | 5ba73e92a8 | ||
chayleaf | 45191559c7 | ||
chayleaf | cc4ae20674 | ||
chayleaf | 8f19644b3e | ||
chayleaf | ff493a9ed9 |
271
flake.lock
271
flake.lock
|
@ -165,6 +165,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728330715,
|
||||
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -264,6 +285,20 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_5": {
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"revCount": 57,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
|
@ -303,10 +338,49 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_3": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727826117,
|
||||
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
|
@ -321,6 +395,58 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"nixvim",
|
||||
"flake-compat"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728092656,
|
||||
"narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "1211305a5b237771e13fcca0c51e60ad47326a9a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -341,6 +467,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728337164,
|
||||
"narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "038630363e7de57c36c417fd2f5d7c14773403e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1719091691,
|
||||
|
@ -427,6 +574,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728385805,
|
||||
"narHash": "sha256-mUd38b0vhB7yzgAjNOaFz7VY9xIVzlbn3P2wjGBcVV0=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "48b50b3b137be5cfb9f4d006835ce7c3fe558ccc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-gaming": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_2",
|
||||
|
@ -649,6 +817,48 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1728241625,
|
||||
"narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixvim": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-compat": "flake-compat_5",
|
||||
"flake-parts": "flake-parts_3",
|
||||
"git-hooks": "git-hooks",
|
||||
"home-manager": "home-manager_2",
|
||||
"nix-darwin": "nix-darwin_2",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nuschtosSearch": "nuschtosSearch",
|
||||
"treefmt-nix": "treefmt-nix_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728485062,
|
||||
"narHash": "sha256-+2e9hAM2GVDF3gywdQI/OA7s4f0Z9rvFuiVxePI41QM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "61ec39764fbe1e4f21cf801ea7b9209d527c8135",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"notlua": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -725,9 +935,31 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"osu-wine": {
|
||||
"nuschtosSearch": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728423244,
|
||||
"narHash": "sha256-+YwNsyIFj3dXyLVQd1ry4pCNmtOpbceKUrkNS8wp9Ho=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "f276cc3b391493ba3a8b30170776860f9520b7fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"osu-wine": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
|
@ -761,6 +993,7 @@
|
|||
"nixos-router": "nixos-router",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-kernel": "nixpkgs-kernel",
|
||||
"nixvim": "nixvim",
|
||||
"notlua": "notlua",
|
||||
"notnft": "notnft",
|
||||
"nur": "nur",
|
||||
|
@ -865,6 +1098,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -886,6 +1134,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727984844,
|
||||
"narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"umu": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
52
flake.nix
52
flake.nix
|
@ -5,6 +5,7 @@
|
|||
nix-community-infra.url = "github:nix-community/infra";
|
||||
nixpkgs-kernel.url = "github:NixOS/nixpkgs/a58bc8ad779655e790115244571758e8de055e3d";
|
||||
nixpkgs.url = "github:chayleaf/nixpkgs/ci";
|
||||
nixvim.url = "github:nix-community/nixvim";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
nix-index-database = {
|
||||
url = "github:nix-community/nix-index-database";
|
||||
|
@ -102,7 +103,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 +115,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 +137,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 = [
|
||||
|
@ -146,6 +161,7 @@
|
|||
nixmsi = rec {
|
||||
system = "x86_64-linux";
|
||||
modules = [ ./system/devices/msi-delta-15-workstation.nix ];
|
||||
home.common.modules = [ inputs.nixvim.homeManagerModules.default ];
|
||||
home.common.extraSpecialArgs = {
|
||||
notlua = inputs.notlua.lib.${system};
|
||||
};
|
||||
|
@ -154,6 +170,7 @@
|
|||
phone = rec {
|
||||
system = "aarch64-linux";
|
||||
modules = [ ./system/devices/oneplus-6-phone.nix ];
|
||||
home.common.modules = [ inputs.nixvim.homeManagerModules.default ];
|
||||
home.common.extraSpecialArgs = {
|
||||
notlua = inputs.notlua.lib.${system};
|
||||
};
|
||||
|
@ -169,6 +186,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 +212,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 +240,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
|
||||
];
|
||||
}
|
|
@ -92,4 +92,5 @@
|
|||
rawMouse=yes
|
||||
escapeKey=KEY_RIGHTALT
|
||||
'';
|
||||
programs.mpv.config.hwdec = lib.mkForce "vdpau";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
};
|
||||
|
||||
phone.enable = true;
|
||||
phone.suspend = false;
|
||||
home.stateVersion = "23.11";
|
||||
home.username = "user";
|
||||
home.homeDirectory = "/home/user";
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
enableSshSupport = true;
|
||||
maxCacheTtl = 72000;
|
||||
maxCacheTtlSsh = 72000;
|
||||
pinentryPackage = pkgs.pinentry.tty;
|
||||
pinentryPackage = if config.minimal then pkgs.pinentry.tty else pkgs.pinentry.qt;
|
||||
};
|
||||
home.shellAliases = {
|
||||
s = "sudo -A";
|
||||
|
@ -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 ];
|
||||
};
|
||||
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
|
||||
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 = {
|
||||
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" ];
|
||||
|
@ -139,6 +118,14 @@
|
|||
|
||||
"1" = "add volume -1";
|
||||
"2" = "add volume 1";
|
||||
"3" = "add contrast -1";
|
||||
"4" = "add contrast 1";
|
||||
"5" = "add brightness -1";
|
||||
"6" = "add brightness 1";
|
||||
"7" = "add saturation -1";
|
||||
"8" = "add saturation 1";
|
||||
"9" = "add gamma -1";
|
||||
"0" = "add gamma 1";
|
||||
s = "cycle sub";
|
||||
v = "cycle video";
|
||||
a = "cycle audio";
|
||||
|
@ -162,7 +149,7 @@
|
|||
config = {
|
||||
osc = "no";
|
||||
hwdec = "vaapi";
|
||||
vo = "gpu-next,gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,";
|
||||
vo = "gpu,dmabuf-wayland,wlshm,vdpau,xv,x11,sdl,drm,";
|
||||
alang = "jpn,en,ru";
|
||||
slang = "jpn,en,ru";
|
||||
vlang = "jpn,en,ru";
|
||||
|
@ -201,16 +188,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 +274,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 +285,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)
|
||||
|
@ -34,6 +34,7 @@ audioPrev = pkgs.writeShellScript "playerctl-prev" ''
|
|||
${pkgs.playerctl}/bin/playerctl play
|
||||
fi
|
||||
'';
|
||||
# TODO: only unidle mako when unlocked
|
||||
swaylock =
|
||||
if config.phone.enable
|
||||
then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin"
|
||||
|
@ -44,17 +45,25 @@ swaylock-start = pkgs.writeShellScript "swaylock-start" ''
|
|||
dpms-off = pkgs.writeShellScript "sway-dpms-off" ''
|
||||
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off
|
||||
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled
|
||||
${config.services.mako.package}/bin/makoctl mode -a idle
|
||||
'';
|
||||
dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
|
||||
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on
|
||||
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled
|
||||
${config.services.mako.package}/bin/makoctl mode -r idle
|
||||
'';
|
||||
lock-script = pkgs.writeShellScript "lock-start" ''
|
||||
${swaylock-start}
|
||||
${lib.optionalString config.phone.enable
|
||||
# suspend if nothing is playing
|
||||
${lib.optionalString (config.phone.enable && config.phone.suspend)
|
||||
# suspend if nothing is playing and no ssh sessions are active
|
||||
''
|
||||
${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null || /run/current-system/sw/bin/systemctl suspend
|
||||
if ${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null; then
|
||||
exit
|
||||
fi
|
||||
if ${pkgs.coreutils}/bin/who -u | ${pkgs.gnugrep}/bin/grep "pts.*(" >/dev/null; then
|
||||
exit
|
||||
fi
|
||||
/run/current-system/sw/bin/systemctl suspend
|
||||
''}
|
||||
'';
|
||||
barConfig = {
|
||||
|
@ -109,12 +118,15 @@ commonConfig = {
|
|||
${lib.optionalString config.phone.enable ''
|
||||
${pkgs.procps}/bin/pkill -x wvkbd-mobintl
|
||||
${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji&
|
||||
${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"}&
|
||||
${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
|
||||
|
@ -128,6 +140,7 @@ commonConfig = {
|
|||
${pkgs.tdesktop}/bin/telegram-desktop -startintray&
|
||||
# and final sleep just in case
|
||||
sleep 1
|
||||
''}
|
||||
''); }
|
||||
];
|
||||
colors = {
|
||||
|
@ -187,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%+";
|
||||
}
|
||||
|
@ -202,13 +215,11 @@ genKeybindings = (default_options: kb:
|
|||
.imports)
|
||||
.options.keybindings.default)
|
||||
);
|
||||
in
|
||||
{
|
||||
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";
|
||||
};
|
||||
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;
|
||||
|
@ -221,28 +232,42 @@ 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;
|
||||
# ms
|
||||
defaultTimeout = 7500;
|
||||
package = pkgs.mako.overrideAttrs (old: {
|
||||
patches = old.patches or []
|
||||
++ (lib.mapAttrsToList (k: v: ../../pkgs/mako/${k}) (builtins.readDir ../../pkgs/mako));
|
||||
});
|
||||
defaultTimeout = 10000;
|
||||
font = "Noto Sans Mono 12";
|
||||
extraConfig = ''
|
||||
max-history=50
|
||||
[mode=idle]
|
||||
freeze=1
|
||||
'';
|
||||
};
|
||||
xsession.windowManager.i3 = {
|
||||
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;
|
||||
|
@ -273,9 +298,9 @@ in
|
|||
sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU=";
|
||||
})*/
|
||||
] ++ lib.optionals config.phone.enable
|
||||
(map
|
||||
(x: ../../pkgs/sway/${x})
|
||||
(builtins.filter (lib.hasInfix "-mobile-") (builtins.attrNames (builtins.readDir ../../pkgs/sway))));
|
||||
(lib.mapAttrsToList
|
||||
(k: v: ../../pkgs/sway/${k})
|
||||
(lib.filterAttrs (k: v: lib.hasInfix "-mobile-" k) (builtins.readDir ../../pkgs/sway)));
|
||||
});
|
||||
inherit (cfg) extraSessionCommands extraOptions;
|
||||
withBaseWrapper = cfg.wrapperFeatures.base;
|
||||
|
@ -380,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}
|
||||
|
@ -400,10 +425,14 @@ in
|
|||
''}";
|
||||
});
|
||||
startup = [
|
||||
{
|
||||
/*{
|
||||
always = true;
|
||||
command = "${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; /run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; /run/current-system/sw/bin/systemctl --user reset-failed && /run/current-system/sw/bin/systemctl --user start sway-session.target && ${pkgs.sway}/bin/swaymsg -mt subscribe '[]' || true && /run/current-system/sw/bin/systemctl --user stop sway-session.target";
|
||||
}
|
||||
command = pkgs.writeShellScript "dbus-upd.sh" ''
|
||||
${lib.getBin pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE
|
||||
/run/current-system/sw/bin/systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
|
||||
/run/current-system/sw/bin/systemctl --user reset-failed";
|
||||
'';
|
||||
}*/
|
||||
{
|
||||
command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist";
|
||||
}
|
||||
|
@ -443,16 +472,16 @@ in
|
|||
'';
|
||||
};
|
||||
services.swayidle = {
|
||||
enable = config.wayland.windowManager.sway.enable && !config.phone.enable;
|
||||
enable = config.wayland.windowManager.sway.enable;
|
||||
events = [
|
||||
{ event = "before-sleep"; command = toString swaylock-start; }
|
||||
# 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; }
|
||||
];
|
||||
};
|
||||
|
@ -496,16 +525,16 @@ 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";
|
||||
package = lib.mkIf config.wayland.windowManager.sway.enable pkgs.rofi-wayland;
|
||||
package = lib.mkIf config.wayland.windowManager.sway.enable (pkgs.rofi-wayland.override {
|
||||
rofi-unwrapped = pkgs.rofi-wayland-unwrapped.overrideAttrs (old: {
|
||||
patches = old.patches or []
|
||||
++ (lib.mapAttrsToList (k: v: ../../pkgs/rofi-wayland/${k}) (builtins.readDir ../../pkgs/rofi-wayland));
|
||||
});
|
||||
});
|
||||
plugins = with pkgs; [
|
||||
rofi-calc
|
||||
];
|
||||
|
@ -564,4 +593,5 @@ in
|
|||
steal-focus = true;
|
||||
};
|
||||
};
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
*/
|
||||
|
||||
# welcome to my cursed DSL
|
||||
programs.neovim = let
|
||||
notlua-nvim = notlua.neovim { inherit (config.programs.neovim) plugins extraLuaPackages; };
|
||||
programs.nixvim = let
|
||||
notlua-nvim = notlua.neovim {
|
||||
plugins = config.programs.nixvim.extraPlugins;
|
||||
inherit (config.programs.nixvim) extraLuaPackages;
|
||||
};
|
||||
inherit (notlua.keywords)
|
||||
AND APPLY CALL DEFUN ELSE EQ GE IDX IF
|
||||
LE LET LETREC MERGE OR PROP RETURN SET;
|
||||
|
@ -68,102 +71,13 @@
|
|||
|
||||
which-key = REQ "which-key";
|
||||
luasnip = REQ "luasnip";
|
||||
in {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
extraPackages = with pkgs; [
|
||||
rust-analyzer
|
||||
nodePackages_latest.bash-language-server shellcheck
|
||||
nodePackages_latest.typescript-language-server
|
||||
# nodePackages_latest.svelte-language-server
|
||||
clang-tools_latest
|
||||
nodePackages_latest.vscode-langservers-extracted
|
||||
nil
|
||||
marksman
|
||||
taplo
|
||||
ripgrep
|
||||
(python3.withPackages (p: with p; [
|
||||
python-lsp-server
|
||||
python-lsp-black
|
||||
pylsp-mypy
|
||||
python-lsp-server.optional-dependencies.pyflakes
|
||||
python-lsp-server.optional-dependencies.mccabe
|
||||
python-lsp-server.optional-dependencies.pycodestyle
|
||||
]))
|
||||
];
|
||||
# extraPython3Packages = pyPkgs: with pyPkgs; [
|
||||
# ];
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
extraLuaConfig = compile "main" [
|
||||
(kmSetNs {
|
||||
"<C-X>" = {
|
||||
rhs = DEFUN (vim.fn.system [ "chmod" "+x" (vim.fn.expand "%") ]);
|
||||
desc = "chmod +x %";
|
||||
};
|
||||
})
|
||||
(SET (vimg "vimsyn_embed") "l")
|
||||
(LET (vim.api.nvim_create_augroup "nvimrc" { clear = true; }) (group:
|
||||
lib.mapAttrsToList (k: v: vim.api.nvim_create_autocmd k { inherit group; callback = v; }) {
|
||||
BufReadPre = DEFUN (SET vim.o.foldmethod "syntax");
|
||||
BufEnter = { buf, ... }:
|
||||
LET (vim.filetype.match { inherit buf; }) (filetype: [
|
||||
(IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" "mail" ])) (
|
||||
LET vim.o.colorcolumn (old_colorcolumn: [
|
||||
(SET vim.o.colorcolumn "73")
|
||||
(vim.api.nvim_create_autocmd "BufLeave" {
|
||||
buffer = buf;
|
||||
callback = DEFUN [
|
||||
(SET vim.o.colorcolumn old_colorcolumn)
|
||||
# return true = delete autocommand
|
||||
(RETURN true)
|
||||
];
|
||||
})
|
||||
])
|
||||
))
|
||||
(IF (APPLY OR (map (EQ filetype) [ "markdown" "mail" ])) (
|
||||
(SET (IDX vim.bo buf).textwidth 72)
|
||||
))
|
||||
]);
|
||||
BufWinEnter = { buf, ... }:
|
||||
LET (vim.filetype.match { inherit buf; }) (filetype: [
|
||||
(CALL (PROP vim.cmd "folddoc") "foldopen!")
|
||||
(IF (EQ filetype "gitcommit") (
|
||||
vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "gg" ];
|
||||
}
|
||||
) ELSE (LET
|
||||
(IDX (vim.api.nvim_buf_get_mark buf "\"") 1)
|
||||
(vim.api.nvim_buf_line_count buf)
|
||||
(pos: cnt:
|
||||
IF (AND (GE pos 1) (LE pos cnt))
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "g`\"" ];
|
||||
})
|
||||
/*ELIF*/ (GE pos 1)
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "g$" ];
|
||||
})
|
||||
ELSE
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "gg" ];
|
||||
})
|
||||
)))
|
||||
]);
|
||||
}
|
||||
))
|
||||
];
|
||||
plugins = let ps = pkgs.vimPlugins; in map (x: if x?config && x?plugin then { type = "lua"; } // x else x) [
|
||||
ps.vim-svelte
|
||||
plugins = let ps = pkgs.vimPlugins; in [
|
||||
{ plugin = ps.vim-svelte; }
|
||||
# vim-nix isn't necessary for syntax highlighting, but it improves overall editing experience
|
||||
ps.vim-nix
|
||||
{ plugin = ps.vim-nix; }
|
||||
# the latest version of vscode-nvim has breaking changes and i'm too lazy to migrate
|
||||
# FIXME: migrate
|
||||
{ plugin = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "vscode-nvim";
|
||||
version = "2023-02-10";
|
||||
|
@ -174,7 +88,7 @@
|
|||
sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI=";
|
||||
};
|
||||
};
|
||||
config = compile "vscode_nvim" [
|
||||
config = [
|
||||
((REQ "vscode").setup {
|
||||
transparent = true;
|
||||
color_overrides = {
|
||||
|
@ -197,14 +111,12 @@
|
|||
bg = "NONE";
|
||||
})
|
||||
]; }
|
||||
{ plugin = ps.nvim-web-devicons;
|
||||
config = compile "nvim_web_devicons" ((REQ "nvim-web-devicons").setup { }); }
|
||||
{ plugin = ps.nvim-tree-lua;
|
||||
config = compile "nvim_tree_lua" (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [
|
||||
(SET (vimg "loaded_netrw") 1)
|
||||
(SET (vimg "loaded_netrwPlugin") 1)
|
||||
(SET vim.o.termguicolors true)
|
||||
(nvim-tree.setup { }) # :help nvim-tree-setup
|
||||
{ settings.plugins.web-devicons.enable = true; }
|
||||
{ settings.plugins.nvim-tree.enable = true;
|
||||
settings.globalOpts.termguicolors = true;
|
||||
settings.globals.loaded_netrw = 1;
|
||||
settings.globals.loaded_netrwPlugin = 1;
|
||||
config = (LET (REQ "nvim-tree") (REQ "nvim-tree.api") (nvim-tree: nvim-tree-api: [
|
||||
(kmSetNs {
|
||||
"<C-N>" = {
|
||||
rhs = nvim-tree-api.tree.toggle;
|
||||
|
@ -212,9 +124,10 @@
|
|||
};
|
||||
})
|
||||
])); }
|
||||
ps.vim-sleuth
|
||||
ps.luasnip
|
||||
{ settings.plugins.sleuth.enable = true; }
|
||||
{ settings.plugins.luasnip.enable = true; }
|
||||
{ plugin = ps.nvim-cmp;
|
||||
settings.plugins.cmp.enable = false;
|
||||
config = let
|
||||
border = (name: [
|
||||
[ "╭" name ]
|
||||
|
@ -226,7 +139,7 @@
|
|||
[ "╰" name ]
|
||||
[ "│" name ]
|
||||
]);
|
||||
in compile "nvim_cmp" (LET (REQ "cmp") (REQ "lspkind") (cmp: lspkind:
|
||||
in (LET (REQ "cmp") (REQ "lspkind") (cmp: lspkind:
|
||||
# call is required because cmp.setup is a table
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
|
@ -285,14 +198,16 @@
|
|||
sources = cmp.config.sources [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "neorg"; }
|
||||
];
|
||||
}
|
||||
)); }
|
||||
ps.lspkind-nvim
|
||||
ps.cmp_luasnip
|
||||
ps.cmp-nvim-lsp
|
||||
{ settings.plugins.lspkind.enable = true; }
|
||||
{ settings.plugins.cmp_luasnip.enable = true; }
|
||||
{ settings.plugins.cmp-nvim-lsp.enable = true; }
|
||||
{ plugin = ps.nvim-autopairs;
|
||||
config = compile "nvim_autopairs" (LET
|
||||
settings.plugins.nvim-autopairs.enable = false;
|
||||
config = (LET
|
||||
(REQ "cmp") (REQ "nvim-autopairs.completion.cmp") (REQ "nvim-autopairs")
|
||||
(cmp: cmp-autopairs: nvim-autopairs:
|
||||
[
|
||||
|
@ -301,9 +216,9 @@
|
|||
})
|
||||
(cmp.event.on cmp.event "confirm_done" (cmp-autopairs.on_confirm_done { }))
|
||||
])); }
|
||||
{ plugin = ps.comment-nvim;
|
||||
config = compile "comment_nvim" [
|
||||
((REQ "Comment").setup { })
|
||||
{ settings.plugins.comment.enable = true;
|
||||
config = [
|
||||
# ((REQ "Comment").setup { })
|
||||
(kmSetNs {
|
||||
"<space>/" = {
|
||||
# metatables......
|
||||
|
@ -319,7 +234,8 @@
|
|||
})
|
||||
]; }
|
||||
{ plugin = ps.nvim-lspconfig;
|
||||
config = compile "nvim_lspconfig" (
|
||||
settings.plugins.lsp.enable = false;
|
||||
config = (
|
||||
let lsp = name: builtins.seq
|
||||
# ensure an lsp exists (otherwise lspconfig will still create an empty config for some reason)
|
||||
(REQ "lspconfig.server_configurations.${name}")
|
||||
|
@ -437,9 +353,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 +363,11 @@
|
|||
cssls = { };
|
||||
tsserver = { };
|
||||
jsonls = { };
|
||||
nil_ls = { };
|
||||
nil_ls = {
|
||||
settings.nil = {
|
||||
formatting.command = ["nixfmt"];
|
||||
};
|
||||
};
|
||||
taplo = { };
|
||||
marksman = { };
|
||||
rust_analyzer = {
|
||||
|
@ -458,12 +378,163 @@
|
|||
]) # END
|
||||
)) # END
|
||||
]); }
|
||||
{ plugin = ps.which-key-nvim;
|
||||
config = compile "which_key_nvim" [
|
||||
(SET vim.o.timeout true)
|
||||
(SET vim.o.timeoutlen 500)
|
||||
(which-key.setup { })
|
||||
]; }
|
||||
{ settings.plugins.which-key.enable = true;
|
||||
settings.globalOpts.timeout = true;
|
||||
settings.globalOpts.timeoutlen = 500; }
|
||||
{ settings.plugins.treesitter = {
|
||||
enable = true;
|
||||
grammarPackages = with pkgs.tree-sitter-grammars; [
|
||||
tree-sitter-norg
|
||||
tree-sitter-norg-meta
|
||||
];
|
||||
settings.highlight.enable = true;
|
||||
}; }
|
||||
{ settings.plugins.image = {
|
||||
enable = true;
|
||||
backend = "kitty";
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true;
|
||||
downloadRemoteImages = false;
|
||||
};
|
||||
neorg = {
|
||||
enabled = true;
|
||||
downloadRemoteImages = true;
|
||||
};
|
||||
};
|
||||
}; }
|
||||
{ settings.plugins.telescope.enable = true; }
|
||||
{ plugin = ps.neorg;
|
||||
# TODO: remove when bumping inputs https://github.com/nix-community/nixvim/issues/1395
|
||||
settings.extraLuaPackages = (x: with x; [
|
||||
lua-utils-nvim
|
||||
pathlib-nvim
|
||||
nvim-nio
|
||||
]);
|
||||
config = (REQ "neorg").setup {
|
||||
load = {
|
||||
"core.defaults" = { };
|
||||
"core.completion".config = {
|
||||
engine = "nvim-cmp";
|
||||
};
|
||||
"core.concealer" = { };
|
||||
"core.dirman".config = {
|
||||
workspaces.ws = "~/notes";
|
||||
default_workspace = "ws";
|
||||
};
|
||||
"core.esupports.metagen".config = {
|
||||
author = "chayleaf";
|
||||
timezone = "utc";
|
||||
type = "empty";
|
||||
};
|
||||
"core.integrations.nvim-cmp" = { };
|
||||
"core.integrations.image" = { };
|
||||
"core.integrations.treesitter".config = {
|
||||
# install_parsers = false;
|
||||
};
|
||||
"core.journal".config = {
|
||||
workspace = "ws";
|
||||
};
|
||||
"core.keybinds" = { };
|
||||
"core.latex.renderer" = { };
|
||||
};
|
||||
}; }
|
||||
{ plugin = ps.neorg-telescope; }
|
||||
];
|
||||
in lib.mkMerge ((builtins.concatLists (map (x: lib.toList (x.settings or [ ])) plugins)) ++ lib.toList {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
extraPackages = with pkgs; [
|
||||
rust-analyzer
|
||||
nodePackages_latest.bash-language-server shellcheck
|
||||
nodePackages_latest.typescript-language-server
|
||||
# nodePackages_latest.svelte-language-server
|
||||
clang-tools_latest
|
||||
nodePackages_latest.vscode-langservers-extracted
|
||||
nil
|
||||
marksman
|
||||
nixfmt-rfc-style
|
||||
taplo
|
||||
ripgrep
|
||||
(python3.withPackages (p: with p; [
|
||||
python-lsp-server
|
||||
python-lsp-black
|
||||
pylsp-mypy
|
||||
python-lsp-server.optional-dependencies.pyflakes
|
||||
python-lsp-server.optional-dependencies.mccabe
|
||||
python-lsp-server.optional-dependencies.pycodestyle
|
||||
]))
|
||||
];
|
||||
# extraPython3Packages = pyPkgs: with pyPkgs; [
|
||||
# ];
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
extraConfigLua = compile "main" (
|
||||
builtins.concatLists (map (x: if x?plugin && x?config then lib.toList x.config else [ ]) plugins) ++ [
|
||||
(kmSetNs {
|
||||
"<C-X>" = {
|
||||
rhs = DEFUN (vim.fn.system [ "chmod" "+x" (vim.fn.expand "%") ]);
|
||||
desc = "chmod +x %";
|
||||
};
|
||||
})
|
||||
(SET (vimg "vimsyn_embed") "l")
|
||||
(LET (vim.api.nvim_create_augroup "nvimrc" { clear = true; }) (group:
|
||||
lib.mapAttrsToList (k: v: vim.api.nvim_create_autocmd k { inherit group; callback = v; }) {
|
||||
BufReadPre = DEFUN (SET vim.o.foldmethod "syntax");
|
||||
BufEnter = { buf, ... }:
|
||||
LET (vim.filetype.match { inherit buf; }) (filetype: [
|
||||
(IF (APPLY OR (map (EQ filetype) [ "gitcommit" "markdown" "mail" ])) (
|
||||
LET vim.o.colorcolumn (old_colorcolumn: [
|
||||
(SET vim.o.colorcolumn "73")
|
||||
(vim.api.nvim_create_autocmd "BufLeave" {
|
||||
buffer = buf;
|
||||
callback = DEFUN [
|
||||
(SET vim.o.colorcolumn old_colorcolumn)
|
||||
# return true = delete autocommand
|
||||
(RETURN true)
|
||||
];
|
||||
})
|
||||
])
|
||||
))
|
||||
(IF (APPLY OR (map (EQ filetype) [ "markdown" "mail" ])) (
|
||||
(SET (IDX vim.bo buf).textwidth 72)
|
||||
))
|
||||
]);
|
||||
BufWinEnter = { buf, ... }:
|
||||
LET (vim.filetype.match { inherit buf; }) (filetype: [
|
||||
(CALL (PROP vim.cmd "folddoc") "foldopen!")
|
||||
(IF (EQ filetype "gitcommit") (
|
||||
vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "gg" ];
|
||||
}
|
||||
) ELSE (LET
|
||||
(IDX (vim.api.nvim_buf_get_mark buf "\"") 1)
|
||||
(vim.api.nvim_buf_line_count buf)
|
||||
(pos: cnt:
|
||||
IF (AND (GE pos 1) (LE pos cnt))
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "g`\"" ];
|
||||
})
|
||||
/*ELIF*/ (GE pos 1)
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "g$" ];
|
||||
})
|
||||
ELSE
|
||||
(vim.cmd {
|
||||
cmd = "normal"; bang = true;
|
||||
args = [ "gg" ];
|
||||
})
|
||||
)))
|
||||
]);
|
||||
}
|
||||
))
|
||||
]);
|
||||
extraPlugins = builtins.filter (x: x != null) (map (x: x.plugin or null) plugins);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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,10 +198,10 @@ 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")
|
||||
''
|
||||
(supportTerminal "kitty" && config.programs.kitty.font.name == "Noto Sans Mono") {
|
||||
text = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
|
@ -215,4 +215,5 @@ in {
|
|||
</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', attr_path)
|
||||
cmd = ["nix", "build", attr_path, "--no-link", "--json"] + args
|
||||
ret = subprocess.run(cmd, check=True, encoding="utf-8", stdout=subprocess.PIPE)
|
||||
ret = json.loads(ret.stdout)[0]["outputs"]["out"]
|
||||
print('output', ret)
|
||||
cmds = []
|
||||
if act in ["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";
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
, xorg
|
||||
, xvfb-run
|
||||
, dbus
|
||||
, gnome
|
||||
, adwaita-icon-theme
|
||||
, alsa-lib
|
||||
, glib
|
||||
, glib-networking
|
||||
|
@ -89,7 +89,7 @@ in gimp.overrideAttrs (old: rec {
|
|||
json-glib
|
||||
python
|
||||
xorg.libXmu
|
||||
gnome.adwaita-icon-theme
|
||||
adwaita-icon-theme
|
||||
(luajit.withPackages (ps: [ ps.lgi ]))
|
||||
alsa-lib
|
||||
gjs
|
||||
|
@ -130,7 +130,7 @@ in gimp.overrideAttrs (old: rec {
|
|||
preFixup = ''
|
||||
gappsWrapperArgs+=(\
|
||||
--prefix PATH : "${lib.makeBinPath [ graphviz ]}:$out/bin" \
|
||||
--suffix XDG_DATA_DIRS : "${gnome.adwaita-icon-theme}/share" \
|
||||
--suffix XDG_DATA_DIRS : "${adwaita-icon-theme}/share" \
|
||||
)
|
||||
'';
|
||||
postFixup = ''
|
||||
|
|
|
@ -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");
|
210
pkgs/mako/0001-add-on-long-touch-option.patch
Normal file
210
pkgs/mako/0001-add-on-long-touch-option.patch
Normal file
|
@ -0,0 +1,210 @@
|
|||
From 85bbcf7e18136f788cf76bb6f345ade84a5e536e Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 10:49:21 +0700
|
||||
Subject: [PATCH 1/5] add on-long-touch option
|
||||
|
||||
---
|
||||
config.c | 21 +++++++++++++++++++++
|
||||
doc/mako.5.scd | 15 ++++++++++++++-
|
||||
include/config.h | 7 ++++---
|
||||
include/notification.h | 2 +-
|
||||
include/wayland.h | 1 +
|
||||
notification.c | 8 ++++++--
|
||||
wayland.c | 3 ++-
|
||||
7 files changed, 49 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/config.c b/config.c
|
||||
index 70be717..87db932 100644
|
||||
--- a/config.c
|
||||
+++ b/config.c
|
||||
@@ -129,6 +129,9 @@ void init_default_style(struct mako_style *style) {
|
||||
style->button_bindings.right.action = MAKO_BINDING_DISMISS;
|
||||
style->button_bindings.middle.action = MAKO_BINDING_NONE;
|
||||
style->touch_binding.action = MAKO_BINDING_DISMISS;
|
||||
+ style->long_touch_binding.action = MAKO_BINDING_INVOKE_ACTION;
|
||||
+ style->long_touch_binding.action_name = strdup(DEFAULT_ACTION_KEY);
|
||||
+ style->long_press_duration = 500;
|
||||
|
||||
// Everything in the default config is explicitly specified.
|
||||
memset(&style->spec, true, sizeof(struct mako_style_spec));
|
||||
@@ -148,6 +151,7 @@ void finish_style(struct mako_style *style) {
|
||||
finish_binding(&style->button_bindings.middle);
|
||||
finish_binding(&style->button_bindings.right);
|
||||
finish_binding(&style->touch_binding);
|
||||
+ finish_binding(&style->long_touch_binding);
|
||||
finish_binding(&style->notify_binding);
|
||||
free(style->icon_path);
|
||||
free(style->font);
|
||||
@@ -385,6 +389,16 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
|
||||
target->spec.touch_binding = true;
|
||||
}
|
||||
|
||||
+ if (style->spec.long_touch_binding) {
|
||||
+ copy_binding(&target->long_touch_binding, &style->long_touch_binding);
|
||||
+ target->spec.long_touch_binding = true;
|
||||
+ }
|
||||
+
|
||||
+ if (style->spec.long_press_duration) {
|
||||
+ target->long_press_duration = style->long_press_duration;
|
||||
+ target->spec.long_press_duration = true;
|
||||
+ }
|
||||
+
|
||||
if (style->spec.notify_binding) {
|
||||
copy_binding(&target->notify_binding, &style->notify_binding);
|
||||
target->spec.notify_binding = true;
|
||||
@@ -660,6 +674,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
||||
return true;
|
||||
} else if (strcmp(name, "anchor") == 0) {
|
||||
return spec->anchor = parse_anchor(value, &style->anchor);
|
||||
+ } else if (strcmp(name, "long-press-duration") == 0) {
|
||||
+ return spec->long_press_duration = parse_int_ge(value, &style->long_press_duration, 0);
|
||||
} else if (has_prefix(name, "on-")) {
|
||||
struct mako_binding binding = {0};
|
||||
if (strcmp(value, "none") == 0) {
|
||||
@@ -697,6 +713,9 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
||||
} else if (strcmp(name, "on-touch") == 0) {
|
||||
copy_binding(&style->touch_binding, &binding);
|
||||
style->spec.touch_binding = true;
|
||||
+ } else if (strcmp(name, "on-long-touch") == 0) {
|
||||
+ copy_binding(&style->long_touch_binding, &binding);
|
||||
+ style->spec.long_touch_binding = true;
|
||||
} else if (strcmp(name, "on-notify") == 0) {
|
||||
copy_binding(&style->notify_binding, &binding);
|
||||
style->spec.notify_binding = true;
|
||||
@@ -886,6 +905,8 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
|
||||
{"on-button-right", required_argument, 0, 0},
|
||||
{"on-button-middle", required_argument, 0, 0},
|
||||
{"on-touch", required_argument, 0, 0},
|
||||
+ {"on-long-touch", required_argument, 0, 0},
|
||||
+ {"long-press-duration", required_argument, 0, 0},
|
||||
{0},
|
||||
};
|
||||
|
||||
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
|
||||
index 91378ba..fff19ed 100644
|
||||
--- a/doc/mako.5.scd
|
||||
+++ b/doc/mako.5.scd
|
||||
@@ -57,10 +57,23 @@ Supported options:
|
||||
Default: dismiss
|
||||
|
||||
*on-touch*=_action_
|
||||
- Performs the action when tapped via a touch device.
|
||||
+ Performs the action when tapped via a touch device if the tap
|
||||
+ duration is less than *long-press-duration*.
|
||||
|
||||
Default: dismiss
|
||||
|
||||
+*on-long-touch*=_action_
|
||||
+ Performs the action when tapped via a touch device if the press
|
||||
+ duration is greater or equal to *long-press-duration*.
|
||||
+
|
||||
+ Default: invoke-default-action
|
||||
+
|
||||
+*long-press-duration*=_time_
|
||||
+ Specifies the cutoff time (in milliseconds) for a press to be
|
||||
+ considered a long press.
|
||||
+
|
||||
+ Default: 500
|
||||
+
|
||||
*on-notify*=_action_
|
||||
Performs the action when the notification is opened.
|
||||
|
||||
diff --git a/include/config.h b/include/config.h
|
||||
index 013923a..5ff541c 100644
|
||||
--- a/include/config.h
|
||||
+++ b/include/config.h
|
||||
@@ -42,14 +42,14 @@ struct mako_style_spec {
|
||||
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
|
||||
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
|
||||
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
|
||||
- icon_location, max_visible, layer, output, anchor;
|
||||
+ icon_location, max_visible, layer, output, anchor, long_press_duration;
|
||||
struct {
|
||||
bool background, text, border, progress;
|
||||
} colors;
|
||||
struct {
|
||||
bool left, right, middle;
|
||||
} button_bindings;
|
||||
- bool touch_binding, notify_binding;
|
||||
+ bool touch_binding, long_touch_binding, notify_binding;
|
||||
};
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ struct mako_style {
|
||||
struct {
|
||||
struct mako_binding left, right, middle;
|
||||
} button_bindings;
|
||||
- struct mako_binding touch_binding, notify_binding;
|
||||
+ struct mako_binding touch_binding, long_touch_binding, notify_binding;
|
||||
+ int32_t long_press_duration;
|
||||
};
|
||||
|
||||
struct mako_config {
|
||||
diff --git a/include/notification.h b/include/notification.h
|
||||
index 9a395ba..a02d855 100644
|
||||
--- a/include/notification.h
|
||||
+++ b/include/notification.h
|
||||
@@ -101,7 +101,7 @@ size_t format_notification(struct mako_notification *notif, const char *format,
|
||||
void notification_handle_button(struct mako_notification *notif, uint32_t button,
|
||||
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
|
||||
void notification_handle_touch(struct mako_notification *notif,
|
||||
- const struct mako_binding_context *ctx);
|
||||
+ const struct mako_binding_context *ctx, int32_t duration_ms);
|
||||
void notification_execute_binding(struct mako_notification *notif,
|
||||
const struct mako_binding *binding, const struct mako_binding_context *ctx);
|
||||
void insert_notification(struct mako_state *state, struct mako_notification *notif);
|
||||
diff --git a/include/wayland.h b/include/wayland.h
|
||||
index cc00500..c8767be 100644
|
||||
--- a/include/wayland.h
|
||||
+++ b/include/wayland.h
|
||||
@@ -35,6 +35,7 @@ struct mako_seat {
|
||||
struct wl_touch *wl_touch;
|
||||
struct {
|
||||
int32_t x, y;
|
||||
+ uint32_t time;
|
||||
struct mako_surface *surface;
|
||||
} pts[MAX_TOUCHPOINTS];
|
||||
} touch;
|
||||
diff --git a/notification.c b/notification.c
|
||||
index 8c0c8a7..7d3db2f 100644
|
||||
--- a/notification.c
|
||||
+++ b/notification.c
|
||||
@@ -446,8 +446,12 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
|
||||
}
|
||||
|
||||
void notification_handle_touch(struct mako_notification *notif,
|
||||
- const struct mako_binding_context *ctx) {
|
||||
- notification_execute_binding(notif, ¬if->style.touch_binding, ctx);
|
||||
+ const struct mako_binding_context *ctx, int32_t duration_ms) {
|
||||
+ if (duration_ms >= notif->style.long_press_duration) {
|
||||
+ notification_execute_binding(notif, ¬if->style.long_touch_binding, ctx);
|
||||
+ } else {
|
||||
+ notification_execute_binding(notif, ¬if->style.touch_binding, ctx);
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/wayland.c b/wayland.c
|
||||
index eeefb30..d247779 100644
|
||||
--- a/wayland.c
|
||||
+++ b/wayland.c
|
||||
@@ -122,6 +122,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
|
||||
}
|
||||
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
|
||||
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
|
||||
+ seat->touch.pts[id].time = time;
|
||||
seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch,
|
||||
wl_list_for_each(notif, &state->notifications, link) {
|
||||
if (hotspot_at(¬if->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
|
||||
struct mako_surface *surface = notif->surface;
|
||||
- notification_handle_touch(notif, &ctx);
|
||||
+ notification_handle_touch(notif, &ctx, time - seat->touch.pts[id].time);
|
||||
set_dirty(surface);
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
From 7365261e130016e884371d2e288b83e16a9dcb48 Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 13:50:38 +0700
|
||||
Subject: [PATCH 2/5] consider long press done even before release
|
||||
|
||||
---
|
||||
include/notification.h | 16 ++++++++++------
|
||||
include/wayland.h | 1 +
|
||||
notification.c | 22 ++++++++++++++++++++++
|
||||
wayland.c | 15 ++++++++++++++-
|
||||
4 files changed, 47 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/include/notification.h b/include/notification.h
|
||||
index a02d855..b1482ec 100644
|
||||
--- a/include/notification.h
|
||||
+++ b/include/notification.h
|
||||
@@ -19,6 +19,12 @@ struct mako_hotspot {
|
||||
int32_t width, height;
|
||||
};
|
||||
|
||||
+struct mako_binding_context {
|
||||
+ struct mako_surface *surface;
|
||||
+ struct mako_seat *seat;
|
||||
+ uint32_t serial;
|
||||
+};
|
||||
+
|
||||
struct mako_notification {
|
||||
struct mako_state *state;
|
||||
struct mako_surface *surface;
|
||||
@@ -38,6 +44,8 @@ struct mako_notification {
|
||||
char *body;
|
||||
int32_t requested_timeout;
|
||||
struct wl_list actions; // mako_action::link
|
||||
+ struct mako_timer *long_press_timer;
|
||||
+ struct mako_binding_context long_press_ctx;
|
||||
|
||||
enum mako_notification_urgency urgency;
|
||||
char *category;
|
||||
@@ -70,12 +78,6 @@ struct mako_hidden_format_data {
|
||||
size_t count;
|
||||
};
|
||||
|
||||
-struct mako_binding_context {
|
||||
- struct mako_surface *surface;
|
||||
- struct mako_seat *seat;
|
||||
- uint32_t serial;
|
||||
-};
|
||||
-
|
||||
typedef char *(*mako_format_func_t)(char variable, bool *markup, void *data);
|
||||
|
||||
bool hotspot_at(struct mako_hotspot *hotspot, int32_t x, int32_t y);
|
||||
@@ -100,6 +102,8 @@ size_t format_notification(struct mako_notification *notif, const char *format,
|
||||
char *buf);
|
||||
void notification_handle_button(struct mako_notification *notif, uint32_t button,
|
||||
enum wl_pointer_button_state state, const struct mako_binding_context *ctx);
|
||||
+void notification_handle_touch_start(struct mako_notification *notif,
|
||||
+ const struct mako_binding_context *ctx);
|
||||
void notification_handle_touch(struct mako_notification *notif,
|
||||
const struct mako_binding_context *ctx, int32_t duration_ms);
|
||||
void notification_execute_binding(struct mako_notification *notif,
|
||||
diff --git a/include/wayland.h b/include/wayland.h
|
||||
index c8767be..d4d39c4 100644
|
||||
--- a/include/wayland.h
|
||||
+++ b/include/wayland.h
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
+#include "mako.h"
|
||||
|
||||
#define MAX_TOUCHPOINTS 10
|
||||
|
||||
diff --git a/notification.c b/notification.c
|
||||
index 7d3db2f..32e7f7b 100644
|
||||
--- a/notification.c
|
||||
+++ b/notification.c
|
||||
@@ -41,6 +41,8 @@ void reset_notification(struct mako_notification *notif) {
|
||||
|
||||
destroy_timer(notif->timer);
|
||||
notif->timer = NULL;
|
||||
+ destroy_timer(notif->long_press_timer);
|
||||
+ notif->long_press_timer = NULL;
|
||||
|
||||
free(notif->app_name);
|
||||
free(notif->app_icon);
|
||||
@@ -447,6 +449,8 @@ void notification_handle_button(struct mako_notification *notif, uint32_t button
|
||||
|
||||
void notification_handle_touch(struct mako_notification *notif,
|
||||
const struct mako_binding_context *ctx, int32_t duration_ms) {
|
||||
+ destroy_timer(notif->long_press_timer);
|
||||
+ notif->long_press_timer = NULL;
|
||||
if (duration_ms >= notif->style.long_press_duration) {
|
||||
notification_execute_binding(notif, ¬if->style.long_touch_binding, ctx);
|
||||
} else {
|
||||
@@ -454,6 +458,24 @@ void notification_handle_touch(struct mako_notification *notif,
|
||||
}
|
||||
}
|
||||
|
||||
+void handle_notification_touch_timer(void *data) {
|
||||
+ struct mako_notification *notif = data;
|
||||
+ notif->long_press_timer = NULL;
|
||||
+ struct mako_binding_context ctx = notif->long_press_ctx;
|
||||
+ notification_execute_binding(notif, ¬if->style.long_touch_binding, &ctx);
|
||||
+ set_dirty(ctx.surface);
|
||||
+}
|
||||
+
|
||||
+void notification_handle_touch_start(struct mako_notification *notif,
|
||||
+ const struct mako_binding_context *ctx) {
|
||||
+ if (notif->long_press_timer) {
|
||||
+ return;
|
||||
+ }
|
||||
+ notif->long_press_ctx = *ctx;
|
||||
+ notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, 500,
|
||||
+ handle_notification_touch_timer, notif);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Searches through the notifications list and returns the next position at
|
||||
* which to insert. If no results for the specified urgency are found,
|
||||
diff --git a/wayland.c b/wayland.c
|
||||
index d247779..6d8b6ff 100644
|
||||
--- a/wayland.c
|
||||
+++ b/wayland.c
|
||||
@@ -120,10 +120,23 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
|
||||
if (id >= MAX_TOUCHPOINTS) {
|
||||
return;
|
||||
}
|
||||
+ struct mako_state *state = seat->state;
|
||||
seat->touch.pts[id].x = wl_fixed_to_int(surface_x);
|
||||
seat->touch.pts[id].y = wl_fixed_to_int(surface_y);
|
||||
seat->touch.pts[id].time = time;
|
||||
- seat->touch.pts[id].surface = get_surface(seat->state, wl_surface);
|
||||
+ seat->touch.pts[id].surface = get_surface(state, wl_surface);
|
||||
+
|
||||
+ struct mako_notification *notif;
|
||||
+ const struct mako_binding_context ctx = {
|
||||
+ .surface = seat->touch.pts[id].surface,
|
||||
+ .seat = seat,
|
||||
+ .serial = serial,
|
||||
+ };
|
||||
+ wl_list_for_each(notif, &state->notifications, link) {
|
||||
+ if (hotspot_at(¬if->hotspot, seat->touch.pts[id].x, seat->touch.pts[id].y)) {
|
||||
+ notification_handle_touch_start(notif, &ctx);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
static void touch_handle_up(void *data, struct wl_touch *wl_touch,
|
||||
--
|
||||
2.45.2
|
||||
|
284
pkgs/mako/0003-dynamic-timeouts.patch
Normal file
284
pkgs/mako/0003-dynamic-timeouts.patch
Normal file
|
@ -0,0 +1,284 @@
|
|||
From 0b53bc7fb9494bc7a804a1d088c6b4137d6eef6d Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 08:47:49 +0700
|
||||
Subject: [PATCH 3/5] dynamic timeouts
|
||||
|
||||
Compute notification timeouts on every config change, rather than only
|
||||
on notification creation.
|
||||
---
|
||||
criteria.c | 50 ++++++++++++++++++++++++++++++++++++++----
|
||||
dbus/mako.c | 2 +-
|
||||
dbus/xdg.c | 21 +-----------------
|
||||
event-loop.c | 22 +++----------------
|
||||
include/criteria.h | 4 ++--
|
||||
include/event-loop.h | 2 +-
|
||||
include/notification.h | 1 +
|
||||
notification.c | 2 ++
|
||||
render.c | 4 ++--
|
||||
9 files changed, 59 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/criteria.c b/criteria.c
|
||||
index 9db3966..3108a38 100644
|
||||
--- a/criteria.c
|
||||
+++ b/criteria.c
|
||||
@@ -418,15 +418,38 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
-// Iterate through `criteria_list`, applying the style from each matching
|
||||
+static void timespec_add(struct timespec *t, int delta_ms) {
|
||||
+ static const long ms = 1000000, s = 1000000000;
|
||||
+
|
||||
+ int delta_ms_low = delta_ms % 1000;
|
||||
+ int delta_s_high = delta_ms / 1000;
|
||||
+
|
||||
+ t->tv_sec += delta_s_high;
|
||||
+
|
||||
+ t->tv_nsec += (long)delta_ms_low * ms;
|
||||
+ if (t->tv_nsec >= s) {
|
||||
+ t->tv_nsec -= s;
|
||||
+ ++t->tv_sec;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void handle_notification_timer(void *data) {
|
||||
+ struct mako_notification *notif = data;
|
||||
+ struct mako_surface *surface = notif->surface;
|
||||
+ notif->timer = NULL;
|
||||
+
|
||||
+ close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
|
||||
+ set_dirty(surface);
|
||||
+}
|
||||
+
|
||||
+// Iterate through the criteria list, applying the style from each matching
|
||||
// criteria to `notif`. Returns the number of criteria that matched, or -1 if
|
||||
// a failure occurs.
|
||||
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
||||
- struct mako_notification *notif) {
|
||||
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif) {
|
||||
ssize_t match_count = 0;
|
||||
|
||||
struct mako_criteria *criteria;
|
||||
- wl_list_for_each(criteria, criteria_list, link) {
|
||||
+ wl_list_for_each(criteria, &state->config.criteria, link) {
|
||||
if (!match_criteria(criteria, notif)) {
|
||||
continue;
|
||||
}
|
||||
@@ -447,6 +470,25 @@ ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
||||
}
|
||||
}
|
||||
|
||||
+ int32_t expire_timeout = notif->requested_timeout;
|
||||
+ if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
||||
+ expire_timeout = notif->style.default_timeout;
|
||||
+ }
|
||||
+
|
||||
+ if (expire_timeout > 0) {
|
||||
+ struct timespec at = notif->at;
|
||||
+ timespec_add(&at, expire_timeout);
|
||||
+ if (notif->timer) {
|
||||
+ notif->timer->at = at;
|
||||
+ } else {
|
||||
+ notif->timer = add_event_loop_timer(&state->event_loop, &at,
|
||||
+ handle_notification_timer, notif);
|
||||
+ }
|
||||
+ } else if (notif->timer) {
|
||||
+ destroy_timer(notif->timer);
|
||||
+ notif->timer = NULL;
|
||||
+ }
|
||||
+
|
||||
if (!notif->surface) {
|
||||
notif->surface = create_surface(notif->state, notif->style.output,
|
||||
notif->style.layer, notif->style.anchor);
|
||||
diff --git a/dbus/mako.c b/dbus/mako.c
|
||||
index 4c95881..8f3c874 100644
|
||||
--- a/dbus/mako.c
|
||||
+++ b/dbus/mako.c
|
||||
@@ -305,7 +305,7 @@ static void reapply_config(struct mako_state *state) {
|
||||
|
||||
finish_style(¬if->style);
|
||||
init_empty_style(¬if->style);
|
||||
- apply_each_criteria(&state->config.criteria, notif);
|
||||
+ apply_each_criteria(state, notif);
|
||||
|
||||
// Having to do this for every single notification really hurts... but
|
||||
// it does do The Right Thing (tm).
|
||||
diff --git a/dbus/xdg.c b/dbus/xdg.c
|
||||
index 1f91431..650dff7 100644
|
||||
--- a/dbus/xdg.c
|
||||
+++ b/dbus/xdg.c
|
||||
@@ -81,15 +81,6 @@ static int handle_get_capabilities(sd_bus_message *msg, void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void handle_notification_timer(void *data) {
|
||||
- struct mako_notification *notif = data;
|
||||
- struct mako_surface *surface = notif->surface;
|
||||
- notif->timer = NULL;
|
||||
-
|
||||
- close_notification(notif, MAKO_NOTIFICATION_CLOSE_EXPIRED, true);
|
||||
- set_dirty(surface);
|
||||
-}
|
||||
-
|
||||
static int handle_notify(sd_bus_message *msg, void *data,
|
||||
sd_bus_error *ret_error) {
|
||||
struct mako_state *state = data;
|
||||
@@ -382,7 +373,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
|
||||
insert_notification(state, notif);
|
||||
}
|
||||
|
||||
- int match_count = apply_each_criteria(&state->config.criteria, notif);
|
||||
+ int match_count = apply_each_criteria(state, notif);
|
||||
if (match_count == -1) {
|
||||
// We encountered an allocation failure or similar while applying
|
||||
// criteria. The notification may be partially matched, but the worst
|
||||
@@ -398,16 +389,6 @@ static int handle_notify(sd_bus_message *msg, void *data,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- int32_t expire_timeout = notif->requested_timeout;
|
||||
- if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
||||
- expire_timeout = notif->style.default_timeout;
|
||||
- }
|
||||
-
|
||||
- if (expire_timeout > 0) {
|
||||
- notif->timer = add_event_loop_timer(&state->event_loop, expire_timeout,
|
||||
- handle_notification_timer, notif);
|
||||
- }
|
||||
-
|
||||
if (notif->style.icons) {
|
||||
notif->icon = create_icon(notif);
|
||||
}
|
||||
diff --git a/event-loop.c b/event-loop.c
|
||||
index 99c1f4a..92c627a 100644
|
||||
--- a/event-loop.c
|
||||
+++ b/event-loop.c
|
||||
@@ -74,21 +74,6 @@ void finish_event_loop(struct mako_event_loop *loop) {
|
||||
}
|
||||
}
|
||||
|
||||
-static void timespec_add(struct timespec *t, int delta_ms) {
|
||||
- static const long ms = 1000000, s = 1000000000;
|
||||
-
|
||||
- int delta_ms_low = delta_ms % 1000;
|
||||
- int delta_s_high = delta_ms / 1000;
|
||||
-
|
||||
- t->tv_sec += delta_s_high;
|
||||
-
|
||||
- t->tv_nsec += (long)delta_ms_low * ms;
|
||||
- if (t->tv_nsec >= s) {
|
||||
- t->tv_nsec -= s;
|
||||
- ++t->tv_sec;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static bool timespec_less(struct timespec *t1, struct timespec *t2) {
|
||||
if (t1->tv_sec != t2->tv_sec) {
|
||||
return t1->tv_sec < t2->tv_sec;
|
||||
@@ -124,7 +109,7 @@ static void update_event_loop_timer(struct mako_event_loop *loop) {
|
||||
}
|
||||
|
||||
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
||||
- int delay_ms, mako_event_loop_timer_func_t func, void *data) {
|
||||
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data) {
|
||||
struct mako_timer *timer = calloc(1, sizeof(struct mako_timer));
|
||||
if (timer == NULL) {
|
||||
fprintf(stderr, "allocation failed\n");
|
||||
@@ -133,10 +118,9 @@ struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
||||
timer->event_loop = loop;
|
||||
timer->func = func;
|
||||
timer->user_data = data;
|
||||
- wl_list_insert(&loop->timers, &timer->link);
|
||||
+ timer->at = *at;
|
||||
|
||||
- clock_gettime(CLOCK_MONOTONIC, &timer->at);
|
||||
- timespec_add(&timer->at, delay_ms);
|
||||
+ wl_list_insert(&loop->timers, &timer->link);
|
||||
|
||||
update_event_loop_timer(loop);
|
||||
return timer;
|
||||
diff --git a/include/criteria.h b/include/criteria.h
|
||||
index 2f03514..58c36ef 100644
|
||||
--- a/include/criteria.h
|
||||
+++ b/include/criteria.h
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <wayland-client.h>
|
||||
#include "config.h"
|
||||
#include "types.h"
|
||||
+#include "mako.h"
|
||||
|
||||
struct mako_config;
|
||||
struct mako_notification;
|
||||
@@ -53,8 +54,7 @@ bool parse_criteria(const char *string, struct mako_criteria *criteria);
|
||||
bool apply_criteria_field(struct mako_criteria *criteria, char *token);
|
||||
|
||||
struct mako_criteria *global_criteria(struct mako_config *config);
|
||||
-ssize_t apply_each_criteria(struct wl_list *criteria_list,
|
||||
- struct mako_notification *notif);
|
||||
+ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *notif);
|
||||
struct mako_criteria *create_criteria_from_notification(
|
||||
struct mako_notification *notif, struct mako_criteria_spec *spec);
|
||||
|
||||
diff --git a/include/event-loop.h b/include/event-loop.h
|
||||
index 95c8d36..cd63e98 100644
|
||||
--- a/include/event-loop.h
|
||||
+++ b/include/event-loop.h
|
||||
@@ -47,7 +47,7 @@ bool init_event_loop(struct mako_event_loop *loop, sd_bus *bus,
|
||||
void finish_event_loop(struct mako_event_loop *loop);
|
||||
int run_event_loop(struct mako_event_loop *loop);
|
||||
struct mako_timer *add_event_loop_timer(struct mako_event_loop *loop,
|
||||
- int delay_ms, mako_event_loop_timer_func_t func, void *data);
|
||||
+ struct timespec *at, mako_event_loop_timer_func_t func, void *data);
|
||||
|
||||
void destroy_timer(struct mako_timer *timer);
|
||||
|
||||
diff --git a/include/notification.h b/include/notification.h
|
||||
index b1482ec..2775d88 100644
|
||||
--- a/include/notification.h
|
||||
+++ b/include/notification.h
|
||||
@@ -56,6 +56,7 @@ struct mako_notification {
|
||||
|
||||
struct mako_hotspot hotspot;
|
||||
struct mako_timer *timer;
|
||||
+ struct timespec at;
|
||||
};
|
||||
|
||||
struct mako_action {
|
||||
diff --git a/notification.c b/notification.c
|
||||
index 32e7f7b..b78bd09 100644
|
||||
--- a/notification.c
|
||||
+++ b/notification.c
|
||||
@@ -68,6 +68,8 @@ void reset_notification(struct mako_notification *notif) {
|
||||
|
||||
destroy_icon(notif->icon);
|
||||
notif->icon = NULL;
|
||||
+
|
||||
+ clock_gettime(CLOCK_MONOTONIC, ¬if->at);
|
||||
}
|
||||
|
||||
struct mako_notification *create_notification(struct mako_state *state) {
|
||||
diff --git a/render.c b/render.c
|
||||
index 5b68632..44b78a0 100644
|
||||
--- a/render.c
|
||||
+++ b/render.c
|
||||
@@ -355,7 +355,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
|
||||
// Immediately before rendering we need to re-match all of the criteria
|
||||
// so that matches against the anchor and output work even if the
|
||||
// output was automatically assigned by the compositor.
|
||||
- int rematch_count = apply_each_criteria(&state->config.criteria, notif);
|
||||
+ int rematch_count = apply_each_criteria(state, notif);
|
||||
if (rematch_count == -1) {
|
||||
// We encountered an allocation failure or similar while applying
|
||||
// criteria. The notification may be partially matched, but the
|
||||
@@ -427,7 +427,7 @@ void render(struct mako_surface *surface, struct pool_buffer *buffer, int scale,
|
||||
struct mako_notification *hidden_notif = create_notification(state);
|
||||
hidden_notif->surface = surface;
|
||||
hidden_notif->hidden = true;
|
||||
- apply_each_criteria(&state->config.criteria, hidden_notif);
|
||||
+ apply_each_criteria(state, hidden_notif);
|
||||
|
||||
struct mako_style *style = &hidden_notif->style;
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
192
pkgs/mako/0004-implement-notification-time-freezing.patch
Normal file
192
pkgs/mako/0004-implement-notification-time-freezing.patch
Normal file
|
@ -0,0 +1,192 @@
|
|||
From e2cb0d80c643b03a61f69f85454c9ed06eda5c3e Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 09:19:34 +0700
|
||||
Subject: [PATCH 4/5] implement notification time freezing
|
||||
|
||||
---
|
||||
config.c | 8 +++++++
|
||||
criteria.c | 49 +++++++++++++++++++++++++++++++++++-------
|
||||
doc/mako.5.scd | 6 ++++++
|
||||
include/config.h | 4 +++-
|
||||
include/notification.h | 2 ++
|
||||
notification.c | 1 +
|
||||
6 files changed, 61 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/config.c b/config.c
|
||||
index 87db932..79dc58a 100644
|
||||
--- a/config.c
|
||||
+++ b/config.c
|
||||
@@ -105,6 +105,7 @@ void init_default_style(struct mako_style *style) {
|
||||
style->actions = true;
|
||||
style->default_timeout = 0;
|
||||
style->ignore_timeout = false;
|
||||
+ style->freeze = false;
|
||||
|
||||
style->colors.background = 0x285577FF;
|
||||
style->colors.text = 0xFFFFFFFF;
|
||||
@@ -305,6 +306,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
|
||||
target->spec.ignore_timeout = true;
|
||||
}
|
||||
|
||||
+ if (style->spec.freeze) {
|
||||
+ target->freeze = style->freeze;
|
||||
+ target->spec.freeze = true;
|
||||
+ }
|
||||
+
|
||||
if (style->spec.colors.background) {
|
||||
target->colors.background = style->colors.background;
|
||||
target->spec.colors.background = true;
|
||||
@@ -637,6 +643,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
|
||||
} else if (strcmp(name, "ignore-timeout") == 0) {
|
||||
return spec->ignore_timeout =
|
||||
parse_boolean(value, &style->ignore_timeout);
|
||||
+ } else if (strcmp(name, "freeze") == 0) {
|
||||
+ return spec->freeze = parse_boolean(value, &style->freeze);
|
||||
} else if (strcmp(name, "group-by") == 0) {
|
||||
return spec->group_criteria_spec =
|
||||
parse_criteria_spec(value, &style->group_criteria_spec);
|
||||
diff --git a/criteria.c b/criteria.c
|
||||
index 3108a38..523a467 100644
|
||||
--- a/criteria.c
|
||||
+++ b/criteria.c
|
||||
@@ -418,21 +418,39 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
-static void timespec_add(struct timespec *t, int delta_ms) {
|
||||
- static const long ms = 1000000, s = 1000000000;
|
||||
+static void timespec_from_ms(struct timespec *t, long time_ms) {
|
||||
+ static const long ms = 1000000;
|
||||
|
||||
- int delta_ms_low = delta_ms % 1000;
|
||||
- int delta_s_high = delta_ms / 1000;
|
||||
+ t->tv_sec = time_ms / 1000;
|
||||
+ t->tv_nsec = (time_ms % 1000) * ms;
|
||||
+}
|
||||
+
|
||||
+static void timespec_add(struct timespec *t, struct timespec *u) {
|
||||
+ static const long s = 1000000000;
|
||||
|
||||
- t->tv_sec += delta_s_high;
|
||||
+ t->tv_sec += u->tv_sec;
|
||||
+ t->tv_nsec += u->tv_nsec;
|
||||
|
||||
- t->tv_nsec += (long)delta_ms_low * ms;
|
||||
if (t->tv_nsec >= s) {
|
||||
t->tv_nsec -= s;
|
||||
++t->tv_sec;
|
||||
}
|
||||
}
|
||||
|
||||
+static void timespec_sub(struct timespec *t, struct timespec *u) {
|
||||
+ static const long s = 1000000000;
|
||||
+
|
||||
+ t->tv_sec -= u->tv_sec;
|
||||
+ t->tv_nsec += s;
|
||||
+ t->tv_nsec -= u->tv_nsec;
|
||||
+
|
||||
+ if (t->tv_nsec >= s) {
|
||||
+ t->tv_nsec -= s;
|
||||
+ } else {
|
||||
+ --t->tv_sec;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void handle_notification_timer(void *data) {
|
||||
struct mako_notification *notif = data;
|
||||
struct mako_surface *surface = notif->surface;
|
||||
@@ -474,10 +492,25 @@ ssize_t apply_each_criteria(struct mako_state *state, struct mako_notification *
|
||||
if (expire_timeout < 0 || notif->style.ignore_timeout) {
|
||||
expire_timeout = notif->style.default_timeout;
|
||||
}
|
||||
+ if (notif->frozen != notif->style.freeze) {
|
||||
+ struct timespec now;
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
+ if (notif->style.freeze) {
|
||||
+ notif->froze_at = now;
|
||||
+ } else {
|
||||
+ timespec_sub(&now, ¬if->froze_at);
|
||||
+ timespec_add(¬if->at, &now);
|
||||
+ }
|
||||
+ notif->frozen = notif->style.freeze;
|
||||
+ }
|
||||
+ if (notif->frozen) {
|
||||
+ expire_timeout = 0;
|
||||
+ }
|
||||
|
||||
if (expire_timeout > 0) {
|
||||
- struct timespec at = notif->at;
|
||||
- timespec_add(&at, expire_timeout);
|
||||
+ struct timespec at = notif->at, delta;
|
||||
+ timespec_from_ms(&delta, expire_timeout);
|
||||
+ timespec_add(&at, &delta);
|
||||
if (notif->timer) {
|
||||
notif->timer->at = at;
|
||||
} else {
|
||||
diff --git a/doc/mako.5.scd b/doc/mako.5.scd
|
||||
index fff19ed..c0be528 100644
|
||||
--- a/doc/mako.5.scd
|
||||
+++ b/doc/mako.5.scd
|
||||
@@ -421,6 +421,12 @@ associated command-line option.
|
||||
|
||||
Default: 0
|
||||
|
||||
+*freeze*=0|1
|
||||
+ Whether to freeze this notification's active timeout, stopping it from
|
||||
+ progressing. This can be used for pausing notifications while you're away.
|
||||
+
|
||||
+ Default: 0
|
||||
+
|
||||
# COLORS
|
||||
|
||||
Colors can be specified as _#RRGGBB_ or _#RRGGBBAA_.
|
||||
diff --git a/include/config.h b/include/config.h
|
||||
index 5ff541c..53116e1 100644
|
||||
--- a/include/config.h
|
||||
+++ b/include/config.h
|
||||
@@ -42,7 +42,8 @@ struct mako_style_spec {
|
||||
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
|
||||
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
|
||||
icons, max_icon_size, icon_path, group_criteria_spec, invisible, history,
|
||||
- icon_location, max_visible, layer, output, anchor, long_press_duration;
|
||||
+ icon_location, max_visible, layer, output, anchor, long_press_duration,
|
||||
+ freeze;
|
||||
struct {
|
||||
bool background, text, border, progress;
|
||||
} colors;
|
||||
@@ -76,6 +77,7 @@ struct mako_style {
|
||||
bool actions;
|
||||
int default_timeout; // in ms
|
||||
bool ignore_timeout;
|
||||
+ bool freeze;
|
||||
|
||||
struct {
|
||||
uint32_t background;
|
||||
diff --git a/include/notification.h b/include/notification.h
|
||||
index 2775d88..a631b49 100644
|
||||
--- a/include/notification.h
|
||||
+++ b/include/notification.h
|
||||
@@ -57,6 +57,8 @@ struct mako_notification {
|
||||
struct mako_hotspot hotspot;
|
||||
struct mako_timer *timer;
|
||||
struct timespec at;
|
||||
+ struct timespec froze_at;
|
||||
+ bool frozen;
|
||||
};
|
||||
|
||||
struct mako_action {
|
||||
diff --git a/notification.c b/notification.c
|
||||
index b78bd09..ce0bafd 100644
|
||||
--- a/notification.c
|
||||
+++ b/notification.c
|
||||
@@ -70,6 +70,7 @@ void reset_notification(struct mako_notification *notif) {
|
||||
notif->icon = NULL;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, ¬if->at);
|
||||
+ notif->frozen = false;
|
||||
}
|
||||
|
||||
struct mako_notification *create_notification(struct mako_state *state) {
|
||||
--
|
||||
2.45.2
|
||||
|
64
pkgs/mako/0005-cherry-pick-fixup.patch
Normal file
64
pkgs/mako/0005-cherry-pick-fixup.patch
Normal file
|
@ -0,0 +1,64 @@
|
|||
From cf4c99d9fa92e397b3860a71d293957741abc7c2 Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 14:22:23 +0700
|
||||
Subject: [PATCH 5/5] cherry-pick fixup
|
||||
|
||||
---
|
||||
criteria.c | 4 ++--
|
||||
include/criteria.h | 3 +++
|
||||
notification.c | 6 +++++-
|
||||
3 files changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/criteria.c b/criteria.c
|
||||
index 523a467..2514da9 100644
|
||||
--- a/criteria.c
|
||||
+++ b/criteria.c
|
||||
@@ -418,14 +418,14 @@ struct mako_criteria *global_criteria(struct mako_config *config) {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
-static void timespec_from_ms(struct timespec *t, long time_ms) {
|
||||
+void timespec_from_ms(struct timespec *t, long time_ms) {
|
||||
static const long ms = 1000000;
|
||||
|
||||
t->tv_sec = time_ms / 1000;
|
||||
t->tv_nsec = (time_ms % 1000) * ms;
|
||||
}
|
||||
|
||||
-static void timespec_add(struct timespec *t, struct timespec *u) {
|
||||
+void timespec_add(struct timespec *t, struct timespec *u) {
|
||||
static const long s = 1000000000;
|
||||
|
||||
t->tv_sec += u->tv_sec;
|
||||
diff --git a/include/criteria.h b/include/criteria.h
|
||||
index 58c36ef..48f256d 100644
|
||||
--- a/include/criteria.h
|
||||
+++ b/include/criteria.h
|
||||
@@ -60,4 +60,7 @@ struct mako_criteria *create_criteria_from_notification(
|
||||
|
||||
bool validate_criteria(struct mako_criteria *criteria);
|
||||
|
||||
+void timespec_add(struct timespec *t, struct timespec *u);
|
||||
+void timespec_from_ms(struct timespec *t, long time_ms);
|
||||
+
|
||||
#endif
|
||||
diff --git a/notification.c b/notification.c
|
||||
index ce0bafd..730176f 100644
|
||||
--- a/notification.c
|
||||
+++ b/notification.c
|
||||
@@ -475,7 +475,11 @@ void notification_handle_touch_start(struct mako_notification *notif,
|
||||
return;
|
||||
}
|
||||
notif->long_press_ctx = *ctx;
|
||||
- notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, 500,
|
||||
+ struct timespec at, delta;
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &at);
|
||||
+ timespec_from_ms(&delta, 500);
|
||||
+ timespec_add(&at, &delta);
|
||||
+ notif->long_press_timer = add_event_loop_timer(¬if->state->event_loop, &at,
|
||||
handle_notification_touch_timer, notif);
|
||||
}
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -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
|
181
pkgs/rofi-wayland/0001-wip-touch-support.patch
Normal file
181
pkgs/rofi-wayland/0001-wip-touch-support.patch
Normal file
|
@ -0,0 +1,181 @@
|
|||
From 637fe90e0c69d77d2ad24576d924b041525fd941 Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 12:10:16 +0700
|
||||
Subject: [PATCH 1/3] wip touch support
|
||||
|
||||
---
|
||||
include/wayland-internal.h | 7 +++
|
||||
source/wayland/display.c | 115 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 122 insertions(+)
|
||||
|
||||
diff --git a/include/wayland-internal.h b/include/wayland-internal.h
|
||||
index e6d248ce..77aaaf9d 100644
|
||||
--- a/include/wayland-internal.h
|
||||
+++ b/include/wayland-internal.h
|
||||
@@ -84,6 +84,8 @@ typedef struct {
|
||||
uint32_t layer_height;
|
||||
} wayland_stuff;
|
||||
|
||||
+#define MAX_TOUCHPOINTS 10
|
||||
+
|
||||
struct _wayland_seat {
|
||||
wayland_stuff *context;
|
||||
uint32_t global_name;
|
||||
@@ -99,6 +101,11 @@ struct _wayland_seat {
|
||||
uint32_t pointer_serial;
|
||||
struct wl_keyboard *keyboard;
|
||||
struct wl_pointer *pointer;
|
||||
+ struct wl_touch *touch;
|
||||
+ struct {
|
||||
+ int32_t x, start_y, move_y;
|
||||
+ uint32_t start_time, move_time;
|
||||
+ } touches[MAX_TOUCHPOINTS];
|
||||
|
||||
#ifdef HAVE_WAYLAND_CURSOR_SHAPE
|
||||
struct wp_cursor_shape_device_v1 *cursor_shape_device;
|
||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
||||
index 6cdc7d2f..381c402d 100644
|
||||
--- a/source/wayland/display.c
|
||||
+++ b/source/wayland/display.c
|
||||
@@ -526,6 +526,101 @@ static const struct wl_keyboard_listener wayland_keyboard_listener = {
|
||||
.repeat_info = wayland_keyboard_repeat_info,
|
||||
};
|
||||
|
||||
+static void wayland_touch_down(void *data, struct wl_touch *wl_touch,
|
||||
+ uint32_t serial, uint32_t time, struct wl_surface *wl_surface,
|
||||
+ int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||
+ wayland_seat *self = data;
|
||||
+ if (id >= MAX_TOUCHPOINTS) {
|
||||
+ return;
|
||||
+ }
|
||||
+ self->touches[id].x = wl_fixed_to_int(surface_x);
|
||||
+ self->touches[id].start_y = self->touches[id].move_y = wl_fixed_to_int(surface_y);
|
||||
+ self->touches[id].start_time = self->touches[id].move_time = time;
|
||||
+ RofiViewState *state = rofi_view_get_active();
|
||||
+
|
||||
+ if (state == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
||||
+ FALSE);
|
||||
+}
|
||||
+
|
||||
+static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
||||
+ uint32_t serial, uint32_t time, int32_t id) {
|
||||
+ wayland_seat *self = data;
|
||||
+ if (id >= MAX_TOUCHPOINTS) {
|
||||
+ return;
|
||||
+ }
|
||||
+ gboolean is_move =
|
||||
+ time - self->touches[id].start_time > 500
|
||||
+ || self->touches[id].start_time != self->touches[id].move_time;
|
||||
+ if (is_move) {
|
||||
+ return;
|
||||
+ }
|
||||
+ RofiViewState *state = rofi_view_get_active();
|
||||
+
|
||||
+ if (state == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
||||
+ // FALSE);
|
||||
+ nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
|
||||
+ KEY_ENTER + 8,
|
||||
+ NK_BINDINGS_KEY_STATE_PRESS);
|
||||
+ rofi_view_maybe_update(state);
|
||||
+}
|
||||
+
|
||||
+static int32_t y_offset_to_line_offset(int32_t y_offset) {
|
||||
+ static const int32_t line_height = 20;
|
||||
+ return -(y_offset / line_height);
|
||||
+}
|
||||
+
|
||||
+static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
|
||||
+ uint32_t time, int32_t id, wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||
+ wayland_seat *self = data;
|
||||
+ if (id >= MAX_TOUCHPOINTS) {
|
||||
+ return;
|
||||
+ }
|
||||
+ RofiViewState *state = rofi_view_get_active();
|
||||
+
|
||||
+ if (state == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int32_t x = wl_fixed_to_int(surface_x);
|
||||
+ int32_t y = wl_fixed_to_int(surface_y);
|
||||
+
|
||||
+ int last_pos = y_offset_to_line_offset(self->touches[id].move_y - self->touches[id].start_y);
|
||||
+ int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
|
||||
+
|
||||
+ if (cur_pos != last_pos) {
|
||||
+ rofi_view_handle_mouse_motion(state, x, y, FALSE);
|
||||
+ nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
|
||||
+ NK_BINDINGS_SCROLL_AXIS_VERTICAL,
|
||||
+ cur_pos - last_pos);
|
||||
+ self->touches[id].x = x;
|
||||
+ self->touches[id].move_y = y;
|
||||
+ self->touches[id].move_time = time;
|
||||
+ rofi_view_maybe_update(state);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void wayland_touch_frame(void *data, struct wl_touch *wl_touch) { }
|
||||
+static void wayland_touch_cancel(void *data, struct wl_touch *wl_touch) { }
|
||||
+static void wayland_touch_shape(void *data, struct wl_touch *wl_touch,
|
||||
+ int32_t id, wl_fixed_t major, wl_fixed_t minor) { }
|
||||
+static void wayland_touch_orientation(void *data, struct wl_touch *wl_touch,
|
||||
+ int32_t id, wl_fixed_t orientation) { }
|
||||
+
|
||||
+static const struct wl_touch_listener wayland_touch_listener = {
|
||||
+ .down = wayland_touch_down,
|
||||
+ .up = wayland_touch_up,
|
||||
+ .motion = wayland_touch_motion,
|
||||
+ .frame = wayland_touch_frame,
|
||||
+ .cancel = wayland_touch_cancel,
|
||||
+ .shape = wayland_touch_shape,
|
||||
+ .orientation = wayland_touch_orientation,
|
||||
+};
|
||||
+
|
||||
static gboolean wayland_cursor_reload_theme(guint scale);
|
||||
|
||||
static void wayland_cursor_set_image(int i) {
|
||||
@@ -1081,9 +1176,20 @@ static void wayland_pointer_release(wayland_seat *self) {
|
||||
self->pointer = NULL;
|
||||
}
|
||||
|
||||
+static void wayland_touch_release(wayland_seat *self) {
|
||||
+ if (self->touch == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ wl_touch_release(self->touch);
|
||||
+
|
||||
+ self->touch = NULL;
|
||||
+}
|
||||
+
|
||||
static void wayland_seat_release(wayland_seat *self) {
|
||||
wayland_keyboard_release(self);
|
||||
wayland_pointer_release(self);
|
||||
+ wayland_touch_release(self);
|
||||
|
||||
wl_seat_release(self->seat);
|
||||
|
||||
@@ -1113,6 +1219,15 @@ static void wayland_seat_capabilities(void *data, struct wl_seat *seat,
|
||||
wayland_pointer_release(self);
|
||||
}
|
||||
|
||||
+ if ((capabilities & WL_SEAT_CAPABILITY_TOUCH) &&
|
||||
+ (self->touch == NULL)) {
|
||||
+ self->touch = wl_seat_get_touch(self->seat);
|
||||
+ wl_touch_add_listener(self->touch, &wayland_touch_listener, self);
|
||||
+ } else if ((!(capabilities & WL_SEAT_CAPABILITY_TOUCH)) &&
|
||||
+ (self->touch != NULL)) {
|
||||
+ wayland_touch_release(self);
|
||||
+ }
|
||||
+
|
||||
if (wayland->data_device_manager != NULL) {
|
||||
self->data_device = wl_data_device_manager_get_data_device(
|
||||
wayland->data_device_manager, seat);
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
From 3d02857ec8ab68ae243e651874203e88e6788ae7 Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 13:22:34 +0700
|
||||
Subject: [PATCH 2/3] still scroll after the tap moves outside the rofi window
|
||||
|
||||
---
|
||||
source/wayland/display.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
||||
index 381c402d..5154589a 100644
|
||||
--- a/source/wayland/display.c
|
||||
+++ b/source/wayland/display.c
|
||||
@@ -593,7 +593,6 @@ static void wayland_touch_motion(void *data, struct wl_touch *wl_touch,
|
||||
int cur_pos = y_offset_to_line_offset(y - self->touches[id].start_y);
|
||||
|
||||
if (cur_pos != last_pos) {
|
||||
- rofi_view_handle_mouse_motion(state, x, y, FALSE);
|
||||
nk_bindings_seat_handle_scroll(wayland->bindings_seat, NULL,
|
||||
NK_BINDINGS_SCROLL_AXIS_VERTICAL,
|
||||
cur_pos - last_pos);
|
||||
--
|
||||
2.45.2
|
||||
|
45
pkgs/rofi-wayland/0003-exit-on-long-tap.patch
Normal file
45
pkgs/rofi-wayland/0003-exit-on-long-tap.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 8b417bc6304c30bafb56113b868ecac2ffc0ed08 Mon Sep 17 00:00:00 2001
|
||||
From: chayleaf <chayleaf-git@pavluk.org>
|
||||
Date: Sat, 24 Aug 2024 13:29:32 +0700
|
||||
Subject: [PATCH 3/3] exit on long tap
|
||||
|
||||
---
|
||||
source/wayland/display.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/source/wayland/display.c b/source/wayland/display.c
|
||||
index 5154589a..cfd883b3 100644
|
||||
--- a/source/wayland/display.c
|
||||
+++ b/source/wayland/display.c
|
||||
@@ -551,10 +551,8 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
||||
if (id >= MAX_TOUCHPOINTS) {
|
||||
return;
|
||||
}
|
||||
- gboolean is_move =
|
||||
- time - self->touches[id].start_time > 500
|
||||
- || self->touches[id].start_time != self->touches[id].move_time;
|
||||
- if (is_move) {
|
||||
+ gboolean has_moved = self->touches[id].start_time != self->touches[id].move_time;
|
||||
+ if (has_moved) {
|
||||
return;
|
||||
}
|
||||
RofiViewState *state = rofi_view_get_active();
|
||||
@@ -562,10 +560,12 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
- //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
|
||||
- // FALSE);
|
||||
+ int key = KEY_ENTER;
|
||||
+ if (time - self->touches[id].start_time > 200) {
|
||||
+ key = KEY_ESC;
|
||||
+ }
|
||||
nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
|
||||
- KEY_ENTER + 8,
|
||||
+ key + 8,
|
||||
NK_BINDINGS_KEY_STATE_PRESS);
|
||||
rofi_view_maybe_update(state);
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
|
@ -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 = [
|
||||
|
|
148
system/devices/kobo-clara-hd-ereader.nix
Normal file
148
system/devices/kobo-clara-hd-ereader.nix
Normal file
|
@ -0,0 +1,148 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, inputs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
# uuids.enc = "e2abdea5-71dc-4a9e-aff3-242117342d60";
|
||||
uuids.boot = "49b5ab26-a8f4-4873-a235-da2b3608e870";
|
||||
uuids.swap = "b7eb326b-69d8-4347-a2dc-549ec6201e7f";
|
||||
uuids.root = "99cda95f-f866-42a0-883f-343ad3662920";
|
||||
parts = builtins.mapAttrs (k: v: "/dev/disk/by-uuid/${v}") uuids;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
../hardware/kobo-clara
|
||||
../hosts/ereader
|
||||
];
|
||||
|
||||
fonts.enableDefaultPackages = false;
|
||||
# defaults without noto-fonts-color-emoji
|
||||
fonts.packages = with pkgs; [
|
||||
dejavu_fonts
|
||||
freefont_ttf
|
||||
gyre-fonts # TrueType substitutes for standard PostScript fonts
|
||||
liberation_ttf
|
||||
unifont
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: let
|
||||
overrideFfmpeg = ffmpeg: ffmpeg.override {
|
||||
withAlsa = false;
|
||||
withJack = false;
|
||||
withMp3lame = false;
|
||||
withOgg = false;
|
||||
withOpus = false;
|
||||
withPulse = false;
|
||||
withSpeex = false;
|
||||
withVaapi = false;
|
||||
withVdpau = false;
|
||||
withVorbis = false;
|
||||
};
|
||||
in {
|
||||
ffmpeg = overrideFfmpeg super.ffmpeg;
|
||||
waybar = super.waybar.override {
|
||||
hyprlandSupport = false;
|
||||
jackSupport = false;
|
||||
mpdSupport = false;
|
||||
mprisSupport = false;
|
||||
pipewireSupport = false;
|
||||
pulseSupport = false;
|
||||
sndioSupport = false;
|
||||
cavaSupport = false;
|
||||
wireplumberSupport = false;
|
||||
};
|
||||
awesome = super.awesome.overrideAttrs (old: {
|
||||
# broken cross tests
|
||||
doCheck = false;
|
||||
});
|
||||
# ffmpeg isnt actually used in wlroots anymore, remove the useless dependency
|
||||
wlroots_0_17 = super.wlroots_0_17.overrideAttrs (old: {
|
||||
buildInputs = builtins.filter (x: x.pname != "ffmpeg") old.buildInputs;
|
||||
});
|
||||
# heif/avif support isnt worth an extra rust dependency
|
||||
imagemagick = super.imagemagick.override {
|
||||
libheifSupport = false;
|
||||
};
|
||||
jasper = super.jasper.override {
|
||||
enableHEIFCodec = false;
|
||||
};
|
||||
# no audio, so no need to bring in the audio libs
|
||||
SDL2 = super.SDL2.override {
|
||||
alsaSupport = false;
|
||||
pipewireSupport = false;
|
||||
pulseaudioSupport = false;
|
||||
};
|
||||
openalSoft = super.openalSoft.override {
|
||||
alsaSupport = false;
|
||||
pipewireSupport = false;
|
||||
pulseSupport = false;
|
||||
};
|
||||
openal = super.openal.override {
|
||||
alsaSupport = false;
|
||||
pipewireSupport = false;
|
||||
pulseSupport = false;
|
||||
};
|
||||
# luajit has to be built on a system with 32-bit pointer width when targeting 32-bit systems
|
||||
luajit = (import inputs.nixpkgs { system = "i686-linux"; }).pkgsCross.armv7l-hf-multiplatform.luajit;
|
||||
# fix cross https://github.com/NixOS/nixpkgs/pull/328919/
|
||||
texinfo = super.texinfo.overrideAttrs (old: {
|
||||
configureFlags = old.configureFlags
|
||||
++ lib.optional
|
||||
(self.stdenv.hostPlatform != self.stdenv.buildPlatform)
|
||||
"texinfo_cv_sys_iconv_converts_euc_cn=yes";
|
||||
});
|
||||
koreader = super.koreader.overrideAttrs (old: {
|
||||
src = self.fetchurl {
|
||||
url = "https://github.com/koreader/koreader/releases/download/v${old.version}/koreader-${old.version}-armhf.deb";
|
||||
hash = "sha256-LgeWQcHm5Qq/7MUuidjily0WsOFZAWGWeO52jNHWKMw=";
|
||||
};
|
||||
meta = old.meta // {
|
||||
platforms = [ "armv7l-linux" ];
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
networking.wireless.iwd.enable = true;
|
||||
|
||||
fileSystems = let
|
||||
neededForBoot = true;
|
||||
in {
|
||||
"/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot;
|
||||
options = [ "defaults" "size=2G" "mode=755" ]; };
|
||||
"/persist" =
|
||||
{ device = parts.root; fsType = "btrfs"; inherit neededForBoot;
|
||||
options = [ "discard=async" "compress=zstd:15" ]; };
|
||||
"/boot" = { device = parts.boot; fsType = "ext4"; };
|
||||
};
|
||||
|
||||
swapDevices = [ { device = parts.swap; } ];
|
||||
boot.resumeDevice = parts.swap;
|
||||
|
||||
system.build.rootfsImage = pkgs.callPackage "${pkgs.path}/nixos/lib/make-btrfs-fs.nix" {
|
||||
storePaths = config.system.build.toplevel;
|
||||
compressImage = true;
|
||||
volumeLabel = "NIX_ROOTFS";
|
||||
uuid = uuids.root;
|
||||
};
|
||||
system.build.bootFiles = pkgs.runCommand "kobo-clara-boot-files" {} ''
|
||||
mkdir -p "$out"
|
||||
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d $out -g 0
|
||||
'';
|
||||
|
||||
impermanence = {
|
||||
enable = true;
|
||||
path = /persist;
|
||||
directories = [
|
||||
{ directory = /home/${config.common.mainUsername}; user = config.common.mainUsername; group = "users"; mode = "0700"; }
|
||||
{ directory = /root; mode = "0700"; }
|
||||
{ directory = /nix; }
|
||||
{ directory = /secrets; mode = "0000"; }
|
||||
];
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
let
|
||||
uuids.enc = "e2abdea5-71dc-4a9e-aff3-242117342d60";
|
||||
uuids.boot = "9DA3-28AC";
|
||||
uuids.bch = "ac343ffb-407c-4966-87bf-a0ef1075e93d";
|
||||
uuids.root = "5fadc23c-f374-442d-8b05-fb76611c9eb7";
|
||||
parts = builtins.mapAttrs (k: v: "/dev/disk/by-uuid/${v}") uuids;
|
||||
in
|
||||
|
||||
|
@ -30,9 +30,13 @@ 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" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
|
||||
fileSystems = let
|
||||
neededForBoot = true;
|
||||
|
@ -40,8 +44,8 @@ in
|
|||
"/" = { device = "none"; fsType = "tmpfs"; inherit neededForBoot;
|
||||
options = [ "defaults" "size=2G" "mode=755" ]; };
|
||||
"/persist" =
|
||||
{ device = "UUID=${uuids.bch}"; fsType = "bcachefs"; inherit neededForBoot;
|
||||
options = [ "errors=ro" ]; };
|
||||
{ device = parts.root; fsType = "btrfs"; inherit neededForBoot;
|
||||
options = [ "discard=async" "compress=zstd:15" ]; };
|
||||
"/boot" = { device = parts.boot; fsType = "vfat"; inherit neededForBoot; };
|
||||
};
|
||||
|
||||
|
|
|
@ -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" = {
|
||||
|
|
12
system/hardware/kobo-clara/README.md
Normal file
12
system/hardware/kobo-clara/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
Note: **the dtb depends on board revision** (and may brick your device
|
||||
if you use the wrong dtb)
|
||||
|
||||
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/firmware-kobo-clara
|
||||
|
||||
https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/device-kobo-clara
|
||||
|
||||
https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/linux-kobo-clara-mainline
|
||||
|
||||
https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/u-boot-kobo-clara
|
||||
|
||||
https://github.com/jwrdegoede/rtl8189ES_linux
|
78
system/hardware/kobo-clara/default.nix
Normal file
78
system/hardware/kobo-clara/default.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs' = pkgs.hw.kobo-clara;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
ereader.epdc-firmware = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs'.linux;
|
||||
|
||||
boot.initrd.preLVMCommands = ''
|
||||
echo 0 > /sys/class/graphics/fbcon/cursor_blink
|
||||
(cd /sys/bus/platform/devices && echo *epdc >/sys/bus/platform/drivers/mxc_epdc/bind)
|
||||
'';
|
||||
boot.consoleLogLevel = 7;
|
||||
hardware.deviceTree.enable = true;
|
||||
hardware.deviceTree.filter = "imx6sll-kobo-clarahd.dtb";
|
||||
hardware.firmware = [
|
||||
(pkgs.runCommand "epdc-firmware" { } ''
|
||||
mkdir -p $out/lib/firmware/imx/epdc
|
||||
cp ${config.ereader.epdc-firmware} $out/lib/firmware/imx/epdc/epdc.fw
|
||||
'')
|
||||
];
|
||||
# boot.initrd.extraFiles."lib/firmware/imx/epdc/epdc.fw".source = pkgs.copyPathToStore config.ereader.epdc-firmware;
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
makeModulesClosure = args: (super.makeModulesClosure args).overrideAttrs (old: {
|
||||
builder = pkgs.writeShellScript "builder.sh" ''
|
||||
source ${old.builder}
|
||||
cd "$firmware"
|
||||
mkdir -p "$out/lib/firmware/imx"
|
||||
cp --no-preserve=mode -vrL lib/firmware/imx/* "$out/lib/firmware/imx/"
|
||||
'';
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
boot.initrd.kernelModules = [ "tps6518x_hwmon" "tps6518x_regulator" "mxc_epdc_drm" ];
|
||||
boot.initrd.availableKernelModules = [ "mmc_block" "dm_mod" ];
|
||||
boot.kernelParams = [ "console=ttymxc0,115200" "detect_clara_rev" ];
|
||||
# "dtb=/${config.hardware.deviceTree.name}"
|
||||
|
||||
boot.initrd.compressor = "zstd";
|
||||
|
||||
boot.postBootCommands = ''
|
||||
if [ -f ${toString config.impermanence.path}/nix-path-registration ]; then
|
||||
${config.nix.package.out}/bin/nix-store --load-db < ${toString config.impermanence.path}/nix-path-registration
|
||||
mkdir -p /etc
|
||||
touch /etc/NIXOS
|
||||
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
|
||||
rm -f ${toString config.impermanence.path}/nix-path-registration
|
||||
fi
|
||||
'';
|
||||
|
||||
system.build.uboot = pkgs'.uboot;
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
}
|
||||
(lib.mkIf config.phone.buffyboard.enable {
|
||||
common.gettyAutologin = true;
|
||||
})
|
||||
];
|
||||
}
|
50
system/hardware/kobo-clara/pkgs.nix
Normal file
50
system/hardware/kobo-clara/pkgs.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
uboot = pkgs.buildUBoot {
|
||||
defconfig = "mx6sllclarahd_defconfig";
|
||||
extraConfig = ''
|
||||
CONFIG_FASTBOOT_OEM_RUN=y
|
||||
CONFIG_ENV_IS_IN_EXT4=y
|
||||
CONFIG_ENV_IS_IN_MMC=n
|
||||
CONFIG_ENV_EXT4_INTERFACE=mmc
|
||||
CONFIG_ENV_EXT4_DEVICE_AND_PART=0:1
|
||||
CONFIG_ENV_EXT4_FILE=/uboot.env
|
||||
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
|
||||
detect_clara_rev
|
||||
run distro_bootcmd
|
||||
setenv stdin usbacm
|
||||
setenv stdout usbacm
|
||||
setenv stderr usbacm
|
||||
''};"
|
||||
'';
|
||||
# fastboot 0
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "akemnade";
|
||||
repo = "u-boot-fslc";
|
||||
hash = "sha256-MUAiiXTfxt/o/6rnoI7A76IMRPDUhXodjnguKwQKrVs=";
|
||||
rev = "3247fa27aed27bb5ac24bd9966fd7dadd9c4c373";
|
||||
};
|
||||
version = "2023.10";
|
||||
extraMeta.platforms = [ "armv7l-linux" ];
|
||||
filesToInstall = [ "u-boot-dtb.imx" ];
|
||||
};
|
||||
linux = (pkgs.buildLinux rec {
|
||||
version = "6.9.0";
|
||||
modDirVersion = lib.versions.pad 3 version;
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "akemnade";
|
||||
repo = "linux";
|
||||
rev = "4b0c49001732b93f6787c44e090b8e8f72e6fe6a";
|
||||
hash = "sha256-rCiznEHDqrOW+CEI1I9HdHNSsVYCb7iJGE+7PKJ8H6A=";
|
||||
};
|
||||
|
||||
defconfig = "kobo_defconfig";
|
||||
}).overrideAttrs (old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.lzop ];
|
||||
});
|
||||
}
|
|
@ -19,13 +19,6 @@ in
|
|||
|
||||
options.phone = {
|
||||
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 [
|
||||
|
@ -55,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;
|
||||
|
@ -78,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;
|
||||
|
@ -110,82 +104,7 @@ in
|
|||
];
|
||||
}
|
||||
(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;
|
||||
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 {
|
||||
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_6_9.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...8914f1483d0784bf1133577f3c161a3f83a12653.diff";
|
||||
# hash = "sha256-orBQDGHAXOAy1PVLwNIBk3FgiMslziW1xddQyIwbnCs=";
|
||||
# };
|
||||
# }
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
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_testing;
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
|
||||
};
|
||||
|
||||
|
@ -55,9 +55,9 @@
|
|||
hardware = {
|
||||
opentabletdriver.enable = true;
|
||||
steam-hardware.enable = true;
|
||||
opengl.driSupport32Bit = true;
|
||||
graphics.enable32Bit = true;
|
||||
# needed for sway WLR_RENDERER=vulkan
|
||||
opengl.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
||||
graphics.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
||||
};
|
||||
|
||||
# see modules/vfio.nix
|
||||
|
@ -81,6 +81,7 @@
|
|||
7777
|
||||
9887
|
||||
];
|
||||
networking.firewall.allowedUDPPorts = [ 27015 ];
|
||||
# kde connect
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
{ from = 1714; to = 1764; }
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
});
|
||||
'';
|
||||
|
||||
phone.buffyboard.enable = true;
|
||||
phone.rndis.enable = true;
|
||||
common.minimal = false;
|
||||
services.sshd.enable = true;
|
||||
services.tlp.enable = true;
|
||||
|
|
|
@ -62,8 +62,23 @@ in {
|
|||
DISABLE_REGISTRATION = true;
|
||||
REGISTER_EMAIL_CONFIRM = true;
|
||||
};
|
||||
cache = {
|
||||
ADAPTER = "redis";
|
||||
HOST = "redis+socket://${config.services.redis.servers.forgejo.unixSocket}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.forgejo = {
|
||||
wants = [ "redis-forgejo.service" ];
|
||||
after = [ "redis-forgejo.service" ];
|
||||
};
|
||||
|
||||
users.users.forgejo.extraGroups = [ config.services.redis.servers.forgejo.user ];
|
||||
|
||||
services.redis.servers.forgejo = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."cloud.${cfg.domainName}" = {
|
||||
quic = true;
|
||||
|
@ -82,6 +97,7 @@ in {
|
|||
dbtype = "pgsql";
|
||||
dbhost = "/run/postgresql";
|
||||
};
|
||||
phpOptions."opcache.interned_strings_buffer" = "16";
|
||||
settings.overwriteprotocol = "https";
|
||||
hostName = "cloud.${cfg.domainName}";
|
||||
https = 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";
|
||||
|
@ -281,7 +283,13 @@ in {
|
|||
job_name = "local_medium_freq";
|
||||
scrape_interval = "15m";
|
||||
static_configs = [ {
|
||||
targets = [ "127.0.0.1:9548" "127.0.0.1:9198" "127.0.0.1:9173" ];
|
||||
targets = [
|
||||
"127.0.0.1:9548"
|
||||
"127.0.0.1:9198"
|
||||
(let cfg = config.services.matrix-appservice-discord.settings.metrics;
|
||||
in "${lib.quoteListenAddr cfg.host}:${toString cfg.port}")
|
||||
config.services.matrix-sliding-sync.settings.SYNCV3_PROM
|
||||
];
|
||||
labels.machine = "server";
|
||||
} ];
|
||||
}
|
||||
|
@ -357,12 +365,17 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
# don't mess with my dns god damn it
|
||||
services.resolved.enable = false;
|
||||
# TODO: enable
|
||||
services.matrix-appservice-discord.settings.metrics = {
|
||||
enable = true;
|
||||
host = "127.0.0.1";
|
||||
port = 9173;
|
||||
};
|
||||
services.matrix-sliding-sync = {
|
||||
settings.SYNCV3_PROM = "[::]:8011";
|
||||
};
|
||||
services.matrix-synapse.settings = {
|
||||
enable_metrics = true;
|
||||
federation_metrics_domains = [ "matrix.org" ];
|
||||
|
|
|
@ -27,6 +27,11 @@ in {
|
|||
hostName = "mail.${cfg.domainName}";
|
||||
maxAttachmentSize = 100;
|
||||
plugins = [ "persistent_login" ];
|
||||
extraConfig = ''
|
||||
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
|
||||
$config['smtp_user'] = "%u";
|
||||
$config['smtp_pass'] = "%p";
|
||||
'';
|
||||
};
|
||||
mailserver = {
|
||||
enable = true;
|
||||
|
|
|
@ -11,6 +11,7 @@ let
|
|||
matrixClientJson = {
|
||||
"m.homeserver".base_url = "https://matrix.${cfg.domainName}";
|
||||
"m.identity_server".base_url = "https://vector.im";
|
||||
"org.matrix.msc3575.proxy".url = "https://matrix.${cfg.domainName}";
|
||||
};
|
||||
matrixServerConfigResponse = ''
|
||||
add_header Content-Type application/json;
|
||||
|
@ -41,7 +42,8 @@ in {
|
|||
locations = {
|
||||
"= /.well-known/matrix/server".extraConfig = matrixServerConfigResponse;
|
||||
"= /.well-known/matrix/client".extraConfig = matrixClientConfigResponse;
|
||||
"/".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}";
|
||||
"~ ^/(_matrix(?!/maubot)|_synapse/client|$)".proxyPass = "http://${lib.quoteListenAddr matrixAddr}:${toString matrixPort}";
|
||||
"~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/)".proxyPass = "http://${config.services.matrix-sliding-sync.settings.SYNCV3_BINDADDR}";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -71,9 +73,12 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ matrix-synapse-tools.rust-synapse-compress-state ];
|
||||
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
extraConfigFiles = [ "/var/lib/matrix-synapse/config.yaml" ];
|
||||
log.root.level = "WARNING";
|
||||
settings = {
|
||||
app_service_config_files = [
|
||||
"/var/lib/heisenbridge/registration.yml"
|
||||
|
@ -109,4 +114,13 @@ in {
|
|||
}];
|
||||
};
|
||||
};
|
||||
|
||||
services.matrix-sliding-sync = {
|
||||
enable = true;
|
||||
environmentFile = "/secrets/sliding-sync/env";
|
||||
settings = {
|
||||
SYNCV3_BINDADDR = "[::]:8010";
|
||||
SYNCV3_SERVER = "https://matrix.pavluk.org";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ in {
|
|||
services.nginx.virtualHosts."matrix.${cfg.domainName}".locations = let
|
||||
inherit (config.services.maubot) settings;
|
||||
in {
|
||||
"/_matrix/maubot/" = {
|
||||
"^~ /_matrix/maubot/" = {
|
||||
proxyPass = "http://${lib.quoteListenAddr settings.server.hostname}:${toString settings.server.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
|
|
50
system/modules/buffyboard.nix
Normal file
50
system/modules/buffyboard.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.phone;
|
||||
in
|
||||
{
|
||||
options.phone.buffyboard = {
|
||||
enable = lib.mkEnableOption "buffyboard";
|
||||
};
|
||||
config = lib.mkIf cfg.buffyboard.enable {
|
||||
boot.initrd.kernelModules = [ "uinput" "evdev" ];
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
copy_bin_and_libs ${pkgs.buffyboard}/bin/buffyboard
|
||||
cp -a ${pkgs.libinput.out}/share $out/
|
||||
'';
|
||||
boot.initrd.extraUdevRulesCommands = ''
|
||||
cp -v ${config.systemd.package}/lib/udev/rules.d/60-input-id.rules $out/
|
||||
cp -v ${config.systemd.package}/lib/udev/rules.d/60-persistent-input.rules $out/
|
||||
cp -v ${config.systemd.package}/lib/udev/rules.d/70-touchpad.rules $out/
|
||||
'';
|
||||
boot.initrd.preLVMCommands = ''
|
||||
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
|
||||
ln -s "$(dirname "$(dirname "$(which buffyboard)")")"/share /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.libinput.name}/
|
||||
buffyboard 2>/dev/null &
|
||||
'';
|
||||
boot.initrd.postMountCommands = ''
|
||||
pkill -x buffyboard
|
||||
'';
|
||||
systemd.services.buffyboard = {
|
||||
description = "buffyboard";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.buffyboard}/bin/buffyboard";
|
||||
Restart = "always";
|
||||
RestartSec = "1";
|
||||
};
|
||||
};
|
||||
security.sudo.extraRules = [
|
||||
{ groups = [ "users" ];
|
||||
commands = [
|
||||
{ command = "/run/current-system/sw/bin/systemctl stop buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
|
||||
{ command = "/run/current-system/sw/bin/systemctl start buffyboard"; options = [ "SETENV" "NOPASSWD" ]; }
|
||||
]; }
|
||||
];
|
||||
};
|
||||
}
|
|
@ -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 = [
|
||||
|
|
|
@ -133,9 +133,12 @@ in {
|
|||
{ directory = /var/lib/${config.services.prometheus.stateDir}; user = "prometheus"; group = "prometheus"; mode = "0755"; }
|
||||
] ++ lib.optionals (config.services.qbittorrent-nox.enable or false) [
|
||||
{ directory = /var/lib/qbittorrent-nox; mode = "0755"; }
|
||||
] ++ lib.optionals (config.services.redis.servers.rspamd.enable or false) [
|
||||
{ directory = /var/lib/redis-rspamd; user = "redis-rspamd"; group = "redis-rspamd"; mode = "0700"; }
|
||||
] ++ lib.optionals config.services.roundcube.enable [
|
||||
] ++ (lib.mapAttrsToList
|
||||
(k: v: let
|
||||
name = if k == "" then "redis" else "redis-${k}";
|
||||
in { directory = /var/lib/${name}; inherit (v) user; group = v.user; mode = "0700"; })
|
||||
(lib.filterAttrs (k: v: v.enable or false) config.services.redis.servers))
|
||||
++ lib.optionals config.services.roundcube.enable [
|
||||
{ directory = /var/lib/roundcube; user = "roundcube"; group = "roundcube"; mode = "0700"; }
|
||||
] ++ lib.optionals config.services.rspamd.enable [
|
||||
{ directory = /var/lib/rspamd; user = "rspamd"; group = "rspamd"; mode = "0700"; }
|
||||
|
|
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;
|
||||
};
|
||||
}
|
|
@ -151,7 +151,7 @@ in {
|
|||
'')
|
||||
cfg.lookingGlass.ivshmem));
|
||||
hardware = {
|
||||
opengl.enable = true;
|
||||
graphics.enable = true;
|
||||
} // lib.optionalAttrs (cfg.enable && !cfg.nvidiaGpu && options?hardware.amdgpu.loadInInitrd) {
|
||||
# disable early KMS so GPU can be properly unbound
|
||||
# can't use mkif because the option may not even exist
|
||||
|
|
12
update.sh
12
update.sh
|
@ -7,9 +7,9 @@ mozilla-addons-to-nix \
|
|||
./pkgs/firefox-addons/addons.json \
|
||||
./pkgs/firefox-addons/generated.nix || echo "failed to update firefox addons"
|
||||
nix flake update
|
||||
#if [ -z ${SUDO_ASKPASS+x} ]; then
|
||||
# sudo nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
#else
|
||||
# sudo -A nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
#fi
|
||||
#home-manager switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
if [ -z ${SUDO_ASKPASS+x} ]; then
|
||||
sudo nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
else
|
||||
sudo -A nixos-rebuild switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
fi
|
||||
home-manager switch --flake . --option extra-builtins-file "$(pwd)/extra-builtins.nix"
|
||||
|
|
Loading…
Reference in a new issue