Compare commits
9 commits
ad3ded339f
...
d9d4e43c35
| Author | SHA1 | Date | |
|---|---|---|---|
| d9d4e43c35 | |||
| 30f81b2b79 | |||
| f0c21b2e79 | |||
| 91ba0212b2 | |||
| 5f5daf1047 | |||
| 397fb19e0b | |||
| 05928785b0 | |||
| 1d06352181 | |||
| ef29bdf5aa |
38 changed files with 3198 additions and 2632 deletions
33
;
Normal file
33
;
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
lib,
|
||||
options,
|
||||
machine,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
custom.program = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.string;
|
||||
};
|
||||
home-config = mkOption {
|
||||
type = types.deferredModule;
|
||||
};
|
||||
system-config = mkOption {
|
||||
type = types.deferredModule;
|
||||
default = _: { };
|
||||
};
|
||||
};
|
||||
config = if builtins.isNull machine.home-only then config.system-config else config.home-config;
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
133
config.nix
Normal file
133
config.nix
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
inputs@{
|
||||
nixpkgs,
|
||||
deploy-rs,
|
||||
self,
|
||||
pkgsForSystem,
|
||||
...
|
||||
}:
|
||||
|
||||
rec {
|
||||
configs =
|
||||
configs: builtins.foldl' (acc: val: nixpkgs.lib.recursiveUpdate (config val) acc) { } configs;
|
||||
config =
|
||||
{
|
||||
hostname,
|
||||
capabilities,
|
||||
type,
|
||||
home-only ? null,
|
||||
extra-modules ? [ ],
|
||||
system ? "x86_64-linux",
|
||||
deploy-hostname ? hostname,
|
||||
deploy-options ? {
|
||||
user = if builtins.isNull home-only then "root" else home-only;
|
||||
sshUser = if builtins.isNull home-only then "jana" else home-only;
|
||||
},
|
||||
home-manager ? builtins.isNull home-only,
|
||||
stateVersion ? "26.05",
|
||||
}:
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
matches-capabilities =
|
||||
# all requirements are contained in the machine capabilities
|
||||
requirements: lib.all (req: builtins.elem req capabilities) requirements;
|
||||
program =
|
||||
{
|
||||
inputs,
|
||||
name,
|
||||
requirements ? [ ],
|
||||
home-config,
|
||||
system-config ? (_: { }),
|
||||
}:
|
||||
if (matches-capabilities requirements) then
|
||||
[ (if builtins.isNull home-only then (system-config inputs) else (home-config inputs)) ]
|
||||
++
|
||||
|
||||
(
|
||||
if builtins.isNull home-only then
|
||||
[
|
||||
(_: {
|
||||
custom.program.${name}.defered-config = home-config;
|
||||
})
|
||||
]
|
||||
else
|
||||
[ ]
|
||||
)
|
||||
else
|
||||
[ ];
|
||||
specialArgsForHomeSystem =
|
||||
{
|
||||
system,
|
||||
type,
|
||||
capabilities,
|
||||
}:
|
||||
home-only: {
|
||||
pkgs = pkgsForSystem system;
|
||||
flakes = inputs;
|
||||
inherit inputs;
|
||||
inherit (inputs.secrets.packages.${system}) secrets;
|
||||
machine = {
|
||||
inherit
|
||||
type
|
||||
capabilities
|
||||
stateVersion
|
||||
home-only
|
||||
program
|
||||
;
|
||||
};
|
||||
};
|
||||
specialArgsForSystem = system: specialArgsForHomeSystem system null;
|
||||
|
||||
specialArgs = specialArgsForSystem {
|
||||
inherit system type capabilities;
|
||||
};
|
||||
modules =
|
||||
extra-modules
|
||||
++ [ ./hosts/${hostname}/configuration.nix ]
|
||||
++ (
|
||||
if builtins.isNull home-only then
|
||||
[ ./defaults/machine-config.nix ]
|
||||
else
|
||||
[ ./defaults/machine-or-home-config.nix ]
|
||||
)
|
||||
++ (
|
||||
if home-manager then
|
||||
[
|
||||
inputs.home-manager.nixosModules.default
|
||||
{
|
||||
home-manager.extraSpecialArgs = specialArgs;
|
||||
}
|
||||
]
|
||||
else
|
||||
[ ]
|
||||
);
|
||||
in
|
||||
{
|
||||
deploy.nodes.${hostname} = {
|
||||
hostname = deploy-hostname;
|
||||
fastConnection = true;
|
||||
profiles.system = {
|
||||
path =
|
||||
if (builtins.isNull home-only) then
|
||||
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${hostname}
|
||||
else
|
||||
deploy-rs.lib.x86_64-linux.activate.home-manager self.nixosConfigurations.${hostname};
|
||||
}
|
||||
// deploy-options;
|
||||
};
|
||||
|
||||
nixosConfigurations.${hostname} =
|
||||
if builtins.isNull home-only then
|
||||
(nixosSystem {
|
||||
inherit system modules specialArgs;
|
||||
})
|
||||
else
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
extraSpecialArgs = specialArgsForHomeSystem {
|
||||
inherit system type capabilities;
|
||||
} home-only;
|
||||
inherit modules;
|
||||
pkgs = pkgsForSystem system;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
flakes,
|
||||
machine,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(inputs.self + /modules/machine-type.nix)
|
||||
(inputs.self + /modules/program.nix)
|
||||
(inputs.self + /programs)
|
||||
./machine-or-home-config.nix
|
||||
];
|
||||
|
||||
system.stateVersion = "26.05";
|
||||
system.stateVersion = machine.stateVersion;
|
||||
services.resolved.enable = false;
|
||||
|
||||
xdg.mime.enable = lib.mkForce false;
|
||||
|
||||
# Enable SSH
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
9
defaults/machine-or-home-config.nix
Normal file
9
defaults/machine-or-home-config.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(../modules/program.nix)
|
||||
(../programs)
|
||||
(../users)
|
||||
];
|
||||
|
||||
}
|
||||
722
flake.lock
generated
722
flake.lock
generated
File diff suppressed because it is too large
Load diff
142
flake.nix
142
flake.nix
|
|
@ -2,21 +2,16 @@
|
|||
description = "jana's server infrastructure";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
colmena.url = "github:zhaofengli/colmena";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
vpn-confinement.url = "github:Maroka-chan/VPN-Confinement";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
firefox-addons = {
|
||||
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# deployment
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
|
||||
# websites
|
||||
|
||||
homepage.url = "github:jdonszelmann/homepage";
|
||||
totpal.url = "github:jdonszelmann/totpal";
|
||||
harmonica.url = "git+ssh://git@github.com/jdonszelmann/harmonica-tabs";
|
||||
|
|
@ -25,39 +20,39 @@
|
|||
compiler-construction-2021.url = "git+ssh://forgejo@git.donsz.nl/jana/eelco-visser-compiler-construction.git";
|
||||
mifg.url = "git+ssh://forgejo@git.donsz.nl/jana/money.is.fckn.gay.git";
|
||||
|
||||
# server
|
||||
raw-data.url = "git+ssh://forgejo@git.donsz.nl/jana/raw-data.git";
|
||||
secrets.url = "git+ssh://forgejo@git.donsz.nl/jana/server-secrets.git";
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
vpn-confinement.url = "github:Maroka-chan/VPN-Confinement";
|
||||
|
||||
# home
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
t.url = "github:jdonszelmann/t-rs";
|
||||
dumpasm.url = "github:jdonszelmann/dumpasm";
|
||||
|
||||
kitty-search = {
|
||||
url = "github:trygveaa/kitty-kitten-search";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
jujutsu = {
|
||||
url = "github:martinvonz/jj";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
p1n3appl3 = {
|
||||
url = "github:p1n3appl3/config";
|
||||
inputs.rahul-config.follows = "rahul-config";
|
||||
};
|
||||
rahul-config.url = "github:jdonszelmann/nix-config";
|
||||
|
||||
niri-unstable.url = "github:YaLTeR/niri";
|
||||
niri = {
|
||||
url = "github:sodiboo/niri-flake";
|
||||
inputs.niri-unstable.follows = "niri-unstable";
|
||||
};
|
||||
matugen = {
|
||||
url = "github:/InioX/matugen/main";
|
||||
url = "github:/InioX/matugen/v4.0.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
noctalia = {
|
||||
|
|
@ -65,21 +60,23 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
pipethon.url = "git+ssh://forgejo@git.donsz.nl/jana/pipethon.git";
|
||||
firefox-addons = {
|
||||
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
firefox-sidebar-css = {
|
||||
url = "github:drannex/FirefoxSidebar";
|
||||
flake = false;
|
||||
};
|
||||
raw-data.url = "git+ssh://forgejo@git.donsz.nl/jana/raw-data.git";
|
||||
|
||||
};
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
colmena,
|
||||
flake-utils,
|
||||
sops-nix,
|
||||
vpn-confinement,
|
||||
home-manager,
|
||||
deploy-rs,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
|
|
@ -95,61 +92,40 @@
|
|||
})
|
||||
];
|
||||
};
|
||||
configs = import ./config.nix (inputs // { inherit pkgsForSystem; });
|
||||
in
|
||||
{
|
||||
colmenaHive = colmena.lib.makeHive self.outputs.colmena;
|
||||
|
||||
colmena = {
|
||||
meta =
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
nixpkgs = pkgsForSystem system;
|
||||
specialArgs = {
|
||||
flakes = inputs;
|
||||
inherit inputs;
|
||||
inherit (inputs.secrets.packages.${system}) secrets;
|
||||
};
|
||||
};
|
||||
|
||||
fili = {
|
||||
deployment = {
|
||||
targetHost = "donsz.nl";
|
||||
targetPort = 22;
|
||||
replaceUnknownProfiles = false;
|
||||
tags = [ "server" ];
|
||||
# buildOnTarget = true;
|
||||
targetUser = "jana";
|
||||
};
|
||||
|
||||
imports = [
|
||||
home-manager.nixosModules.home-manager
|
||||
./hosts/fili/configuration.nix
|
||||
./users
|
||||
./default-machine-config.nix
|
||||
sops-nix.nixosModules.sops
|
||||
vpn-confinement.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
kili = {
|
||||
deployment = {
|
||||
allowLocalDeployment = true;
|
||||
targetHost = null;
|
||||
replaceUnknownProfiles = false;
|
||||
tags = [ "laptop" ];
|
||||
# buildOnTarget = true;
|
||||
targetUser = "jana";
|
||||
};
|
||||
imports = [
|
||||
home-manager.nixosModules.home-manager
|
||||
./hosts/kili/configuration.nix
|
||||
./users
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
(configs.configs [
|
||||
{
|
||||
hostname = "fili";
|
||||
capabilities = [ "cli" ];
|
||||
type = "server";
|
||||
extra-modules = [
|
||||
sops-nix.nixosModules.sops
|
||||
vpn-confinement.nixosModules.default
|
||||
];
|
||||
}
|
||||
{
|
||||
hostname = "kili";
|
||||
deploy-hostname = "localhost";
|
||||
capabilities = [
|
||||
"cli"
|
||||
"graphical"
|
||||
"work"
|
||||
"fun"
|
||||
];
|
||||
type = "pc";
|
||||
}
|
||||
{
|
||||
hostname = "ragdoll";
|
||||
deploy-hostname = "ragdoll";
|
||||
home-only = "jana";
|
||||
capabilities = [
|
||||
"cli"
|
||||
"work"
|
||||
];
|
||||
type = "pc";
|
||||
}
|
||||
])
|
||||
// flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
|
|
@ -159,17 +135,27 @@
|
|||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
lix
|
||||
colmena.packages.${system}.colmena
|
||||
(pkgs.writeShellScriptBin "apply" ''
|
||||
colmena apply --no-substitute
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "apply-local" ''
|
||||
colmena apply-local --sudo
|
||||
apply $(hostname)
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "apply" ''
|
||||
set -e
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
deploy -s
|
||||
elif [ $# -eq 1 ]
|
||||
then
|
||||
deploy -s ".#$@"
|
||||
else
|
||||
echo "too many parameters"
|
||||
exit 1
|
||||
fi
|
||||
'')
|
||||
deploy-rs.packages.${system}.deploy-rs
|
||||
];
|
||||
shellHook = "exec $NIX_BUILD_SHELL";
|
||||
};
|
||||
packages = custom pkgs;
|
||||
custom-packages = custom pkgs;
|
||||
formatter = pkgs.nixfmt;
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@ _: {
|
|||
./services
|
||||
];
|
||||
|
||||
custom.machine = {
|
||||
type = "server";
|
||||
capabilities = [
|
||||
"cli"
|
||||
];
|
||||
};
|
||||
|
||||
networking.nameservers = [
|
||||
"1.1.1.1"
|
||||
"9.9.9.9"
|
||||
|
|
@ -50,4 +43,6 @@ _: {
|
|||
"media"
|
||||
"nginx"
|
||||
];
|
||||
|
||||
users.groups.media = { };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ let
|
|||
};
|
||||
privateUsers = "no";
|
||||
|
||||
config =
|
||||
imports =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@
|
|||
wget
|
||||
|
||||
# used in deployments
|
||||
flakes.colmena.defaultPackage."x86_64-linux"
|
||||
# flakes.deploy.defaultPackage."x86_64-linux"
|
||||
lix
|
||||
openssh
|
||||
];
|
||||
|
|
|
|||
|
|
@ -68,10 +68,21 @@
|
|||
|
||||
settings = {
|
||||
server.externalDomain = "https://photos.donsz.nl";
|
||||
logging.level = "verbose";
|
||||
logging.level = "log";
|
||||
|
||||
passwordLogin.enabled = false;
|
||||
|
||||
storageTemplate = {
|
||||
enabled = true;
|
||||
# year / album name or "Other" / y m d / filename
|
||||
template = "{{y}}/{{#if album}}{{album}}{{else}}Other{{/if}}/{{y}}-{{MM}}-{{dd}}/{{filename}}";
|
||||
hashVerificationEnabled = true;
|
||||
};
|
||||
|
||||
reverseGeocoding = {
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
oauth = {
|
||||
enabled = true;
|
||||
|
||||
|
|
@ -84,10 +95,7 @@
|
|||
roleClaim = "immich_role";
|
||||
scope = "openid email profile groups";
|
||||
tokenEndpointAuthMethod = "client_secret_post";
|
||||
# storageLabelClaim: "",
|
||||
# "mobileOverrideEnabled": false,
|
||||
# "mobileRedirectUri": "",
|
||||
|
||||
storageLabelClaim = "preferred_username";
|
||||
};
|
||||
};
|
||||
mediaLocation = "/storage/storage/media-server/photos";
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ in
|
|||
};
|
||||
};
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
|
|
|
|||
|
|
@ -6,19 +6,9 @@
|
|||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../default-machine-config.nix
|
||||
./kanata.nix
|
||||
];
|
||||
|
||||
custom.machine = {
|
||||
type = "pc";
|
||||
capabilities = [
|
||||
"cli"
|
||||
"graphical"
|
||||
"work"
|
||||
"fun"
|
||||
];
|
||||
};
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
|
|
@ -52,6 +42,7 @@
|
|||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
"docker"
|
||||
];
|
||||
packages = with pkgs; [ ];
|
||||
};
|
||||
|
|
@ -61,6 +52,8 @@
|
|||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
gcc
|
||||
docker
|
||||
|
||||
firefox
|
||||
kitty
|
||||
|
|
@ -87,8 +80,13 @@
|
|||
'';
|
||||
}
|
||||
) { })
|
||||
|
||||
config.boot.kernelPackages.perf
|
||||
rr
|
||||
];
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
services.xserver.enable = true;
|
||||
services.displayManager.gdm.enable = true;
|
||||
services.desktopManager.gnome.enable = true;
|
||||
|
|
@ -157,6 +155,13 @@
|
|||
};
|
||||
};
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
||||
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
||||
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
|
||||
};
|
||||
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = {
|
||||
# enable = true;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,44 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"nvme"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"rtsx_pci_sdmmc"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/4919727e-d114-4d57-b206-522b5df5fccc";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/4919727e-d114-4d57-b206-522b5df5fccc";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/26CD-373C";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/26CD-373C";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
|
|
|
|||
13
hosts/kili/kanata.nix
Normal file
13
hosts/kili/kanata.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
# TODO: make kanata system pkgs only
|
||||
users.groups.uinput = { };
|
||||
users.extraUsers.jana.extraGroups = [
|
||||
"uinput"
|
||||
"input"
|
||||
];
|
||||
environment.systemPackages = [ pkgs.kanata-with-cmd ];
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"
|
||||
'';
|
||||
}
|
||||
7
hosts/ragdoll/configuration.nix
Normal file
7
hosts/ragdoll/configuration.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
custom.home-info = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
custom.machine = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.enum [
|
||||
"server"
|
||||
"pc"
|
||||
];
|
||||
};
|
||||
capabilities = mkOption {
|
||||
type = types.listOf (types.enum (import ./capabilities.nix));
|
||||
default = [ "cli" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
inputs@{
|
||||
lib,
|
||||
options,
|
||||
machine,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
|
|
@ -8,28 +9,16 @@ with lib;
|
|||
options = {
|
||||
custom.program = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.string;
|
||||
};
|
||||
requirements = mkOption {
|
||||
type = types.listOf (types.enum (import ./capabilities.nix));
|
||||
default = [ "cli" ];
|
||||
};
|
||||
home-config = mkOption {
|
||||
type = types.deferredModule;
|
||||
};
|
||||
system-config = mkOption {
|
||||
# type = types.attrs;
|
||||
type = types.deferredModule;
|
||||
default = { };
|
||||
};
|
||||
types.submodule (_: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.string;
|
||||
};
|
||||
}
|
||||
)
|
||||
defered-config = mkOption {
|
||||
type = types.deferredModule;
|
||||
};
|
||||
};
|
||||
})
|
||||
);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,30 +1,31 @@
|
|||
{
|
||||
args@{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
machine,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.custom.users;
|
||||
machine = config.custom.machine;
|
||||
inherit (machine) home-only;
|
||||
inherit (machine) stateVersion;
|
||||
|
||||
valid-on-machine =
|
||||
on:
|
||||
# TODO: iterate over possibilities
|
||||
if machine.type == "server" then
|
||||
on.server
|
||||
else if machine.type == "pc" then
|
||||
on.pc
|
||||
else
|
||||
false;
|
||||
matches-capabilities =
|
||||
# all requirements are contained in the machine capabilities
|
||||
requirements: lib.all (req: builtins.elem req machine.capabilities) requirements;
|
||||
(
|
||||
if machine.type == "server" then
|
||||
on.server
|
||||
else if machine.type == "pc" then
|
||||
on.pc
|
||||
else
|
||||
false
|
||||
);
|
||||
|
||||
users = lib.filterAttrs (_: value: valid-on-machine value.on) cfg;
|
||||
home-users = lib.filterAttrs (_: value: value.apply-home-configs) users;
|
||||
stateVersion = config.system.stateVersion;
|
||||
programs = lib.attrsets.attrValues config.custom.program;
|
||||
valid-programs = builtins.filter (program: matches-capabilities program.requirements) programs;
|
||||
in
|
||||
{
|
||||
options =
|
||||
|
|
@ -75,35 +76,47 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge ([
|
||||
{
|
||||
users.extraUsers = lib.mapAttrs (name: value: {
|
||||
isNormalUser = true;
|
||||
extraGroups = value.groups;
|
||||
openssh.authorizedKeys.keys = value.keys;
|
||||
shell = value.shell;
|
||||
description = name;
|
||||
}) users;
|
||||
home-manager.users = lib.mapAttrs (
|
||||
name: value:
|
||||
(
|
||||
{ pkgs, lib, ... }:
|
||||
config = lib.mkMerge [
|
||||
(
|
||||
if (!builtins.isNull home-only) then
|
||||
lib.mkMerge ([
|
||||
{
|
||||
imports = (
|
||||
[
|
||||
./home-info.nix
|
||||
]
|
||||
++ (map (program: program.home-config) valid-programs)
|
||||
);
|
||||
|
||||
home = {
|
||||
inherit stateVersion;
|
||||
username = name;
|
||||
homeDirectory = "/home/${name}";
|
||||
username = toString home-only;
|
||||
homeDirectory = "/home/${toString home-only}";
|
||||
};
|
||||
}
|
||||
]
|
||||
# ++ map (program: program.home-config) programs
|
||||
)
|
||||
) home-users;
|
||||
}
|
||||
]);
|
||||
else
|
||||
(lib.mkMerge ([
|
||||
{
|
||||
users.extraUsers = lib.mapAttrs (name: value: {
|
||||
isNormalUser = true;
|
||||
extraGroups = value.groups;
|
||||
openssh.authorizedKeys.keys = value.keys;
|
||||
inherit (value) shell;
|
||||
description = name;
|
||||
}) users;
|
||||
home-manager.users = lib.mapAttrs (
|
||||
name: value:
|
||||
(_: {
|
||||
imports = (
|
||||
[
|
||||
]
|
||||
++ (map (program: program.defered-config) programs)
|
||||
);
|
||||
home = {
|
||||
inherit stateVersion;
|
||||
username = name;
|
||||
homeDirectory = "/home/${name}";
|
||||
};
|
||||
})
|
||||
) home-users;
|
||||
}
|
||||
]))
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Ptmux;_Gq=2,a=d,d=a\\
|
||||
|
|
@ -1,257 +1,241 @@
|
|||
_: {
|
||||
imports = [
|
||||
./nvim
|
||||
./fish
|
||||
./kanata
|
||||
./kitty
|
||||
./tmux
|
||||
./git
|
||||
./jj
|
||||
./niri
|
||||
./zed
|
||||
./firefox
|
||||
];
|
||||
{ machine, lib, ... }@inputs:
|
||||
{
|
||||
|
||||
custom.program.graphcial-packages = {
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
spotify
|
||||
obsidian
|
||||
element-desktop
|
||||
chromium
|
||||
bind.dnsutils
|
||||
mpv
|
||||
vlc
|
||||
];
|
||||
};
|
||||
};
|
||||
imports = lib.concatLists [
|
||||
[
|
||||
./xdg.nix
|
||||
./nvim
|
||||
./fish
|
||||
./kanata
|
||||
./kitty
|
||||
./tmux
|
||||
./git
|
||||
./jj
|
||||
./niri
|
||||
./zed
|
||||
./firefox
|
||||
]
|
||||
|
||||
custom.program.discord = {
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
disableFeatures = [
|
||||
"WebRtcAllowInputVolumeAdjustment"
|
||||
"ChromeWideEchoCancellation"
|
||||
];
|
||||
enableFeatures = [ ];
|
||||
commandLineArgs =
|
||||
lib.optionals (enableFeatures != [ ]) [
|
||||
"--enable-features=${lib.concatStringsSep "," enableFeatures}"
|
||||
]
|
||||
++ lib.optionals (disableFeatures != [ ]) [
|
||||
"--disable-features=${lib.concatStringsSep "," disableFeatures}"
|
||||
(machine.program {
|
||||
name = "graphcial-packages";
|
||||
inherit inputs;
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
spotify
|
||||
obsidian
|
||||
element-desktop
|
||||
# chromium
|
||||
bind.dnsutils
|
||||
mpv
|
||||
vlc
|
||||
libreoffice-qt
|
||||
hunspell
|
||||
hunspellDicts.en_US
|
||||
];
|
||||
joinedArgs = lib.concatStringsSep " " commandLineArgs;
|
||||
in
|
||||
{
|
||||
home.file."${config.xdg.configHome}/discord/settings.json".source = pkgs.writeText "settings.json" (
|
||||
lib.strings.toJSON (
|
||||
let
|
||||
endpoint = "https://inject.shelter.uwu.network/shelter+yt_ad_block+yt_embed_fix";
|
||||
in
|
||||
{
|
||||
SKIP_HOST_UPDATE = true;
|
||||
MINIMIZE_TO_TRAY = false;
|
||||
OPEN_ON_STARTUP = false;
|
||||
DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true;
|
||||
enableHardwareAcceleration = true;
|
||||
UPDATE_ENDPOINT = endpoint;
|
||||
NEW_UPDATE_ENDPOINT = "${endpoint}/";
|
||||
BACKGROUND_COLOR = "#2c2d32";
|
||||
};
|
||||
})
|
||||
|
||||
openasar = {
|
||||
setup = true;
|
||||
# using the performance preset breaks vaapi
|
||||
cmdPreset = "balanced";
|
||||
# quickstart is buggy and breaks discord sometimes.
|
||||
quickstart = false;
|
||||
# this css is made for discord compact mode. if you're not using that, stuff won't align!!
|
||||
css =
|
||||
# css
|
||||
''
|
||||
/* Hide nitro begging */
|
||||
@import url("https://raw.codeberg.page/AllPurposeMat/Disblock-Origin/DisblockOrigin.theme.css");
|
||||
(machine.program {
|
||||
name = "discord";
|
||||
inherit inputs;
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
disableFeatures = [
|
||||
"WebRtcAllowInputVolumeAdjustment"
|
||||
"ChromeWideEchoCancellation"
|
||||
];
|
||||
enableFeatures = [ ];
|
||||
commandLineArgs =
|
||||
lib.optionals (enableFeatures != [ ]) [
|
||||
"--enable-features=${lib.concatStringsSep "," enableFeatures}"
|
||||
]
|
||||
++ lib.optionals (disableFeatures != [ ]) [
|
||||
"--disable-features=${lib.concatStringsSep "," disableFeatures}"
|
||||
];
|
||||
joinedArgs = lib.concatStringsSep " " commandLineArgs;
|
||||
in
|
||||
{
|
||||
home.file."${config.xdg.configHome}/discord/settings.json".source = pkgs.writeText "settings.json" (
|
||||
lib.strings.toJSON (
|
||||
let
|
||||
endpoint = "https://inject.shelter.uwu.network/shelter+yt_ad_block+yt_embed_fix";
|
||||
in
|
||||
{
|
||||
SKIP_HOST_UPDATE = true;
|
||||
MINIMIZE_TO_TRAY = false;
|
||||
OPEN_ON_STARTUP = false;
|
||||
DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING = true;
|
||||
enableHardwareAcceleration = true;
|
||||
UPDATE_ENDPOINT = endpoint;
|
||||
NEW_UPDATE_ENDPOINT = "${endpoint}/";
|
||||
BACKGROUND_COLOR = "#2c2d32";
|
||||
|
||||
/* Hide the Visual Refresh title bar */
|
||||
.visual-refresh {
|
||||
/* Hide the bar itself */
|
||||
--custom-app-top-bar-height: 0px !important;
|
||||
openasar = {
|
||||
setup = true;
|
||||
# using the performance preset breaks vaapi
|
||||
cmdPreset = "balanced";
|
||||
# quickstart is buggy and breaks discord sometimes.
|
||||
quickstart = false;
|
||||
# this css is made for discord compact mode. if you're not using that, stuff won't align!!
|
||||
css =
|
||||
# css
|
||||
''
|
||||
/* Hide nitro begging */
|
||||
@import url("https://raw.codeberg.page/AllPurposeMat/Disblock-Origin/DisblockOrigin.theme.css");
|
||||
|
||||
/* Title bar buttons are still visible so hide them too */
|
||||
div.base__5e434 > div.bar_c38106 {
|
||||
display: none;
|
||||
/* Hide the Visual Refresh title bar */
|
||||
.visual-refresh {
|
||||
/* Hide the bar itself */
|
||||
--custom-app-top-bar-height: 0px !important;
|
||||
|
||||
/* Title bar buttons are still visible so hide them too */
|
||||
div.base__5e434 > div.bar_c38106 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Bring the server list down a few pixels */
|
||||
ul[data-list-id="guildsnav"] > div.itemsContainer_ef3116 {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Bring the server list down a few pixels */
|
||||
ul[data-list-id="guildsnav"] > div.itemsContainer_ef3116 {
|
||||
margin-top: 8px;
|
||||
:root {
|
||||
/* Disblock settings */
|
||||
--display-clan-tags: none;
|
||||
--display-active-now: none;
|
||||
--display-hover-reaction-emoji: none;
|
||||
--bool-show-name-gradients: false;
|
||||
}
|
||||
}
|
||||
|
||||
:root {
|
||||
/* Disblock settings */
|
||||
--display-clan-tags: none;
|
||||
--display-active-now: none;
|
||||
--display-hover-reaction-emoji: none;
|
||||
--bool-show-name-gradients: false;
|
||||
}
|
||||
/* Make "Read All" vencord button text smaller */
|
||||
button.vc-ranb-button {
|
||||
font-size: 9.5pt;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* Make "Read All" vencord button text smaller */
|
||||
button.vc-ranb-button {
|
||||
font-size: 9.5pt;
|
||||
font-weight: normal;
|
||||
}
|
||||
/* Hide Discover button */
|
||||
div[data-list-item-id="guildsnav___guild-discover-button"] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Hide Discover button */
|
||||
div[data-list-item-id="guildsnav___guild-discover-button"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide voice settings menus in user panel */
|
||||
div[class^="micButtonParent__"] button[role="switch"] {
|
||||
border-radius: var(--radius-sm);
|
||||
& ~ button { display: none; }
|
||||
}
|
||||
/* Also reduce the gap between the buttons */
|
||||
div.container__37e49 > div.buttons__37e49 {
|
||||
gap: 1px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
/* Hide voice settings menus in user panel */
|
||||
div[class^="micButtonParent__"] button[role="switch"] {
|
||||
border-radius: var(--radius-sm);
|
||||
& ~ button { display: none; }
|
||||
}
|
||||
/* Also reduce the gap between the buttons */
|
||||
div.container__37e49 > div.buttons__37e49 {
|
||||
gap: 1px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
home.packages = with pkgs; [
|
||||
(discord.override {
|
||||
# we disable updates in settings.json
|
||||
disableUpdates = false;
|
||||
commandLineArgs = joinedArgs;
|
||||
withTTS = false;
|
||||
enableAutoscroll = true;
|
||||
withOpenASAR = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
custom.program.fun-packages = {
|
||||
requirements = [ "fun" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
custom.p1n3appl3.tab
|
||||
prismlauncher
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
custom.program.cli-packages = {
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# general cli tools
|
||||
sops
|
||||
fzf
|
||||
htop
|
||||
ncdu
|
||||
psmisc
|
||||
ripgrep
|
||||
rsync
|
||||
zoxide
|
||||
tmux
|
||||
direnv
|
||||
atuin
|
||||
rcon
|
||||
lix
|
||||
nix-output-monitor
|
||||
wget
|
||||
comma
|
||||
unzip
|
||||
pciutils
|
||||
|
||||
# dev tools
|
||||
gdb
|
||||
clang-tools
|
||||
rustup
|
||||
git
|
||||
python3
|
||||
unixtools.xxd
|
||||
net-tools
|
||||
sqlite-interactive
|
||||
tokei
|
||||
just
|
||||
uv
|
||||
llvmPackages.bintools
|
||||
|
||||
(writeShellScriptBin "nas" ''
|
||||
mkdir -p ~/Documents/nas
|
||||
${sshfs}/bin/sshfs fili:/storage/storage/data/ ~/Documents/nas
|
||||
cd ~/Documents/nas
|
||||
'')
|
||||
];
|
||||
|
||||
# Set up direnv
|
||||
programs.direnv = {
|
||||
package = pkgs.direnv;
|
||||
silent = false;
|
||||
nix-direnv = {
|
||||
enable = true;
|
||||
package = pkgs.nix-direnv;
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
(discord.override {
|
||||
# we disable updates in settings.json
|
||||
disableUpdates = false;
|
||||
commandLineArgs = joinedArgs;
|
||||
withTTS = false;
|
||||
enableAutoscroll = true;
|
||||
withOpenASAR = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
home.file = {
|
||||
"${config.xdg.configHome}/sqlite3/sqliterc".source = pkgs.writeText ".sqliterc" ''
|
||||
.mode box
|
||||
'';
|
||||
(machine.program {
|
||||
name = "fun-packages";
|
||||
inherit inputs;
|
||||
requirements = [ "fun" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
custom.p1n3appl3.tab
|
||||
prismlauncher
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
custom.program.homedirs = {
|
||||
home-config =
|
||||
{ config, ... }:
|
||||
{
|
||||
home.file = {
|
||||
"dl".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.userDirs.download}";
|
||||
"doc".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.userDirs.documents}";
|
||||
};
|
||||
};
|
||||
};
|
||||
(machine.program {
|
||||
name = "cli-packages";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# general cli tools
|
||||
sops
|
||||
fzf
|
||||
htop
|
||||
ncdu
|
||||
psmisc
|
||||
ripgrep
|
||||
rsync
|
||||
zoxide
|
||||
tmux
|
||||
direnv
|
||||
atuin
|
||||
rcon
|
||||
lix
|
||||
nix-output-monitor
|
||||
wget
|
||||
comma
|
||||
unzip
|
||||
pciutils
|
||||
difftastic
|
||||
|
||||
custom.program.xdg = {
|
||||
home-config =
|
||||
{ config, ... }:
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
# dev tools
|
||||
gdb
|
||||
clang-tools
|
||||
rustup
|
||||
git
|
||||
python3
|
||||
unixtools.xxd
|
||||
net-tools
|
||||
sqlite-interactive
|
||||
tokei
|
||||
just
|
||||
uv
|
||||
llvmPackages.bintools
|
||||
|
||||
configHome = "${config.home.homeDirectory}/.config";
|
||||
userDirs = {
|
||||
enable = true;
|
||||
documents = "${config.home.homeDirectory}/Documents";
|
||||
desktop = "${config.home.homeDirectory}/Documents";
|
||||
download = "${config.home.homeDirectory}/Downloads";
|
||||
music = "${config.home.homeDirectory}/Documents/personal/music";
|
||||
pictures = "${config.home.homeDirectory}/Documents/personal/pictures";
|
||||
(writeShellScriptBin "nas" ''
|
||||
mkdir -p ~/Documents/nas
|
||||
${sshfs}/bin/sshfs fili:/storage/storage/data/ ~/Documents/nas
|
||||
cd ~/Documents/nas
|
||||
'')
|
||||
];
|
||||
|
||||
# Set up direnv
|
||||
programs.direnv = {
|
||||
package = pkgs.direnv;
|
||||
silent = false;
|
||||
nix-direnv = {
|
||||
enable = true;
|
||||
package = pkgs.nix-direnv;
|
||||
};
|
||||
};
|
||||
|
||||
mime.enable = true;
|
||||
home.file = {
|
||||
"${config.xdg.configHome}/sqlite3/sqliterc".source = pkgs.writeText ".sqliterc" ''
|
||||
.mode box
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,165 +1,170 @@
|
|||
_: {
|
||||
custom.program.firefox.requirements = [ "graphical" ];
|
||||
custom.program.firefox.home-config =
|
||||
{
|
||||
config,
|
||||
flakes,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
ff-pkgs = flakes.firefox-addons.packages.${pkgs.system};
|
||||
lock-false = {
|
||||
Value = false;
|
||||
Status = "locked";
|
||||
};
|
||||
# lock-true = {
|
||||
# Value = true;
|
||||
# Status = "locked";
|
||||
# };
|
||||
in
|
||||
{
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
|
||||
extraPolicies = {
|
||||
DisableFormHistory = true;
|
||||
OfferToSaveLogins = false;
|
||||
PasswordManagerEnabled = false;
|
||||
AppAutoUpdate = false;
|
||||
DisableFirefoxStudies = true;
|
||||
DisablePocket = true;
|
||||
DisableTelemetry = true;
|
||||
UserMessaging = {
|
||||
WhatsNew = true;
|
||||
ExtensionRecommendations = false;
|
||||
FeatureRecommendations = false;
|
||||
UrlbarInterventions = false;
|
||||
SkipOnboarding = true;
|
||||
MoreFromMozilla = false;
|
||||
Locked = true;
|
||||
};
|
||||
FirefoxHome = {
|
||||
Search = true;
|
||||
TopSites = false;
|
||||
SponsoredTopSites = false;
|
||||
Highlights = false;
|
||||
Pocket = false;
|
||||
SponsoredPocket = false;
|
||||
Snippets = false;
|
||||
Locked = false;
|
||||
};
|
||||
FirefoxSuggest = {
|
||||
WebSuggestions = false;
|
||||
SponsoredSuggestions = false;
|
||||
ImproveSuggest = false;
|
||||
Locked = true;
|
||||
};
|
||||
# TODO: https://github.com/TheRealGramdalf/nixos/blob/83f4339b121175f47940314bf5811080ac42c316/users/games/firefox/privacy.nix
|
||||
};
|
||||
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "firefox";
|
||||
inherit inputs;
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{
|
||||
config,
|
||||
flakes,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
ff-pkgs = flakes.firefox-addons.packages.${pkgs.system};
|
||||
lock-false = {
|
||||
Value = false;
|
||||
Status = "locked";
|
||||
};
|
||||
# lock-true = {
|
||||
# Value = true;
|
||||
# Status = "locked";
|
||||
# };
|
||||
in
|
||||
{
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
|
||||
extraPolicies = {
|
||||
DisableFormHistory = true;
|
||||
OfferToSaveLogins = false;
|
||||
PasswordManagerEnabled = false;
|
||||
AppAutoUpdate = false;
|
||||
DisableFirefoxStudies = true;
|
||||
DisablePocket = true;
|
||||
DisableTelemetry = true;
|
||||
UserMessaging = {
|
||||
WhatsNew = true;
|
||||
ExtensionRecommendations = false;
|
||||
FeatureRecommendations = false;
|
||||
UrlbarInterventions = false;
|
||||
SkipOnboarding = true;
|
||||
MoreFromMozilla = false;
|
||||
Locked = true;
|
||||
};
|
||||
FirefoxHome = {
|
||||
Search = true;
|
||||
TopSites = false;
|
||||
SponsoredTopSites = false;
|
||||
Highlights = false;
|
||||
Pocket = false;
|
||||
SponsoredPocket = false;
|
||||
Snippets = false;
|
||||
Locked = false;
|
||||
};
|
||||
FirefoxSuggest = {
|
||||
WebSuggestions = false;
|
||||
SponsoredSuggestions = false;
|
||||
ImproveSuggest = false;
|
||||
Locked = true;
|
||||
};
|
||||
# TODO: https://github.com/TheRealGramdalf/nixos/blob/83f4339b121175f47940314bf5811080ac42c316/users/games/firefox/privacy.nix
|
||||
};
|
||||
|
||||
profiles.default = {
|
||||
id = 0;
|
||||
name = "profile_0";
|
||||
isDefault = true;
|
||||
settings = {
|
||||
# specify profile-specific preferences here; check about:config for options
|
||||
"browser.newtabpage.activity-stream.feeds.section.highlights" = false;
|
||||
"browser.startup.page" = 3; # Restore previous tabs
|
||||
"extensions.autoDisableScopes" = 0;
|
||||
"extensions.pocket.enabled" = lock-false;
|
||||
"browser.tabs.closeWindowWithLastTab" = lock-false;
|
||||
"sidebar.position_start" = false; # sidebar on the right
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.toolbars.bookmarks.visibility" = "always";
|
||||
};
|
||||
|
||||
userChrome = builtins.readFile ./userChrome.css;
|
||||
userContent = builtins.readFile ./userChrome.css;
|
||||
profiles.default = {
|
||||
id = 0;
|
||||
name = "profile_0";
|
||||
isDefault = true;
|
||||
settings = {
|
||||
# specify profile-specific preferences here; check about:config for options
|
||||
"browser.newtabpage.activity-stream.feeds.section.highlights" = false;
|
||||
"browser.startup.page" = 3; # Restore previous tabs
|
||||
"extensions.autoDisableScopes" = 0;
|
||||
"extensions.pocket.enabled" = lock-false;
|
||||
"browser.tabs.closeWindowWithLastTab" = lock-false;
|
||||
"sidebar.position_start" = false; # sidebar on the right
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.toolbars.bookmarks.visibility" = "always";
|
||||
};
|
||||
|
||||
extensions.packages = with ff-pkgs; [
|
||||
bitwarden
|
||||
ublock-origin
|
||||
sidebery
|
||||
sponsorblock
|
||||
# vimium
|
||||
];
|
||||
userChrome = builtins.readFile ./userChrome.css;
|
||||
userContent = builtins.readFile ./userChrome.css;
|
||||
|
||||
bookmarks = {
|
||||
force = true;
|
||||
settings = [
|
||||
{
|
||||
keyword = "!w";
|
||||
url = "https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!m";
|
||||
url = "https://www.google.com/maps?q=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!git";
|
||||
url = "https://github.com/search?q=%s&type=code";
|
||||
}
|
||||
{
|
||||
keyword = "!std";
|
||||
url = "https://std.rs%s";
|
||||
}
|
||||
{
|
||||
keyword = "!rust";
|
||||
url = "https://docs.rs/releases/search?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!np";
|
||||
url = "https://search.nixos.org/packages?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!hmo";
|
||||
url = "https://home-manager-options.extranix.com/?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!no";
|
||||
url = "https://search.nixos.org/options?query=%s";
|
||||
}
|
||||
|
||||
# {
|
||||
# name = "bank";
|
||||
# toolbar = true;
|
||||
# url = "https://web.bunq.com/user";
|
||||
# }
|
||||
extensions.packages = with ff-pkgs; [
|
||||
bitwarden
|
||||
ublock-origin
|
||||
sidebery
|
||||
sponsorblock
|
||||
# vimium
|
||||
];
|
||||
};
|
||||
|
||||
# extensions.settings = {
|
||||
# "${ff-pkgs.sidebery.addonId}".settings = {
|
||||
# sidebar = {
|
||||
# # panels = with builtins; with lib; listToAttrs (map ffContainerToSideberryPanel (attrsToList containers));
|
||||
# # nav = [ "Personal" "Programming"];
|
||||
# };
|
||||
# # https://github.com/Dash-L/nixconfig/blob/c30f6d1486a3fe2b3793ab0cb13a88edefe83b7a/home/firefox.nix#L82
|
||||
# settings = {
|
||||
# pinnedTabsPosition = "top";
|
||||
# hideEmptyPanels = false;
|
||||
# activateAfterClosing = "prev";
|
||||
# activateAfterClosingStayInPanel = true;
|
||||
# newTabCtxReopen = true;
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
bookmarks = {
|
||||
force = true;
|
||||
settings = [
|
||||
{
|
||||
keyword = "!w";
|
||||
url = "https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!m";
|
||||
url = "https://www.google.com/maps?q=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!git";
|
||||
url = "https://github.com/search?q=%s&type=code";
|
||||
}
|
||||
{
|
||||
keyword = "!std";
|
||||
url = "https://std.rs%s";
|
||||
}
|
||||
{
|
||||
keyword = "!rust";
|
||||
url = "https://docs.rs/releases/search?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!np";
|
||||
url = "https://search.nixos.org/packages?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!hmo";
|
||||
url = "https://home-manager-options.extranix.com/?query=%s";
|
||||
}
|
||||
{
|
||||
keyword = "!no";
|
||||
url = "https://search.nixos.org/options?query=%s";
|
||||
}
|
||||
|
||||
# {
|
||||
# name = "bank";
|
||||
# toolbar = true;
|
||||
# url = "https://web.bunq.com/user";
|
||||
# }
|
||||
];
|
||||
};
|
||||
|
||||
# extensions.settings = {
|
||||
# "${ff-pkgs.sidebery.addonId}".settings = {
|
||||
# sidebar = {
|
||||
# # panels = with builtins; with lib; listToAttrs (map ffContainerToSideberryPanel (attrsToList containers));
|
||||
# # nav = [ "Personal" "Programming"];
|
||||
# };
|
||||
# # https://github.com/Dash-L/nixconfig/blob/c30f6d1486a3fe2b3793ab0cb13a88edefe83b7a/home/firefox.nix#L82
|
||||
# settings = {
|
||||
# pinnedTabsPosition = "top";
|
||||
# hideEmptyPanels = false;
|
||||
# activateAfterClosing = "prev";
|
||||
# activateAfterClosingStayInPanel = true;
|
||||
# newTabCtxReopen = true;
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
};
|
||||
};
|
||||
|
||||
xdg.mimeApps = {
|
||||
defaultApplications."x-scheme-handler/http" = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
defaultApplications."x-scheme-handler/https" = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
defaultApplications."text/html" = [ "firefox.desktop" ];
|
||||
defaultApplications."x-scheme-handler/about" = [ "firefox.desktop" ];
|
||||
defaultApplications."x-scheme-handler/unknown" = [ "firefox.desktop" ];
|
||||
};
|
||||
};
|
||||
|
||||
xdg.mimeApps = {
|
||||
defaultApplications."x-scheme-handler/http" = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
defaultApplications."x-scheme-handler/https" = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
defaultApplications."text/html" = [ "firefox.desktop" ];
|
||||
defaultApplications."x-scheme-handler/about" = [ "firefox.desktop" ];
|
||||
defaultApplications."x-scheme-handler/unknown" = [ "firefox.desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,241 +1,260 @@
|
|||
_: {
|
||||
custom.program.fish.requirements = [ "cli" ];
|
||||
custom.program.fish.home-config =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with builtins;
|
||||
with lib.attrsets;
|
||||
let
|
||||
scripts = (import ./scripts.nix) pkgs;
|
||||
aliases = with scripts; {
|
||||
"cp-mov" = cp-media "mov" "movies";
|
||||
"cp-ser" = cp-media "ser" "shows";
|
||||
"cp-ani" = cp-media "ani" "anime";
|
||||
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
||||
"p" = builtins.trace calc calc;
|
||||
"s" = "systemctl";
|
||||
"j" = "journalctl";
|
||||
"ju" = "journalctl -u";
|
||||
"jfu" = "journalctl -fu";
|
||||
"ls" = "${pkgs.eza}/bin/eza --git";
|
||||
"ll" = "${pkgs.eza}/bin/eza --git";
|
||||
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
|
||||
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
|
||||
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy";
|
||||
"cat" = "${pkgs.bat}/bin/bat";
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "fish";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with builtins;
|
||||
with lib.attrsets;
|
||||
let
|
||||
scripts = (import ./scripts.nix) pkgs;
|
||||
aliases = with scripts; {
|
||||
"cp-mov" = cp-media "mov" "movies";
|
||||
"cp-ser" = cp-media "ser" "shows";
|
||||
"cp-ani" = cp-media "ani" "anime";
|
||||
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
||||
"p" = builtins.trace calc calc;
|
||||
"s" = "systemctl";
|
||||
"j" = "journalctl";
|
||||
"ju" = "journalctl -u";
|
||||
"jfu" = "journalctl -fu";
|
||||
"ls" = "${pkgs.eza}/bin/eza --git";
|
||||
"ll" = "${pkgs.eza}/bin/eza --git";
|
||||
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
|
||||
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
|
||||
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy";
|
||||
"cat" = "${pkgs.bat}/bin/bat";
|
||||
|
||||
# "pull" = "${pkgs.git}/bin/git pull";
|
||||
# "push" = "${pkgs.git}/bin/git push";
|
||||
# "commit" = "${pkgs.git}/bin/git commit";
|
||||
# "add" = "${pkgs.git}/bin/git add";
|
||||
# "patch" = "${pkgs.git}/bin/git add -p";
|
||||
# "amend" = "${pkgs.git}/bin/git commit --amend";
|
||||
# "log" = "${pkgs.git}/bin/git log --all --graph --decorate";
|
||||
# "st" = "${pkgs.git}/bin/git status";
|
||||
# "checkout" = "${pkgs.git}/bin/git checkout";
|
||||
# "rebase" = "${pkgs.git}/bin/git rebase";
|
||||
# "stash" = "${pkgs.git}/bin/git stash";
|
||||
# "pull" = "${pkgs.git}/bin/git pull";
|
||||
# "push" = "${pkgs.git}/bin/git push";
|
||||
# "commit" = "${pkgs.git}/bin/git commit";
|
||||
# "add" = "${pkgs.git}/bin/git add";
|
||||
# "patch" = "${pkgs.git}/bin/git add -p";
|
||||
# "amend" = "${pkgs.git}/bin/git commit --amend";
|
||||
# "log" = "${pkgs.git}/bin/git log --all --graph --decorate";
|
||||
# "st" = "${pkgs.git}/bin/git status";
|
||||
# "checkout" = "${pkgs.git}/bin/git checkout";
|
||||
# "rebase" = "${pkgs.git}/bin/git rebase";
|
||||
# "stash" = "${pkgs.git}/bin/git stash";
|
||||
|
||||
"edit" = "jj edit";
|
||||
"old" = "jj edit @-";
|
||||
"new" = "jj edit @+";
|
||||
"rebase" = "jj rebase";
|
||||
"pull" = "jj git fetch; jj catchup";
|
||||
"msg" = "jj describe -m";
|
||||
"branch" = "jj bookmark set";
|
||||
"stat" = "jj status";
|
||||
"push" = "jj git push";
|
||||
"edit" = "jj edit";
|
||||
"old" = "jj edit @-";
|
||||
"new" = "jj edit @+";
|
||||
"rebase" = "jj rebase";
|
||||
"pull" = "jj git fetch; jj catchup";
|
||||
"msg" = "jj describe -m";
|
||||
"branch" = "jj bookmark set";
|
||||
"stat" = "jj status";
|
||||
"push" = "jj git push";
|
||||
|
||||
"tidy" = "x test tidy --bless";
|
||||
"ui" = "x test tests/ui/";
|
||||
"tidy" = "x test tidy --bless";
|
||||
"ui" = "x test tests/ui/";
|
||||
|
||||
"f" = "nautilus --no-desktop . &";
|
||||
};
|
||||
# extracting any compressed format
|
||||
extract = ''
|
||||
function extract -a file -d "decompress a file"
|
||||
if not test -f $file
|
||||
echo "'$file' is not a valid file"
|
||||
return 1
|
||||
end
|
||||
switch $file
|
||||
# tar can automatically figure out how to decompress
|
||||
case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end
|
||||
case '*.bz2'; bunzip2 $file; end
|
||||
case '*.rar'; unrar e $file; end
|
||||
case '*.gz'; gunzip $file; end
|
||||
case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end
|
||||
case '*.Z'; uncompress $file; end
|
||||
case '*.7z'; 7z x $file; end
|
||||
case '*';
|
||||
echo "'$file' cannot be extracted"
|
||||
"f" = "nautilus --no-desktop . &";
|
||||
};
|
||||
# extracting any compressed format
|
||||
extract = ''
|
||||
function extract -a file -d "decompress a file"
|
||||
if not test -f $file
|
||||
echo "'$file' is not a valid file"
|
||||
return 1
|
||||
end
|
||||
switch $file
|
||||
# tar can automatically figure out how to decompress
|
||||
case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end
|
||||
case '*.bz2'; bunzip2 $file; end
|
||||
case '*.rar'; unrar e $file; end
|
||||
case '*.gz'; gunzip $file; end
|
||||
case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end
|
||||
case '*.Z'; uncompress $file; end
|
||||
case '*.7z'; 7z x $file; end
|
||||
case '*';
|
||||
echo "'$file' cannot be extracted"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
in
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
'';
|
||||
in
|
||||
{
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
|
||||
settings = {
|
||||
filter_mode_shell_up_key_binding = "workspace";
|
||||
exit_mode = "return-original";
|
||||
inline_height = 20;
|
||||
workspaces = true;
|
||||
settings = {
|
||||
filter_mode_shell_up_key_binding = "workspace";
|
||||
exit_mode = "return-original";
|
||||
inline_height = 20;
|
||||
workspaces = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
# enableFishIntegration = lib.mkDefault true;
|
||||
};
|
||||
direnv = {
|
||||
enable = true;
|
||||
# enableFishIntegration = lib.mkDefault true;
|
||||
};
|
||||
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
fish = {
|
||||
enable = true;
|
||||
shellAliases = aliases;
|
||||
plugins = with pkgs.fishPlugins; [
|
||||
{
|
||||
name = "bang-bang";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "plugin-bang-bang";
|
||||
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
|
||||
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=";
|
||||
fish = {
|
||||
enable = true;
|
||||
shellAliases = aliases;
|
||||
plugins = with pkgs.fishPlugins; [
|
||||
{
|
||||
name = "bang-bang";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "plugin-bang-bang";
|
||||
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
|
||||
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "tide";
|
||||
inherit (tide) src;
|
||||
}
|
||||
{
|
||||
name = "sponge";
|
||||
inherit (sponge) src;
|
||||
}
|
||||
{
|
||||
name = "autopair";
|
||||
inherit (autopair) src;
|
||||
}
|
||||
];
|
||||
|
||||
functions = {
|
||||
fish_jj_prompt = {
|
||||
body = ''
|
||||
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T '
|
||||
separate(
|
||||
" ",
|
||||
bookmarks.join(", "),
|
||||
change_id.shortest(),
|
||||
commit_id.shortest(),
|
||||
if(conflict, "conflict"),
|
||||
if(empty, "empty"),
|
||||
if(divergent, "divergent"),
|
||||
if(hidden, "hidden"),
|
||||
)
|
||||
'
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "tide";
|
||||
inherit (tide) src;
|
||||
}
|
||||
{
|
||||
name = "sponge";
|
||||
inherit (sponge) src;
|
||||
}
|
||||
{
|
||||
name = "autopair";
|
||||
inherit (autopair) src;
|
||||
}
|
||||
];
|
||||
|
||||
functions = {
|
||||
fish_jj_prompt = {
|
||||
body = ''
|
||||
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null
|
||||
return 1
|
||||
end
|
||||
_tide_item_jj = {
|
||||
body = ''
|
||||
set -l _tide_item_jj_color $_tide_location_color
|
||||
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
|
||||
'';
|
||||
};
|
||||
|
||||
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T '
|
||||
separate(
|
||||
" ",
|
||||
bookmarks.join(", "),
|
||||
change_id.shortest(),
|
||||
commit_id.shortest(),
|
||||
if(conflict, "conflict"),
|
||||
if(empty, "empty"),
|
||||
if(divergent, "divergent"),
|
||||
if(hidden, "hidden"),
|
||||
)
|
||||
'
|
||||
'';
|
||||
_tide_item_git = {
|
||||
body = ''
|
||||
if not test -d .jj
|
||||
fish_git_prompt '%s'
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
_tide_item_jj = {
|
||||
body = ''
|
||||
set -l _tide_item_jj_color $_tide_location_color
|
||||
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
|
||||
'';
|
||||
};
|
||||
interactiveShellInit = ''
|
||||
fish_vi_key_bindings
|
||||
|
||||
_tide_item_git = {
|
||||
body = ''
|
||||
if not test -d .jj
|
||||
fish_git_prompt '%s'
|
||||
end
|
||||
'';
|
||||
};
|
||||
bind \e\[3\;5~ kill-word
|
||||
bind \cH backward-kill-word
|
||||
bind \cV beginning-of-line
|
||||
bind \f end-of-line
|
||||
|
||||
bind -M insert \e\[3\;5~ kill-word
|
||||
bind -M insert \cH backward-kill-word
|
||||
bind -M insert \cV beginning-of-line
|
||||
bind -M insert \f end-of-line
|
||||
|
||||
bind \cl 'clear; commandline -f repaint'
|
||||
bind -M insert \cl 'clear; commandline -f repaint'
|
||||
|
||||
set -g sponge_successful_exit_codes 0
|
||||
set -g sponge_allow_previously_successful false
|
||||
set -g sponge_delay 10
|
||||
|
||||
${config.programs.jujutsu.package}/bin/jj util completion fish | source
|
||||
|
||||
# if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items
|
||||
# set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items)
|
||||
# if test $tide_item_jj_idx
|
||||
# set tide_left_prompt_items \
|
||||
# $tide_left_prompt_items[1..$tide_item_jj_idx] \
|
||||
# jj \
|
||||
# $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1]
|
||||
# end
|
||||
# end
|
||||
|
||||
function t
|
||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||
end
|
||||
|
||||
function temp
|
||||
t $argv
|
||||
end
|
||||
|
||||
function rs
|
||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||
cargo init . --bin --name $(basename "$PWD")
|
||||
vim src/main.rs
|
||||
end
|
||||
|
||||
fish_add_path "$HOME/.cargo/bin"
|
||||
fish_add_path "$HOME/.local/bin"
|
||||
fish_add_path "$HOME/Documents/scripts"
|
||||
fish_add_path "$HOME/.nix-profile/bin"
|
||||
|
||||
function fish_greeting
|
||||
${pkgs.blahaj}/bin/blahaj -s
|
||||
echo "welcome to $(uname -n), $(whoami)!"
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
interactiveShellInit = ''
|
||||
fish_vi_key_bindings
|
||||
|
||||
set -g sponge_successful_exit_codes 0
|
||||
set -g sponge_allow_previously_successful false
|
||||
set -g sponge_delay 10
|
||||
|
||||
${config.programs.jujutsu.package}/bin/jj util completion fish | source
|
||||
|
||||
# if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items
|
||||
# set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items)
|
||||
# if test $tide_item_jj_idx
|
||||
# set tide_left_prompt_items \
|
||||
# $tide_left_prompt_items[1..$tide_item_jj_idx] \
|
||||
# jj \
|
||||
# $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1]
|
||||
# end
|
||||
# end
|
||||
|
||||
function t
|
||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||
end
|
||||
|
||||
function temp
|
||||
t $argv
|
||||
end
|
||||
|
||||
function rs
|
||||
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
|
||||
cargo init . --bin --name $(basename "$PWD")
|
||||
vim src/main.rs
|
||||
end
|
||||
|
||||
fish_add_path "$HOME/.cargo/bin"
|
||||
fish_add_path "$HOME/.local/bin"
|
||||
fish_add_path "$HOME/Documents/scripts"
|
||||
fish_add_path "$HOME/.nix-profile/bin"
|
||||
|
||||
function fish_greeting
|
||||
${pkgs.blahaj}/bin/blahaj -s
|
||||
end
|
||||
home.activation = {
|
||||
setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
setupTide() {
|
||||
${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
|
||||
lib.cli.toGNUCommandLineShell { } {
|
||||
auto = true;
|
||||
style = "Lean";
|
||||
prompt_colors = "True color";
|
||||
show_time = "No";
|
||||
lean_prompt_height = "Two lines";
|
||||
prompt_connection = "Disconnected";
|
||||
prompt_spacing = "Compact";
|
||||
icons = "Few icons";
|
||||
transient = "Yes";
|
||||
}
|
||||
}"} >/dev/null 2>&1
|
||||
}
|
||||
setupTide
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
home.activation = {
|
||||
setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
setupTide() {
|
||||
${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
|
||||
lib.cli.toGNUCommandLineShell { } {
|
||||
auto = true;
|
||||
style = "Lean";
|
||||
prompt_colors = "True color";
|
||||
show_time = "No";
|
||||
lean_prompt_height = "Two lines";
|
||||
prompt_connection = "Disconnected";
|
||||
prompt_spacing = "Compact";
|
||||
icons = "Few icons";
|
||||
transient = "Yes";
|
||||
}
|
||||
}"} >/dev/null 2>&1
|
||||
}
|
||||
setupTide
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,44 @@
|
|||
_: {
|
||||
custom.program.git.requirements = [ "cli" ];
|
||||
custom.program.git.home-config = _: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
signing.key = "/home/jana/.ssh/id_ed25519.pub";
|
||||
signing.signByDefault = true;
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "git";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config = _: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
signing.key = "/home/jana/.ssh/id_ed25519.pub";
|
||||
signing.signByDefault = true;
|
||||
|
||||
settings = {
|
||||
user.email = "jana@donsz.nl";
|
||||
user.name = "Jana Dönszelmann";
|
||||
settings = {
|
||||
user.email = "jana@donsz.nl";
|
||||
user.name = "Jana Dönszelmann";
|
||||
|
||||
push.autoSetupRemote = true;
|
||||
pull.rebase = true;
|
||||
init.defaultBranch = "main";
|
||||
gpg.format = "ssh";
|
||||
diff.colorMoved = "default";
|
||||
rerere.enabled = true;
|
||||
push.autoSetupRemote = true;
|
||||
pull.rebase = true;
|
||||
init.defaultBranch = "main";
|
||||
gpg.format = "ssh";
|
||||
diff.colorMoved = "default";
|
||||
rerere.enabled = true;
|
||||
|
||||
alias.conflicts = "diff --check";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
programs.delta = {
|
||||
enable = true;
|
||||
options = {
|
||||
navigate = true;
|
||||
light = false;
|
||||
side-by-side = true;
|
||||
features = "decorations interactive";
|
||||
interactive = {
|
||||
keep-plus-minus-markers = false;
|
||||
alias.conflicts = "diff --check";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
programs.delta = {
|
||||
enable = true;
|
||||
options = {
|
||||
navigate = true;
|
||||
light = false;
|
||||
side-by-side = true;
|
||||
features = "decorations interactive";
|
||||
interactive = {
|
||||
keep-plus-minus-markers = false;
|
||||
};
|
||||
};
|
||||
enableGitIntegration = true;
|
||||
};
|
||||
enableGitIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,193 +1,198 @@
|
|||
_: {
|
||||
custom.program.jujutsu.requirements = [ "cli" ];
|
||||
custom.program.jujutsu.home-config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
# package = pkgs.custom.jujutsu;
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "jujutsu";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
# package = pkgs.custom.jujutsu;
|
||||
|
||||
settings = {
|
||||
user = {
|
||||
email = config.programs.git.settings.user.email;
|
||||
name = config.programs.git.settings.user.name;
|
||||
};
|
||||
|
||||
ui = {
|
||||
paginate = "never";
|
||||
# pager = "${pkgs.delta}/bin/delta";
|
||||
# for delta
|
||||
# diff-formatter = ":git";
|
||||
diff-formatter = [
|
||||
"${pkgs.difftastic}/bin/difft"
|
||||
"--color=always"
|
||||
"$left"
|
||||
"$right"
|
||||
];
|
||||
|
||||
default-command = [
|
||||
"log"
|
||||
"--reversed"
|
||||
"--no-pager"
|
||||
];
|
||||
merge-editor = [
|
||||
"${pkgs.meld}/bin/meld"
|
||||
"$left"
|
||||
"$base"
|
||||
"$right"
|
||||
"-o"
|
||||
"$output"
|
||||
"--auto-merge"
|
||||
];
|
||||
# diff-editor = "${pkgs.meld}/bin/meld";
|
||||
};
|
||||
|
||||
fsmonitor.backend = "watchman";
|
||||
fsmonitor.watchman.register-snapshot-trigger = true;
|
||||
|
||||
# revsets.log = "@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()";
|
||||
# revsets.log = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)";
|
||||
revsets.log = "trunk() | ancestors(trunk()..heads(((trunk()..visible_heads()) & my() | @)::), 2)";
|
||||
|
||||
revset-aliases = {
|
||||
"my()" = "user(\"${config.programs.jujutsu.settings.user.email}\")";
|
||||
"user(x)" = "author(x) | committer(x)";
|
||||
current = "bookmarks() & my() & ~immutable()";
|
||||
"closest_bookmark(to)" = "heads(::to & bookmarks())";
|
||||
};
|
||||
|
||||
template-aliases = {
|
||||
"format_timestamp(timestamp)" = "timestamp.ago()";
|
||||
log_oneline = ''
|
||||
if(root,
|
||||
format_root_commit(self),
|
||||
label(if(current_working_copy, "working_copy"),
|
||||
concat(
|
||||
separate(" ",
|
||||
format_short_change_id_with_change_offset(self),
|
||||
if(empty, label("empty", "(empty)")),
|
||||
if(description,
|
||||
description.first_line(),
|
||||
label(if(empty, "empty"), description_placeholder),
|
||||
),
|
||||
bookmarks,
|
||||
tags,
|
||||
working_copies,
|
||||
if(conflict, label("conflict", "conflict")),
|
||||
if(config("ui.show-cryptographic-signatures").as_boolean(),
|
||||
format_short_cryptographic_signature(signature)),
|
||||
) ++ "\n",
|
||||
),
|
||||
)
|
||||
)
|
||||
'';
|
||||
# if(.contained_in('first_parent(@)'), label("git_head", "HEAD")),
|
||||
status_summary = "'\n' ++ self.diff().summary() ++ '\n'";
|
||||
log_oneline_with_status_summary = "log_oneline ++ if(self.current_working_copy() && self.diff().files().len() > 0, status_summary)";
|
||||
};
|
||||
|
||||
aliases =
|
||||
let
|
||||
util = script: [
|
||||
"util"
|
||||
"exec"
|
||||
"--"
|
||||
"bash"
|
||||
"-c"
|
||||
script
|
||||
];
|
||||
in
|
||||
{
|
||||
tug = [
|
||||
"bookmark"
|
||||
"move"
|
||||
"--from"
|
||||
"heads(@- & bookmarks())"
|
||||
"--to"
|
||||
"coalesce(@ & ~empty(), @-)"
|
||||
];
|
||||
fuck = [
|
||||
"bookmark"
|
||||
"move"
|
||||
"--from"
|
||||
"heads(@ & bookmarks())"
|
||||
"--to"
|
||||
"@-"
|
||||
"--allow-backwards"
|
||||
];
|
||||
catchup = [
|
||||
"rebase"
|
||||
"-b"
|
||||
"bookmarks() & mine() & ~immutable()"
|
||||
"-d"
|
||||
"trunk()"
|
||||
"--skip-emptied"
|
||||
];
|
||||
pull = util ''
|
||||
jj git fetch
|
||||
jj catchup
|
||||
'';
|
||||
ch = [
|
||||
"show"
|
||||
"--stat"
|
||||
];
|
||||
move = [
|
||||
"rebase"
|
||||
"-r"
|
||||
];
|
||||
push = [
|
||||
"git"
|
||||
"push"
|
||||
];
|
||||
ll = [
|
||||
"log"
|
||||
"-T"
|
||||
"builtin_log_compact"
|
||||
];
|
||||
mdiff = [
|
||||
"diff"
|
||||
"--from"
|
||||
"trunk()"
|
||||
];
|
||||
settings = {
|
||||
user = {
|
||||
email = config.programs.git.settings.user.email;
|
||||
name = config.programs.git.settings.user.name;
|
||||
};
|
||||
|
||||
templates = {
|
||||
log_node = ''
|
||||
label("node",
|
||||
coalesce(
|
||||
if(!self, label("elided", "~")),
|
||||
if(current_working_copy, label("working_copy", "@")),
|
||||
if(conflict, label("conflict", "×")),
|
||||
if(immutable, label("immutable", "*")),
|
||||
label("normal", "·")
|
||||
ui = {
|
||||
paginate = "never";
|
||||
# pager = "${pkgs.delta}/bin/delta";
|
||||
# for delta
|
||||
# diff-formatter = ":git";
|
||||
diff-formatter = [
|
||||
"${pkgs.difftastic}/bin/difft"
|
||||
"--color=always"
|
||||
"$left"
|
||||
"$right"
|
||||
];
|
||||
|
||||
default-command = [
|
||||
"log"
|
||||
"--reversed"
|
||||
"--no-pager"
|
||||
];
|
||||
merge-editor = [
|
||||
"${pkgs.meld}/bin/meld"
|
||||
"$left"
|
||||
"$base"
|
||||
"$right"
|
||||
"-o"
|
||||
"$output"
|
||||
"--auto-merge"
|
||||
];
|
||||
# diff-editor = "${pkgs.meld}/bin/meld";
|
||||
};
|
||||
|
||||
fsmonitor.backend = "watchman";
|
||||
fsmonitor.watchman.register-snapshot-trigger = true;
|
||||
|
||||
revsets.log = "@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()";
|
||||
# revsets.log = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)";
|
||||
# revsets.log = "trunk() | ancestors(trunk()..heads(((trunk()..visible_heads()) & my() | @)::), 2)";
|
||||
|
||||
revset-aliases = {
|
||||
"my()" = "user(\"${config.programs.jujutsu.settings.user.email}\")";
|
||||
"user(x)" = "author(x) | committer(x)";
|
||||
current = "bookmarks() & my() & ~immutable()";
|
||||
"closest_bookmark(to)" = "heads(::to & bookmarks())";
|
||||
};
|
||||
|
||||
template-aliases = {
|
||||
"format_timestamp(timestamp)" = "timestamp.ago()";
|
||||
log_oneline = ''
|
||||
if(root,
|
||||
format_root_commit(self),
|
||||
label(if(current_working_copy, "working_copy"),
|
||||
concat(
|
||||
separate(" ",
|
||||
format_short_change_id_with_change_offset(self),
|
||||
if(empty, label("empty", "(empty)")),
|
||||
if(description,
|
||||
description.first_line(),
|
||||
label(if(empty, "empty"), description_placeholder),
|
||||
),
|
||||
bookmarks,
|
||||
tags,
|
||||
working_copies,
|
||||
if(conflict, label("conflict", "conflict")),
|
||||
if(config("ui.show-cryptographic-signatures").as_boolean(),
|
||||
format_short_cryptographic_signature(signature)),
|
||||
) ++ "\n",
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
'';
|
||||
log = "log_oneline_with_status_summary";
|
||||
git_push_bookmark = ''"jdonszelmann/" ++ change_id.short()'';
|
||||
};
|
||||
'';
|
||||
# if(.contained_in('first_parent(@)'), label("git_head", "HEAD")),
|
||||
status_summary = "'\n' ++ self.diff().summary() ++ '\n'";
|
||||
log_oneline_with_status_summary = "log_oneline ++ if(self.current_working_copy() && self.diff().files().len() > 0, status_summary)";
|
||||
};
|
||||
|
||||
signing = {
|
||||
# sign-all = true;
|
||||
behavior = "own";
|
||||
backend = "ssh";
|
||||
key = "~/.ssh/id_ed25519.pub";
|
||||
};
|
||||
aliases =
|
||||
let
|
||||
util = script: [
|
||||
"util"
|
||||
"exec"
|
||||
"--"
|
||||
"bash"
|
||||
"-c"
|
||||
script
|
||||
];
|
||||
in
|
||||
{
|
||||
tug = [
|
||||
"bookmark"
|
||||
"move"
|
||||
"--from"
|
||||
"heads(@- & bookmarks())"
|
||||
"--to"
|
||||
"coalesce(@ & ~empty(), @-)"
|
||||
];
|
||||
fuck = [
|
||||
"bookmark"
|
||||
"move"
|
||||
"--from"
|
||||
"heads(@ & bookmarks())"
|
||||
"--to"
|
||||
"@-"
|
||||
"--allow-backwards"
|
||||
];
|
||||
catchup = [
|
||||
"rebase"
|
||||
"-b"
|
||||
"bookmarks() & mine() & ~immutable()"
|
||||
"-d"
|
||||
"trunk()"
|
||||
"--skip-emptied"
|
||||
];
|
||||
pull = util ''
|
||||
jj git fetch
|
||||
jj catchup
|
||||
'';
|
||||
ch = [
|
||||
"show"
|
||||
"--stat"
|
||||
];
|
||||
move = [
|
||||
"rebase"
|
||||
"-r"
|
||||
];
|
||||
push = [
|
||||
"git"
|
||||
"push"
|
||||
];
|
||||
ll = [
|
||||
"log"
|
||||
"-T"
|
||||
"builtin_log_compact"
|
||||
];
|
||||
mdiff = [
|
||||
"diff"
|
||||
"--from"
|
||||
"trunk()"
|
||||
];
|
||||
};
|
||||
|
||||
# remotes.origin.auto-track-bookmarks = true;
|
||||
# remotes.upstream.auto-track-bookmarks = true;
|
||||
templates = {
|
||||
log_node = ''
|
||||
label("node",
|
||||
coalesce(
|
||||
if(!self, label("elided", "~")),
|
||||
if(current_working_copy, label("working_copy", "@")),
|
||||
if(conflict, label("conflict", "×")),
|
||||
if(immutable, label("immutable", "*")),
|
||||
label("normal", "·")
|
||||
)
|
||||
)
|
||||
'';
|
||||
log = "log_oneline_with_status_summary";
|
||||
git_push_bookmark = ''"jdonszelmann/" ++ change_id.short()'';
|
||||
};
|
||||
|
||||
git = {
|
||||
private-commits = "description(glob:'wip:*') | description(glob:'trial:*')";
|
||||
write-change-id-header = true;
|
||||
signing = {
|
||||
# sign-all = true;
|
||||
behavior = "own";
|
||||
backend = "ssh";
|
||||
key = "~/.ssh/id_ed25519.pub";
|
||||
};
|
||||
|
||||
fetch = [
|
||||
"upstream"
|
||||
"origin"
|
||||
];
|
||||
push = "origin";
|
||||
# remotes.origin.auto-track-bookmarks = true;
|
||||
# remotes.upstream.auto-track-bookmarks = true;
|
||||
|
||||
git = {
|
||||
private-commits = "description(glob:'wip:*') | description(glob:'trial:*')";
|
||||
write-change-id-header = true;
|
||||
|
||||
fetch = [
|
||||
"upstream"
|
||||
"origin"
|
||||
];
|
||||
push = "origin";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
inputs@{ machine, pkgs, ... }:
|
||||
let
|
||||
kanata-config = ''
|
||||
(defcfg
|
||||
|
|
@ -26,25 +26,29 @@ let
|
|||
|
||||
(deflayer control
|
||||
@esc
|
||||
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||
tab q w e @replay t y u i o p @wup @wdown \
|
||||
@cap a s d f g left down up right ; ' bspc
|
||||
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||
tab @mcleft @mup @mcright @replay t y u i o p @wup @wdown \
|
||||
@cap @mleft @mdown @mright f g left down up right ; ' bspc
|
||||
lsft z x C-c v bspc n @macro , . C-f rsft
|
||||
lctl lmet lalt spc ralt @rctl
|
||||
)
|
||||
|
||||
(deflayermap (programming)
|
||||
f (macro f n spc)
|
||||
w (macro w h e r e spc)
|
||||
l (macro l o o p { ret)
|
||||
u (macro u s e spc)
|
||||
i (macro i m p o r t spc)
|
||||
s (macro s e l f spc)
|
||||
(deflayermap (other)
|
||||
w @mup
|
||||
a @mleft
|
||||
s @mdown
|
||||
d @mright
|
||||
|
||||
q @mcleft
|
||||
e @mcright
|
||||
|
||||
[ @wup
|
||||
] @wdown
|
||||
)
|
||||
|
||||
(defalias
|
||||
;; hold esc
|
||||
esc (tap-hold 800 800 esc caps)
|
||||
esc (tap-hold 200 200 C-k (macro C-f esc))
|
||||
|
||||
;; control
|
||||
cap (tap-hold-release 200 200
|
||||
|
|
@ -58,6 +62,14 @@ let
|
|||
lmet
|
||||
)
|
||||
|
||||
mup (movemouse-up 1 1)
|
||||
mleft (movemouse-left 1 1)
|
||||
mdown (movemouse-down 1 1)
|
||||
mright (movemouse-right 1 1)
|
||||
|
||||
mcleft mlft
|
||||
mcright mrgt
|
||||
|
||||
macro (dynamic-macro-record 0)
|
||||
replay (dynamic-macro-play 0)
|
||||
|
||||
|
|
@ -68,38 +80,42 @@ let
|
|||
rctl (
|
||||
tap-hold-release
|
||||
200 200
|
||||
C-k (layer-while-held programming)
|
||||
C-k (layer-while-held other)
|
||||
)
|
||||
)
|
||||
'';
|
||||
in
|
||||
{
|
||||
custom.program.kanata.requirements = [ "graphical" ];
|
||||
custom.program.kanata.home-config =
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
systemd.user.services.kanata = {
|
||||
Unit = {
|
||||
Description = "kanata";
|
||||
imports = machine.program {
|
||||
name = "kanata";
|
||||
inherit inputs;
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
systemd.user.services.kanata = {
|
||||
Unit = {
|
||||
Description = "kanata";
|
||||
};
|
||||
|
||||
Service = {
|
||||
Restart = "always";
|
||||
RestartSec = "3";
|
||||
ExecStart = "${pkgs.kanata-with-cmd}/bin/kanata --cfg ${pkgs.writeText "kanata.kbd" kanata-config}";
|
||||
Nice = "-20";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
Service = {
|
||||
Restart = "always";
|
||||
RestartSec = "3";
|
||||
ExecStart = "${pkgs.kanata-with-cmd}/bin/kanata --cfg ${pkgs.writeText "kanata.kbd" kanata-config}";
|
||||
Nice = "-20";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
home.file.kanata = {
|
||||
target = ".config/kanata/kanata.kbd";
|
||||
text = kanata-config;
|
||||
};
|
||||
};
|
||||
|
||||
home.file.kanata = {
|
||||
target = ".config/kanata/kanata.kbd";
|
||||
text = kanata-config;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# custom.program.kanata.system-config =
|
||||
# { pkgs, ... }:
|
||||
|
|
@ -111,15 +127,6 @@ in
|
|||
# reboot or sudo udevadm control --reload-rules && sudo udevadm trigger
|
||||
# sudo modprobe uinput
|
||||
|
||||
users.groups.uinput = { };
|
||||
users.extraUsers.jana.extraGroups = [
|
||||
"uinput"
|
||||
"input"
|
||||
];
|
||||
environment.systemPackages = [ pkgs.kanata-with-cmd ];
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"
|
||||
'';
|
||||
# };
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,59 +1,68 @@
|
|||
_: {
|
||||
custom.program.kitty.requirements = [ "graphical" ];
|
||||
custom.program.kitty.home-config =
|
||||
{ pkgs, flakes, ... }:
|
||||
{
|
||||
home.packages = pkgs.custom.maple-fonts-pack;
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "kitty";
|
||||
inherit inputs;
|
||||
requirements = [ "graphical" ];
|
||||
home-config =
|
||||
{ pkgs, flakes, ... }:
|
||||
{
|
||||
home.packages = pkgs.custom.maple-fonts-pack;
|
||||
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
name = "Maple Mono NF";
|
||||
size = 13.0;
|
||||
package = pkgs.jetbrains-mono;
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
name = "Maple Mono NF";
|
||||
size = 11.0;
|
||||
package = pkgs.jetbrains-mono;
|
||||
};
|
||||
|
||||
settings = {
|
||||
scrollback_lines = 20000;
|
||||
allow_hyperlinks = true;
|
||||
|
||||
repaint_delay = 10;
|
||||
input_delay = 3;
|
||||
|
||||
enable_audio_bell = false;
|
||||
update_check_interval = 0;
|
||||
|
||||
initial_window_width = "95c";
|
||||
initial_window_height = "30c";
|
||||
remember_window_size = "no";
|
||||
|
||||
draw_minimal_borders = false;
|
||||
hide_window_decorations = true;
|
||||
|
||||
shell = "${pkgs.tmux}/bin/tmux";
|
||||
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
|
||||
|
||||
foreground = "#fcfcfc";
|
||||
background = "#232627";
|
||||
linux_display_server = "auto";
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
"ctrl+f" =
|
||||
"launch --location=hsplit --allow-remote-control kitty +kitten ${flakes.kitty-search}/search.py @active-kitty-window-id";
|
||||
"ctrl+alt+r" = "load_config_file";
|
||||
"ctrl+shift+r" = "no_op";
|
||||
"super+`" = "no_op";
|
||||
"ctrl+EQUAL" = "change_font_size all +2.0";
|
||||
"ctrl+minus" = "change_font_size all -2.0";
|
||||
"ctrl+0" = "change_font_size all 0";
|
||||
# "ctrl+/" = "send_text all ";
|
||||
"super+~" = "no_op";
|
||||
|
||||
# required for vim!!
|
||||
# terminals map ctrl+i to tab. I want them to do different things in vim.
|
||||
"ctrl+i" = "send_text all \\x01";
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
mouse_map left click ungrabbed no-op
|
||||
'';
|
||||
};
|
||||
|
||||
settings = {
|
||||
scrollback_lines = 20000;
|
||||
allow_hyperlinks = true;
|
||||
|
||||
repaint_delay = 10;
|
||||
input_delay = 3;
|
||||
|
||||
enable_audio_bell = false;
|
||||
update_check_interval = 0;
|
||||
|
||||
initial_window_width = "95c";
|
||||
initial_window_height = "30c";
|
||||
remember_window_size = "no";
|
||||
|
||||
draw_minimal_borders = false;
|
||||
hide_window_decorations = true;
|
||||
|
||||
shell = "${pkgs.tmux}/bin/tmux";
|
||||
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
|
||||
|
||||
foreground = "#fcfcfc";
|
||||
background = "#232627";
|
||||
linux_display_server = "auto";
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
"ctrl+f" =
|
||||
"launch --location=hsplit --allow-remote-control kitty +kitten ${flakes.kitty-search}/search.py @active-kitty-window-id";
|
||||
"ctrl+alt+r" = "load_config_file";
|
||||
"ctrl+shift+r" = "no_op";
|
||||
"super+`" = "no_op";
|
||||
"ctrl+EQUAL" = "change_font_size all +2.0";
|
||||
"ctrl+minus" = "change_font_size all -2.0";
|
||||
"ctrl+0" = "change_font_size all 0";
|
||||
# "ctrl+/" = "send_text all ";
|
||||
"super+~" = "no_op";
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
mouse_map left click ungrabbed no-op
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,134 +19,32 @@ local esc = vim.api.nvim_replace_termcodes(
|
|||
)
|
||||
local api = require('Comment.api')
|
||||
|
||||
vim.keymap.set("n", "<C-_>", ":lua require('Comment.api').toggle.linewise.current()<CR> j", { remap = true })
|
||||
vim.keymap.set("n", "<C-_>", ":lua require('Comment.api').toggle.linewise.current()<CR>j", { remap = true })
|
||||
vim.keymap.set("i", "<C-_>", "<c-o>:lua require('Comment.api').toggle.linewise.current()<CR>", { remap = true })
|
||||
vim.keymap.set("x", "<C-_>", function()
|
||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
||||
api.toggle.linewise(vim.fn.visualmode())
|
||||
end, { remap = true })
|
||||
|
||||
vim.keymap.set('n', 'gr', (function() builtin.lsp_references({jump_type="vsplit"}) end), {})
|
||||
vim.keymap.set('n', 'gd', (function() builtin.lsp_definitions({jump_type="vsplit"}) end), {})
|
||||
vim.keymap.set('n', 'gt', (function() builtin.lsp_type_definitions({jump_type="vsplit"}) end), {})
|
||||
|
||||
local barbar_state = require("barbar.state")
|
||||
function find_windows_with_buffer(bufnum)
|
||||
windows = {}
|
||||
|
||||
local window_list = vim.api.nvim_list_wins()
|
||||
-- vim.keymap.set('n', 'gr', (function() builtin.lsp_references({jump_type="vsplit"}) end), {})
|
||||
-- vim.keymap.set('n', 'gd', (function() builtin.lsp_definitions({jump_type="vsplit"}) end), {})
|
||||
-- vim.keymap.set('n', 'gt', (function() builtin.lsp_type_definitions({jump_type="vsplit"}) end), {})
|
||||
-- vim.keymap.set('n', 'gt', (function() builtin.lsp_type_definitions({jump_type="vsplit"}) end), {})
|
||||
|
||||
for _, window in ipairs(window_list) do
|
||||
local win_info = vim.fn.getwininfo(window)
|
||||
|
||||
if win_info ~= nil then
|
||||
for _, buf in ipairs(win_info) do
|
||||
if buf.bufnr == bufnum then
|
||||
table.insert(windows, window)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return windows
|
||||
end
|
||||
|
||||
function num_useful_windows()
|
||||
local window_list = vim.api.nvim_tabpage_list_wins(0)
|
||||
local num = 0
|
||||
|
||||
for _, window in ipairs(window_list) do
|
||||
local win_info = vim.fn.getwininfo(window)
|
||||
|
||||
if win_info ~= nil then
|
||||
for _, win_info in ipairs(win_info) do
|
||||
if buf_is_useful(win_info.bufnr) then
|
||||
num = num + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return num
|
||||
end
|
||||
|
||||
function buf_is_useful(bufnr)
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
|
||||
-- if the window's buffer has no name, it's not useful
|
||||
if bufname == '' then
|
||||
return false
|
||||
end
|
||||
|
||||
-- print("bufname: ", bufname)
|
||||
|
||||
-- if the window's buffer is read only, it's not useful
|
||||
local readonly = vim.api.nvim_buf_get_option(bufnr, 'readonly')
|
||||
if readonly then
|
||||
-- print("=readonly")
|
||||
return false
|
||||
end
|
||||
|
||||
-- -- if the buffer is not listed, it's not useful
|
||||
local listed = vim.api.nvim_buf_get_option(bufnr, 'buflisted')
|
||||
if not listed then
|
||||
-- print("=unlisted")
|
||||
return false
|
||||
end
|
||||
|
||||
local buftype = vim.api.nvim_buf_get_option(bufnr, 'buftype')
|
||||
if buftype == "quickfix" then
|
||||
-- print("=readonly")
|
||||
return false
|
||||
end
|
||||
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
if #lines > 1 or (#lines == 1 and #lines[1] > 0) then
|
||||
return true -- If the buffer has content, return false
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
-- the window contains a useful buffer
|
||||
return true
|
||||
end
|
||||
|
||||
function quit_window(window)
|
||||
vim.api.nvim_win_call(window, function()
|
||||
vim.cmd "quit"
|
||||
end)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('CloseBuffer', function (opts)
|
||||
if num_useful_windows() > 1 then
|
||||
vim.cmd {
|
||||
cmd = "quit",
|
||||
bang = opts.bang,
|
||||
}
|
||||
else
|
||||
vim.cmd {
|
||||
cmd = "BufferDelete",
|
||||
bang = opts.bang,
|
||||
}
|
||||
if not buf_is_useful(vim.api.nvim_get_current_buf()) then
|
||||
vim.cmd {
|
||||
cmd = "quit",
|
||||
bang = opts.bang,
|
||||
}
|
||||
end
|
||||
end
|
||||
end, { desc = "Close Current Buffer", bang = true, })
|
||||
|
||||
local function close_floating()
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
local config = vim.api.nvim_win_get_config(win)
|
||||
if config.relative ~= "" then
|
||||
vim.api.nvim_win_close(win, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Esc>", close_floating, { desc = "Close floats, clear highlights" })
|
||||
-- local function close_floating()
|
||||
-- for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
-- local config = vim.api.nvim_win_get_config(win)
|
||||
-- if config.relative ~= "" then
|
||||
-- vim.api.nvim_win_close(win, false)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- vim.keymap.set("n", "<Esc>", close_floating, { desc = "Close floats, clear highlights" })
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,104 +1,160 @@
|
|||
_: {
|
||||
custom.program.nvim.requirements = [ "cli" ];
|
||||
custom.program.nvim.home-config =
|
||||
{ pkgs, flakes, ... }:
|
||||
{
|
||||
|
||||
home = {
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "nvim";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{
|
||||
pkgs,
|
||||
flakes,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nvim_mime_types = [
|
||||
"application/x-zerosize"
|
||||
"text/english"
|
||||
"text/plain"
|
||||
"text/x-makefile"
|
||||
"text/x-c++hdr"
|
||||
"text/x-c++src"
|
||||
"text/x-chdr"
|
||||
"text/x-csrc"
|
||||
"text/x-java"
|
||||
"text/x-moc"
|
||||
"text/x-pascal"
|
||||
"text/x-tcl"
|
||||
"text/x-tex"
|
||||
"application/x-shellscript"
|
||||
"text/x-c"
|
||||
"text/x-c++"
|
||||
];
|
||||
desktop-entry-name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanvim";
|
||||
desktop-entry = pkgs.makeDesktopItem {
|
||||
name = desktop-entry-name;
|
||||
desktopName = "neovim";
|
||||
exec = "${./editor-hax.py} %F";
|
||||
tryExec = "${./editor-hax.py}";
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
categories = [
|
||||
"Utility"
|
||||
"TextEditor"
|
||||
];
|
||||
icon = "terminal";
|
||||
mimeTypes = nvim_mime_types;
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
flakes.nixvim.homeModules.nixvim
|
||||
./options.nix
|
||||
./plugins.nix
|
||||
./keys.nix
|
||||
];
|
||||
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
globals.mapleader = " ";
|
||||
globals.maplocalleader = " ";
|
||||
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# Highlight and remove extra white spaces
|
||||
# same color as cursorline as per
|
||||
# https://github.com/joshdick/onedark.vim/blob/390b893d361c356ac1b00778d849815f2aa44ae4/autoload/onedark.vim
|
||||
highlight.ExtraWhitespace.bg = "#2C323C";
|
||||
match.ExtraWhitespace = "\\s\\+$";
|
||||
|
||||
clipboard.providers.wl-copy.enable = true;
|
||||
|
||||
performance = {
|
||||
byteCompileLua.enable = true;
|
||||
combinePlugins = {
|
||||
enable = true;
|
||||
|
||||
standalonePlugins = [
|
||||
# clashes with lualine
|
||||
"onedark.nvim"
|
||||
];
|
||||
in
|
||||
{
|
||||
home = {
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
};
|
||||
};
|
||||
|
||||
extraLuaPackages = ps: [ ps.magick ];
|
||||
extraPackages = [ pkgs.imagemagick ];
|
||||
home.file.".local/share/applications/${desktop-entry-name}.desktop" = {
|
||||
source = "${desktop-entry}/share/applications/${desktop-entry-name}.desktop";
|
||||
};
|
||||
|
||||
# package = (import inputs.unstable { inherit (pkgs) system; }).neovim-unwrapped;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
xdg.mimeApps.associations.added = lib.mergeAttrsList (
|
||||
map (mime: {
|
||||
${mime} = [ "${desktop-entry-name}.desktop" ];
|
||||
}) nvim_mime_types
|
||||
);
|
||||
|
||||
colorschemes.onedark = {
|
||||
imports = [
|
||||
flakes.nixvim.homeModules.nixvim
|
||||
./options.nix
|
||||
./plugins.nix
|
||||
./keys.nix
|
||||
];
|
||||
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
style = "deep";
|
||||
globals.mapleader = " ";
|
||||
globals.maplocalleader = " ";
|
||||
|
||||
highlights = {
|
||||
# bright green doccomments
|
||||
"@lsp.type.comment".fg = "#77B767";
|
||||
"@comment.documentation.rust".fg = "#77B767";
|
||||
"@comment.documentation".fg = "#77B767";
|
||||
"@comment".fg = "#426639";
|
||||
# "Visual".bg = "#2a2e36";
|
||||
# "Cursorline".bg = "#2a2e36";
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# Highlight and remove extra white spaces
|
||||
# same color as cursorline as per
|
||||
# https://github.com/joshdick/onedark.vim/blob/390b893d361c356ac1b00778d849815f2aa44ae4/autoload/onedark.vim
|
||||
highlight.ExtraWhitespace.bg = "#2C323C";
|
||||
match.ExtraWhitespace = "\\s\\+$";
|
||||
|
||||
clipboard.providers.wl-copy.enable = true;
|
||||
|
||||
performance = {
|
||||
byteCompileLua.enable = true;
|
||||
combinePlugins = {
|
||||
enable = true;
|
||||
|
||||
standalonePlugins = [
|
||||
# clashes with lualine
|
||||
"onedark.nvim"
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
extraLuaPackages = ps: [ ps.magick ];
|
||||
extraPackages = [ pkgs.imagemagick ];
|
||||
|
||||
# package = (import inputs.unstable { inherit (pkgs) system; }).neovim-unwrapped;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
|
||||
colorschemes.onedark = {
|
||||
enable = true;
|
||||
settings = {
|
||||
style = "deep";
|
||||
|
||||
highlights = {
|
||||
# bright green doccomments
|
||||
"@lsp.type.comment".fg = "#77B767";
|
||||
"@comment.documentation.rust".fg = "#77B767";
|
||||
"@comment.documentation".fg = "#77B767";
|
||||
"@comment".fg = "#426639";
|
||||
# "Visual".bg = "#2a2e36";
|
||||
# "Cursorline".bg = "#2a2e36";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
extraConfigLuaPre = ''
|
||||
require("neoconf").setup({})
|
||||
'';
|
||||
extraConfigLua = ''
|
||||
require("render-markdown").setup {
|
||||
latex_converter = '${pkgs.python312Packages.pylatexenc}/bin/latex2text',
|
||||
}
|
||||
''
|
||||
|
||||
# local lspconfig = require 'lspconfig'
|
||||
# local configs = require 'lspconfig.configs'
|
||||
# if not configs.foo_lsp then
|
||||
# configs.noteslsp = {
|
||||
# default_config = {
|
||||
# -- cmd = {'${pkgs.custom.noteslsp}/bin/noteslsp'},
|
||||
# cmd = {'./noteslsp/target/debug/noteslsp'},
|
||||
# filetypes = {'markdown'},
|
||||
# root_dir = function(fname)
|
||||
# return lspconfig.util.find_git_ancestor(fname)
|
||||
# end,
|
||||
# settings = {}
|
||||
# ,
|
||||
# },
|
||||
# }
|
||||
# end
|
||||
#
|
||||
# lspconfig.noteslsp.setup{}
|
||||
# ''
|
||||
+ (builtins.readFile ./config.lua);
|
||||
extraConfigLuaPost = ''
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfigLuaPre = ''
|
||||
require("neoconf").setup({})
|
||||
'';
|
||||
extraConfigLua = ''
|
||||
require("render-markdown").setup {
|
||||
latex_converter = '${pkgs.python312Packages.pylatexenc}/bin/latex2text',
|
||||
}
|
||||
''
|
||||
|
||||
# local lspconfig = require 'lspconfig'
|
||||
# local configs = require 'lspconfig.configs'
|
||||
# if not configs.foo_lsp then
|
||||
# configs.noteslsp = {
|
||||
# default_config = {
|
||||
# -- cmd = {'${pkgs.custom.noteslsp}/bin/noteslsp'},
|
||||
# cmd = {'./noteslsp/target/debug/noteslsp'},
|
||||
# filetypes = {'markdown'},
|
||||
# root_dir = function(fname)
|
||||
# return lspconfig.util.find_git_ancestor(fname)
|
||||
# end,
|
||||
# settings = {}
|
||||
# ,
|
||||
# },
|
||||
# }
|
||||
# end
|
||||
#
|
||||
# lspconfig.noteslsp.setup{}
|
||||
# ''
|
||||
+ (builtins.readFile ./config.lua);
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
119
programs/nvim/editor-hax.py
Executable file
119
programs/nvim/editor-hax.py
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env python
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
extract_line_regex = re.compile(r"(.*?)(?::([0-9]+))?(?::([0-9]+))?(:)?$")
|
||||
|
||||
main_editor = "nvim"
|
||||
editors = [main_editor, "vim", "vi"]
|
||||
real_editor = os.environ.get("REAL_EDITOR", None)
|
||||
editor_command = main_editor
|
||||
if real_editor is not None:
|
||||
editors.append(real_editor)
|
||||
editor_command = real_editor
|
||||
|
||||
def run(cmd, only_stdout=True):
|
||||
res = subprocess.run(cmd, capture_output=True, text=True, shell=True)
|
||||
if only_stdout:
|
||||
return str(res.stdout)
|
||||
else:
|
||||
return res
|
||||
|
||||
def find_pane(window):
|
||||
for editor in editors:
|
||||
pane = run(f"tmux list-panes -a -f '#{{&&:#{{==:#{{window_id}},{window}}},#{{==:#{{pane_current_command}},{editor}}}}}' -F '#{{pane_id}}'").strip();
|
||||
if pane != "":
|
||||
return pane
|
||||
|
||||
def create_pane(args):
|
||||
run(f'tmux split-window -h -P -F "#{{pane_id}}" {editor_command} {args}')
|
||||
|
||||
def find_or_create_pane(window, args):
|
||||
if pane := find_pane(window):
|
||||
# exit copy mode so we don't send these commands directly to tmux
|
||||
run(f"tmux send-keys -t {pane} -X cancel")
|
||||
# Escape for some reason doesn't get sent as the escape key if it shows up next to any other keys???
|
||||
run(f"tmux send-keys -t {pane} Escape")
|
||||
|
||||
# note the space, this tells nvim not to save it in history
|
||||
run(f"tmux send-keys -t {pane} \": drop {args}\" Enter")
|
||||
run(f"tmux select-pane -t {pane} -Z")
|
||||
else:
|
||||
create_pane(args)
|
||||
|
||||
def split_line(filename):
|
||||
mtch = extract_line_regex.match(filename)
|
||||
file = mtch.group(1)
|
||||
line = mtch.group(2)
|
||||
column = mtch.group(3)
|
||||
|
||||
url = urlsplit(line)
|
||||
if url.scheme == "file" and url.path != file:
|
||||
file = url.path
|
||||
|
||||
file = os.path.abspath(file)
|
||||
|
||||
print(f"opening {file}:{line}:{column}")
|
||||
return file, line, column
|
||||
|
||||
def join_line(filename, maybe_line, maybe_column):
|
||||
assert not (maybe_line is None and maybe_column is not None)
|
||||
|
||||
if maybe_line is None:
|
||||
return filename
|
||||
|
||||
if maybe_column is None:
|
||||
maybe_column = "0"
|
||||
|
||||
return f"+normal!{maybe_line}G{maybe_column} {filename}"
|
||||
|
||||
def trim(arg):
|
||||
if arg.startswith("\"") and not arg.endswith("\""):
|
||||
arg = arg.lstrip("\"")
|
||||
if arg.endswith("\"") and not arg.startswith("\""):
|
||||
arg = arg.rstrip("\"")
|
||||
return arg.strip()
|
||||
|
||||
def editor_hax(filename):
|
||||
args = split_line(trim(filename))
|
||||
current_window = run("tmux display-message -p \"#{window_id}\"").strip();
|
||||
find_or_create_pane(current_window, join_line(*args))
|
||||
|
||||
def xdg_open(arg):
|
||||
subprocess.run(f"xdg-open {trim(arg)}", shell=True)
|
||||
|
||||
def xdg_open_proxy(*args):
|
||||
for arg in args:
|
||||
try:
|
||||
_file, line, _column = split_line(arg)
|
||||
if line is not None:
|
||||
editor_hax(arg)
|
||||
else:
|
||||
xdg_open(arg)
|
||||
except:
|
||||
xdg_open(arg)
|
||||
|
||||
|
||||
def usage():
|
||||
print(f"usage: {sys.argv[0]} filename:(line):(column)")
|
||||
print(" Opens a file with line number and colum in the editor in another pane of the current tmux window")
|
||||
print(f"usage: {sys.argv[0]} xdg-open-proxy filename:(line):(column)")
|
||||
print(" Calls xdg-open on the given parameters. However, if any part contains a line number and or column, opens in nvim like editor-hax")
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
usage()
|
||||
elif sys.argv[1] == "xdg-open-proxy":
|
||||
if len(sys.argv) < 3:
|
||||
usage()
|
||||
else:
|
||||
xdg_open_proxy(*sys.argv[1:])
|
||||
elif len(sys.argv) > 2:
|
||||
usage()
|
||||
else:
|
||||
editor_hax(sys.argv[1])
|
||||
|
||||
|
|
@ -17,39 +17,23 @@ in
|
|||
# splitting
|
||||
(map "n" "<leader>s" "<cmd>vertical sb<cr>")
|
||||
|
||||
# closing
|
||||
(map "n" "<leader>w" "<cmd>BufferClose<cr>") # single buffer
|
||||
(map "n" "<leader>cb" "<cmd>BufferClose<cr>") # single buffer
|
||||
|
||||
(map "n" "<leader>ct" "<cmd>CloseBuffer<cr>") # buffer or extra tab
|
||||
(map "n" "<leader>q" "<cmd>CloseBuffer<cr>") # buffer or extra tab
|
||||
|
||||
(map "n" "<leader>co" "<cmd>silent! BufferCloseAllButVisible<cr>") # other buffers
|
||||
(map "n" "<leader>cl" "<cmd>silent! BufferCloseBuffersLeft<cr>") # other buffers (left)
|
||||
(map "n" "<leader>cr" "<cmd>silent! BufferCloseBuffersRight<cr>") # other buffers (right)
|
||||
|
||||
# moving
|
||||
(map "n" "mL" "<cmd>BufferMovePrevious<cr>") # left
|
||||
(map "n" "mr" "<cmd>BufferMoveNext<cr>") # right
|
||||
(map "n" "m0" "<cmd>BufferMoveStart<cr>") # start
|
||||
(map "n" "m$" "<cmd>BufferMoveEnd<cr>") # end
|
||||
|
||||
(map "n" "<leader>jb" "<cmd>BufferPick<cr>") # jump to tab
|
||||
|
||||
# jumplist
|
||||
# (map "n" "<leader><Tab>" "<C-o>")
|
||||
# (map "n" "<leader><S-Tab>" "<C-i>")
|
||||
(map "" "<C-a>" "<C-i>") # note: C-a is actually C-i, remapped through kitty.
|
||||
(luamap "n" "<leader>r" "${telescope}.jumplist()")
|
||||
(luamap "n" "<leader>R" "${telescope}.loclist()")
|
||||
|
||||
# pickers
|
||||
(luamap "n" "<leader><leader>" "${telescope}.find_files()")
|
||||
(luamap "n" "<leader>f" "${telescope}.live_grep()")
|
||||
(luamap "n" "<leader>t" "${telescope}.lsp_document_symbols()")
|
||||
(luamap "n" "<leader>T" "${telescope}.lsp_dynamic_workspace_symbols()")
|
||||
(luamap "n" "<leader>/" "${telescope}.current_buffer_fuzzy_find()")
|
||||
# last used pickers/searches
|
||||
(luamap "n" "<leader>h" "${telescope}.pickers()")
|
||||
(luamap "n" "<leader>p" "${telescope}.pickers()")
|
||||
(luamap "n" "<leader>m" "${telescope}.search_history()")
|
||||
# open buffers
|
||||
(luamap "n" "<leader>b" "${telescope}.buffers({sort_mru = true})")
|
||||
(luamap "n" "<leader><Tab>" "${telescope}.buffers({sort_mru = true})")
|
||||
|
||||
# diagnostics
|
||||
(map "n" "<leader>d" "<cmd>Trouble diagnostics toggle filter.buf=0<cr>")
|
||||
|
|
@ -69,26 +53,25 @@ in
|
|||
# expand macro
|
||||
(map "n" "<leader>em" "<cmd>RustLsp expandMacro<cr>")
|
||||
|
||||
# easier quitting etc
|
||||
(map "ca" "W" "w")
|
||||
(map "ca" "X" "x")
|
||||
|
||||
(map "ca" "Q" "CloseBuffer")
|
||||
(map "ca" "q" "CloseBuffer")
|
||||
|
||||
# navigation
|
||||
(map "" "<leader><Left>" "<C-w><Left>")
|
||||
(map "" "<leader><Right>" "<C-w><Right>")
|
||||
(map "" "<leader><Up>" "<C-w><Up>")
|
||||
(map "" "<leader><Down>" "<C-w><Down>")
|
||||
(map "" "<leader><Down>" "<C-w><Down>")
|
||||
(map "" "<leader>h" "<C-w><Left>")
|
||||
(map "" "<leader>l" "<C-w><Right>")
|
||||
(map "" "<leader>k" "<C-w><Up>")
|
||||
(map "" "<leader>j" "<C-w><Down>")
|
||||
|
||||
# close buffer
|
||||
(map "" "<leader>c" "<cmd>bd<cr>")
|
||||
|
||||
# {
|
||||
# key = "/";
|
||||
# action = "<cmd>lua require('spectre').open_file_search({select_word=true})<CR>";
|
||||
# }
|
||||
|
||||
(map "n" "t" "<cmd>Neotree toggle<cr>")
|
||||
# (map "n" "t" "<cmd>Neotree toggle<cr>")
|
||||
|
||||
# tab for indent/dedent
|
||||
(map "n" "<tab>" ">>_")
|
||||
|
|
@ -98,6 +81,9 @@ in
|
|||
(map "v" "<S-tab>" "<gv")
|
||||
|
||||
# to avoid many typos
|
||||
# easier quitting etc
|
||||
(map "n" ";" ":")
|
||||
(map "ca" "W" "w")
|
||||
(map "ca" "X" "x")
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,5 +84,9 @@ _: {
|
|||
"noselect"
|
||||
"noinsert"
|
||||
];
|
||||
|
||||
# disable auto-folding
|
||||
foldlevel = 99;
|
||||
foldlevelstart = 99;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,6 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
# fzy-lua-native = pkgs.vimUtils.buildVimPlugin {
|
||||
# name = "fzy-lua-native";
|
||||
# src = pkgs.fetchFromGitHub {
|
||||
# owner = "romgrk";
|
||||
# repo = "fzy-lua-native";
|
||||
# rev = "9d720745d5c2fb563c0d86c17d77612a3519c506";
|
||||
# hash = "sha256-pBV5iGa1+5gtM9BcDk8I5SKoQ9sydOJHsmyoBcxAct0=";
|
||||
# };
|
||||
# };
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
|
|
@ -168,7 +159,11 @@ in
|
|||
crates.enable = true;
|
||||
fidget.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
# nvim-highlight-colors.enable = true;
|
||||
spider.enable = true;
|
||||
origami = {
|
||||
enable = true;
|
||||
settings.autofold.enabled = false;
|
||||
};
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
|
|
@ -221,11 +216,15 @@ in
|
|||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<C-d>" = ''
|
||||
function()
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
else
|
||||
cmp.open_docs()
|
||||
end
|
||||
else
|
||||
cmp.open_docs()
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
|
@ -270,7 +269,7 @@ in
|
|||
};
|
||||
|
||||
auto-session = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
settings = {
|
||||
auto_save_enabled = true;
|
||||
auto_restore_enabled = true;
|
||||
|
|
@ -288,7 +287,7 @@ in
|
|||
};
|
||||
|
||||
neo-tree = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
settings = {
|
||||
close_if_last_window = true;
|
||||
enable_git_status = false;
|
||||
|
|
@ -660,7 +659,7 @@ in
|
|||
return wilder.renderer_mux({
|
||||
[':'] = popupmenu_renderer,
|
||||
['/'] = wildmenu_renderer,
|
||||
substitute = wildmenu_renderer,
|
||||
substitute = wildmenu_enderer,
|
||||
})
|
||||
end)()
|
||||
'';
|
||||
|
|
@ -695,7 +694,7 @@ in
|
|||
];
|
||||
defaults = {
|
||||
path_display = [ "smart" ];
|
||||
layout_strategy = "horizontal";
|
||||
layout_strategy = "flex";
|
||||
layout_config = {
|
||||
width = 0.99;
|
||||
height = 0.99;
|
||||
|
|
@ -709,15 +708,6 @@ in
|
|||
enable = true;
|
||||
};
|
||||
|
||||
# tabs
|
||||
barbar = {
|
||||
enable = true;
|
||||
settings = {
|
||||
options.diagnostics = "nvim_lsp";
|
||||
focus_on_close = "previous";
|
||||
};
|
||||
};
|
||||
|
||||
# for lsp/cmp inside markdown code blocks
|
||||
otter = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -1,170 +1,207 @@
|
|||
_: {
|
||||
custom.program.tmux.requirements = [ "cli" ];
|
||||
custom.program.tmux.home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
mouse = true;
|
||||
clock24 = true;
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "tmux";
|
||||
inherit inputs;
|
||||
requirements = [ "cli" ];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
mouse = true;
|
||||
clock24 = true;
|
||||
|
||||
shortcut = "k";
|
||||
shortcut = "k";
|
||||
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
plugin = tmuxPlugins.mkTmuxPlugin {
|
||||
pluginName = "suspend";
|
||||
version = "1a2f806";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "MunifTanjim";
|
||||
repo = "tmux-suspend";
|
||||
rev = "1a2f806666e0bfed37535372279fa00d27d50d14";
|
||||
sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv";
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
plugin = tmuxPlugins.mkTmuxPlugin {
|
||||
pluginName = "suspend";
|
||||
version = "1a2f806";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "MunifTanjim";
|
||||
repo = "tmux-suspend";
|
||||
rev = "1a2f806666e0bfed37535372279fa00d27d50d14";
|
||||
sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv";
|
||||
};
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
set -g @suspend_key 'F11'
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = tmuxPlugins.mode-indicator;
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
set -g @suspend_key 'F11'
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = tmuxPlugins.mode-indicator;
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# unbind every single normal keybinding
|
||||
unbind-key -a
|
||||
extraConfig = ''
|
||||
# unbind every single normal keybinding
|
||||
unbind-key -a
|
||||
|
||||
# for special characters to work right
|
||||
# like <C-_>
|
||||
# set-window-option -g xterm-keys on
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S "
|
||||
|
||||
set -g set-titles on
|
||||
set -g allow-passthrough on
|
||||
set -s escape-time 0
|
||||
# for special characters to work right
|
||||
# like <C-_>
|
||||
# set-window-option -g xterm-keys on
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
set-option -g default-shell ${pkgs.fish}/bin/fish
|
||||
set -ga terminal-features "\*:hyperlinks"
|
||||
set -g set-titles on
|
||||
set -g allow-passthrough on
|
||||
set -s escape-time 0
|
||||
|
||||
set-window-option -g mode-keys vi
|
||||
set-option -g default-shell ${pkgs.fish}/bin/fish
|
||||
set -ga terminal-features "\*:hyperlinks"
|
||||
|
||||
# clipboard stuff
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
|
||||
bind v copy-mode
|
||||
bind p paste-buffer -p
|
||||
set -s set-clipboard on
|
||||
set-window-option -g mode-keys vi
|
||||
|
||||
# get back normal terminal emulator bindings
|
||||
bind-key -n S-PPage copy-mode -u
|
||||
bind-key -T copy-mode -n S-NPage send-keys -X page-down
|
||||
# clipboard stuff
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
|
||||
bind v copy-mode
|
||||
bind p paste-buffer -p
|
||||
set -s set-clipboard on
|
||||
|
||||
# don't scroll to end when copying with mouse
|
||||
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe
|
||||
bind-key -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
# get back normal terminal emulator bindings
|
||||
bind-key -n S-PPage copy-mode -u
|
||||
bind-key -T copy-mode -n S-NPage send-keys -X page-down
|
||||
|
||||
# window control
|
||||
bind t new-window -c "#{pane_current_path}"
|
||||
bind-key Tab next-window
|
||||
bind-key BTab previous-window
|
||||
set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
|
||||
set -g renumber-windows on
|
||||
bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window
|
||||
bind A last-window
|
||||
# don't scroll to end when copying with mouse
|
||||
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe
|
||||
bind-key -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
|
||||
|
||||
bind-key 1 select-window -t :0
|
||||
bind-key 2 select-window -t :1
|
||||
bind-key 3 select-window -t :2
|
||||
bind-key 4 select-window -t :3
|
||||
bind-key 5 select-window -t :4
|
||||
bind-key 6 select-window -t :5
|
||||
bind-key 7 select-window -t :6
|
||||
bind-key 8 select-window -t :7
|
||||
bind-key 9 select-window -t :8
|
||||
bind-key 0 select-window -t :9
|
||||
# window control
|
||||
bind t new-window -c "#{pane_current_path}"
|
||||
bind-key Tab next-window
|
||||
bind-key BTab previous-window
|
||||
set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
|
||||
set -g renumber-windows on
|
||||
bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window
|
||||
bind A last-window
|
||||
|
||||
# pane control
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
bind L split-window -h -c "#{pane_current_path}"
|
||||
bind J split-window -v -c "#{pane_current_path}"
|
||||
bind H split-window -h -b -c "#{pane_current_path}"
|
||||
bind K split-window -v -b -c "#{pane_current_path}"
|
||||
bind x swap-pane -D
|
||||
bind-key 1 select-window -t :0
|
||||
bind-key 2 select-window -t :1
|
||||
bind-key 3 select-window -t :2
|
||||
bind-key 4 select-window -t :3
|
||||
bind-key 5 select-window -t :4
|
||||
bind-key 6 select-window -t :5
|
||||
bind-key 7 select-window -t :6
|
||||
bind-key 8 select-window -t :7
|
||||
bind-key 9 select-window -t :8
|
||||
bind-key 0 select-window -t :9
|
||||
|
||||
# double-click ^k (or lshift with kanata) for previous pane like ^w in vim
|
||||
bind -r ^k select-pane -l
|
||||
bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
||||
# pane control
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
bind Left select-pane -L
|
||||
bind Down select-pane -D
|
||||
bind Up select-pane -U
|
||||
bind Right select-pane -R
|
||||
bind L split-window -h -c "#{pane_current_path}"
|
||||
bind J split-window -v -c "#{pane_current_path}"
|
||||
bind H split-window -h -b -c "#{pane_current_path}"
|
||||
bind K split-window -v -b -c "#{pane_current_path}"
|
||||
bind S-Left split-window -h -c "#{pane_current_path}"
|
||||
bind S-Down split-window -v -c "#{pane_current_path}"
|
||||
bind S-Up split-window -h -b -c "#{pane_current_path}"
|
||||
bind S-Right split-window -v -b -c "#{pane_current_path}"
|
||||
bind-key -r -T prefix M-h resize-pane -L 5
|
||||
bind-key -r -T prefix M-j resize-pane -D 5
|
||||
bind-key -r -T prefix M-k resize-pane -U 5
|
||||
bind-key -r -T prefix M-l resize-pane -R 5
|
||||
bind x swap-pane -D
|
||||
|
||||
bind-key o choose-tree -wZ
|
||||
bind-key O choose-tree -sZ
|
||||
# double-click ^k (or lshift with kanata) for previous pane like ^w in vim
|
||||
bind -r ^k select-pane -l
|
||||
bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
||||
|
||||
# get back command mode and some other basics...
|
||||
bind : command-prompt
|
||||
bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
|
||||
bind-key ? list-keys
|
||||
# bind-key o choose-tree -wZ
|
||||
# bind-key O choose-tree -sZ
|
||||
|
||||
# Scroll oin man etc
|
||||
tmux_commands_with_legacy_scroll="nano less more man git"
|
||||
# get back command mode and some other basics...
|
||||
bind : command-prompt
|
||||
bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
|
||||
bind-key ? list-keys
|
||||
|
||||
bind-key -T root WheelUpPane \
|
||||
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
|
||||
'send -Mt=' \
|
||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||
"send -t= Up" "copy-mode -et="'
|
||||
# Scroll oin man etc
|
||||
tmux_commands_with_legacy_scroll="nano less more man git"
|
||||
|
||||
bind-key -T root WheelDownPane \
|
||||
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
||||
'send -Mt=' \
|
||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||
"send -t= Down" "send -Mt="'
|
||||
bind-key -T root WheelUpPane \
|
||||
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
|
||||
'send -Mt=' \
|
||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||
"send -t= Up" "copy-mode -et="'
|
||||
|
||||
bind-key -T copy-mode-vi ] \
|
||||
send-keys -X clear-selection \; \
|
||||
send-keys -X search-forward "--> " \; \
|
||||
send-keys -X next-word \; \
|
||||
send-keys -X begin-selection \; \
|
||||
send-keys -X jump-forward ":" \; \
|
||||
send-keys -X jump-to-forward ":" \;
|
||||
bind-key -T root WheelDownPane \
|
||||
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
||||
'send -Mt=' \
|
||||
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
|
||||
"send -t= Down" "send -Mt="'
|
||||
|
||||
bind-key -T copy-mode-vi [ \
|
||||
send-keys -X clear-selection \; \
|
||||
send-keys -X start-of-line \; \
|
||||
send-keys -X search-backward "--> " \; \
|
||||
send-keys -X next-word \; \
|
||||
send-keys -X begin-selection \; \
|
||||
send-keys -X jump-forward ":" \; \
|
||||
send-keys -X jump-to-forward ":" \;
|
||||
bind-key -T copy-mode-vi ] \
|
||||
send-keys -X clear-selection \; \
|
||||
send-keys -X search-forward "--> " \; \
|
||||
send-keys -X next-word \; \
|
||||
send-keys -X begin-selection \; \
|
||||
send-keys -X jump-forward ":" \; \
|
||||
send-keys -X jump-to-forward ":" \;
|
||||
|
||||
bind-key [ copy-mode \; send-keys [
|
||||
bind-key ] copy-mode \; send-keys ]
|
||||
bind-key -T copy-mode-vi [ \
|
||||
send-keys -X clear-selection \; \
|
||||
send-keys -X start-of-line \; \
|
||||
send-keys -X search-backward "--> " \; \
|
||||
send-keys -X next-word \; \
|
||||
send-keys -X begin-selection \; \
|
||||
send-keys -X jump-forward ":" \; \
|
||||
send-keys -X jump-to-forward ":" \;
|
||||
|
||||
bind d select-pane -l \; send-keys [
|
||||
bind-key [ copy-mode \; send-keys [
|
||||
bind-key ] copy-mode \; send-keys ]
|
||||
|
||||
'';
|
||||
bind d select-pane -l \; send-keys [
|
||||
|
||||
# f: file search
|
||||
# unbound: git files
|
||||
# g: git hashes
|
||||
# u: urls
|
||||
# C-d: numbers
|
||||
# M-i: ips
|
||||
# include line and column numbers in file search
|
||||
# rebind `f` so we can reuse it here
|
||||
bind-key -T prefix C-f command-prompt { find-window -Z "%%" }
|
||||
# jyn is so sorry, and so am I now
|
||||
# https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212
|
||||
# see `search-regex.sh` for wtf this means
|
||||
# TODO: include shell variable names
|
||||
bind-key f copy-mode \; send-keys -X search-backward '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))'
|
||||
# urls
|
||||
bind-key u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*'
|
||||
# hashes
|
||||
bind-key g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]'
|
||||
# ips
|
||||
bind-key M-i copy-mode \; send-keys -X search-backward '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'
|
||||
|
||||
bind-key -T copy-mode-vi o send-keys -X copy-pipe \
|
||||
'cd #{pane_current_path}; xargs -I {} echo "echo {}" | bash | xargs ${../nvim/editor-hax.py} xdg-open-proxy' \; \
|
||||
if -F "#{alternate_on}" { send-keys -X cancel }
|
||||
# save the buffer, then open an editor in the current pane
|
||||
bind-key -T copy-mode-vi O send-keys -X copy-pipe-and-cancel \
|
||||
'tmux send-keys "C-q"; xargs -I {} tmux send-keys "vim {}"; tmux send-keys "C-m"'
|
||||
# search for the highlighted text
|
||||
bind-key -T copy-mode-vi s send-keys -X copy-pipe \
|
||||
"cd #{pane_current_path}; xargs -I {} open 'https://www.google.com/search?q={}'" \; \
|
||||
if -F "#{alternate_on}" { send-keys -X cancel }
|
||||
# save buffer and retype into the shell
|
||||
bind-key -T copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
# bind-key -T root DoubleClick1Pane run-shell "cd '#{pane_current_path}'; echo '#{mouse_line}' | ${pkgs.writeScriptBin "open-file" ''
|
||||
# open_file () {
|
||||
# input=`cat`
|
||||
# link=$(echo "$input" | grep -Po '[^ \\]*/[^ \\]*\.[^ \\]*\:[0-9]+' | sed 's/\:/|/g')
|
||||
#
|
||||
# if [ ! -z "$link" ]; then
|
||||
# echo "LINK = $link"
|
||||
# vim_proc=$(pgrep vim | xargs pwdx | grep $(pwd -P) | awk '{print $1}' | sed 's/\:*$//g' | xargs -I{} find /run/user/1000 -depth -maxdepth 1 -name "nvim.{}.0")
|
||||
#
|
||||
# nvim --server "$vim_proc" --remote-send "<C-\><C-N>:e $link<cr>"
|
||||
# fi
|
||||
# }
|
||||
#
|
||||
# open_file 2>&1 >> ~/open-file.log
|
||||
#
|
||||
# ''}/bin/open-file"
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
159
programs/xdg.nix
Normal file
159
programs/xdg.nix
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
{ machine, ... }@inputs:
|
||||
let
|
||||
browsers = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
|
||||
defaultApps = {
|
||||
text = [
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanvim.desktop"
|
||||
];
|
||||
image = [ "org.gnome.Loupe.desktop" ];
|
||||
audio = [ "mpv.desktop" ];
|
||||
video = [ "mpv.desktop" ];
|
||||
directory = [
|
||||
"nautilus.desktop"
|
||||
"org.gnome.Nautilus.desktop"
|
||||
];
|
||||
mail = [ ] ++ browsers;
|
||||
calendar = [ ] ++ browsers;
|
||||
browser = [ ] ++ browsers;
|
||||
office = [ "libreoffice.desktop" ];
|
||||
pdf = [ ] ++ browsers;
|
||||
ebook = [ ];
|
||||
magnet = [ ];
|
||||
signal = [ "signal.desktop" ];
|
||||
};
|
||||
|
||||
mimeMap = {
|
||||
text = [
|
||||
"text/plain"
|
||||
"text/english"
|
||||
"application/x-zerosize"
|
||||
"text/x-makefile"
|
||||
"text/x-c++hdr"
|
||||
"text/x-c++src"
|
||||
"text/x-chdr"
|
||||
"text/x-csrc"
|
||||
"text/x-java"
|
||||
"text/x-moc"
|
||||
"text/x-pascal"
|
||||
"text/x-tcl"
|
||||
"text/x-tex"
|
||||
"application/x-shellscript"
|
||||
"text/x-c"
|
||||
"text/x-c++"
|
||||
];
|
||||
image = [
|
||||
"image/bmp"
|
||||
"image/gif"
|
||||
"image/jpeg"
|
||||
"image/jpg"
|
||||
"image/png"
|
||||
"image/svg+xml"
|
||||
"image/tiff"
|
||||
"image/vnd.microsoft.icon"
|
||||
"image/webp"
|
||||
];
|
||||
audio = [
|
||||
"audio/aac"
|
||||
"audio/mpeg"
|
||||
"audio/ogg"
|
||||
"audio/opus"
|
||||
"audio/wav"
|
||||
"audio/webm"
|
||||
"audio/x-matroska"
|
||||
];
|
||||
video = [
|
||||
"video/mp2t"
|
||||
"video/mp4"
|
||||
"video/mpeg"
|
||||
"video/ogg"
|
||||
"video/webm"
|
||||
"video/x-flv"
|
||||
"video/x-matroska"
|
||||
"video/x-msvideo"
|
||||
];
|
||||
directory = [ "inode/directory" ];
|
||||
mail = [ "x-scheme-handler/mailto" ];
|
||||
calendar = [
|
||||
"text/calendar"
|
||||
"x-scheme-handler/webcal"
|
||||
];
|
||||
browser = [
|
||||
"text/html"
|
||||
"x-scheme-handler/about"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
"x-scheme-handler/unknown"
|
||||
];
|
||||
office = [
|
||||
"application/vnd.oasis.opendocument.text"
|
||||
"application/vnd.oasis.opendocument.spreadsheet"
|
||||
"application/vnd.oasis.opendocument.presentation"
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
"application/msword"
|
||||
"application/vnd.ms-excel"
|
||||
"application/vnd.ms-powerpoint"
|
||||
"application/rtf"
|
||||
];
|
||||
pdf = [ "application/pdf" ];
|
||||
ebook = [ "application/epub+zip" ];
|
||||
magnet = [ "x-scheme-handler/magnet" ];
|
||||
signal = [ "signal.desktop" ];
|
||||
};
|
||||
|
||||
associations =
|
||||
with inputs.lib;
|
||||
with builtins;
|
||||
listToAttrs (
|
||||
flatten (mapAttrsToList (key: map (type: attrsets.nameValuePair type defaultApps."${key}")) mimeMap)
|
||||
);
|
||||
removedAssociations = {
|
||||
"text/plain" = "dev.zed.Zed.desktop";
|
||||
"application/x-zerosize" = "dev.zed.Zed.desktop";
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "xdg";
|
||||
inherit inputs;
|
||||
requirements = [ ];
|
||||
home-config =
|
||||
{ config, ... }:
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
configHome = "${config.home.homeDirectory}/.config";
|
||||
userDirs = {
|
||||
enable = true;
|
||||
documents = "${config.home.homeDirectory}/Documents";
|
||||
desktop = "${config.home.homeDirectory}/Documents";
|
||||
download = "${config.home.homeDirectory}/Downloads";
|
||||
music = "${config.home.homeDirectory}/Documents/personal/music";
|
||||
pictures = "${config.home.homeDirectory}/Documents/personal/pictures";
|
||||
};
|
||||
configFile."mimeapps.list".force = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
associations.added = associations;
|
||||
associations.removed = removedAssociations;
|
||||
defaultApplications = associations;
|
||||
};
|
||||
};
|
||||
};
|
||||
system-config = _: {
|
||||
xdg = {
|
||||
mime = {
|
||||
enable = true;
|
||||
defaultApplications = associations;
|
||||
addedAssociations = associations;
|
||||
inherit removedAssociations;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,173 +1,184 @@
|
|||
_: {
|
||||
custom.program.zed.requirements = [ "work" ];
|
||||
custom.program.zed.home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = pkgs.custom.maple-fonts-pack;
|
||||
inputs@{ machine, ... }:
|
||||
{
|
||||
imports = machine.program {
|
||||
name = "zed";
|
||||
inherit inputs;
|
||||
requirements = [
|
||||
"work"
|
||||
"graphical"
|
||||
];
|
||||
home-config =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = pkgs.custom.maple-fonts-pack;
|
||||
|
||||
programs.zed-editor = {
|
||||
enable = true;
|
||||
extensions = [
|
||||
"nix"
|
||||
"intellij-newui-theme"
|
||||
"charmed-icons"
|
||||
"astro"
|
||||
];
|
||||
userSettings = {
|
||||
|
||||
ssh_connections = [
|
||||
{
|
||||
host = "icecube";
|
||||
args = [ ];
|
||||
projects = [
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/eii-test"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/example"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/fitgirl-ddl"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/libs-team/tools/unstable-api"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/ml-kem-hang"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/opendal/core"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/rust"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/span-lowering-tests"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
programs.zed-editor = {
|
||||
enable = true;
|
||||
extensions = [
|
||||
"nix"
|
||||
"intellij-newui-theme"
|
||||
"charmed-icons"
|
||||
"astro"
|
||||
];
|
||||
icon_theme = "Warm Charmed Icons";
|
||||
ui_font_size = 16;
|
||||
buffer_font_size = 16;
|
||||
theme = {
|
||||
mode = "system";
|
||||
light = "One Light";
|
||||
dark = "JetBrains New Dark";
|
||||
};
|
||||
disable_ai = true;
|
||||
userSettings = {
|
||||
|
||||
preview_tabs = {
|
||||
enabled = true;
|
||||
enable_preview_from_file_finder = true;
|
||||
};
|
||||
|
||||
close_on_file_delete = true;
|
||||
confirm_quit = true;
|
||||
|
||||
edit_predictions_disabled_in = [
|
||||
"comment"
|
||||
"string"
|
||||
];
|
||||
|
||||
vim_mode = true;
|
||||
cursor_blink = false;
|
||||
vertical_scroll_margin = 0;
|
||||
|
||||
inlay_hints = {
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
project_panel = {
|
||||
dock = "right";
|
||||
git_status = false;
|
||||
};
|
||||
minimap = {
|
||||
show = "auto";
|
||||
thumb = "always";
|
||||
thumb_border = "left_open";
|
||||
};
|
||||
tab_bar = {
|
||||
show = true;
|
||||
show_nav_history_buttons = false;
|
||||
show_tab_bar_buttons = false;
|
||||
};
|
||||
tabs = {
|
||||
file_icons = true;
|
||||
git_status = false;
|
||||
activate_on_close = "history";
|
||||
show_close_button = "hover";
|
||||
};
|
||||
lsp = {
|
||||
rust-analyzer = {
|
||||
initialization_options = {
|
||||
inlayHints = {
|
||||
lifetimeElisionHints = "always";
|
||||
discriminantHints = "always";
|
||||
};
|
||||
diagnostic = {
|
||||
refreshSupport = true;
|
||||
};
|
||||
};
|
||||
ssh_connections = [
|
||||
{
|
||||
host = "icecube";
|
||||
args = [ ];
|
||||
projects = [
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/eii-test"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/example"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/fitgirl-ddl"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/libs-team/tools/unstable-api"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/ml-kem-hang"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/opendal/core"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/rust"
|
||||
];
|
||||
}
|
||||
{
|
||||
paths = [
|
||||
"/home/jana/src/span-lowering-tests"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
icon_theme = "Warm Charmed Icons";
|
||||
ui_font_size = 16;
|
||||
buffer_font_size = 16;
|
||||
theme = {
|
||||
mode = "system";
|
||||
light = "One Light";
|
||||
dark = "JetBrains New Dark";
|
||||
};
|
||||
nil = {
|
||||
binary = {
|
||||
ignore_system_version = false;
|
||||
path = "${pkgs.lib.getExe' pkgs.nil "nil"}";
|
||||
};
|
||||
disable_ai = true;
|
||||
|
||||
initialization_options = {
|
||||
formatting = {
|
||||
command = [ "${pkgs.lib.getExe' pkgs.nixfmt "nixfmt"}" ];
|
||||
};
|
||||
};
|
||||
preview_tabs = {
|
||||
enabled = true;
|
||||
enable_preview_from_file_finder = true;
|
||||
};
|
||||
};
|
||||
diagnostics = {
|
||||
button = false;
|
||||
include_warnings = true;
|
||||
inline = {
|
||||
|
||||
close_on_file_delete = true;
|
||||
confirm_quit = true;
|
||||
|
||||
edit_predictions_disabled_in = [
|
||||
"comment"
|
||||
"string"
|
||||
];
|
||||
|
||||
vim_mode = true;
|
||||
cursor_blink = false;
|
||||
vertical_scroll_margin = 0;
|
||||
|
||||
inlay_hints = {
|
||||
enabled = true;
|
||||
};
|
||||
};
|
||||
terminal = {
|
||||
"dock" = "left";
|
||||
"env" = {
|
||||
# "EDITOR": "zeditor --wait"
|
||||
"EDITOR" = "vim";
|
||||
|
||||
project_panel = {
|
||||
dock = "right";
|
||||
git_status = false;
|
||||
};
|
||||
"font_size" = 12;
|
||||
"font_family" = "Maple Mono NF";
|
||||
"line_height" = "standard";
|
||||
};
|
||||
buffer_font_family = "Maple Mono NF";
|
||||
minimap = {
|
||||
show = "auto";
|
||||
thumb = "always";
|
||||
thumb_border = "left_open";
|
||||
};
|
||||
tab_bar = {
|
||||
show = true;
|
||||
show_nav_history_buttons = false;
|
||||
show_tab_bar_buttons = false;
|
||||
};
|
||||
tabs = {
|
||||
file_icons = true;
|
||||
git_status = false;
|
||||
activate_on_close = "history";
|
||||
show_close_button = "hover";
|
||||
};
|
||||
lsp = {
|
||||
rust-analyzer = {
|
||||
initialization_options = {
|
||||
inlayHints = {
|
||||
lifetimeElisionHints = "always";
|
||||
discriminantHints = "always";
|
||||
};
|
||||
diagnostic = {
|
||||
refreshSupport = true;
|
||||
};
|
||||
};
|
||||
binary = {
|
||||
path_lookup = true;
|
||||
};
|
||||
};
|
||||
nil = {
|
||||
binary = {
|
||||
ignore_system_version = false;
|
||||
path = "${pkgs.lib.getExe' pkgs.nil "nil"}";
|
||||
};
|
||||
|
||||
# "diagnostics_max_severity": "off",
|
||||
initialization_options = {
|
||||
formatting = {
|
||||
command = [ "${pkgs.lib.getExe' pkgs.nixfmt "nixfmt"}" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
diagnostics = {
|
||||
button = false;
|
||||
include_warnings = true;
|
||||
inline = {
|
||||
enabled = true;
|
||||
};
|
||||
};
|
||||
terminal = {
|
||||
"dock" = "left";
|
||||
"env" = {
|
||||
# "EDITOR": "zeditor --wait"
|
||||
"EDITOR" = "vim";
|
||||
};
|
||||
"font_size" = 12;
|
||||
"font_family" = "Maple Mono NF";
|
||||
"line_height" = "standard";
|
||||
};
|
||||
buffer_font_family = "Maple Mono NF";
|
||||
|
||||
"experimental.theme_overrides" = {
|
||||
"syntax" = {
|
||||
"comment.doc" = {
|
||||
"color" = "#77B767";
|
||||
# "diagnostics_max_severity": "off",
|
||||
|
||||
"experimental.theme_overrides" = {
|
||||
"syntax" = {
|
||||
"comment.doc" = {
|
||||
"color" = "#77B767";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(inputs.self + /modules/users.nix)
|
||||
(../modules/users.nix)
|
||||
];
|
||||
users.groups.media = { };
|
||||
|
||||
custom.users = {
|
||||
vivian = {
|
||||
|
|
@ -19,6 +18,16 @@
|
|||
];
|
||||
};
|
||||
|
||||
mara = {
|
||||
shell = pkgs.zsh;
|
||||
keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKAzf3UCwTWJlF878EWqlrLUOBsxw/b/6PoLjbKkA8Xh"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIHi5YnRt1VgK8tt6oSPsKo1X+0gcBXVyvCKXM03/vEh"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFWF1MtDV5HJT+GhD8wrKICyDwQK8ZPQTxZdnsfaqWcs"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIHi1EEGRry1aD6uPmdlcRqdiTiIty0JlnfoXeM0qKBC"
|
||||
];
|
||||
};
|
||||
|
||||
jana = {
|
||||
shell = pkgs.fish;
|
||||
keys = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue