40 lines
987 B
Nix
40 lines
987 B
Nix
{ lib, config, ... }:
|
|
|
|
let cfg = config.local.nix; in
|
|
{
|
|
options.local.nix = with lib; {
|
|
enableMyRegistry = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Enable my custom nix registry";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
nix = {
|
|
settings = {
|
|
auto-optimise-store = true;
|
|
|
|
trusted-users = [ "root" ];
|
|
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
# To protect nix-shell against garbage collection
|
|
# Source: https://github.com/nix-community/nix-direnv#installation
|
|
keep-derivations = true;
|
|
keep-outputs = true;
|
|
};
|
|
|
|
registry = lib.mkIf cfg.enableMyRegistry (
|
|
let
|
|
gitple = "https://git.pleshevski.ru";
|
|
mkRegistry = id: url: {
|
|
from = { type = "indirect"; inherit id; };
|
|
to = { type = "git"; inherit url; };
|
|
};
|
|
in
|
|
{ templates = mkRegistry "tmpl" "${gitple}/mynix/templates"; }
|
|
);
|
|
};
|
|
};
|
|
}
|