From cccb6d240fac5d62016c2f1d6ed7870743757c81 Mon Sep 17 00:00:00 2001 From: Daniel Kahlenberg <573@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:13:41 +0200 Subject: [PATCH] Make use of specialArgs WIP --- flake/builders/mkHome.nix | 3 +++ flake/builders/mkNixOnDroid.nix | 1 + flake/builders/mkNixos.nix | 1 + home/base/general.nix | 6 +++--- home/programs/arbtt.nix | 6 +++--- home/programs/hledger.nix | 7 ++++--- home/programs/neovim.nix | 8 ++++---- lib/common-config.nix | 16 ++++++++++------ 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/flake/builders/mkHome.nix b/flake/builders/mkHome.nix index 01a480dc..86e026a4 100644 --- a/flake/builders/mkHome.nix +++ b/flake/builders/mkHome.nix @@ -22,6 +22,9 @@ inputs.home-manager.lib.homeManagerConfiguration { inherit inputs rootPath; libreoffice-postscript = inputs.libreoffice-postscript.legacyPackages.${system}; + inherit (inputs.nixvim.legacyPackages.${system}) makeNixvim; + ghc-nixpkgs-unstable = inputs.ghc-nixpkgs-unstable.legacyPackages.${system}; + unstable = inputs.unstable.legacyPackages.${system}; emacs = if isLinux && isAarch64 then inputs.emacs-overlay-cached.packages.${system}.emacs-unstable-nox else inputs.emacs-overlay.packages.${system}.emacs-unstable; diff --git a/flake/builders/mkNixOnDroid.nix b/flake/builders/mkNixOnDroid.nix index 41e0c2d2..0df9e2ad 100644 --- a/flake/builders/mkNixOnDroid.nix +++ b/flake/builders/mkNixOnDroid.nix @@ -29,6 +29,7 @@ inputs.nix-on-droid.lib.nixOnDroidConfiguration { extraSpecialArgs = { inherit inputs rootPath; unstable = inputs.unstable.legacyPackages.${system}; + inherit (inputs.nixvim.legacyPackages.${system}) makeNixvim; emacs = if isLinux && isAarch64 then inputs.emacs-overlay-cached.packages.${system}.emacs-unstable-nox else inputs.emacs-overlay.packages.${system}.emacs-unstable; diff --git a/flake/builders/mkNixos.nix b/flake/builders/mkNixos.nix index 3729f042..6836854e 100644 --- a/flake/builders/mkNixos.nix +++ b/flake/builders/mkNixos.nix @@ -12,6 +12,7 @@ inputs.nixpkgs.lib.nixosSystem { */ specialArgs = { inherit inputs rootPath; + inherit (inputs.nixvim.legacyPackages.${system}) makeNixvim; # NOTE one can alternatively also just (with only inherit inputs;) use in the downstream nix file then: inputs.unstable.legacyPackages.${pkgs.system}; unstable = inputs.unstable.legacyPackages.${system}; emacs = if isLinux && isAarch64 diff --git a/home/base/general.nix b/home/base/general.nix index 5066887f..34cb794d 100644 --- a/home/base/general.nix +++ b/home/base/general.nix @@ -4,7 +4,7 @@ Original author's home'nix files are always prefixed with `{ config, lib, pkgs, Parameter `[inputs]` here is a deviation from the orinal author's intent (doing that via overlay) and should maybe be fixed For `[inputs]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) */ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, unstable, ... }: let inherit (lib) attrValues @@ -18,7 +18,7 @@ Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatfo If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? */ - inherit (pkgs.stdenv.hostPlatform) system; + #inherit (pkgs.stdenv.hostPlatform) system; cfg = config.custom.base.general; localeGerman = "de_DE.UTF-8"; localeEnglish = "en_US.UTF-8"; @@ -143,7 +143,7 @@ in ; inherit - (inputs.unstable.legacyPackages.${system}) + (unstable) eza yazi ; diff --git a/home/programs/arbtt.nix b/home/programs/arbtt.nix index 88585c43..fa4ce314 100644 --- a/home/programs/arbtt.nix +++ b/home/programs/arbtt.nix @@ -3,7 +3,7 @@ Original author's home'nix files are always prefixed with `{ config, lib, pkgs, For `[haskellPackages]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) */ -{ config, lib, pkgs, /*haskellPackages,*/ inputs, ... }: +{ config, lib, pkgs, haskellPackages, inputs, ... }: let inherit (lib) @@ -37,7 +37,7 @@ in config = mkIf cfg.enable { # FIXME https://github.com/toonn/nix-config/blob/master/home/home.nix home.packages = attrValues { - inherit (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965) + inherit (haskellPackages) arbtt ; }; @@ -51,7 +51,7 @@ in let path = builtins.concatStringsSep ":" (map (p: "${lib.getBin p}/bin") - (attrValues { inherit (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}.haskell.packages.ghc965) arbtt; inherit (pkgs) coreutils; } # with pkgs; [] + (attrValues { inherit (haskellPackages) arbtt; inherit (pkgs) coreutils; } # with pkgs; [] ) ); in diff --git a/home/programs/hledger.nix b/home/programs/hledger.nix index 7f53fb82..000b7ffc 100644 --- a/home/programs/hledger.nix +++ b/home/programs/hledger.nix @@ -1,9 +1,10 @@ /** + Original author's home'nix files are always prefixed with `{ config, lib, pkgs, ... }:` header For `[haskellPackages]` parameter determine a solution (./../../nixos/programs/docker.nix also has the issue yet) */ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, ghc-nixpkgs-unstable, ... }: let inherit (lib) @@ -17,7 +18,7 @@ let inherit (pkgs.stdenv) isLinux isx86_64; inherit - (inputs.ghc-nixpkgs-unstable.legacyPackages.${system}) + (ghc-nixpkgs-unstable) hledger hledger-utils hledger-interest @@ -30,7 +31,7 @@ Attribute `system` here is determined that way (`inherit (pkgs.stdenv.hostPlatfo If I want to rid overlays I might have to find a way with less potentially bad implications, IDK are there any ? */ - inherit (pkgs.stdenv.hostPlatform) system; + # inherit (pkgs.stdenv.hostPlatform) system; cfg = config.custom.programs.hledger; in diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index ab3e6814..a420baf6 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, rootPath, inputs, ... }: +{ config, lib, pkgs, rootPath, inputs, unstable, makeNixvim, ... }: let inherit (lib) @@ -19,7 +19,7 @@ let # version = "2023-20-10"; # }; - pluggo = pname: inputs.unstable.legacyPackages.${system}.vimUtils.buildVimPlugin { inherit pname; src = inputs."${pname}"; version = "0.1"; }; + pluggo = pname: unstable.vimUtils.buildVimPlugin { inherit pname; src = inputs."${pname}"; version = "0.1"; }; /*extraConfig = '' if filereadable($HOME . "/.vimrc") source ~/.vimrc @@ -385,7 +385,7 @@ in config = mkIf cfg.enable (mkMerge [ { # FIXME add nvim-lsp as in https://github.com/nix-community/nixd/blob/main/nixd/docs/editors/nvim-lsp.nix - custom.programs.neovim.minimalPackage = inputs.nixvim.legacyPackages."${system}".makeNixvim { + custom.programs.neovim.minimalPackage = makeNixvim { enableMan = false; colorschemes.gruvbox.enable = true; extraPlugins = builtins.attrValues { @@ -800,7 +800,7 @@ in (mkIf (!cfg.lightWeight) { # inputs.nixvim.legacyPackages."${system}".makeNixvim configuration; - custom.programs.neovim.finalPackage = inputs.nixvim.legacyPackages."${system}".makeNixvim configuration; + custom.programs.neovim.finalPackage = makeNixvim configuration; home.packages = let inherit (config.custom.programs.neovim) finalPackage; in [ finalPackage diff --git a/lib/common-config.nix b/lib/common-config.nix index b4ab9dd1..83c90b67 100644 --- a/lib/common-config.nix +++ b/lib/common-config.nix @@ -16,13 +16,17 @@ see also ./../flake/builders/mkHome.nix `homeManagerConfiguration.extraSpecialAr */ extraSpecialArgs = { inherit inputs rootPath; - emacs = if isLinux && isAarch64 - then inputs.emacs-overlay-cached.packages.${pkgs.system}.emacs-unstable-nox - else inputs.emacs-overlay.packages.${pkgs.system}.emacs-unstable; + inherit (inputs.nixvim.legacyPackages.${pkgs.system}) makeNixvim; + unstable = inputs.unstable.legacyPackages.${pkgs.system}; + haskellPackages = inputs.ghc-nixpkgs-unstable.legacyPackages.${pkgs.system}.haskell.packages.ghc965; + ghc-nixpkgs-unstable = inputs.ghc-nixpkgs-unstable.legacyPackages.${pkgs.system}; + emacs = if isLinux && isAarch64 + then inputs.emacs-overlay-cached.packages.${pkgs.system}.emacs-unstable-nox + else inputs.emacs-overlay.packages.${pkgs.system}.emacs-unstable; - emacsWithPackagesFromUsePackage = if isLinux && isAarch64 - then inputs.emacs-overlay-cached.lib.${pkgs.system}.emacsWithPackagesFromUsePackage - else inputs.emacs-overlay.lib.${pkgs.system}.emacsWithPackagesFromUsePackage; + emacsWithPackagesFromUsePackage = if isLinux && isAarch64 + then inputs.emacs-overlay-cached.lib.${pkgs.system}.emacsWithPackagesFromUsePackage + else inputs.emacs-overlay.lib.${pkgs.system}.emacsWithPackagesFromUsePackage; }; sharedModules = homeModules; useGlobalPkgs = true; # disables options nixpkgs.*