nixos-config/config/nix.nix

116 lines
2.9 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
pkgs,
lib,
config,
system,
2023-01-17 09:42:06 +00:00
attic,
2022-06-12 15:39:15 +00:00
...
2022-11-10 11:08:59 +00:00
}: let
post-build-hook = pkgs.writeScript "post-build-hook" ''
2023-01-17 10:02:41 +00:00
#!${pkgs.bash}/bin/bash
2022-11-10 11:08:59 +00:00
set -euf
export IFS=' '
2023-01-17 10:02:41 +00:00
until ${attic.packages.${system}.attic-client}/bin/attic-client push chir-rs $OUT_PATHS; do
sleep 5
echo "Retrying..."
done
2022-11-10 11:08:59 +00:00
'';
in {
2022-01-27 16:16:42 +00:00
imports = [
./workarounds
];
2023-01-17 09:42:06 +00:00
sops.secrets."attic/config.toml" = {
sopsFile = ../secrets/shared.yaml;
owner = "root";
key = "attic/config.toml";
path = "/root/.config/attic/config.toml";
};
2022-01-14 13:03:14 +00:00
nixpkgs.config.allowUnfree = true;
nix = {
settings = {
sandbox = true;
2023-01-14 19:58:07 +00:00
trusted-users = ["@wheel" "remote-build"];
2022-04-12 09:37:53 +00:00
require-sigs = true;
2022-02-08 09:48:37 +00:00
builders-use-substitutes = true;
2022-03-03 07:50:45 +00:00
substituters = [
2023-01-17 10:02:41 +00:00
"https://attic.chir.rs/chir-rs/"
2022-04-12 09:33:58 +00:00
];
trusted-public-keys = [
"nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg="
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
2023-01-17 10:02:41 +00:00
"chir-rs:AnwyFacopHSkprD6aXY4/R3J9JYzTbV2rosJCBPaB28="
2022-03-03 07:50:45 +00:00
];
2022-11-10 11:08:59 +00:00
post-build-hook = "${post-build-hook}";
2023-01-17 10:02:41 +00:00
auto-optimise-store = true;
};
2022-09-13 17:27:49 +00:00
package = pkgs.nix;
2022-01-14 13:03:14 +00:00
extraOptions = ''
experimental-features = nix-command flakes ca-derivations
2022-01-14 13:03:14 +00:00
'';
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
2022-02-08 09:48:37 +00:00
buildMachines = [
2022-09-20 12:24:29 +00:00
{
hostName = "build-nas";
systems = [
"armv7l-linux"
"aarch64-linux"
"powerpc-linux"
"powerpc64-linux"
"powerpc64le-linux"
"riscv32-linux"
"riscv64-linux"
"wasm32-wasi"
"x86_64-linux"
"i686-linux"
];
maxJobs = 12;
speedFactor = 1;
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark" "gccarch-znver1" "gccarch-skylake" "ca-derivations"];
}
{
hostName = "build-pc";
systems = [
"armv7l-linux"
"aarch64-linux"
"powerpc-linux"
"powerpc64-linux"
"powerpc64le-linux"
"riscv32-linux"
"riscv64-linux"
"wasm32-wasi"
"x86_64-linux"
"i686-linux"
];
maxJobs = 16;
2022-09-20 12:24:29 +00:00
speedFactor = 2;
2022-06-12 15:39:15 +00:00
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark" "gccarch-znver2" "gccarch-znver1" "gccarch-skylake" "ca-derivations"];
}
2023-01-14 13:57:00 +00:00
{
hostName = "build-aarch64";
systems = [
"aarch64-linux"
];
maxJobs = 2;
speedFactor = 10;
supportedFeatures = ["nixos-test" "benchmark" "ca-derivations"];
}
2022-02-08 09:48:37 +00:00
];
distributedBuilds = true;
2022-01-14 13:03:14 +00:00
};
2022-01-14 13:07:01 +00:00
system.autoUpgrade = {
2023-01-17 09:42:06 +00:00
enable = true;
flake = "github:DarkKirb/nixos-config";
2022-01-14 13:07:01 +00:00
flags = [
"--no-write-lock-file"
"-L" # print build logs
];
2022-02-18 19:43:14 +00:00
dates = "hourly";
2023-01-17 09:42:06 +00:00
randomizedDelaySec = "1h";
2022-01-14 13:07:01 +00:00
};
2022-01-27 16:16:42 +00:00
systemd.services.nix-daemon.environment.TMPDIR = "/build";
2022-01-14 13:03:14 +00:00
}