summaryrefslogtreecommitdiff
path: root/templates/nixos
diff options
context:
space:
mode:
authorseth <[email protected]>2023-09-24 14:01:02 -0400
committerseth <[email protected]>2023-09-24 14:01:02 -0400
commita6c7b042849d519903bd7d54ecef470b192b1c8c (patch)
treed7e24bb39861f4d5d851d07e4e22ec362716a429 /templates/nixos
parent742de9f6b50db31e031dc673c050b88e7391c262 (diff)
templates/nixos: fix channelPath option
Diffstat (limited to 'templates/nixos')
-rw-r--r--templates/nixos/modules/basic.nix38
1 files changed, 20 insertions, 18 deletions
diff --git a/templates/nixos/modules/basic.nix b/templates/nixos/modules/basic.nix
index f1f7a81..fb67701 100644
--- a/templates/nixos/modules/basic.nix
+++ b/templates/nixos/modules/basic.nix
@@ -5,7 +5,7 @@
...
}: let
inherit (builtins) attrNames map;
- inherit (lib) filterAttrs mapAttrs mkDefault mkEnableOption mkIf mkOption types;
+ inherit (lib) filterAttrs mapAttrs mkDefault mkEnableOption mkIf mkOption optionals types;
cfg = config.getchoo.basicConfig;
mapInputs = fn: map fn (attrNames inputs);
@@ -14,7 +14,7 @@ in {
enable = mkEnableOption "getchoo's basic config" // {default = true;};
channelPath = {
enable =
- mkEnableOption "enable channels"
+ mkEnableOption "enable channel path management"
// {default = true;};
dirname = mkOption {
type = types.str;
@@ -25,25 +25,27 @@ in {
};
config = mkIf cfg.enable {
- nix = {
- gc = {
- automatic = mkDefault true;
- options = mkDefault "-d --delete-older-than 2d";
- };
-
- nixPath = mapInputs (i: "${i}=${cfg.channelPath.dirname i}");
+ nix =
+ {
+ gc = {
+ automatic = mkDefault true;
+ options = mkDefault "-d --delete-older-than 2d";
+ };
- registry =
- {n.flake = inputs.nixpkgs;}
- // (mapAttrs (_: flake: {inherit flake;})
- (filterAttrs (n: _: n != "nixpkgs") inputs));
+ registry =
+ {n.flake = inputs.nixpkgs;}
+ // (mapAttrs (_: flake: {inherit flake;})
+ (filterAttrs (n: _: n != "nixpkgs") inputs));
- settings = {
- auto-optimise-store = true;
- experimental-features = ["nix-command" "flakes" "auto-allocate-uids" "repl-flake"];
+ settings = {
+ auto-optimise-store = true;
+ experimental-features = ["nix-command" "flakes" "auto-allocate-uids" "repl-flake"];
+ };
+ }
+ // mkIf cfg.channelPath.enable {
+ nixPath = mapInputs (i: "${i}=${cfg.channelPath.dirname}/${i}");
};
- };
- systemd.tmpfiles.rules = mapInputs (i: "L+ ${cfg.channelPath i} - - - - ${inputs.${i}.outPath}");
+ systemd.tmpfiles.rules = optionals cfg.channelPath.enable (mapInputs (i: "L+ ${cfg.channelPath.dirname}/${i} - - - - ${inputs.${i}.outPath}"));
};
}