hello
i would like to be flexible with the use of nixos and home-manager regarding the installed packages.
So I would like to import one or multiple variables -each are list or set - from an external file.
But it should be clean and simple / usable in configuration.nix and home.nix (so without parameter like “home.packages = with pkgs; [” or “environment.systemPackages = with pkgs; [”)
To change the channel from nixos to unstable it is needed to not specify the prefix/source.
I thought that I could import the pkgs list if I would define variables in the “let part” of the external script but that doesnt work yet .
home.nix
{ config, pkgs, ... }:
let
os_pkgs = with pkgs; [ htop ];
os_pkgs_file = import ./pkgs_test.nix pkgs ;
#os_pkgs_file_read= builtins.readFile ./pkgs_test.nix ;
in
{
imports = [ ./pkgs_test.nix ] ; # Imports a set NOT a list
nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true;
home.packages = with pkgs; [
htop
]
++ os_pkgs
++ pkgs_gr_named # variable defined in external file
;
}
./pkgs_test.nix
{ config, pkgs, ... }:
let pkgs_gr_named = with pkgs; [jp git-backup ];
in {}
I get undefined variable ‘pkgs_gr_named’