Created
December 27, 2019 15:17
-
-
Save danbst/eb55f9363c0b9151d65271ae6c20f39b to your computer and use it in GitHub Desktop.
Manage your /etc from home-manager (install home-manager as root)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { 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
In more recent versions of Nixpkgs (around 2022), this snippet broke due to a change in the upsteam etc.nix module. For anyone else wanting to use this file, I've found that the easiest fix is to replace mentions of
system.activationScripts.etcwithsystem.build.etcActivationCommands.Also, you might want to replace
(import <nixpkgs/nixos/modules/system/etc/etc.nix>)with a pure version that works with flakes:(inputs.nixpkgs + "/nixos/modules/system/etc/etc.nix")(you need to addinputsinto your home-manager'sextraSpecialArgsand then also actually import them at the top of this module).