From c6d39b2d83cf588e1198ac3a2ae1893e276271f9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 22 Aug 2024 23:16:19 +0200 Subject: ... --- accounts/gkleen@sif/hyprland.nix | 1 + flake.nix | 5 +++-- hosts/surtr/default.nix | 2 ++ installer/default.nix | 1 + system-profiles/core/default.nix | 34 ++++++++++++++++++++++++++-------- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix index 3b2f8879..645a2f22 100644 --- a/accounts/gkleen@sif/hyprland.nix +++ b/accounts/gkleen@sif/hyprland.nix @@ -300,6 +300,7 @@ in { "workspace 1, class:^Element$" "workspace 1, class:^thunderbird$" "workspace 5, class:^virt-manager$" + "workspace 5, class:^qemu$" "float, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" "center, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database" diff --git a/flake.nix b/flake.nix index a5bcc93c..728a6322 100644 --- a/flake.nix +++ b/flake.nix @@ -286,6 +286,7 @@ forAllUsers = genAttrs (unique (map accountUserName (attrNames self.nixosModules.accounts))); activateNixosConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (mapAttrs' (hostName: nixosConfig: nameValuePair "${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${nixosConfig.config.system.build.toplevel}/bin/switch-to-configuration"; } else null)) self.nixosConfigurations)); + startVMs = forAllSystems (system: pkgs: mapAttrs' (hostName: nixosConfig: nameValuePair "run-${hostName}-vm" { type = "app"; program = "${nixosConfig.config.system.build.vm}/bin/run-${hostName}-vm"; }) (nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [ { config.virtualisation.host.pkgs = pkgs; } ] dir; })); activateHomeManagerConfigurations = forAllSystems (system: _pkgs: filterAttrs (_n: v: v != null) (listToAttrs (concatLists (mapAttrsToList (hostName: nixosConfig: mapAttrsToList (userName: userCfg: nameValuePair "${userName}@${hostName}-activate" (if system == nixosConfig.config.nixpkgs.system then { type = "app"; program = "${userCfg.home.activationPackage}/activate"; } else null)) nixosConfig.config.home-manager.users) self.nixosConfigurations)))); installerShells = system: pkgs: mapAttrs (installerName: config: pkgs.callPackage ./installer/shell.nix { inherit system installerName config; @@ -302,7 +303,7 @@ mkInstallerForSystem = system: (lib.systems.elaborate system).isLinux; installers = let mkInstallers = system: mapAttrs (mkInstaller system) installerProfiles; - mkInstaller = system: name: profile: mkNixosConfiguration [profile { config = { nixpkgs.system = system; }; }] ./. installerConfig "installer"; + mkInstaller = system: name: profile: mkNixosConfiguration [profile { config.nixpkgs.system = system; }] ./. installerConfig "installer"; in forAllSystems (system: _systemPkgs: optionalAttrs (!(isNull installerConfig) && mkInstallerForSystem system) (mkInstallers system)); installerNixosConfigurations = listToAttrs (concatLists (mapAttrsToList (system: mapAttrsToList (profile: config: nameValuePair ("installer-${system}-${profile}") config)) installers)); @@ -333,7 +334,7 @@ legacyPackages = forAllSystems (system: systemPkgs: systemPkgs.override { overlays = attrValues self.overlays; }); - apps = foldr recursiveUpdate {} [activateNixosConfigurations activateHomeManagerConfigurations]; + apps = foldr recursiveUpdate {} [startVMs activateNixosConfigurations activateHomeManagerConfigurations]; devShells = forAllSystems (system: systemPkgs: { default = import ./shell.nix ({ inherit system; } // inputs); } // installerShells system systemPkgs); diff --git a/hosts/surtr/default.nix b/hosts/surtr/default.nix index ceb035cb..705f69b3 100644 --- a/hosts/surtr/default.nix +++ b/hosts/surtr/default.nix @@ -166,6 +166,8 @@ with lib; }; systemd.sysusers.enable = false; + system.etc.overlay.mutable = true; + boot.enableContainers = true; system.stateVersion = "20.09"; }; } diff --git a/installer/default.nix b/installer/default.nix index e9d9fa1a..d5e0fc07 100644 --- a/installer/default.nix +++ b/installer/default.nix @@ -57,6 +57,7 @@ with lib; system.disableInstallerTools = false; + systemd.sysusers.enable = false; system.stateVersion = config.system.nixos.release; # No state in installer }; } 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