From 43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 14 May 2025 10:50:27 +0200 Subject: ... --- system-profiles/core/default.nix | 26 ++------------------------ system-profiles/default-locale.nix | 27 +++++++++++++++++---------- system-profiles/rebuild-machines/default.nix | 20 +++++++++++--------- 3 files changed, 30 insertions(+), 43 deletions(-) (limited to 'system-profiles') diff --git a/system-profiles/core/default.nix b/system-profiles/core/default.nix index b85aea4e..229a007e 100644 --- a/system-profiles/core/default.nix +++ b/system-profiles/core/default.nix @@ -127,36 +127,16 @@ in { flake-registry = "${flakeInputs.flake-registry}/flake-registry.json"; }; - nixPath = [ - "nixpkgs=${pkgs.runCommand "nixpkgs" {} '' - mkdir $out - ln -s ${./nixpkgs.nix} $out/default.nix - ln -s /run/nixpkgs/lib $out/lib - ''}" - ]; + nixPath = map (flake: "${flake}=flake:${flake}") (attrNames config.nix.registry); registry = let override = { self = "nixos"; }; in mapAttrs' (inpName: inpFlake: nameValuePair (override.${inpName} or inpName) - { flake = inpFlake; } ) flakeInputs; + { to = { type = "path"; path = inpFlake; }; } ) flakeInputs; }; systemd.tmpfiles.rules = [ "L+ /run/nixpkgs - - - - ${flakeInputs.${config.nixpkgs.flakeInput}.outPath}" - "L+ /run/nixpkgs-overlays.nix - - - - ${pkgs.writeText "overlays.nix" '' - with builtins; - - attrValues (import - ( - let lock = fromJSON (readFile ${flake + "/flake.lock"}); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/''${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { src = ${flake}; } - ).defaultNix.overlays - ''}" "L+ /etc/nixos - - - - ${flake}" ] ++ map (input: "L+ /run/flake-inputs/${input} - - - - ${flakeInputs.${input}.outPath}") (attrNames flakeInputs); @@ -177,8 +157,6 @@ in { { manual.manpages.enable = true; systemd.user.startServices = "sd-switch"; - - programs.ssh.internallyManaged = mkForce true; } ]; extraSpecialArgs = { inherit flake flakeInputs path; hostConfig = config; }; diff --git a/system-profiles/default-locale.nix b/system-profiles/default-locale.nix index 2d483f04..60d338cb 100644 --- a/system-profiles/default-locale.nix +++ b/system-profiles/default-locale.nix @@ -1,16 +1,23 @@ -{ lib, ... }: +{ lib, options, ... }: with lib; { - i18n = { - defaultLocale = "en_DK.UTF-8"; - extraLocaleSettings = { - "TIME_STYLE" = "long-iso"; - }; - supportedLocales = [ "C.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "en_DK.UTF-8/UTF-8" ]; - }; - console.keyMap = mkDefault "dvorak-programmer"; + config = foldr recursiveUpdate {} ([ + { + i18n = { + defaultLocale = "en_DK.UTF-8"; + extraLocaleSettings = { + "TIME_STYLE" = "long-iso"; + }; + }; + console.keyMap = mkDefault "dvorak-programmer"; - time.timeZone = mkDefault "Europe/Berlin"; + time.timeZone = mkDefault "Europe/Berlin"; + } + ] ++ (optional (options ? i18n.extraLocales) { + i18n.extraLocales = [ "C.UTF-8" "en_US.UTF-8" "en_DK.UTF-8" ]; + }) ++ (optional (!(options ? i18n.extraLocales)) { + i18n.supportedLocales = [ "C.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "en_DK.UTF-8/UTF-8" ]; + })); } diff --git a/system-profiles/rebuild-machines/default.nix b/system-profiles/rebuild-machines/default.nix index 544f47e1..de86cd74 100644 --- a/system-profiles/rebuild-machines/default.nix +++ b/system-profiles/rebuild-machines/default.nix @@ -25,16 +25,18 @@ let phases = [ "buildPhase" "installPhase" ]; - inherit (pkgs) zsh coreutils openssh; - inherit (cfg) scriptName; - inherit (cfg.flake) flakeOutput; - flake = cfg.flake.name; - nixosRebuild = config.system.build.nixos-rebuild; - inherit (config.security) wrapperDir; - inherit sshConfig; - buildPhase = '' - substituteAll $src rebuild-machine.zsh + substitute $src rebuild-machine.zsh \ + --subst-var-by zsh ${pkgs.zsh} \ + --subst-var-by coreutils ${pkgs.coreutils} \ + --subst-var-by openssh ${pkgs.openssh} \ + --subst-var-by wrapperDir ${config.security.wrapperDir} \ + --subst-var-by sshConfig ${sshConfig} \ + --subst-var-by out "$out" \ + --subst-var-by nixosRebuild ${config.system.build.nixos-rebuild} \ + --subst-var-by flake ${cfg.flake.name} \ + --subst-var-by scriptName ${cfg.scriptName} \ + --subst-var-by flakeOutput ${cfg.flake.flakeOutput} ''; installPhase = '' -- cgit v1.2.3