modules: create dedicated default Nix config profile

This commit is contained in:
Gabriel Arazas 2024-01-27 16:51:10 +08:00
parent ecad96688c
commit 1b4d91c67b
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
5 changed files with 73 additions and 40 deletions

View File

@ -25,33 +25,17 @@
lib.nameValuePair name' { inherit flake; })
inputs;
# Set the package for generating the configuration.
nix.package = lib.mkDefault pkgs.nixStable;
# Set the configurations for the package manager.
nix.settings = {
# Set several binary caches.
substituters = [
"https://nix-community.cachix.org"
"https://foo-dogsquared.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
];
# Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered
# stable.
#
# Since we're using flakes to make this possible, we need it. Plus, the
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
auto-optimise-store = lib.mkDefault true;
};
# Stallman-senpai will be disappointed.
nixpkgs.config.allowUnfree = true;
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
# here.

View File

@ -69,6 +69,7 @@
standaloneConfigModules = [
defaultNixConf
../../modules/home-manager/profiles/nix-conf.nix
({ config, lib, ... }: {
# Don't create the user directories since they are assumed to

View File

@ -93,23 +93,11 @@
# Bring our own teeny-tiny snippets of configurations.
defaultNixConf
../../modules/nixos/profiles/generic.nix
../../modules/nixos/profiles/nix-conf.nix
# The NixOS module that came from flake-parts.
({ config, lib, ... }: {
_module.args = defaultExtraArgs;
# Set several paths for the traditional channels.
nix.nixPath = lib.mkIf config.nix.channel.enable
(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"
]);
})
];
};

View File

@ -0,0 +1,30 @@
{ lib, pkgs, ... }: {
# Set the package for generating the configuration.
nix.package = lib.mkDefault pkgs.nixStable;
# Set the configurations for the package manager.
nix.settings = {
# Set several binary caches.
substituters = [
"https://nix-community.cachix.org"
"https://foo-dogsquared.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
];
# Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered
# stable.
#
# Since we're using flakes to make this possible, we need it. Plus, the
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
auto-optimise-store = lib.mkDefault true;
};
# Stallman-senpai will be disappointed.
nixpkgs.config.allowUnfree = true;
}

View File

@ -0,0 +1,30 @@
{ lib, pkgs, ... }: {
# Set the package for generating the configuration.
nix.package = lib.mkDefault pkgs.nixStable;
# Set the configurations for the package manager.
nix.settings = {
# Set several binary caches.
substituters = [
"https://nix-community.cachix.org"
"https://foo-dogsquared.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
];
# Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered
# stable.
#
# Since we're using flakes to make this possible, we need it. Plus, the
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
auto-optimise-store = lib.mkDefault true;
};
# Stallman-senpai will be disappointed.
nixpkgs.config.allowUnfree = true;
}