summaryrefslogtreecommitdiff
path: root/system-profiles
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2024-08-22 23:16:19 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2024-08-22 23:16:19 +0200
commitc6d39b2d83cf588e1198ac3a2ae1893e276271f9 (patch)
treea3bf0d2a2dd02faf9d51ccd4c32b5ab1b35174ff /system-profiles
parent567c22812fe1fbe525f1732661d253b3902710a9 (diff)
downloadnixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.gz
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.bz2
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.tar.xz
nixos-c6d39b2d83cf588e1198ac3a2ae1893e276271f9.zip
...
Diffstat (limited to 'system-profiles')
-rw-r--r--system-profiles/core/default.nix34
1 files changed, 26 insertions, 8 deletions
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 @@
1{ flake, flakeInputs, home-manager, path, hostName, config, lib, pkgs, customUtils, ... }: 1{ flake, flakeInputs, home-manager, path, hostName, config, options, lib, pkgs, customUtils, ... }:
2 2
3with lib; 3with lib;
4 4
@@ -83,11 +83,22 @@ in {
83 ''; 83 '';
84 }; 84 };
85 85
86 nixpkgs.flakeInput = mkOption { 86 nixpkgs = {
87 type = types.enum (attrNames flakeInputs); 87 flakeInput = mkOption {
88 default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs"; 88 type = types.enum (attrNames flakeInputs);
89 defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"''; 89 default = if flakeInputs ? "nixpkgs-${hostName}" then "nixpkgs-${hostName}" else "nixpkgs";
90 internal = true; 90 defaultText = literalExpression ''if flakeInputs ? "nixpkgs-''${hostName}" then "nixpkgs-''${hostName}" else "nixpkgs"'';
91 internal = true;
92 };
93 extraOverlays = mkOption {
94 default = [];
95 type = types.listOf (mkOptionType {
96 name = "nixpkgs-overlay";
97 description = "nixpkgs overlay";
98 check = lib.isFunction;
99 merge = lib.mergeOneOption;
100 });
101 };
91 }; 102 };
92 }; 103 };
93 104
@@ -97,7 +108,7 @@ in {
97 system.configurationRevision = mkIf (flake ? rev) flake.rev; 108 system.configurationRevision = mkIf (flake ? rev) flake.rev;
98 109
99 nixpkgs.pkgs = import (flakeInputs.${config.nixpkgs.flakeInput}.outPath + "/pkgs/top-level") { 110 nixpkgs.pkgs = import (flakeInputs.${config.nixpkgs.flakeInput}.outPath + "/pkgs/top-level") {
100 overlays = attrValues flake.overlays; 111 overlays = attrValues flake.overlays ++ config.nixpkgs.extraOverlays;
101 config = config.nixpkgs.externalConfig; 112 config = config.nixpkgs.externalConfig;
102 localSystem = config.nixpkgs.system; 113 localSystem = config.nixpkgs.system;
103 }; 114 };
@@ -131,7 +142,7 @@ in {
131 }; 142 };
132 143
133 systemd.tmpfiles.rules = [ 144 systemd.tmpfiles.rules = [
134 "L+ /run/nixpkgs - - - - ${flakeInputs.nixpkgs.outPath}" 145 "L+ /run/nixpkgs - - - - ${flakeInputs.${config.nixpkgs.flakeInput}.outPath}"
135 "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" '' 146 "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" ''
136 with builtins; 147 with builtins;
137 148
@@ -200,6 +211,7 @@ in {
200 ++ (optional (options ? system.etc) { 211 ++ (optional (options ? system.etc) {
201 boot.initrd.systemd.enable = lib.mkDefault true; 212 boot.initrd.systemd.enable = lib.mkDefault true;
202 system.etc.overlay.enable = lib.mkDefault true; 213 system.etc.overlay.enable = lib.mkDefault true;
214 system.etc.overlay.mutable = lib.mkDefault (!config.systemd.sysusers.enable);
203 systemd.sysusers.enable = lib.mkDefault true; 215 systemd.sysusers.enable = lib.mkDefault true;
204 216
205 # Random perl remnants 217 # Random perl remnants
@@ -210,5 +222,11 @@ in {
210 boot.loader.grub.enable = lib.mkDefault false; 222 boot.loader.grub.enable = lib.mkDefault false;
211 environment.defaultPackages = lib.mkDefault [ ]; 223 environment.defaultPackages = lib.mkDefault [ ];
212 documentation.info.enable = lib.mkDefault false; 224 documentation.info.enable = lib.mkDefault false;
225 })
226 ++ (optional (options ? nixpkgs.flake) {
227 nixpkgs.flake = {
228 setNixPath = false;
229 setFlakeRegistry = false;
230 };
213 })); 231 }));
214} 232}