From bfda34453b11b556cea224a0cc15a2c04c8c1c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Mon, 24 Jul 2023 10:34:59 +0100 Subject: [PATCH] use content addressing --- flake.lock | 19 ++++++++++++++++++- flake.nix | 11 +++++++++-- hydra/default.nix | 13 ++++++++++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 92d8668..6b017cd 100644 --- a/flake.lock +++ b/flake.lock @@ -272,6 +272,22 @@ "type": "github" } }, + "per-system-optim": { + "flake": false, + "locked": { + "lastModified": 1690201962, + "narHash": "sha256-tMO6Etv+eOpvodQ0CguzVpha86DxqPlmHdbZGZLZn6M=", + "ref": "refs/heads/main", + "rev": "0bd0f0813464742251233df72c8590093a407aa0", + "revCount": 10, + "type": "git", + "url": "https://git.chir.rs/darkkirb/per-system-optim" + }, + "original": { + "type": "git", + "url": "https://git.chir.rs/darkkirb/per-system-optim" + } + }, "root": { "inputs": { "attic": "attic", @@ -280,7 +296,8 @@ "gomod2nix": "gomod2nix", "hydra": "hydra", "mautrix-cleanup": "mautrix-cleanup", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "per-system-optim": "per-system-optim" } }, "rust-overlay": { diff --git a/flake.nix b/flake.nix index 85c6ab5..b117dac 100644 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,10 @@ hydra = { url = "git+https://git.chir.rs/darkkirb/hydra"; }; + per-system-optim = { + url = "git+https://git.chir.rs/darkkirb/per-system-optim"; + flake = false; + }; }; outputs = { @@ -33,14 +37,17 @@ nixpkgs, flake-utils, hydra, + per-system-optim, ... }: - flake-utils.lib.eachSystem ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" "riscv64-linux"] ( + flake-utils.lib.eachSystem ["aarch64-linux" "x86_64-linux" "riscv64-linux"] ( system: let - pkgs = import nixpkgs { + nixpkgs-patched = (import "${per-system-optim}/nixpkgs/eval.nix" {inherit nixpkgs;}).${system}; + pkgs = import nixpkgs-patched { inherit system; config.allowUnfree = true; config.allowUnsupportedSystem = true; + config.contentAddressedByDefault = true; overlays = [ self.overlays.${system}.default ]; diff --git a/hydra/default.nix b/hydra/default.nix index 93f39c8..359154f 100644 --- a/hydra/default.nix +++ b/hydra/default.nix @@ -3,13 +3,24 @@ nixpkgs, system, }: let - pkgs = import nixpkgs { + pkgs' = import nixpkgs { inherit system; config = { allowUnfree = true; allowUnsupportedSystem = true; }; }; + lib = import ../lib {pkgs = pkgs';}; + flake = (lib.importFlake {inherit system;}).defaultNix; + nixpkgs-patched = (import "${flake.inputs.per-system-optim}/nixpkgs/eval.nix" {inherit nixpkgs;}).${system}; + pkgs = import nixpkgs-patched { + inherit system; + config = { + allowUnfree = true; + allowUnsupportedSystem = true; + contentAddressedByDefault = true; + }; + }; ci = import nix-packages {inherit pkgs;}; isReserved = n: n == "lib" || n == "overlays" || n == "modules"; in