flake-parts/setups: update shared Nix config

At least we've set the right sources for the system's nixpkgs and
home-manager branches.
This commit is contained in:
Gabriel Arazas 2024-03-06 17:01:21 +08:00
parent f3462beed8
commit ec3fdab52c
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 41 additions and 29 deletions

View File

@ -17,30 +17,6 @@
_module.args = { _module.args = {
# This will be shared among NixOS and home-manager configurations. # This will be shared among NixOS and home-manager configurations.
defaultNixConf = { config, lib, pkgs, ... }: { defaultNixConf = { config, lib, pkgs, ... }: {
# I want to capture the usual flakes to its exact version so we're
# making them available to our system. This will also prevent the
# annoying downloads since it always get the latest revision.
nix.registry =
lib.mapAttrs'
(name: flake:
let
name' = if (name == "self") then "config" else name;
in
lib.nameValuePair name' { inherit flake; })
inputs;
nix.settings.nix-path =
(lib.mapAttrsToList
(name: source:
let
name' = if (name == "self") then "config" else name;
in
"${name'}=${source}")
inputs
++ [
"/nix/var/nix/profiles/per-user/root/channels"
]);
# Extend nixpkgs with our overlays except for the NixOS-focused modules # Extend nixpkgs with our overlays except for the NixOS-focused modules
# here. # here.
nixpkgs.overlays = lib.attrValues inputs.self.overlays; nixpkgs.overlays = lib.attrValues inputs.self.overlays;

View File

@ -200,6 +200,7 @@ in
type = with lib.types; attrsOf (submoduleWith { type = with lib.types; attrsOf (submoduleWith {
specialArgs = { inherit (config) systems; }; specialArgs = { inherit (config) systems; };
modules = [ modules = [
(import ./shared/nix-conf.nix { inherit inputs; })
./shared/nixvim-instance-options.nix ./shared/nixvim-instance-options.nix
./shared/config-options.nix ./shared/config-options.nix
configType configType

View File

@ -459,11 +459,6 @@ let
{ {
nixpkgs.overlays = setupConfig.overlays; nixpkgs.overlays = setupConfig.overlays;
networking.hostName = lib.mkDefault setupConfig.hostname; networking.hostName = lib.mkDefault setupConfig.hostname;
nix.settings.nix-path = lib.mkBefore [
"home-manager=${inputs.${setupConfig.homeManagerBranch}}"
"nixpkgs=${inputs.${setupConfig.nixpkgsBranch}}"
];
} }
(lib.mkIf (setupConfig.domain != null) { (lib.mkIf (setupConfig.domain != null) {
@ -489,6 +484,7 @@ in
type = with lib.types; attrsOf (submoduleWith { type = with lib.types; attrsOf (submoduleWith {
specialArgs = { inherit (config) systems; }; specialArgs = { inherit (config) systems; };
modules = [ modules = [
(import ./shared/nix-conf.nix { inherit inputs; })
./shared/config-options.nix ./shared/config-options.nix
./shared/nixvim-instance-options.nix ./shared/nixvim-instance-options.nix
configType configType

View File

@ -0,0 +1,39 @@
{ inputs }:
{ config, lib, ... }:
let
inputs' = inputs // {
nixpkgs = inputs.${config.nixpkgsBranch};
home-manager = inputs.${config.homeManagerBranch};
};
in
{
config.modules = [(
{ lib, ... }: {
# I want to capture the usual flakes to its exact version so we're
# making them available to our system. This will also prevent the
# annoying downloads since it always get the latest revision.
nix.registry =
lib.mapAttrs'
(name: flake:
let
name' = if (name == "self") then "config" else name;
in
lib.nameValuePair name' { inherit flake; })
inputs';
nix.settings.nix-path =
(lib.mapAttrsToList
(name: source:
let
name' = if (name == "self") then "config" else name;
in
"${name'}=${source}")
inputs'
++ [
"/nix/var/nix/profiles/per-user/root/channels"
]);
}
)];
}