diff --git a/common/users/cameron/home-manager/lf.nix b/common/users/cameron/home-manager/lf.nix new file mode 100644 index 0000000..92d3982 --- /dev/null +++ b/common/users/cameron/home-manager/lf.nix @@ -0,0 +1,37 @@ +{ pkgs, lib, inputs, config, osConfig, ... }: + +{ + programs.lf = { + enable = builtins.elem pkgs.lf osConfig.environment.systemPackages; + + commands = { + delete = ''''${{ + set -f + printf "$fx\n" + printf "delete? [y/N] " + read ans + [ "$ans" = "y" ] && rm -rf $fx + }}''; + }; + + keybindings = { + x = "delete"; + "" = "delete"; + "" = "open"; + }; + + settings = { + scrolloff = 8; + preview = true; + drawbox = true; + icons = true; + cursorpreviewfmt = "\033[7;90m"; + }; + }; + + xdg.configFile."lf/icons" = { + enable = builtins.elem pkgs.lf osConfig.environment.systemPackages; + + source = "${inputs.lf-icons}/etc/icons.example"; + }; +} diff --git a/common/users/cameron/home-manager/zsh.nix b/common/users/cameron/home-manager/zsh.nix index 2296bad..4d15b3e 100644 --- a/common/users/cameron/home-manager/zsh.nix +++ b/common/users/cameron/home-manager/zsh.nix @@ -101,6 +101,15 @@ if command -v direnv &> /dev/null; then fi +if command -v lf &> /dev/null; then + lfcd() { + cd "$(command lf -print-last-lf "$@")" + } + + bindkey -s '^o' 'lfcd\n' +fi + + if [ "$TERM" = "xterm-kitty" ]; then alias ssh='kitty +kitten ssh' alias clear='printf "\033c"' diff --git a/common/users/cameron/home.nix b/common/users/cameron/home.nix index 4c3fbf8..059d22d 100644 --- a/common/users/cameron/home.nix +++ b/common/users/cameron/home.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, osConfig, ... }: +{ pkgs, lib, inputs, config, osConfig, ... }: { imports = [ @@ -12,8 +12,14 @@ ./home-manager/waybar.nix ./home-manager/zsh.nix + + ./home-manager/lf.nix ]; home.username = "cameron"; home.homeDirectory = osConfig.users.users.cameron.home; + + home.sessionVariables = { + EDITOR = "nvim"; + }; } diff --git a/flake.lock b/flake.lock index 7a8d7ed..4cc2c6b 100644 --- a/flake.lock +++ b/flake.lock @@ -41,6 +41,22 @@ "type": "github" } }, + "lf-icons": { + "flake": false, + "locked": { + "lastModified": 1705549864, + "narHash": "sha256-JqjJLz+XxbvN2lC8+nhjvfheHjgjlLMp2NvQREF4zbk=", + "owner": "gokcehan", + "repo": "lf", + "rev": "8a14749154c2c11fce4fec0188dc204c012bd3e9", + "type": "github" + }, + "original": { + "owner": "gokcehan", + "repo": "lf", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1706098335, @@ -75,6 +91,7 @@ "inputs": { "home-manager": "home-manager", "home-manager-unstable": "home-manager-unstable", + "lf-icons": "lf-icons", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index 33d833b..b31bf32 100644 --- a/flake.nix +++ b/flake.nix @@ -12,11 +12,17 @@ nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; home-manager-unstable.url = "github:nix-community/home-manager"; home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable"; + + + lf-icons.url = "github:gokcehan/lf"; + lf-icons.flake = false; }; - outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, home-manager-unstable }: - let common_dir = ./common; + outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, home-manager-unstable, lf-icons }: + let + common_dir = ./common; + inputs = { inherit lf-icons; }; in { nixosConfigurations = { @@ -30,7 +36,7 @@ home-manager.useUserPackages = true; home-manager.users.cameron = import ./hosts/nixos/home-manager/cameron.nix; - home-manager.extraSpecialArgs = { inherit common_dir; }; + home-manager.extraSpecialArgs = { inherit common_dir inputs; }; } ]; }; @@ -45,7 +51,7 @@ home-manager.useUserPackages = true; home-manager.users.cameron = import ./hosts/nixserver/home-manager/cameron.nix; - home-manager.extraSpecialArgs = { inherit common_dir; }; + home-manager.extraSpecialArgs = { inherit common_dir inputs; }; } ]; }; diff --git a/hosts/nixos/home-manager/cameron.nix b/hosts/nixos/home-manager/cameron.nix index 4088d14..c7946ac 100644 --- a/hosts/nixos/home-manager/cameron.nix +++ b/hosts/nixos/home-manager/cameron.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, osConfig, common_dir, ... }: +{ lib, pkgs, inputs, config, osConfig, common_dir, ... }: { imports = [