-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gather inspiration from the best flakes #4
Comments
Some conversation from the forum of people trying to modularize home-manager configuration |
{config, pkgs, lib, ...}:
{
systemd.services = lib.mkIf (config.networking.hostName == "my-server") {
ircSession = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
description = "Start the irc client of username.";
serviceConfig = {
Type = "forking";
User = "username";
ExecStart = ''${pkgs.screen}/bin/screen -dmS irc ${pkgs.irssi}/bin/irssi'';
ExecStop = ''${pkgs.screen}/bin/screen -S irc -X quit'';
};
};
};
environment.systemPackages = lib.mkIf (config.networking.hostName == "my-server") [ pkgs.screen ];
# ... usual configuration ...
} |
# ./foo.nix
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.foo;
in {
options.programs.foo = {
enable = mkEnableOption "the foo program";
package = mkOption {
type = types.package;
default = pkgs.hello;
defaultText = literalExpression "pkgs.hello";
description = "foo package to use.";
};
extraConfig = mkOption {
default = "";
example = ''
foo bar
'';
type = types.lines;
description = ''
Extra settings for foo.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."foo/foorc" = mkIf (cfg.extraConfig != "") {
text = ''
# Generated by Home Manager.
${cfg.extraConfig}
'';
};
};
} |
config = if config.services.httpd.enable then {
environment.systemPackages = [ ... ];
...
} else {}; |
dminca
added a commit
that referenced
this issue
May 30, 2024
- prepare to expand this for multiple hosts Resolves: Related: #1 #3 #4 Signed-off-by: Daniel Andrei Mincă <[email protected]>
asked the Discord community for proposals and I've got this |
dminca
added a commit
that referenced
this issue
Jun 1, 2024
- darwinConfigurations to account for multiple hosts - homeManagerConfiguration to expand for multiple hosts - define a common set of dependencies and settings which are imported Resolves: #1 #4 Related: Signed-off-by: Daniel Andrei Mincă <[email protected]>
Solved in #7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seen a lot of professionally written flakes, to name a few
In addition, if we're to define
options
within the flake, here's a list of supportedtypes
by NixThe text was updated successfully, but these errors were encountered: