base: move some shared configuration to shared
This commit is contained in:
parent
6fe9af56e7
commit
fe306085f4
11 changed files with 273 additions and 227 deletions
73
modules/shared/base/nix/default.nix
Normal file
73
modules/shared/base/nix/default.nix
Normal file
|
@ -0,0 +1,73 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
baseDirenv = {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
config.global.load_dotenv = true;
|
||||
};
|
||||
};
|
||||
baseNixIndex = {
|
||||
programs.command-not-found.enable = false;
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
package = config.programs.nix-index.package;
|
||||
};
|
||||
};
|
||||
username = config.chvp.username;
|
||||
in
|
||||
{
|
||||
options.chvp.base.nix = {
|
||||
enableDirenv = lib.mkOption {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
slowGc = lib.mkOption {
|
||||
default = false;
|
||||
example = true;
|
||||
};
|
||||
# Used in /flake.nix, since we have to use it at nixpkgs import time
|
||||
unfreePackages = lib.mkOption {
|
||||
default = [ ];
|
||||
example = [ "teams" ];
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://accentor.cachix.org"
|
||||
"https://chvp.cachix.org"
|
||||
"https://lanzaboote.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"accentor.cachix.org-1:QP+oJwzmeq5Fsyp4Vk501UgUSbl5VIna/ard/XOePH8="
|
||||
"chvp.cachix.org-1:eIG26KkeA+R3tCpvmaayA9i3KVVL06G+qB5ci4dHBT4="
|
||||
"lanzaboote.cachix.org-1:Nt9//zGmqkg1k5iu+B3bkj3OmHKjSw9pvf3faffLLNk="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
trusted-users = [ username ];
|
||||
};
|
||||
extraOptions = lib.mkIf config.chvp.base.nix.enableDirenv ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
};
|
||||
|
||||
home-manager.users.${username} = { ... }:
|
||||
lib.recursiveUpdate
|
||||
(lib.optionalAttrs config.chvp.base.nix.enableDirenv baseDirenv)
|
||||
baseNixIndex;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue