From 1dc5dff82f609bd3074d99b5308c0a2df0d1b077 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 31 Dec 2020 14:26:32 +0100 Subject: Set up template --- system-profiles/.keep | 0 system-profiles/core.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 system-profiles/.keep create mode 100644 system-profiles/core.nix (limited to 'system-profiles') diff --git a/system-profiles/.keep b/system-profiles/.keep new file mode 100644 index 00000000..e69de29b diff --git a/system-profiles/core.nix b/system-profiles/core.nix new file mode 100644 index 00000000..2af82703 --- /dev/null +++ b/system-profiles/core.nix @@ -0,0 +1,47 @@ +{ flake, flakeInputs, path, hostName, config, lib, pkgs, customUtils, ... }: +let + profileSet = customUtils.types.attrNameSet flake.nixosModules.systemProfiles; +in { + options = { + # See mkSystemProfile in ../flake.nix + system.profiles = lib.mkOption { + type = profileSet; + default = []; + description = '' + Set (list without duplicates) of ‘systemProfiles’ enabled for this host + ''; + }; + }; + + config = { + networking.hostName = hostName; + system.configurationRevision = lib.mkIf (flake ? rev) flake.rev; + + nixpkgs.pkgs = flakeInputs.nixpkgs.legacyPackages.${config.nixpkgs.system}; + nixpkgs.overlays = lib.attrValues flake.overlays; + + nix = { + package = pkgs.nixUnstable; + useSandbox = true; + allowedUsers = [ "@wheel" ]; + trustedUsers = [ "root" "@wheel" ]; + extraOptions = '' + experimental-features = nix-command flakes ca-references + ''; + nixPath = [ + "nixpkgs=${path}" + ]; + registry = { + nixpkgs.flake = flakeInputs.nixpkgs; + home-manager.flake = flakeInputs.home-manager; + machines.flake = flake; + }; + }; + + users.mutableUsers = false; + + # documentation.nixos.includeAllModules = true; # incompatible with home-manager (build fails) + + home-manager.useGlobalPkgs = true; # Otherwise home-manager would only work impurely + }; +} -- cgit v1.2.3