make home configs work

This commit is contained in:
Jana Dönszelmann 2026-01-23 13:27:58 +01:00
parent f0c21b2e79
commit 30f81b2b79
No known key found for this signature in database
29 changed files with 2131 additions and 2033 deletions

33
; Normal file
View 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;
}
)
);
};
};
}

124
config.nix Normal file
View file

@ -0,0 +1,124 @@
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 =
{
requirements ? [ ],
home-config,
system-config ? { },
}:
# if (matches-capabilities requirements) then
if (true) then
{
inherit home-config system-config;
}
else
{
# home-config = _: { };
};
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;
};
};
}

View file

@ -1,23 +1,21 @@
{ {
lib, lib,
pkgs, pkgs,
inputs,
flakes, flakes,
machine,
... ...
}: }:
{ {
imports = [ imports = [
(inputs.self + /modules/machine-type.nix) ./machine-or-home-config.nix
(inputs.self + /modules/program.nix) ./xdg.nix
(inputs.self + /programs)
(inputs.self + /users)
]; ];
xdg.mime.enable = lib.mkForce false; system.stateVersion = machine.stateVersion;
system.stateVersion = "26.05";
services.resolved.enable = false; services.resolved.enable = false;
xdg.mime.enable = lib.mkForce false;
# Enable SSH # Enable SSH
services.openssh = { services.openssh = {
enable = true; enable = true;

View file

@ -0,0 +1,9 @@
{ inputs, ... }:
{
imports = [
(../modules/program.nix)
(../programs)
(../users)
];
}

112
flake.nix
View file

@ -72,12 +72,10 @@
}; };
outputs = outputs =
{ {
self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
sops-nix, sops-nix,
vpn-confinement, vpn-confinement,
home-manager,
deploy-rs, deploy-rs,
... ...
}@inputs: }@inputs:
@ -94,87 +92,40 @@
}) })
]; ];
}; };
configs = import ./config.nix (inputs // { inherit pkgsForSystem; });
specialArgsForSystem = system: {
pkgs = pkgsForSystem system;
flakes = inputs;
inherit inputs;
inherit (inputs.secrets.packages.${system}) secrets;
};
in in
{ (configs.configs [
nixosConfigurations.fili = nixpkgs.lib.nixosSystem rec { {
system = "x86_64-linux"; hostname = "fili";
modules = [ capabilities = [ "cli" ];
inputs.home-manager.nixosModules.default type = "server";
{ home-manager.extraSpecialArgs = specialArgs; } extra-modules = [
./hosts/fili/configuration.nix
./users
./default-machine-config.nix
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
vpn-confinement.nixosModules.default vpn-confinement.nixosModules.default
]; ];
specialArgs = specialArgsForSystem system; }
}; {
nixosConfigurations.kili = nixpkgs.lib.nixosSystem rec { hostname = "kili";
system = "x86_64-linux"; deploy-hostname = "localhost";
modules = [ capabilities = [
inputs.home-manager.nixosModules.default "cli"
{ home-manager.extraSpecialArgs = specialArgs; } "graphical"
"work"
./hosts/kili/configuration.nix "fun"
./users
]; ];
specialArgs = specialArgsForSystem system; type = "pc";
}; }
nixosConfigurations.ragdoll = home-manager.lib.homeManagerConfiguration ( {
let
system = "x86_64-linux";
in
{
modules = [
inputs.home-manager.nixosModules.default
{ home-manager.extraSpecialArgs = specialArgsForSystem system; }
./hosts/ragdoll/configuration.nix
./default-machine-config.nix
];
pkgs = pkgsForSystem system;
}
);
deploy.nodes.fili = {
hostname = "fili";
fastConnection = true;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.fili;
sshUser = "jana";
};
};
deploy.nodes.kili = {
hostname = "localhost";
fastConnection = true;
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.kili;
sshUser = "jana";
};
};
deploy.nodes.ragdoll = {
hostname = "ragdoll"; hostname = "ragdoll";
fastConnection = true; deploy-hostname = "ragdoll";
profiles.system = { home-only = "jana";
user = "jana"; capabilities = [
path = deploy-rs.lib.x86_64-linux.activate.home-manager self.nixosConfigurations.ragdoll; "cli"
sshUser = "jana"; "work"
}; ];
}; type = "pc";
} }
])
// flake-utils.lib.eachDefaultSystem ( // flake-utils.lib.eachDefaultSystem (
system: system:
let let
@ -184,14 +135,17 @@
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
lix lix
(pkgs.writeShellScriptBin "apply-local" ''
apply $(hostname)
'')
(pkgs.writeShellScriptBin "apply" '' (pkgs.writeShellScriptBin "apply" ''
set -e set -e
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
deploy deploy -s
elif [ $# -eq 1 ] elif [ $# -eq 1 ]
then then
deploy ".#$@" deploy -s ".#$@"
else else
echo "too many parameters" echo "too many parameters"
exit 1 exit 1

View file

@ -6,13 +6,6 @@ _: {
./services ./services
]; ];
custom.machine = {
type = "server";
capabilities = [
"cli"
];
};
networking.nameservers = [ networking.nameservers = [
"1.1.1.1" "1.1.1.1"
"9.9.9.9" "9.9.9.9"
@ -50,4 +43,6 @@ _: {
"media" "media"
"nginx" "nginx"
]; ];
users.groups.media = { };
} }

View file

@ -150,7 +150,7 @@
wget wget
# used in deployments # used in deployments
flakes.colmena.defaultPackage."x86_64-linux" # flakes.deploy.defaultPackage."x86_64-linux"
lix lix
openssh openssh
]; ];

View file

@ -6,19 +6,9 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./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.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;

View file

@ -1,28 +1,44 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/4919727e-d114-4d57-b206-522b5df5fccc"; device = "/dev/disk/by-uuid/4919727e-d114-4d57-b206-522b5df5fccc";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/26CD-373C"; device = "/dev/disk/by-uuid/26CD-373C";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [
}; "fmask=0077"
"dmask=0077"
];
};
swapDevices = [ ]; swapDevices = [ ];

13
hosts/kili/kanata.nix Normal file
View 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"
'';
}

View file

@ -1,18 +1,7 @@
{ {
pkgs,
... ...
}: }:
{ {
imports = [ imports = [ ];
./hardware-configuration.nix
../../default-machine-config.nix
];
custom.machine = {
type = "pc";
capabilities = [
"cli"
];
homeOnly = "jana";
};
} }

View file

@ -1,16 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/4919727e-d114-4d57-b206-522b5df5fccc";
fsType = "ext4";
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -1,16 +0,0 @@
{
lib,
...
}:
with lib;
{
options = {
custom.home-info = mkOption {
type = types.submodule {
options = {
};
};
};
};
}

View file

@ -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" ];
};
};
};
};
};
}

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
options, options,
machine,
... ...
}: }:
with lib; with lib;
@ -15,19 +16,15 @@ with lib;
name = mkOption { name = mkOption {
type = types.string; type = types.string;
}; };
requirements = mkOption {
type = types.listOf (types.enum (import ./capabilities.nix));
default = [ "cli" ];
};
home-config = mkOption { home-config = mkOption {
type = types.deferredModule; type = types.deferredModule;
}; };
system-config = mkOption { system-config = mkOption {
# type = types.attrs;
type = types.deferredModule; type = types.deferredModule;
default = { }; default = _: { };
}; };
}; };
config = if builtins.isNull machine.home-only then config.system-config else config.home-config;
} }
) )
); );

View file

@ -1,30 +1,31 @@
{ args@{
lib, lib,
pkgs, pkgs,
config, config,
machine,
... ...
}: }:
with lib; with lib;
let let
cfg = config.custom.users; cfg = config.custom.users;
machine = config.custom.machine; inherit (machine) home-only;
inherit (machine) stateVersion;
valid-on-machine = valid-on-machine =
on: on:
# TODO: iterate over possibilities # TODO: iterate over possibilities
if machine.type == "server" then (
on.server if machine.type == "server" then
else if machine.type == "pc" then on.server
on.pc else if machine.type == "pc" then
else on.pc
false; else
matches-capabilities = false
# all requirements are contained in the machine capabilities );
requirements: lib.all (req: builtins.elem req machine.capabilities) requirements;
users = lib.filterAttrs (_: value: valid-on-machine value.on) cfg; users = lib.filterAttrs (_: value: valid-on-machine value.on) cfg;
home-users = lib.filterAttrs (_: value: value.apply-home-configs) users; home-users = lib.filterAttrs (_: value: value.apply-home-configs) users;
stateVersion = config.system.stateVersion;
programs = lib.attrsets.attrValues config.custom.program; programs = lib.attrsets.attrValues config.custom.program;
valid-programs = builtins.filter (program: matches-capabilities program.requirements) programs;
in in
{ {
options = options =
@ -75,32 +76,47 @@ in
}; };
}; };
config = lib.mkMerge ([ config = lib.mkMerge [
{ (
users.extraUsers = lib.mapAttrs (name: value: { if (!builtins.isNull home-only) then
isNormalUser = true; lib.mkMerge ([
extraGroups = value.groups; {
openssh.authorizedKeys.keys = value.keys; home = {
shell = value.shell; inherit stateVersion;
description = name; username = toString home-only;
}) users; homeDirectory = "/home/${toString home-only}";
home-manager.users = lib.mapAttrs ( };
name: value: }
(_: { ]
imports = ( # ++ map (program: program.home-config) programs
[ )
./home-info.nix else
] (lib.mkMerge ([
++ (map (program: program.home-config) valid-programs) {
); users.extraUsers = lib.mapAttrs (name: value: {
isNormalUser = true;
home = { extraGroups = value.groups;
inherit stateVersion; openssh.authorizedKeys.keys = value.keys;
username = name; inherit (value) shell;
homeDirectory = "/home/${name}"; description = name;
}; }) users;
}) home-manager.users = lib.mapAttrs (
) home-users; name: value:
} (_: {
]); imports = (
[
]
++ (map (program: program.home-config) programs)
);
home = {
inherit stateVersion;
username = name;
homeDirectory = "/home/${name}";
};
})
) home-users;
}
]))
)
];
} }

View file

@ -1,4 +1,4 @@
{ ... }@inputs: { machine, ... }@inputs:
{ {
imports = [ imports = [
./nvim ./nvim
@ -11,10 +11,9 @@
./niri ./niri
./zed ./zed
./firefox ./firefox
./xdg.nix
]; ];
custom.program.graphcial-packages = { custom.program.graphcial-packages = machine.program {
requirements = [ "graphical" ]; requirements = [ "graphical" ];
home-config = home-config =
{ pkgs, ... }: { pkgs, ... }:
@ -34,7 +33,7 @@
}; };
}; };
custom.program.discord = { custom.program.discord = machine.program {
requirements = [ "graphical" ]; requirements = [ "graphical" ];
home-config = home-config =
{ {
@ -150,7 +149,7 @@
}; };
}; };
custom.program.fun-packages = { custom.program.fun-packages = machine.program {
requirements = [ "fun" ]; requirements = [ "fun" ];
home-config = home-config =
{ pkgs, ... }: { pkgs, ... }:
@ -162,7 +161,7 @@
}; };
}; };
custom.program.cli-packages = { custom.program.cli-packages = machine.program {
requirements = [ "cli" ]; requirements = [ "cli" ];
home-config = home-config =
{ config, pkgs, ... }: { config, pkgs, ... }:

View file

@ -1,165 +1,168 @@
_: { { machine, ... }:
custom.program.firefox.requirements = [ "graphical" ]; {
custom.program.firefox.home-config = custom.program.firefox = machine.program {
{ requirements = [ "graphical" ];
config, home-config =
flakes, {
pkgs, config,
... flakes,
}: pkgs,
let ...
ff-pkgs = flakes.firefox-addons.packages.${pkgs.system}; }:
lock-false = { let
Value = false; ff-pkgs = flakes.firefox-addons.packages.${pkgs.system};
Status = "locked"; lock-false = {
}; Value = false;
# lock-true = { Status = "locked";
# 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
};
}; };
# 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; profiles.default = {
userContent = builtins.readFile ./userChrome.css; 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; [ userChrome = builtins.readFile ./userChrome.css;
bitwarden userContent = builtins.readFile ./userChrome.css;
ublock-origin
sidebery
sponsorblock
# vimium
];
bookmarks = { extensions.packages = with ff-pkgs; [
force = true; bitwarden
settings = [ ublock-origin
{ sidebery
keyword = "!w"; sponsorblock
url = "https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s"; # vimium
}
{
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 = { bookmarks = {
# "${ff-pkgs.sidebery.addonId}".settings = { force = true;
# sidebar = { settings = [
# # panels = with builtins; with lib; listToAttrs (map ffContainerToSideberryPanel (attrsToList containers)); {
# # nav = [ "Personal" "Programming"]; keyword = "!w";
# }; url = "https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s";
# # https://github.com/Dash-L/nixconfig/blob/c30f6d1486a3fe2b3793ab0cb13a88edefe83b7a/home/firefox.nix#L82 }
# settings = { {
# pinnedTabsPosition = "top"; keyword = "!m";
# hideEmptyPanels = false; url = "https://www.google.com/maps?q=%s";
# activateAfterClosing = "prev"; }
# activateAfterClosingStayInPanel = true; {
# newTabCtxReopen = true; 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" ];
};
};
} }

View file

@ -1,254 +1,257 @@
_: { { machine, ... }:
custom.program.fish.requirements = [ "cli" ]; {
custom.program.fish.home-config = custom.program.fish = machine.program {
{ requirements = [ "cli" ];
config, home-config =
pkgs, {
lib, config,
... pkgs,
}: lib,
with builtins; ...
with lib.attrsets; }:
let with builtins;
scripts = (import ./scripts.nix) pkgs; with lib.attrsets;
aliases = with scripts; { let
"cp-mov" = cp-media "mov" "movies"; scripts = (import ./scripts.nix) pkgs;
"cp-ser" = cp-media "ser" "shows"; aliases = with scripts; {
"cp-ani" = cp-media "ani" "anime"; "cp-mov" = cp-media "mov" "movies";
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm"; "cp-ser" = cp-media "ser" "shows";
"p" = builtins.trace calc calc; "cp-ani" = cp-media "ani" "anime";
"s" = "systemctl"; "dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
"j" = "journalctl"; "p" = builtins.trace calc calc;
"ju" = "journalctl -u"; "s" = "systemctl";
"jfu" = "journalctl -fu"; "j" = "journalctl";
"ls" = "${pkgs.eza}/bin/eza --git"; "ju" = "journalctl -u";
"ll" = "${pkgs.eza}/bin/eza --git"; "jfu" = "journalctl -fu";
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3"; "ls" = "${pkgs.eza}/bin/eza --git";
"open" = "${pkgs.xdg-utils}/bin/xdg-open"; "ll" = "${pkgs.eza}/bin/eza --git";
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy"; "lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
"cat" = "${pkgs.bat}/bin/bat"; "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"; # "pull" = "${pkgs.git}/bin/git pull";
# "push" = "${pkgs.git}/bin/git push"; # "push" = "${pkgs.git}/bin/git push";
# "commit" = "${pkgs.git}/bin/git commit"; # "commit" = "${pkgs.git}/bin/git commit";
# "add" = "${pkgs.git}/bin/git add"; # "add" = "${pkgs.git}/bin/git add";
# "patch" = "${pkgs.git}/bin/git add -p"; # "patch" = "${pkgs.git}/bin/git add -p";
# "amend" = "${pkgs.git}/bin/git commit --amend"; # "amend" = "${pkgs.git}/bin/git commit --amend";
# "log" = "${pkgs.git}/bin/git log --all --graph --decorate"; # "log" = "${pkgs.git}/bin/git log --all --graph --decorate";
# "st" = "${pkgs.git}/bin/git status"; # "st" = "${pkgs.git}/bin/git status";
# "checkout" = "${pkgs.git}/bin/git checkout"; # "checkout" = "${pkgs.git}/bin/git checkout";
# "rebase" = "${pkgs.git}/bin/git rebase"; # "rebase" = "${pkgs.git}/bin/git rebase";
# "stash" = "${pkgs.git}/bin/git stash"; # "stash" = "${pkgs.git}/bin/git stash";
"edit" = "jj edit"; "edit" = "jj edit";
"old" = "jj edit @-"; "old" = "jj edit @-";
"new" = "jj edit @+"; "new" = "jj edit @+";
"rebase" = "jj rebase"; "rebase" = "jj rebase";
"pull" = "jj git fetch; jj catchup"; "pull" = "jj git fetch; jj catchup";
"msg" = "jj describe -m"; "msg" = "jj describe -m";
"branch" = "jj bookmark set"; "branch" = "jj bookmark set";
"stat" = "jj status"; "stat" = "jj status";
"push" = "jj git push"; "push" = "jj git push";
"tidy" = "x test tidy --bless"; "tidy" = "x test tidy --bless";
"ui" = "x test tests/ui/"; "ui" = "x test tests/ui/";
"f" = "nautilus --no-desktop . &"; "f" = "nautilus --no-desktop . &";
}; };
# extracting any compressed format # extracting any compressed format
extract = '' extract = ''
function extract -a file -d "decompress a file" function extract -a file -d "decompress a file"
if not test -f $file if not test -f $file
echo "'$file' is not a valid 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 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
end '';
''; in
in {
{ programs = {
programs = { atuin = {
atuin = { enable = true;
enable = true; enableFishIntegration = true;
enableFishIntegration = true;
settings = { settings = {
filter_mode_shell_up_key_binding = "workspace"; filter_mode_shell_up_key_binding = "workspace";
exit_mode = "return-original"; exit_mode = "return-original";
inline_height = 20; inline_height = 20;
workspaces = true; workspaces = true;
};
}; };
};
zoxide = { zoxide = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
}; };
direnv = { direnv = {
enable = true; enable = true;
# enableFishIntegration = lib.mkDefault true; # enableFishIntegration = lib.mkDefault true;
}; };
fzf = { fzf = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
}; };
fish = { fish = {
enable = true; enable = true;
shellAliases = aliases; shellAliases = aliases;
plugins = with pkgs.fishPlugins; [ plugins = with pkgs.fishPlugins; [
{ {
name = "bang-bang"; name = "bang-bang";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "oh-my-fish"; owner = "oh-my-fish";
repo = "plugin-bang-bang"; repo = "plugin-bang-bang";
rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419"; rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419";
hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0="; 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 = { _tide_item_jj = {
fish_jj_prompt = { body = ''
body = '' set -l _tide_item_jj_color $_tide_location_color
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
return 1 '';
end };
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T ' _tide_item_git = {
separate( body = ''
" ", if not test -d .jj
bookmarks.join(", "), fish_git_prompt '%s'
change_id.shortest(), end
commit_id.shortest(), '';
if(conflict, "conflict"), };
if(empty, "empty"),
if(divergent, "divergent"),
if(hidden, "hidden"),
)
'
'';
}; };
_tide_item_jj = { interactiveShellInit = ''
body = '' fish_vi_key_bindings
set -l _tide_item_jj_color $_tide_location_color
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
'';
};
_tide_item_git = { bind \e\[3\;5~ kill-word
body = '' bind \cH backward-kill-word
if not test -d .jj bind \cV beginning-of-line
fish_git_prompt '%s' bind \f end-of-line
end
''; 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
end
'';
}; };
};
interactiveShellInit = '' home.activation = {
fish_vi_key_bindings setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
setupTide() {
bind \e\[3\;5~ kill-word ${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
bind \cH backward-kill-word lib.cli.toGNUCommandLineShell { } {
bind \cV beginning-of-line auto = true;
bind \f end-of-line style = "Lean";
prompt_colors = "True color";
bind -M insert \e\[3\;5~ kill-word show_time = "No";
bind -M insert \cH backward-kill-word lean_prompt_height = "Two lines";
bind -M insert \cV beginning-of-line prompt_connection = "Disconnected";
bind -M insert \f end-of-line prompt_spacing = "Compact";
icons = "Few icons";
bind \cl 'clear; commandline -f repaint' transient = "Yes";
bind -M insert \cl 'clear; commandline -f repaint' }
}"} >/dev/null 2>&1
set -g sponge_successful_exit_codes 0 }
set -g sponge_allow_previously_successful false setupTide
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
'';
};
};
} }

View file

@ -1,39 +1,42 @@
_: { { machine, ... }:
custom.program.git.requirements = [ "cli" ]; {
custom.program.git.home-config = _: { custom.program.git = machine.program {
programs.git = { requirements = [ "cli" ];
enable = true; home-config = _: {
signing.key = "/home/jana/.ssh/id_ed25519.pub"; programs.git = {
signing.signByDefault = true; enable = true;
signing.key = "/home/jana/.ssh/id_ed25519.pub";
signing.signByDefault = true;
settings = { settings = {
user.email = "jana@donsz.nl"; user.email = "jana@donsz.nl";
user.name = "Jana Dönszelmann"; user.name = "Jana Dönszelmann";
push.autoSetupRemote = true; push.autoSetupRemote = true;
pull.rebase = true; pull.rebase = true;
init.defaultBranch = "main"; init.defaultBranch = "main";
gpg.format = "ssh"; gpg.format = "ssh";
diff.colorMoved = "default"; diff.colorMoved = "default";
rerere.enabled = true; rerere.enabled = true;
alias.conflicts = "diff --check"; 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;
}; };
};
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;
}; };
}; };
} }

View file

@ -1,193 +1,196 @@
_: { { machine, ... }:
custom.program.jujutsu.requirements = [ "cli" ]; {
custom.program.jujutsu.home-config = custom.program.jujutsu = machine.program {
{ config, pkgs, ... }: requirements = [ "cli" ];
{ home-config =
programs.jujutsu = { { config, pkgs, ... }:
enable = true; {
# package = pkgs.custom.jujutsu; programs.jujutsu = {
enable = true;
# package = pkgs.custom.jujutsu;
settings = { settings = {
user = { user = {
email = config.programs.git.settings.user.email; email = config.programs.git.settings.user.email;
name = config.programs.git.settings.user.name; 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()"
];
}; };
templates = { ui = {
log_node = '' paginate = "never";
label("node", # pager = "${pkgs.delta}/bin/delta";
coalesce( # for delta
if(!self, label("elided", "~")), # diff-formatter = ":git";
if(current_working_copy, label("working_copy", "@")), diff-formatter = [
if(conflict, label("conflict", "×")), "${pkgs.difftastic}/bin/difft"
if(immutable, label("immutable", "*")), "--color=always"
label("normal", "·") "$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")),
log = "log_oneline_with_status_summary"; status_summary = "'\n' ++ self.diff().summary() ++ '\n'";
git_push_bookmark = ''"jdonszelmann/" ++ change_id.short()''; log_oneline_with_status_summary = "log_oneline ++ if(self.current_working_copy() && self.diff().files().len() > 0, status_summary)";
}; };
signing = { aliases =
# sign-all = true; let
behavior = "own"; util = script: [
backend = "ssh"; "util"
key = "~/.ssh/id_ed25519.pub"; "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; templates = {
# remotes.upstream.auto-track-bookmarks = true; 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 = { signing = {
private-commits = "description(glob:'wip:*') | description(glob:'trial:*')"; # sign-all = true;
write-change-id-header = true; behavior = "own";
backend = "ssh";
key = "~/.ssh/id_ed25519.pub";
};
fetch = [ # remotes.origin.auto-track-bookmarks = true;
"upstream" # remotes.upstream.auto-track-bookmarks = true;
"origin"
]; git = {
push = "origin"; private-commits = "description(glob:'wip:*') | description(glob:'trial:*')";
write-change-id-header = true;
fetch = [
"upstream"
"origin"
];
push = "origin";
};
}; };
}; };
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { machine, pkgs, ... }:
let let
kanata-config = '' kanata-config = ''
(defcfg (defcfg
@ -86,32 +86,34 @@ let
''; '';
in in
{ {
custom.program.kanata.requirements = [ "graphical" ]; custom.program.kanata = machine.program {
custom.program.kanata.home-config = requirements = [ "graphical" ];
{ pkgs, config, ... }: home-config =
{ { pkgs, ... }:
systemd.user.services.kanata = { {
Unit = { systemd.user.services.kanata = {
Description = "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 = { home.file.kanata = {
Restart = "always"; target = ".config/kanata/kanata.kbd";
RestartSec = "3"; text = kanata-config;
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;
};
};
# custom.program.kanata.system-config = # custom.program.kanata.system-config =
# { pkgs, ... }: # { pkgs, ... }:
@ -123,15 +125,6 @@ in
# reboot or sudo udevadm control --reload-rules && sudo udevadm trigger # reboot or sudo udevadm control --reload-rules && sudo udevadm trigger
# sudo modprobe uinput # 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"
'';
# }; # };
} }

View file

@ -1,63 +1,66 @@
_: { { machine, ... }:
custom.program.kitty.requirements = [ "graphical" ]; {
custom.program.kitty.home-config = custom.program.kitty = machine.program {
{ pkgs, flakes, ... }: requirements = [ "graphical" ];
{ home-config =
home.packages = pkgs.custom.maple-fonts-pack; { pkgs, flakes, ... }:
{
home.packages = pkgs.custom.maple-fonts-pack;
programs.kitty = { programs.kitty = {
enable = true; enable = true;
font = { font = {
name = "Maple Mono NF"; name = "Maple Mono NF";
size = 11.0; size = 11.0;
package = pkgs.jetbrains-mono; 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";
# 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
'';
}; };
}; };
} }

File diff suppressed because it is too large Load diff

View file

@ -1,155 +1,158 @@
_: { { machine, ... }:
custom.program.nvim.requirements = [ "cli" ]; {
custom.program.nvim.home-config = custom.program.nvim = machine.program {
{ requirements = [ "cli" ];
pkgs, home-config =
flakes, {
lib, pkgs,
... flakes,
}: lib,
let ...
nvim_mime_types = [ }:
"application/x-zerosize" let
"text/english" nvim_mime_types = [
"text/plain" "application/x-zerosize"
"text/x-makefile" "text/english"
"text/x-c++hdr" "text/plain"
"text/x-c++src" "text/x-makefile"
"text/x-chdr" "text/x-c++hdr"
"text/x-csrc" "text/x-c++src"
"text/x-java" "text/x-chdr"
"text/x-moc" "text/x-csrc"
"text/x-pascal" "text/x-java"
"text/x-tcl" "text/x-moc"
"text/x-tex" "text/x-pascal"
"application/x-shellscript" "text/x-tcl"
"text/x-c" "text/x-tex"
"text/x-c++" "application/x-shellscript"
]; "text/x-c"
desktop-entry-name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanvim"; "text/x-c++"
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"; desktop-entry-name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanvim";
mimeTypes = nvim_mime_types; desktop-entry = pkgs.makeDesktopItem {
}; name = desktop-entry-name;
in desktopName = "neovim";
{ exec = "${./editor-hax.py} %F";
home = { tryExec = "${./editor-hax.py}";
sessionVariables = { terminal = false;
EDITOR = "nvim"; type = "Application";
categories = [
"Utility"
"TextEditor"
];
icon = "terminal";
mimeTypes = nvim_mime_types;
}; };
}; in
{
home.file.".local/share/applications/${desktop-entry-name}.desktop" = { home = {
source = "${desktop-entry}/share/applications/${desktop-entry-name}.desktop"; sessionVariables = {
}; EDITOR = "nvim";
xdg.mimeApps.associations.added = lib.mergeAttrsList (
map (mime: {
${mime} = [ "${desktop-entry-name}.desktop" ];
}) 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"
];
}; };
}; };
extraLuaPackages = ps: [ ps.magick ]; home.file.".local/share/applications/${desktop-entry-name}.desktop" = {
extraPackages = [ pkgs.imagemagick ]; source = "${desktop-entry}/share/applications/${desktop-entry-name}.desktop";
};
# package = (import inputs.unstable { inherit (pkgs) system; }).neovim-unwrapped; xdg.mimeApps.associations.added = lib.mergeAttrsList (
package = pkgs.neovim-unwrapped; 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; enable = true;
settings = { globals.mapleader = " ";
style = "deep"; globals.maplocalleader = " ";
highlights = { viAlias = true;
# bright green doccomments vimAlias = true;
"@lsp.type.comment".fg = "#77B767";
"@comment.documentation.rust".fg = "#77B767"; # Highlight and remove extra white spaces
"@comment.documentation".fg = "#77B767"; # same color as cursorline as per
"@comment".fg = "#426639"; # https://github.com/joshdick/onedark.vim/blob/390b893d361c356ac1b00778d849815f2aa44ae4/autoload/onedark.vim
# "Visual".bg = "#2a2e36"; highlight.ExtraWhitespace.bg = "#2C323C";
# "Cursorline".bg = "#2a2e36"; 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);
extraConfigLuaPost = ''
'';
}; };
}; };
} }

View file

@ -1,202 +1,205 @@
_: { { machine, ... }:
custom.program.tmux.requirements = [ "cli" ]; {
custom.program.tmux.home-config = custom.program.tmux = machine.program {
{ pkgs, ... }: requirements = [ "cli" ];
{ home-config =
programs.tmux = { { pkgs, ... }:
enable = true; {
mouse = true; programs.tmux = {
clock24 = true; enable = true;
mouse = true;
clock24 = true;
shortcut = "k"; shortcut = "k";
plugins = with pkgs; [ plugins = with pkgs; [
{ {
plugin = tmuxPlugins.mkTmuxPlugin { plugin = tmuxPlugins.mkTmuxPlugin {
pluginName = "suspend"; pluginName = "suspend";
version = "1a2f806"; version = "1a2f806";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "MunifTanjim"; owner = "MunifTanjim";
repo = "tmux-suspend"; repo = "tmux-suspend";
rev = "1a2f806666e0bfed37535372279fa00d27d50d14"; rev = "1a2f806666e0bfed37535372279fa00d27d50d14";
sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv"; sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv";
};
}; };
}; extraConfig = ''
extraConfig = '' set -g @suspend_key 'F11'
set -g @suspend_key 'F11' '';
''; }
} {
{ plugin = tmuxPlugins.mode-indicator;
plugin = tmuxPlugins.mode-indicator; }
} ];
];
extraConfig = '' extraConfig = ''
# unbind every single normal keybinding # unbind every single normal keybinding
unbind-key -a unbind-key -a
set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S " set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S "
# for special characters to work right # for special characters to work right
# like <C-_> # like <C-_>
# set-window-option -g xterm-keys on # set-window-option -g xterm-keys on
set -g default-terminal "screen-256color" set -g default-terminal "screen-256color"
set -g set-titles on set -g set-titles on
set -g allow-passthrough on set -g allow-passthrough on
set -s escape-time 0 set -s escape-time 0
set-option -g default-shell ${pkgs.fish}/bin/fish set-option -g default-shell ${pkgs.fish}/bin/fish
set -ga terminal-features "\*:hyperlinks" set -ga terminal-features "\*:hyperlinks"
set-window-option -g mode-keys vi set-window-option -g mode-keys vi
# clipboard stuff # clipboard stuff
bind -T copy-mode-vi v send-keys -X begin-selection 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 -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind v copy-mode bind v copy-mode
bind p paste-buffer -p bind p paste-buffer -p
set -s set-clipboard on set -s set-clipboard on
# get back normal terminal emulator bindings # get back normal terminal emulator bindings
bind-key -n S-PPage copy-mode -u bind-key -n S-PPage copy-mode -u
bind-key -T copy-mode -n S-NPage send-keys -X page-down bind-key -T copy-mode -n S-NPage send-keys -X page-down
# don't scroll to end when copying with mouse # 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 MouseDragEnd1Pane send-keys -X copy-pipe
bind-key -T copy-mode-vi 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 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 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 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 -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
# window control # window control
bind t new-window -c "#{pane_current_path}" bind t new-window -c "#{pane_current_path}"
bind-key Tab next-window bind-key Tab next-window
bind-key BTab previous-window bind-key BTab previous-window
set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})" set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
set -g renumber-windows on set -g renumber-windows on
bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window
bind A last-window bind A last-window
bind-key 1 select-window -t :0 bind-key 1 select-window -t :0
bind-key 2 select-window -t :1 bind-key 2 select-window -t :1
bind-key 3 select-window -t :2 bind-key 3 select-window -t :2
bind-key 4 select-window -t :3 bind-key 4 select-window -t :3
bind-key 5 select-window -t :4 bind-key 5 select-window -t :4
bind-key 6 select-window -t :5 bind-key 6 select-window -t :5
bind-key 7 select-window -t :6 bind-key 7 select-window -t :6
bind-key 8 select-window -t :7 bind-key 8 select-window -t :7
bind-key 9 select-window -t :8 bind-key 9 select-window -t :8
bind-key 0 select-window -t :9 bind-key 0 select-window -t :9
# pane control # pane control
bind h select-pane -L bind h select-pane -L
bind j select-pane -D bind j select-pane -D
bind k select-pane -U bind k select-pane -U
bind l select-pane -R bind l select-pane -R
bind Left select-pane -L bind Left select-pane -L
bind Down select-pane -D bind Down select-pane -D
bind Up select-pane -U bind Up select-pane -U
bind Right select-pane -R bind Right select-pane -R
bind L split-window -h -c "#{pane_current_path}" bind L split-window -h -c "#{pane_current_path}"
bind J split-window -v -c "#{pane_current_path}" bind J split-window -v -c "#{pane_current_path}"
bind H split-window -h -b -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 K split-window -v -b -c "#{pane_current_path}"
bind S-Left split-window -h -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-Down split-window -v -c "#{pane_current_path}"
bind S-Up split-window -h -b -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 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-h resize-pane -L 5
bind-key -r -T prefix M-j resize-pane -D 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-k resize-pane -U 5
bind-key -r -T prefix M-l resize-pane -R 5 bind-key -r -T prefix M-l resize-pane -R 5
bind x swap-pane -D bind x swap-pane -D
# double-click ^k (or lshift with kanata) for previous pane like ^w in vim # double-click ^k (or lshift with kanata) for previous pane like ^w in vim
bind -r ^k select-pane -l bind -r ^k select-pane -l
bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane
# bind-key o choose-tree -wZ # bind-key o choose-tree -wZ
# bind-key O choose-tree -sZ # bind-key O choose-tree -sZ
# get back command mode and some other basics... # get back command mode and some other basics...
bind : command-prompt bind : command-prompt
bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded" bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
bind-key ? list-keys bind-key ? list-keys
# Scroll oin man etc # Scroll oin man etc
tmux_commands_with_legacy_scroll="nano less more man git" tmux_commands_with_legacy_scroll="nano less more man git"
bind-key -T root WheelUpPane \ bind-key -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \ if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \ 'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up" "copy-mode -et="' "send -t= Up" "copy-mode -et="'
bind-key -T root WheelDownPane \ bind-key -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \ if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \ 'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down" "send -Mt="' "send -t= Down" "send -Mt="'
bind-key -T copy-mode-vi ] \ bind-key -T copy-mode-vi ] \
send-keys -X clear-selection \; \ send-keys -X clear-selection \; \
send-keys -X search-forward "--> " \; \ send-keys -X search-forward "--> " \; \
send-keys -X next-word \; \ send-keys -X next-word \; \
send-keys -X begin-selection \; \ send-keys -X begin-selection \; \
send-keys -X jump-forward ":" \; \ send-keys -X jump-forward ":" \; \
send-keys -X jump-to-forward ":" \; send-keys -X jump-to-forward ":" \;
bind-key -T copy-mode-vi [ \ bind-key -T copy-mode-vi [ \
send-keys -X clear-selection \; \ send-keys -X clear-selection \; \
send-keys -X start-of-line \; \ send-keys -X start-of-line \; \
send-keys -X search-backward "--> " \; \ send-keys -X search-backward "--> " \; \
send-keys -X next-word \; \ send-keys -X next-word \; \
send-keys -X begin-selection \; \ send-keys -X begin-selection \; \
send-keys -X jump-forward ":" \; \ send-keys -X jump-forward ":" \; \
send-keys -X jump-to-forward ":" \; send-keys -X jump-to-forward ":" \;
bind-key [ copy-mode \; send-keys [ bind-key [ copy-mode \; send-keys [
bind-key ] copy-mode \; send-keys ] bind-key ] copy-mode \; send-keys ]
bind d select-pane -l \; send-keys [ bind d select-pane -l \; send-keys [
# f: file search # f: file search
# unbound: git files # unbound: git files
# g: git hashes # g: git hashes
# u: urls # u: urls
# C-d: numbers # C-d: numbers
# M-i: ips # M-i: ips
# include line and column numbers in file search # include line and column numbers in file search
# rebind `f` so we can reuse it here # rebind `f` so we can reuse it here
bind-key -T prefix C-f command-prompt { find-window -Z "%%" } bind-key -T prefix C-f command-prompt { find-window -Z "%%" }
# jyn is so sorry, and so am I now # jyn is so sorry, and so am I now
# https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212 # https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212
# see `search-regex.sh` for wtf this means # see `search-regex.sh` for wtf this means
# TODO: include shell variable names # 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]+)?))' 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 # urls
bind-key u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*' bind-key u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*'
# hashes # hashes
bind-key g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]' bind-key g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]'
# ips # 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 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 \ 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' \; \ '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 } if -F "#{alternate_on}" { send-keys -X cancel }
# save the buffer, then open an editor in the current pane # 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 \ 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"' 'tmux send-keys "C-q"; xargs -I {} tmux send-keys "vim {}"; tmux send-keys "C-m"'
# search for the highlighted text # search for the highlighted text
bind-key -T copy-mode-vi s send-keys -X copy-pipe \ 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={}'" \; \ "cd #{pane_current_path}; xargs -I {} open 'https://www.google.com/search?q={}'" \; \
if -F "#{alternate_on}" { send-keys -X cancel } if -F "#{alternate_on}" { send-keys -X cancel }
# save buffer and retype into the shell # 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 copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p
''; '';
};
}; };
}; };
} }

View file

@ -1,176 +1,182 @@
_: { { machine, ... }:
custom.program.zed.requirements = [ "work" ]; {
custom.program.zed.home-config = custom.program.zed = machine.program {
{ pkgs, ... }: requirements = [
{ "work"
home.packages = pkgs.custom.maple-fonts-pack; "graphical"
];
home-config =
{ pkgs, ... }:
{
home.packages = pkgs.custom.maple-fonts-pack;
programs.zed-editor = { programs.zed-editor = {
enable = true; enable = true;
extensions = [ extensions = [
"nix" "nix"
"intellij-newui-theme" "intellij-newui-theme"
"charmed-icons" "charmed-icons"
"astro" "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"
];
}
];
}
]; ];
icon_theme = "Warm Charmed Icons"; userSettings = {
ui_font_size = 16;
buffer_font_size = 16;
theme = {
mode = "system";
light = "One Light";
dark = "JetBrains New Dark";
};
disable_ai = true;
preview_tabs = { ssh_connections = [
enabled = true; {
enable_preview_from_file_finder = true; host = "icecube";
}; args = [ ];
projects = [
close_on_file_delete = true; {
confirm_quit = true; paths = [
"/home/jana/src/eii-test"
edit_predictions_disabled_in = [ ];
"comment" }
"string" {
]; paths = [
"/home/jana/src/example"
vim_mode = true; ];
cursor_blink = false; }
vertical_scroll_margin = 0; {
paths = [
inlay_hints = { "/home/jana/src/fitgirl-ddl"
enabled = true; ];
}; }
{
project_panel = { paths = [
dock = "right"; "/home/jana/src/libs-team/tools/unstable-api"
git_status = false; ];
}; }
minimap = { {
show = "auto"; paths = [
thumb = "always"; "/home/jana/src/ml-kem-hang"
thumb_border = "left_open"; ];
}; }
tab_bar = { {
show = true; paths = [
show_nav_history_buttons = false; "/home/jana/src/opendal/core"
show_tab_bar_buttons = false; ];
}; }
tabs = { {
file_icons = true; paths = [
git_status = false; "/home/jana/src/rust"
activate_on_close = "history"; ];
show_close_button = "hover"; }
}; {
lsp = { paths = [
rust-analyzer = { "/home/jana/src/span-lowering-tests"
initialization_options = { ];
inlayHints = { }
lifetimeElisionHints = "always"; ];
discriminantHints = "always"; }
}; ];
diagnostic = { icon_theme = "Warm Charmed Icons";
refreshSupport = true; ui_font_size = 16;
}; buffer_font_size = 16;
}; theme = {
binary = { mode = "system";
path_lookup = true; light = "One Light";
}; dark = "JetBrains New Dark";
}; };
nil = { disable_ai = true;
binary = {
ignore_system_version = false;
path = "${pkgs.lib.getExe' pkgs.nil "nil"}";
};
initialization_options = { preview_tabs = {
formatting = { enabled = true;
command = [ "${pkgs.lib.getExe' pkgs.nixfmt "nixfmt"}" ]; enable_preview_from_file_finder = true;
};
};
}; };
};
diagnostics = { close_on_file_delete = true;
button = false; confirm_quit = true;
include_warnings = true;
inline = { edit_predictions_disabled_in = [
"comment"
"string"
];
vim_mode = true;
cursor_blink = false;
vertical_scroll_margin = 0;
inlay_hints = {
enabled = true; enabled = true;
}; };
};
terminal = { project_panel = {
"dock" = "left"; dock = "right";
"env" = { git_status = false;
# "EDITOR": "zeditor --wait"
"EDITOR" = "vim";
}; };
"font_size" = 12; minimap = {
"font_family" = "Maple Mono NF"; show = "auto";
"line_height" = "standard"; thumb = "always";
}; thumb_border = "left_open";
buffer_font_family = "Maple Mono NF"; };
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" = { # "diagnostics_max_severity": "off",
"syntax" = {
"comment.doc" = { "experimental.theme_overrides" = {
"color" = "#77B767"; "syntax" = {
"comment.doc" = {
"color" = "#77B767";
};
}; };
}; };
}; };
}; };
}; };
}; };
} }

View file

@ -1,9 +1,8 @@
{ pkgs, inputs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
(inputs.self + /modules/users.nix) (../modules/users.nix)
]; ];
users.groups.media = { };
custom.users = { custom.users = {
vivian = { vivian = {