nix-conf/modules/nix/default.nix

111 lines
3.4 KiB
Nix
Raw Normal View History

2023-12-29 16:43:40 +01:00
{ config, lib, pkgs, self, ... }:
2023-05-19 20:53:02 +02:00
2023-12-30 23:39:33 +01:00
let cfg = config.jopejoe1.nix;
in {
options.jopejoe1.nix = { enable = lib.mkEnableOption "Enable Nix"; };
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"
2024-02-06 12:23:24 +01:00
"http://kuraokami:5000"
2024-01-11 00:11:01 +01:00
];
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="
2024-02-06 12:23:24 +01:00
"kuraokami:2H7ZvTtwBccxDW7QGzhiQk81ey7iVSjsjqVv4gn+zog="
2023-12-29 16:43:40 +01:00
];
trusted-users = [ "root" ];
sandbox = true;
require-sigs = true;
max-jobs = "auto";
auto-optimise-store = true;
allowed-users = [ "*" ];
experimental-features = [ "nix-command" "flakes" ];
2024-01-11 00:11:01 +01:00
warn-dirty = true;
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;
2023-12-29 16:43:40 +01:00
};
2024-02-02 18:27:35 +01:00
buildMachines = [
2024-02-06 12:43:01 +01:00
(rec {
2024-02-02 18:30:20 +01:00
systems = [ self.nixosConfigurations.kuraokami.config.nixpkgs.hostPlatform.system ];
2024-02-02 18:27:35 +01:00
supportedFeatures = self.nixosConfigurations.kuraokami.config.nix.settings.system-features;
2024-02-06 12:43:01 +01:00
maxJobs = if hostName != config.networking.hostName then 24 else 0;
2024-02-04 17:26:21 +01:00
speedFactor = 20;
2024-02-06 12:43:01 +01:00
sshKey = "/home/jopejoe1/.ssh/github";
sshUser = "jopejoe1";
2024-02-02 18:27:35 +01:00
hostName = "kuraokami";
protocol = "ssh-ng";
2024-02-06 12:43:01 +01:00
})
2024-02-06 12:47:16 +01:00
(rec {
2024-02-02 18:30:20 +01:00
systems = [ self.nixosConfigurations.zap.config.nixpkgs.hostPlatform.system ];
2024-02-02 18:27:35 +01:00
supportedFeatures = self.nixosConfigurations.zap.config.nix.settings.system-features;
2024-02-06 12:47:16 +01:00
maxJobs = if hostName != config.networking.hostName then 4 else 0;
2024-02-04 17:26:21 +01:00
speedFactor = 10;
2024-02-06 12:43:01 +01:00
sshUser = "jopejoe1";
sshKey = "/home/jopejoe1/.ssh/github";
2024-02-02 18:27:35 +01:00
hostName = "zap";
protocol = "ssh-ng";
2024-02-06 12:47:16 +01:00
})
2024-02-02 18:27:35 +01:00
];
2024-02-06 12:13:21 +01:00
distributedBuilds = true;
2024-02-06 11:59:24 +01:00
package = pkgs.nixVersions.unstable;
2024-01-11 00:11:01 +01:00
registry = lib.mkForce ((lib.mapAttrs (_: flake: { inherit flake; })) ((lib.filterAttrs (_: lib.isType "flake")) self.inputs) // {
2024-01-10 23:55:40 +01:00
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 = {
config.allowUnfree = 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-02-06 12:23:24 +01:00
services.nix-serve = {
enable = true;
openFirewall = true;
secretKeyFile = "/var/cache-priv-key.pem";
};
2024-01-10 23:55:40 +01:00
environment.etc = lib.mapAttrs' (name: value: { name = "nix/path/${name}"; value.source = value.flake; }) config.nix.registry;
2023-12-29 16:43:40 +01:00
environment.systemPackages = with pkgs; [
deploy-rs
nixfmt
nixpkgs-fmt
nix-index
nix-prefetch-git
nixpkgs-review
nurl
nix-init
];
2023-12-17 15:25:49 +01:00
2023-12-29 16:43:40 +01:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
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 = {
"192.168.191.46" = [ "zap" ];
"192.168.191.142" = [ "kuraokami" ];
};
2023-12-29 16:43:40 +01:00
};
}
2023-05-19 20:53:02 +02:00