hosts: set nixpkgs.pkgs based on nixpkgs.system
This commit is contained in:
parent
2961c1ea52
commit
aec7c92cc7
4 changed files with 40 additions and 37 deletions
20
flake.nix
20
flake.nix
|
@ -36,18 +36,16 @@
|
||||||
|
|
||||||
extern = import ./extern { inherit inputs; };
|
extern = import ./extern { inherit inputs; };
|
||||||
|
|
||||||
pkgs' = os.mkPkgs;
|
multiPkgs = os.mkPkgs;
|
||||||
|
|
||||||
outputs =
|
outputs = {
|
||||||
let
|
|
||||||
system = "x86_64-linux";
|
|
||||||
pkgs = pkgs'.${system};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
import ./hosts (nixos.lib.recursiveUpdate inputs {
|
import ./hosts (nixos.lib.recursiveUpdate inputs {
|
||||||
inherit pkgs system extern;
|
inherit multiPkgs extern;
|
||||||
inherit (pkgs) lib;
|
defaultSystem = "x86_64-linux";
|
||||||
|
lib = nixos.lib.extend (final: prev: {
|
||||||
|
dev = self.lib;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
nixosModules =
|
nixosModules =
|
||||||
|
@ -57,7 +55,7 @@
|
||||||
overlay = import ./pkgs;
|
overlay = import ./pkgs;
|
||||||
overlays = lib.pathsToImportedAttrs (lib.pathsIn ./overlays);
|
overlays = lib.pathsToImportedAttrs (lib.pathsIn ./overlays);
|
||||||
|
|
||||||
lib = import ./lib { inherit nixos pkgs self inputs; };
|
lib = import ./lib { inherit nixos self inputs; };
|
||||||
|
|
||||||
templates.flk.path = ./.;
|
templates.flk.path = ./.;
|
||||||
templates.flk.description = "flk template";
|
templates.flk.description = "flk template";
|
||||||
|
@ -76,7 +74,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
systemOutputs = utils.lib.eachDefaultSystem (system:
|
systemOutputs = utils.lib.eachDefaultSystem (system:
|
||||||
let pkgs = pkgs'.${system}; in
|
let pkgs = multiPkgs.${system}; in
|
||||||
{
|
{
|
||||||
packages = utils.lib.flattenTreeSystem system
|
packages = utils.lib.flattenTreeSystem system
|
||||||
(os.mkPackages { inherit pkgs; });
|
(os.mkPackages { inherit pkgs; });
|
||||||
|
|
|
@ -25,6 +25,10 @@ that you intend to use on your machine.
|
||||||
Additionally, this is the perfect place to import anything you might need from
|
Additionally, this is the perfect place to import anything you might need from
|
||||||
the [nixos-hardware][nixos-hardware] repository.
|
the [nixos-hardware][nixos-hardware] repository.
|
||||||
|
|
||||||
|
> ##### _Note:_
|
||||||
|
> Set `nixpkgs.system` to the architecture of this host, default is "x86_64-linux".
|
||||||
|
> Keep in mind that not all packages are available for all architectures.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
hosts/librem.nix:
|
hosts/librem.nix:
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
, lib
|
, lib
|
||||||
, nixos
|
, nixos
|
||||||
, override
|
, override
|
||||||
, pkgs
|
, multiPkgs
|
||||||
, self
|
, self
|
||||||
, system
|
, defaultSystem
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -27,7 +27,7 @@ let
|
||||||
modules;
|
modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
global = {
|
global = { config, ... }: {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ let
|
||||||
"home-manager=${home}"
|
"home-manager=${home}"
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs = { inherit pkgs; };
|
nixpkgs.pkgs = lib.mkDefault multiPkgs.${config.nixpkgs.system};
|
||||||
|
|
||||||
nix.registry = {
|
nix.registry = {
|
||||||
devos.flake = self;
|
devos.flake = self;
|
||||||
|
@ -79,7 +79,8 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
dev.os.devosSystem {
|
dev.os.devosSystem {
|
||||||
inherit system specialArgs;
|
inherit specialArgs;
|
||||||
|
system = defaultSystem;
|
||||||
modules = modules // { inherit local lib; };
|
modules = modules // { inherit local lib; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
args@{ nixos, pkgs, self, ... }:
|
args@{ nixos, self, ... }:
|
||||||
let inherit (nixos) lib; in
|
let inherit (nixos) lib; in
|
||||||
lib.makeExtensible (final:
|
lib.makeExtensible (final:
|
||||||
let callLibs = file: import file
|
let callLibs = file: import file
|
||||||
|
|
Loading…
Reference in a new issue