Compare commits
12 commits
main
...
tmux-thumb
Author | SHA1 | Date | |
---|---|---|---|
Antoine Martin | 1ccbe85361 | ||
Antoine Martin | 7a20e72e86 | ||
Antoine Martin | 0cb51a65f6 | ||
Antoine Martin | 4168da868d | ||
Antoine Martin | d72c0d5926 | ||
Antoine Martin | f64b7b18d7 | ||
Antoine Martin | 244d2111af | ||
Antoine Martin | 1fa2bee372 | ||
Antoine Martin | 806f0bd4fb | ||
Antoine Martin | 37882e8d10 | ||
Antoine Martin | 75026b906e | ||
Antoine Martin | 2723186f49 |
|
@ -3,23 +3,17 @@
|
|||
environment.systemPackages = with pkgs; [
|
||||
alacritty
|
||||
discord
|
||||
emacsPgtkGcc
|
||||
feh
|
||||
firefox
|
||||
flameshot
|
||||
pavucontrol
|
||||
slack
|
||||
spotify
|
||||
sqlite # needed for org-roam
|
||||
zathura
|
||||
];
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
input-fonts
|
||||
emacs-all-the-icons-fonts
|
||||
];
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
programs.nm-applet.enable = true;
|
||||
|
||||
# NOTE: needed for home emacs configuration
|
||||
nixpkgs.config.input-fonts.acceptLicense = true;
|
||||
}
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
AddKeysToAgent yes
|
||||
'';
|
||||
};
|
||||
tmux = {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -26,6 +22,7 @@
|
|||
fd
|
||||
ripgrep
|
||||
tree
|
||||
packages.tmux-thumbs
|
||||
wget
|
||||
|
||||
# development
|
||||
|
|
|
@ -67,12 +67,17 @@
|
|||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.alarsyo = import ./home;
|
||||
home-manager.verbose = true;
|
||||
}
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
emacs-overlay.overlay
|
||||
|
||||
(self: super: {
|
||||
packages = import ./packages { pkgs = super; };
|
||||
})
|
||||
|
||||
# uncomment this to build everything from scratch, fun but takes a
|
||||
# while
|
||||
#
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./emacs.nix
|
||||
./flameshot.nix
|
||||
./tmux.nix
|
||||
./x
|
||||
];
|
||||
|
||||
home.stateVersion = "20.09";
|
||||
|
||||
home.username = "alarsyo";
|
||||
|
|
29
home/emacs.nix
Normal file
29
home/emacs.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
options.my.home.emacs = with lib; {
|
||||
enable = mkEnableOption "Emacs daemon configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.my.home.emacs.enable {
|
||||
home.packages = with pkgs; [
|
||||
sqlite # needed by org-roam
|
||||
|
||||
# fonts used by my config
|
||||
input-fonts
|
||||
emacs-all-the-icons-fonts
|
||||
];
|
||||
# make sure above fonts are discoverable
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
# generate emacsclient desktop file
|
||||
client.enable = true;
|
||||
};
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacsPgtkGcc;
|
||||
};
|
||||
};
|
||||
}
|
13
home/flameshot.nix
Normal file
13
home/flameshot.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.home.flameshot;
|
||||
in
|
||||
{
|
||||
options.my.home.flameshot = with lib; {
|
||||
enable = mkEnableOption "flameshot autolaunch";
|
||||
};
|
||||
|
||||
config.services.flameshot = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
};
|
||||
}
|
15
home/tmux.nix
Normal file
15
home/tmux.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.home.tmux;
|
||||
in
|
||||
{
|
||||
options.my.home.tmux = with lib; {
|
||||
enable = mkEnableOption "tmux dotfiles";
|
||||
};
|
||||
|
||||
config.programs.tmux = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
plugins = with pkgs; [ packages.tmux-thumbs ];
|
||||
};
|
||||
}
|
11
home/x/default.nix
Normal file
11
home/x/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./i3.nix
|
||||
./i3bar.nix
|
||||
];
|
||||
|
||||
options.my.home.x = with lib; {
|
||||
enable = mkEnableOption "X server configuration";
|
||||
};
|
||||
}
|
121
home/x/i3.nix
Normal file
121
home/x/i3.nix
Normal file
|
@ -0,0 +1,121 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
isEnabled = config.my.home.x.enable;
|
||||
|
||||
myTerminal =
|
||||
# FIXME: fix when terminal is setup in home
|
||||
# if config.my.home.terminal.program != null
|
||||
if true
|
||||
then "alacritty"
|
||||
else "i3-sensible-terminal";
|
||||
|
||||
alt = "Mod1"; # `Alt` key
|
||||
modifier = "Mod4"; # `Super` key
|
||||
|
||||
logoutMode = "[L]ogout, [S]uspend, [P]oweroff, [R]eboot";
|
||||
|
||||
# colors
|
||||
colorBg = "#282828";
|
||||
colorRed = "#cc241d";
|
||||
colorGreen = "#98971a";
|
||||
colorYellow = "#d79921";
|
||||
colorBlue = "#458588";
|
||||
colorPurple = "#b16286";
|
||||
colorAqua = "#689d68";
|
||||
colorGray = "#a89984";
|
||||
colorDarkGray = "#1d2021";
|
||||
in
|
||||
{
|
||||
config = lib.mkIf isEnabled {
|
||||
my.home = {
|
||||
flameshot.enable = true;
|
||||
};
|
||||
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
|
||||
config = {
|
||||
inherit modifier;
|
||||
|
||||
bars =
|
||||
let
|
||||
barConfigPath =
|
||||
config.xdg.configFile."i3status-rust/config-top.toml".target;
|
||||
in
|
||||
[
|
||||
{
|
||||
statusCommand = "i3status-rs ${barConfigPath}";
|
||||
position = "top";
|
||||
fonts = [ "DejaVu Sans Mono 9" ];
|
||||
|
||||
colors = {
|
||||
background = colorBg;
|
||||
statusline = colorYellow;
|
||||
|
||||
focusedWorkspace = {
|
||||
border = colorAqua;
|
||||
background = colorAqua;
|
||||
text = colorDarkGray;
|
||||
};
|
||||
inactiveWorkspace = {
|
||||
border = colorDarkGray;
|
||||
background = colorDarkGray;
|
||||
text = colorYellow;
|
||||
};
|
||||
activeWorkspace = {
|
||||
border = colorAqua;
|
||||
background = colorDarkGray;
|
||||
text = colorYellow;
|
||||
};
|
||||
urgentWorkspace = {
|
||||
border = colorRed;
|
||||
background = colorRed;
|
||||
text = colorBg;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
focus = {
|
||||
followMouse = true;
|
||||
mouseWarping = true;
|
||||
};
|
||||
|
||||
fonts = [
|
||||
"DejaVu Sans Mono 8"
|
||||
];
|
||||
|
||||
keybindings = lib.mkOptionDefault {
|
||||
"${modifier}+Shift+e" = ''mode "${logoutMode}"'';
|
||||
"${modifier}+i" = "exec emacsclient -c";
|
||||
};
|
||||
|
||||
modes =
|
||||
let
|
||||
makeModeBindings = attrs: attrs // {
|
||||
"Escape" = "mode default";
|
||||
"Return" = "mode default";
|
||||
};
|
||||
in
|
||||
{
|
||||
${logoutMode} = makeModeBindings {
|
||||
"l" = "exec --no-startup-id i3-msg exit, mode default";
|
||||
"s" = "exec --no-startup-id systemctl suspend, mode default";
|
||||
"p" = "exec --no-startup-id systemctl poweroff, mode default";
|
||||
"r" = "exec --no-startup-id systemctl reboot, mode default";
|
||||
};
|
||||
};
|
||||
|
||||
startup = [
|
||||
# FIXME: make it conditional on "nvidia" being part of video drivers
|
||||
{
|
||||
command = "nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'";
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
|
||||
terminal = myTerminal;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
22
home/x/i3bar.nix
Normal file
22
home/x/i3bar.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
isEnabled = config.my.home.x.enable;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf isEnabled {
|
||||
home.packages = with pkgs; [
|
||||
alsaUtils # Used by `sound` block
|
||||
lm_sensors # Used by `temperature` block
|
||||
];
|
||||
|
||||
programs.i3status-rust = {
|
||||
enable = true;
|
||||
|
||||
bars = {
|
||||
top = {
|
||||
theme = "gruvbox-light";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -10,6 +10,8 @@ in
|
|||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
||||
./home.nix
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
|
@ -38,7 +40,7 @@ in
|
|||
# List services that you want to enable:
|
||||
my.services = {
|
||||
wireguard = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
iface = "wg";
|
||||
port = 51820;
|
||||
|
||||
|
@ -69,11 +71,6 @@ in
|
|||
layout = "fr";
|
||||
xkbVariant = "us";
|
||||
};
|
||||
|
||||
emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacsPgtkGcc;
|
||||
};
|
||||
};
|
||||
|
||||
sound.enable = true;
|
||||
|
|
9
hosts/boreal/home.nix
Normal file
9
hosts/boreal/home.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
home-manager.users.alarsyo = {
|
||||
# Keyboard settings & i3 settings
|
||||
my.home.x.enable = true;
|
||||
my.home.emacs.enable = true;
|
||||
my.home.tmux.enable = true;
|
||||
};
|
||||
}
|
4
packages/default.nix
Normal file
4
packages/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ pkgs }:
|
||||
{
|
||||
tmux-thumbs = pkgs.callPackage ./tmux-thumbs.nix {};
|
||||
}
|
41
packages/fix.patch
Normal file
41
packages/fix.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
diff --git a/src/swapper.rs b/src/swapper.rs
|
||||
index aff33e1..cb5f21a 100644
|
||||
--- a/src/swapper.rs
|
||||
+++ b/src/swapper.rs
|
||||
@@ -210,11 +210,10 @@ impl<'a> Swapper<'a> {
|
||||
};
|
||||
|
||||
let pane_command = format!(
|
||||
- "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | {dir}/target/release/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
|
||||
+ "tmux capture-pane -t {active_pane_id} -p{scroll_params} | tail -n {height} | @@replace-me@@/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
|
||||
active_pane_id = active_pane_id,
|
||||
scroll_params = scroll_params,
|
||||
height = self.active_pane_height.unwrap_or(i32::MAX),
|
||||
- dir = self.dir,
|
||||
tmp = TMP_FILE,
|
||||
args = args.join(" "),
|
||||
zoom_command = zoom_command,
|
||||
diff --git a/tmux-thumbs.sh b/tmux-thumbs.sh
|
||||
index 92d5625..c6300c7 100755
|
||||
--- a/tmux-thumbs.sh
|
||||
+++ b/tmux-thumbs.sh
|
||||
@@ -35,4 +35,4 @@ add-param command string
|
||||
add-param upcase-command string
|
||||
add-param osc52 boolean
|
||||
|
||||
-"${CURRENT_DIR}/target/release/tmux-thumbs" "${PARAMS[@]}" || true
|
||||
+@@replace-me@@ "${PARAMS[@]}" || true
|
||||
diff --git a/tmux-thumbs.tmux b/tmux-thumbs.tmux
|
||||
index 4fc9355..87c5346 100755
|
||||
--- a/tmux-thumbs.tmux
|
||||
+++ b/tmux-thumbs.tmux
|
||||
@@ -8,9 +8,3 @@ THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
|
||||
THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}
|
||||
|
||||
tmux bind-key "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
|
||||
-
|
||||
-BINARY="${CURRENT_DIR}/target/release/thumbs"
|
||||
-
|
||||
-if [ ! -f "$BINARY" ]; then
|
||||
- tmux split-window "cd ${CURRENT_DIR} && cargo build --release --target-dir=target && echo 'Press any key to continue...' && read -k1"
|
||||
-fi
|
38
packages/tmux-thumbs.nix
Normal file
38
packages/tmux-thumbs.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ pkgs, lib, rustPlatform, fetchFromGitHub }:
|
||||
let
|
||||
pname = "tmux-thumbs";
|
||||
version = "0.5.1";
|
||||
tmux-thumbs-binary = rustPlatform.buildRustPackage {
|
||||
pname = pname;
|
||||
version = version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "fcsonline";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-rU+tsrYJxoqF8Odh2ucvNekc+fLnSY6kFoVFUjqaTFE=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-/F9tftRLqC6dk7lX41C8RUMqlrgzc0nkunc0rue5zuM=";
|
||||
|
||||
patches = [ ./fix.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace src/swapper.rs --replace '@@replace-me@@' '$out/bin/thumbs'
|
||||
'';
|
||||
meta = {};
|
||||
};
|
||||
in pkgs.tmuxPlugins.mkTmuxPlugin {
|
||||
pluginName = pname;
|
||||
version = version;
|
||||
rtpFilePath = "tmux-thumbs.tmux";
|
||||
src = fetchFromGitHub {
|
||||
owner = "fcsonline";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-rU+tsrYJxoqF8Odh2ucvNekc+fLnSY6kFoVFUjqaTFE=";
|
||||
};
|
||||
patches = [ ./fix.patch ];
|
||||
postInstall = ''
|
||||
substituteInPlace $target/tmux-thumbs.sh --replace '@@replace-me@@' '${tmux-thumbs-binary}/bin/tmux-thumbs'
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue