nix-conf/nixos-modules/nix/default.nix

165 lines
4.8 KiB
Nix
Raw Normal View History

2024-07-10 23:02:54 +02:00
{
config,
lib,
pkgs,
self,
...
}:
2023-05-19 20:53:02 +02:00
2024-07-10 23:02:54 +02:00
let
cfg = config.jopejoe1.nix;
in
{
options.jopejoe1.nix = {
enable = lib.mkEnableOption "Enable Nix";
};
options.jopejoe1.gui = {
enable = lib.mkEnableOption "Enable GUI";
};
2023-05-19 20:53:02 +02:00
2023-12-29 16:43:40 +01:00
config = lib.mkIf cfg.enable {
nix = {
settings = {
2024-01-11 00:11:01 +01:00
substituters = lib.mkForce [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = lib.mkForce [
2023-12-29 16:43:40 +01:00
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
sandbox = true;
require-sigs = true;
max-jobs = "auto";
allowed-users = [ "*" ];
2024-07-17 20:16:23 +02:00
trusted-users = [
"builder"
"jopejeo1"
"root"
];
2024-02-07 22:23:26 +01:00
experimental-features = [
"nix-command"
"flakes"
2024-10-30 00:23:21 +01:00
"auto-allocate-uids"
"ca-derivations"
"cgroups"
"dynamic-derivations"
"fetch-closure"
"impure-derivations"
"no-url-literals"
"recursive-nix"
2024-02-07 22:23:26 +01:00
];
2024-10-30 00:23:21 +01:00
auto-allocate-uids = true;
use-cgroups = true;
2024-01-11 00:11:01 +01:00
warn-dirty = true;
2024-08-06 20:57:14 +02:00
allow-dirty = false;
2023-12-29 16:43:40 +01:00
use-xdg-base-directories = true;
2024-01-29 11:55:44 +01:00
keep-going = true;
2024-02-06 12:43:01 +01:00
builders-use-substitutes = true;
2024-08-06 20:57:14 +02:00
download-attempts = 1;
fallback = true;
2023-12-29 16:43:40 +01:00
};
2024-08-10 11:09:36 +02:00
buildMachines =
let
getMainArch =
name:
self.nixosConfigurations.${name}.config.nixpkgs.hostPlatform.system
or self.nixosConfigurations.${name}.config.nixpkgs.system;
getArchs =
name:
[ (getMainArch name) ]
++ self.nixosConfigurations.${name}.config.nix.settings.extra-platforms or [ ];
in
[
{
systems = getArchs "hetzner";
supportedFeatures = self.nixosConfigurations.hetzner.config.nix.settings.system-features;
2024-08-29 21:01:42 +02:00
hostName = "hetzner";
2024-08-10 11:09:36 +02:00
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUZYQzNPVGRPd0w4V1NDaHhFRENiNS9WbUZYcDZmWUZEM21MMFhFdzFFTDAgcm9vdEBoZXR6bmVyCg==";
protocol = "ssh-ng";
sshUser = "builder";
sshKey = "/root/.ssh/builder";
2024-09-21 19:19:13 +02:00
speedFactor = 5;
2024-08-10 11:09:36 +02:00
maxJobs = 12;
}
2024-08-29 21:01:42 +02:00
{
systems = getArchs "zap";
supportedFeatures = self.nixosConfigurations.zap.config.nix.settings.system-features;
hostName = "zap";
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSU5Xb056T0QrM0UzT20xbGpkRUNxWUhaQkZteHA3bTNsS1MxSHBkQnZkZjYgcm9vdEB6YXAK";
protocol = "ssh-ng";
sshUser = "builder";
sshKey = "/root/.ssh/builder";
maxJobs = 4;
}
2024-09-01 16:04:03 +02:00
{
systems = getArchs "kuraokami";
supportedFeatures = self.nixosConfigurations.kuraokami.config.nix.settings.system-features;
hostName = "kuraokami";
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUtJbFZhWTZ0aTJkVFVGUks0eFVoRitxa1kwbUhiT3pNSWpjTjZpMFNiTW0gcm9vdEBrdXJhb2thbWkK";
protocol = "ssh-ng";
sshUser = "builder";
sshKey = "/root/.ssh/builder";
2024-09-21 19:19:13 +02:00
speedFactor = 10;
2024-09-01 16:04:03 +02:00
maxJobs = 24;
}
2024-08-10 11:09:36 +02:00
];
2024-02-06 12:13:21 +01:00
distributedBuilds = true;
2024-05-29 20:53:22 +02:00
package = pkgs.lix;
2024-07-10 23:02:54 +02:00
registry = lib.mkForce (
(lib.mapAttrs (_: flake: { inherit flake; })) (
(lib.filterAttrs (_: lib.isType "flake")) self.inputs
)
// {
self.flake = self;
}
);
2024-01-11 00:11:01 +01:00
nixPath = lib.mkForce [ "/etc/nix/path" ];
2024-02-06 12:23:24 +01:00
2023-12-29 16:43:40 +01:00
};
2023-12-17 15:25:49 +01:00
2024-01-02 19:32:20 +01:00
nixpkgs = {
2024-07-10 23:02:54 +02:00
config = {
2024-03-08 18:59:28 +01:00
allowUnfree = true;
nvidia.acceptLicense = true;
};
2024-01-13 17:16:32 +01:00
overlays = [
(_self: super: rec {
firefox-addons = self.inputs.firefox-addons.packages.${config.nixpkgs.hostPlatform.system};
localPkgs = self.outputs.packages.${config.nixpkgs.hostPlatform.system};
})
];
2024-01-02 19:32:20 +01:00
};
2024-07-10 23:02:54 +02:00
environment.etc = lib.mapAttrs' (name: value: {
name = "nix/path/${name}";
value.source = value.flake;
}) config.nix.registry;
2024-01-10 23:55:40 +01:00
2023-12-29 16:43:40 +01:00
environment.systemPackages = with pkgs; [
nix-index
nix-prefetch-git
nixpkgs-review
];
2023-12-17 15:25:49 +01:00
2023-12-29 16:43:40 +01:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
2024-07-14 15:22:14 +02:00
sharedModules = [
self.outputs.homeManagerModules.default
];
2023-12-29 16:43:40 +01:00
};
2023-05-19 20:53:02 +02:00
2024-01-02 20:58:18 +01:00
systemd.services.nix-daemon.serviceConfig.LimitNOFILE = lib.mkForce 1048576000;
2024-02-01 17:02:20 +01:00
2024-02-06 12:47:16 +01:00
networking.hosts = {
2024-09-01 15:43:33 +02:00
"192.168.194.46" = [ "zap" ];
2024-09-01 15:57:14 +02:00
"192.168.194.54" = [ "kuraokami" ];
2024-08-29 20:13:58 +02:00
"192.168.194.208" = [ "hetzner" ];
"192.168.194.232" = [ "omoikane" ];
2024-02-06 12:47:16 +01:00
};
2024-07-15 11:46:05 +02:00
users.mutableUsers = false;
2023-12-29 16:43:40 +01:00
};
}