From fd48df0d4328f91abd2f364f6e601b86f335c3fd Mon Sep 17 00:00:00 2001 From: DACHXY Date: Sat, 28 Dec 2024 20:16:33 +0800 Subject: [PATCH] add yazi --- flake.lock | 93 ++++++++++++++++++++++++++++++++++++- flake.nix | 14 +++++- home/user/shell.nix | 10 +--- home/user/shellAlias.nix | 17 +++++++ system/modules/packages.nix | 2 +- 5 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 home/user/shellAlias.nix diff --git a/flake.lock b/flake.lock index 705aa64..3c56582 100644 --- a/flake.lock +++ b/flake.lock @@ -83,6 +83,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghostty": { "inputs": { "flake-compat": "flake-compat", @@ -534,6 +552,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1729265718, + "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ccc0c2126893dd20963580b6478d1a10a4512185", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -567,7 +601,29 @@ "hyprland-plugins": "hyprland-plugins", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable_2" + "nixpkgs-unstable": "nixpkgs-unstable_2", + "yazi": "yazi" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "yazi", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729391507, + "narHash": "sha256-as0I9xieJUHf7kiK2a9znDsVZQTFWhM1pLivII43Gi0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "784981a9feeba406de38c1c9a3decf966d853cca", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { @@ -600,6 +656,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": [ @@ -641,6 +712,26 @@ "type": "github" } }, + "yazi": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1735318734, + "narHash": "sha256-p9VfYkunTS8OWo2R1Mvs4pqs/Ymn50KmmSCHyu/UPmA=", + "owner": "sxyazi", + "repo": "yazi", + "rev": "2770e0259cc83d91b7877b412a27db2dcb1c9427", + "type": "github" + }, + "original": { + "owner": "sxyazi", + "repo": "yazi", + "type": "github" + } + }, "zig": { "inputs": { "flake-compat": [ diff --git a/flake.nix b/flake.nix index 8b1d0d5..3503331 100644 --- a/flake.nix +++ b/flake.nix @@ -4,8 +4,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + home-manager.url = "github:nix-community/home-manager/release-24.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; @@ -13,6 +15,11 @@ url = "github:ghostty-org/ghostty"; }; + yazi = { + url = "github:sxyazi/yazi"; + }; + + # Not used yet due to some skill issue hyprland.url = "github:hyprwm/Hyprland/main"; hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; @@ -28,7 +35,7 @@ { self, nixpkgs-unstable, nixpkgs, nix-index-database, ... }@inputs: let system = "x86_64-linux"; - # pkgs = nixpkgs.legacyPackages.${system}; + pkgs = nixpkgs.legacyPackages.${system}; pkgsUnstable = nixpkgs-unstable.legacyPackages.${system}; in { @@ -44,6 +51,8 @@ inherit inputs; inherit pkgsUnstable; inherit system; + inherit pkgs; + inherit pkgsUnstable; }; }; @@ -55,6 +64,9 @@ specialArgs = { inherit inputs; inherit pkgsUnstable; + inherit system; + inherit pkgs; + inherit pkgsUnstable; }; }; diff --git a/home/user/shell.nix b/home/user/shell.nix index 775a3ca..4649c1d 100644 --- a/home/user/shell.nix +++ b/home/user/shell.nix @@ -1,14 +1,6 @@ { pkgs, ... }: let - shellAlias = { - ls = "exa"; - cat = "bat"; - rebuild = "sudo nixos-rebuild switch --flake /etc/nixos"; - fullClean = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot"; - setWindows = "sudo bootctl set-oneshot auto-windows"; - goWin = "sudo bootctl set-oneshot auto-windows && reboot"; - goBios = "sudo bootctl set-onshot auto-reboot-to-firmware-setup && reboot"; - }; + shellAlias = import ./shellAlias.nix; in { programs = { diff --git a/home/user/shellAlias.nix b/home/user/shellAlias.nix new file mode 100644 index 0000000..b211c3b --- /dev/null +++ b/home/user/shellAlias.nix @@ -0,0 +1,17 @@ +{ + ls = "exa"; + cat = "bat"; + y = "yazi"; + g = "git"; + cd = "z"; # Zoxide + t = "tmux"; + + # Nixos + rebuild = "sudo nixos-rebuild switch --flake /etc/nixos"; + fullClean = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot"; + + # Systemd Boot + setWin = "sudo bootctl set-oneshot auto-windows"; + goWin = "sudo bootctl set-oneshot auto-windows && reboot"; + goBios = "sudo bootctl set-onshot auto-reboot-to-firmware-setup && reboot"; +} diff --git a/system/modules/packages.nix b/system/modules/packages.nix index ee98f98..fb2f042 100644 --- a/system/modules/packages.nix +++ b/system/modules/packages.nix @@ -14,7 +14,6 @@ btop eza fzf - ranger # Terminal file manager neofetch ripgrep tree @@ -85,6 +84,7 @@ vlc ]) ++ ([ inputs.ghostty.packages.x86_64-linux.default + inputs.yazi.packages.x86_64-linux.default # Terminal file manager ]); }