Skip to content

Instantly share code, notes, and snippets.

@danbst
Created December 27, 2019 15:17
Show Gist options
  • Save danbst/eb55f9363c0b9151d65271ae6c20f39b to your computer and use it in GitHub Desktop.
Save danbst/eb55f9363c0b9151d65271ae6c20f39b to your computer and use it in GitHub Desktop.
Manage your /etc from home-manager (install home-manager as root)
{ config, pkgs, lib, ... }: {
imports = [
(import <nixpkgs/nixos/modules/system/etc/etc.nix>)
];
options.system.build.etc = lib.mkOption { type = lib.types.package; };
options.system.activationScripts.etc =
lib.mkOption { type = lib.types.unspecified; };
config = {
home.activation.setupEtc = config.lib.dag.entryAfter [ "writeBoundary" ] ''
exec ${
pkgs.writeScript "etc-activation"
config.system.activationScripts.etc.text
}
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment