From d821a1a4531de819a68f5cf324d474fae76e1096 Mon Sep 17 00:00:00 2001 From: Cole Mickens Date: Tue, 1 Nov 2022 12:36:09 -0700 Subject: [PATCH] simplify flake internals, build+cache efficiency --- flake.nix | 11 ++--------- main.nu | 27 ++++++++++----------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/flake.nix b/flake.nix index 08af57b60..9e470ea7c 100644 --- a/flake.nix +++ b/flake.nix @@ -152,8 +152,7 @@ # wayfire stuff wayfire-unstable = prev.callPackage ./pkgs/wayfire-unstable { }; }; - in - waylandPkgs // { inherit waylandPkgs; }; + in waylandPkgs; in lib.flake-utils.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system: @@ -188,13 +187,7 @@ formatter = pkgs_.nixpkgs.nixpkgs-fmt; - packages = waypkgs.waylandPkgs // - { - default = (waypkgs.linkFarmFromDrvs - "nixpkgs-wayland-pkgs" - (builtins.attrValues waypkgs.waylandPkgs) - ).overrideAttrs (old: { allowSubstitutes = true; }); - }; + packages = (waylandOverlay (pkgs_.nixpkgs) (pkgs_.nixpkgs)); }) // { # overlays have to be outside of eachSystem block diff --git a/main.nu b/main.nu index d40090392..674ebfe86 100755 --- a/main.nu +++ b/main.nu @@ -6,14 +6,8 @@ let-env CACHIX_CACHE = ( else "nixpkgs-wayland" ) -def header [ color: string text: string spacer=" ": string ] { - let text = $"($text) " - let header = $" ($text | str rpad -c $spacer -l 80)" - print -e $"(ansi $color)($header)(ansi reset)" -} - def buildDrv [ drvRef: string ] { - print -e (header yellow_reverse $"eval [($drvRef)]") + print -e $"(ansi yellow) :: eval ($drvRef)(ansi reset)" let evalJobs = ( ^nix-eval-jobs --flake $".#($drvRef)" @@ -22,7 +16,7 @@ def buildDrv [ drvRef: string ] { ) print -e $evalJobs - print -e (header blue_reverse $"build [($drvRef)]") + print -e $"(ansi blue) :: build ($drvRef)(ansi reset)" print -e ($evalJobs | where isCached == false | select name drvPath outputs) @@ -34,20 +28,19 @@ def buildDrv [ drvRef: string ] { null } - print -e (header green_reverse $"cache [($drvRef)]") - $evalJobs | each { |drv| + print -e $"(ansi green) :: cache ($drvRef)(ansi reset)" + let pushPaths = ($evalJobs | each { |drv| $drv.outputs | each { |outPath| if ($outPath.out | path exists) { - ($outPath.out | ^cachix push $env.CACHIX_CACHE) - null + $outPath.out } } - } - - let output = ($evalJobs | select name outputs) - print -e ($output | flatten) + }) - $output + # collect paths to push + # call cachix push once + let arg = ($pushPaths | each {|it| $"($it)(char nl)"} | str collect) + $arg | ^cachix push $env.CACHIX_CACHE | complete } def "main rereadme" [] {