diff --git a/flake.nix b/flake.nix index 4a0e530..91184c3 100644 --- a/flake.nix +++ b/flake.nix @@ -19,23 +19,34 @@ outputs = { self, nixpkgs, home-manager, nixvim, nix-gaming, ... }@inputs: let system = "x86_64-linux"; + customPkgsOverlay = final: prev: import ./pkgs { + pkgs = prev; + lib = prev.lib; + }; pkgs = import nixpkgs { inherit system; config.allowUnfree = true; + overlays = [ customPkgsOverlay ]; }; lib = nixpkgs.lib; in { nixosConfigurations = { nixos = lib.nixosSystem { inherit system; - specialArgs = { - inherit inputs; - inherit system; - }; + specialArgs = { inherit inputs; }; modules = [ + { nixpkgs.overlays = [ customPkgsOverlay ]; } ./hosts/configuration.nix ]; }; }; + + homeConfigurations = { + "cobray" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ ./home-manager/cobray.nix ]; + }; + }; }; } diff --git a/home-manager/modules/fish.nix b/home-manager/modules/fish.nix index f4bf934..e8df928 100644 --- a/home-manager/modules/fish.nix +++ b/home-manager/modules/fish.nix @@ -2,6 +2,7 @@ { home.packages = with pkgs; [ + fish-rust starship fzf bat @@ -10,7 +11,4 @@ ripgrep ]; - programs.fish = { - enable = true; - }; } diff --git a/modules/default.nix b/modules/default.nix index 5adf860..7431c84 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,7 +7,6 @@ ./boot.nix ./docker.nix ./env.nix - ./fish.nix ./fonts.nix ./home-manager.nix ./i3-xfce.nix diff --git a/modules/fish.nix b/modules/fish.nix deleted file mode 100644 index 78b859f..0000000 --- a/modules/fish.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, pkgs, lib, ... }: -let - fish-rust = pkgs.callPackage ../pkgs/fish-rust { }; -in -{ - programs.fish = { - enable = true; - package = fish-rust; - }; - environment.systemPackages = with pkgs; [ - starship - fzf - bat - eza - fd - ripgrep - ]; -} diff --git a/modules/user.nix b/modules/user.nix index e6d87c3..0638ed9 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -1,12 +1,16 @@ { config, pkgs, lib, ... }: +let + fish-rust = pkgs.callPackage ../pkgs/fish-rust { }; +in + { # Define a user account. Don't forget to set a password with 'passwd'. users.users.cobray = { isNormalUser = true; description = "Mon Aie"; extraGroups = [ "networkmanager" "wheel" "docker" "video" ]; - shell = pkgs.fish; + shell = fish-rust; packages = with pkgs; [ # User-specific packages can be defined here # or through home-manager @@ -17,4 +21,9 @@ enable = true; wheelNeedsPassword = true; }; + + programs.fish = { + enable = true; + package = fish-rust; + }; } diff --git a/pkgs/fish-rust/default.nix b/pkgs/fish-rust/default.nix index 18969e2..e7695b9 100644 --- a/pkgs/fish-rust/default.nix +++ b/pkgs/fish-rust/default.nix @@ -1,13 +1,16 @@ -{ lib, rustPlatform, fetchgit, ncurses, sphinx, python3 }: +{ lib, rustPlatform, fetchgit, ncurses, python3Packages, gettext }: + rustPlatform.buildRustPackage rec { pname = "fish"; version = "4.1-2025-03-14-rust"; + src = fetchgit { url = "https://github.com/fish-shell/fish-shell.git"; rev = "refs/heads/master"; fetchSubmodules = true; sha256 = "18zpwa3yddic6wdwj7g51w6n4apwsixfvl179yddk2nwfpxhv4hq"; }; + cargoLock = { lockFile = "${src}/Cargo.lock"; outputHashes = { @@ -15,26 +18,41 @@ rustPlatform.buildRustPackage rec { "pcre2-sys-0.2.9" = "0mhjw7fvrzxb3fd0c534a17qgy6svz0z8269d2fs6q8aw11610mr"; }; }; - buildInputs = [ ncurses ]; - nativeBuildInputs = [ sphinx python3 ]; + + buildInputs = [ ncurses gettext ]; + nativeBuildInputs = with python3Packages; [ + sphinx + sphinx_rtd_theme + gettext + ]; + preBuild = '' export FISH_BUILD_VERSION="${version}" export FISH_BUILD_DOCS=1 ''; + postInstall = '' export HOME=$(mktemp -d) mkdir -p $HOME/.local/share/fish/install - $out/bin/fish --install + + if [ ! -f $HOME/.config/fish/config.fish ]; then + $out/bin/fish --install + fi + mkdir -p $out/share/fish cp -r $HOME/.local/share/fish/install/* $out/share/fish/ 2>/dev/null || true + mkdir -p $out/share/fish/tools cp $src/share/tools/create_manpage_completions.py $out/share/fish/tools/ cp $src/share/tools/deroff.py $out/share/fish/tools/ chmod +x $out/share/fish/tools/create_manpage_completions.py chmod +x $out/share/fish/tools/deroff.py + rm -rf $HOME ''; + doCheck = false; + meta = with lib; { description = "The user-friendly command line shell (Rust version)"; homepage = "https://fishshell.com/"; @@ -42,5 +60,6 @@ rustPlatform.buildRustPackage rec { platforms = platforms.unix; mainProgram = "fish"; }; + passthru.shellPath = "/bin/fish"; }