Consolidated and moved modules/{nixos,darwin} to modules/system
This commit is contained in:
parent
77cf9d4396
commit
679496f5b4
20 changed files with 258 additions and 250 deletions
56
modules/system/common/default.nix
Normal file
56
modules/system/common/default.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{isLinux}: {
|
||||
config,
|
||||
configurationName,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
sharedConfig = {
|
||||
settei.user.config = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
difftastic.enable = true;
|
||||
lfs.enable = true;
|
||||
userName = "Nikodem Rabuliński";
|
||||
userEmail = lib.mkDefault "nikodem@rabulinski.com";
|
||||
signing = {
|
||||
key = config.settei.sane-defaults.allSshKeys.${configurationName};
|
||||
signByDefault = true;
|
||||
};
|
||||
extraConfig = {
|
||||
gpg.format = "ssh";
|
||||
push.followTags = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
linuxConfig = lib.optionalAttrs isLinux {
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/issues/254807
|
||||
boot.swraid.enable = false;
|
||||
|
||||
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
|
||||
|
||||
settei.user.config = {
|
||||
services.ssh-agent.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
darwinConfig = lib.optionalAttrs (!isLinux) {
|
||||
system.stateVersion = 4;
|
||||
};
|
||||
in {
|
||||
_file = ./default.nix;
|
||||
|
||||
imports = [
|
||||
(import ./hercules.nix {inherit isLinux;})
|
||||
];
|
||||
|
||||
config = lib.mkMerge [
|
||||
sharedConfig
|
||||
linuxConfig
|
||||
darwinConfig
|
||||
];
|
||||
}
|
40
modules/system/common/hercules.nix
Normal file
40
modules/system/common/hercules.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{isLinux}: {
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
options = {
|
||||
common.hercules.enable = lib.mkEnableOption "Enables hercules-ci-agent with my configuration";
|
||||
};
|
||||
|
||||
herculesUser =
|
||||
if isLinux
|
||||
then config.systemd.services.hercules-ci-agent.serviceConfig.User
|
||||
else config.launchd.daemons.hercules-ci-agent.serviceConfig.UserName;
|
||||
in {
|
||||
_file = ./hercules.nix;
|
||||
|
||||
inherit options;
|
||||
|
||||
config = lib.mkIf config.common.hercules.enable {
|
||||
age.secrets.hercules-token = {
|
||||
file = ../../../secrets/hercules-token.age;
|
||||
owner = herculesUser;
|
||||
};
|
||||
age.secrets.hercules-cache = {
|
||||
file = ../../../secrets/hercules-cache.age;
|
||||
owner = herculesUser;
|
||||
};
|
||||
|
||||
services.hercules-ci-agent = {
|
||||
enable = true;
|
||||
settings = {
|
||||
clusterJoinTokenPath = config.age.secrets.hercules-token.path;
|
||||
concurrentTasks = lib.mkDefault 4;
|
||||
binaryCachesPath = config.age.secrets.hercules-cache.path;
|
||||
secretsJsonPath = pkgs.writeText "secrets.json" "{}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue