Skip to content

Commit

Permalink
iso: dilter out al profiles (except core)
Browse files Browse the repository at this point in the history
IN order to avoid random startup of systemd services, filter out all
profiles, except for core and user profiles.

This works becasue of a fundamental devos contract, that modules
only define configuration, but don't implement them and profiles
only implement confguration but don't define them. So only ever an
activated profile is expected to effectively start up a systemd service.

closes: divnix#194
  • Loading branch information
David Arnold committed Mar 19, 2021
1 parent 2961c1e commit e287447
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/devos/devosSystem.nix
Expand Up @@ -12,7 +12,11 @@ lib.nixosSystem (args // {
(args // {
modules = moduleList ++ [
"${nixos}/${modpath}/${cd}"
({ config, ... }: {
({ config, suites, ... }: {

# avoid unwanted systemd service startups
disabledModules = suites.allProfilesButCore;

isoImage.isoBaseName = "nixos-" + config.networking.hostName;
isoImage.contents = [{
source = self;
Expand Down
7 changes: 6 additions & 1 deletion suites/default.nix
Expand Up @@ -8,6 +8,11 @@ let
allProfiles =
let defaults = lib.collect (x: x ? default) profiles;
in map (x: x.default) defaults;
allProfilesButCore = let
p = n: _: n != "core";
withoutCore = lib.filterAttrs p profiles;
defaults = lib.collect (x: x ? default) withoutCore;
in map (x: x.default) defaults;

allUsers =
let defaults = lib.collect (x: x ? default) users;
Expand All @@ -19,5 +24,5 @@ let
};
in
lib.mapAttrs (_: v: dev.os.profileMap v) suites // {
inherit allProfiles allUsers;
inherit allProfiles allUsers allProfilesButCore;
}

0 comments on commit e287447

Please sign in to comment.