fix: create nixpkgs instance only in flake.nix, do not create it in any sub module or overlays

This commit is contained in:
ryan4yin
2023-06-01 16:18:30 +08:00
parent d04f4109f2
commit d38bc4ff38
2 changed files with 13 additions and 9 deletions

View File

@@ -97,7 +97,7 @@
# However, the configuration name can also be specified using `sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>`. # However, the configuration name can also be specified using `sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>`.
# The `nixpkgs.lib.nixosSystem` function is used to build this configuration, the following attribute set is its parameter. # The `nixpkgs.lib.nixosSystem` function is used to build this configuration, the following attribute set is its parameter.
# Run `sudo nixos-rebuild switch --flake .#msi-rtx4090` in the flake's directory to deploy this configuration on any NixOS system # Run `sudo nixos-rebuild switch --flake .#msi-rtx4090` in the flake's directory to deploy this configuration on any NixOS system
msi-rtx4090 = nixpkgs.lib.nixosSystem { msi-rtx4090 = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
# The Nix module system can modularize configurations, improving the maintainability of configurations. # The Nix module system can modularize configurations, improving the maintainability of configurations.
@@ -116,7 +116,14 @@
# #
# Only these four parameters can be passed by default. # Only these four parameters can be passed by default.
# If you need to pass other parameters, you must use `specialArgs` by uncomment the following line # If you need to pass other parameters, you must use `specialArgs` by uncomment the following line
specialArgs = inputs; # pass all inputs into all sub modules. specialArgs = {
inherit inputs;
pkgs-stable = import inputs.nixpkgs-stable {
system = system; # refer the `system` parameter form outer scope recursively
# To use chrome, we need to allow the installation of non-free software
config.allowUnfree = true;
};
};
modules = [ modules = [
./hosts/msi-rtx4090 ./hosts/msi-rtx4090

View File

@@ -1,13 +1,10 @@
{ {
pkgs, pkgs,
nixpkgs-stable, pkgs-stable,
... ...
}: let }:
pkgs-stable = import nixpkgs-stable {
system = pkgs.system; {
config.allowUnfree = true;
};
in {
# TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it. # TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it.
programs = { programs = {