treewide: alejandra -> nixfmt-rfc-style
This commit is contained in:
parent
d64c02e3da
commit
6558fdb739
51 changed files with 1108 additions and 928 deletions
|
@ -1,4 +1,5 @@
|
|||
{isLinux}: {
|
||||
{ isLinux }:
|
||||
{
|
||||
config,
|
||||
configurationName,
|
||||
lib,
|
||||
|
@ -7,7 +8,8 @@
|
|||
inputs',
|
||||
username,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
sharedConfig = {
|
||||
settei = {
|
||||
username = lib.mkDefault "niko";
|
||||
|
@ -20,7 +22,7 @@
|
|||
enable = lib.mkDefault true;
|
||||
# TODO: Move to settei or leave here?
|
||||
extraArgs.machineName = configurationName;
|
||||
config.imports = [inputs.settei.homeModules.common];
|
||||
config.imports = [ inputs.settei.homeModules.common ];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -31,7 +33,7 @@
|
|||
|
||||
# NixOS' fish module doesn't allow setting what package to use for fish,
|
||||
# so I need to override the fish package.
|
||||
nixpkgs.overlays = [(_: _: {inherit (inputs'.settei.packages) fish;})];
|
||||
nixpkgs.overlays = [ (_: _: { inherit (inputs'.settei.packages) fish; }) ];
|
||||
|
||||
nix.settings.allow-import-from-derivation = false;
|
||||
};
|
||||
|
@ -53,15 +55,16 @@
|
|||
system.stateVersion = 4;
|
||||
|
||||
# Every macOS ARM machine can emulate x86.
|
||||
nix.settings.extra-platforms = lib.mkIf pkgs.stdenv.isAarch64 ["x86_64-darwin"];
|
||||
nix.settings.extra-platforms = lib.mkIf pkgs.stdenv.isAarch64 [ "x86_64-darwin" ];
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
_file = ./default.nix;
|
||||
|
||||
imports = [
|
||||
(import ./hercules.nix {inherit isLinux;})
|
||||
(import ./user.nix {inherit isLinux;})
|
||||
(import ./github-runner.nix {inherit isLinux;})
|
||||
(import ./hercules.nix { inherit isLinux; })
|
||||
(import ./user.nix { inherit isLinux; })
|
||||
(import ./github-runner.nix { inherit isLinux; })
|
||||
];
|
||||
|
||||
config = lib.mkMerge [
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{isLinux}: {
|
||||
{ isLinux }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
github-runner-user = "github-runner";
|
||||
|
||||
|
@ -20,10 +22,10 @@
|
|||
services.github-runners = lib.pipe cfg.runners [
|
||||
(lib.mapAttrsToList (
|
||||
name: cfg:
|
||||
lib.genList (i:
|
||||
lib.nameValuePair
|
||||
"${name}-${toString i}"
|
||||
{
|
||||
lib.genList
|
||||
(
|
||||
i:
|
||||
lib.nameValuePair "${name}-${toString i}" {
|
||||
enable = true;
|
||||
tokenFile = config.age.secrets.github-token.path;
|
||||
inherit (cfg) url;
|
||||
|
@ -32,8 +34,9 @@
|
|||
serviceOverrides = {
|
||||
DynamicUser = false;
|
||||
};
|
||||
extraLabels = ["nix"];
|
||||
})
|
||||
extraLabels = [ "nix" ];
|
||||
}
|
||||
)
|
||||
cfg.instances
|
||||
))
|
||||
lib.flatten
|
||||
|
@ -45,41 +48,48 @@
|
|||
isSystemUser = true;
|
||||
group = github-runner-user;
|
||||
};
|
||||
groups.${github-runner-user} = {};
|
||||
groups.${github-runner-user} = { };
|
||||
};
|
||||
};
|
||||
|
||||
darwinConfig = lib.optionalAttrs (!isLinux) {
|
||||
warnings = lib.singleton "common.github-runner doesn't do anything on darwin yet";
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
_file = ./github-runner.nix;
|
||||
|
||||
options.common.github-runner = {
|
||||
enable = lib.mkEnableOption "using this machine as a self-hosted github runner";
|
||||
runners = mkOption {
|
||||
type = with types;
|
||||
attrsOf (submodule ({name, ...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "${name}-${config.networking.hostName}";
|
||||
};
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
instances = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
};
|
||||
};
|
||||
}));
|
||||
type =
|
||||
with types;
|
||||
attrsOf (
|
||||
submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "${name}-${config.networking.hostName}";
|
||||
};
|
||||
url = mkOption { type = types.str; };
|
||||
instances = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
sharedConfig
|
||||
linuxConfig
|
||||
darwinConfig
|
||||
]);
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
sharedConfig
|
||||
linuxConfig
|
||||
darwinConfig
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,49 +1,51 @@
|
|||
{isLinux}: {
|
||||
{ isLinux }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
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 {
|
||||
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 false
|
||||
/*
|
||||
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;
|
||||
};
|
||||
age.secrets.hercules-secrets = {
|
||||
file = ../../../secrets/hercules-secrets.age;
|
||||
owner = herculesUser;
|
||||
};
|
||||
# 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;
|
||||
};
|
||||
age.secrets.hercules-secrets = {
|
||||
file = ../../../secrets/hercules-secrets.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 = config.age.secrets.hercules-secrets.path;
|
||||
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 = config.age.secrets.hercules-secrets.path;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
{isLinux}: {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{ isLinux }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
sharedConfig = {
|
||||
settei.programs.podman.enable = true;
|
||||
};
|
||||
|
||||
linuxConfig = lib.optionalAttrs isLinux {
|
||||
boot.kernel.sysctl."kernel.yama.ptrace_scope" = 0;
|
||||
};
|
||||
linuxConfig = lib.optionalAttrs isLinux { boot.kernel.sysctl."kernel.yama.ptrace_scope" = 0; };
|
||||
|
||||
darwinConfig = lib.optionalAttrs (!isLinux) {};
|
||||
darwinConfig = lib.optionalAttrs (!isLinux) { };
|
||||
|
||||
finalConfig = lib.mkMerge [
|
||||
sharedConfig
|
||||
linuxConfig
|
||||
darwinConfig
|
||||
];
|
||||
in {
|
||||
in
|
||||
{
|
||||
_file = ./user.nix;
|
||||
|
||||
config = lib.mkIf config.settei.user.enable finalConfig;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue