From c6d39b2d83cf588e1198ac3a2ae1893e276271f9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 22 Aug 2024 23:16:19 +0200 Subject: ... --- system-profiles/core/default.nix | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'system-profiles/core') diff --git a/system-profiles/core/default.nix b/system-profiles/core/default.nix index fede386b..71d0619a 100644 --- a/system-profiles/core/default.nix +++ b/system-profiles/core/default.nix @@ -1,4 +1,4 @@ -{ flake, flakeInputs, home-manager, path, hostName, config, lib, pkgs, customUtils, ... }: +{ flake, flakeInputs, home-manager, path, hostName, config, options, lib, pkgs, customUtils, ... }: with lib; @@ -83,11 +83,22 @@ in { ''; }; - nixpkgs.flakeInput = mkOption { - type = types.enum (attrNames flakeInputs); - default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs"; - defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"''; - internal = true; + nixpkgs = { + flakeInput = mkOption { + type = types.enum (attrNames flakeInputs); + default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs"; + defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"''; + internal = true; + }; + extraOverlays = mkOption { + default = []; + type = types.listOf (mkOptionType { + name = "nixpkgs-overlay"; + description = "nixpkgs overlay"; + check = lib.isFunction; + merge = lib.mergeOneOption; + }); + }; }; }; @@ -97,7 +108,7 @@ in { system.configurationRevision = mkIf (flake ? rev) flake.rev; nixpkgs.pkgs = import (flakeInputs.${config.nixpkgs.flakeInput}.outPath + "/pkgs/top-level") { - overlays = attrValues flake.overlays; + overlays = attrValues flake.overlays ++ config.nixpkgs.extraOverlays; config = config.nixpkgs.externalConfig; localSystem = config.nixpkgs.system; }; @@ -131,7 +142,7 @@ in { }; systemd.tmpfiles.rules = [ - "L+ /run/nixpkgs - - - - ${flakeInputs.nixpkgs.outPath}" + "L+ /run/nixpkgs - - - - ${flakeInputs.${config.nixpkgs.flakeInput}.outPath}" "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" '' with builtins; @@ -200,6 +211,7 @@ in { ++ (optional (options ? system.etc) { boot.initrd.systemd.enable = lib.mkDefault true; system.etc.overlay.enable = lib.mkDefault true; + system.etc.overlay.mutable = lib.mkDefault (!config.systemd.sysusers.enable); systemd.sysusers.enable = lib.mkDefault true; # Random perl remnants @@ -210,5 +222,11 @@ in { boot.loader.grub.enable = lib.mkDefault false; environment.defaultPackages = lib.mkDefault [ ]; documentation.info.enable = lib.mkDefault false; + }) + ++ (optional (options ? nixpkgs.flake) { + nixpkgs.flake = { + setNixPath = false; + setFlakeRegistry = false; + }; })); } -- cgit v1.2.3