From 567a05d7ecff72ae7a0825df954e08aabdf2e379 Mon Sep 17 00:00:00 2001 From: Michael Forster Date: Fri, 27 Jan 2023 11:54:52 +0100 Subject: [PATCH] nix: use default list of systems Most notably this removes the `i686-linux` target, which wasn't added deliberately and is also not tested. --- flake.nix | 200 ++++++++++++++++++++++++++---------------------------- 1 file changed, 95 insertions(+), 105 deletions(-) diff --git a/flake.nix b/flake.nix index 35c910059..a4abfd524 100644 --- a/flake.nix +++ b/flake.nix @@ -11,117 +11,107 @@ rust-overlay.inputs.flake-utils.follows = "flake-utils"; }; - outputs = { self, nixpkgs, flake-utils, rust-overlay }: + outputs = { self, nixpkgs, flake-utils, rust-overlay }: { + overlays.default = (final: prev: { + jujutsu = self.packages.${final.system}.jujutsu; + }); + } // + (flake-utils.lib.eachDefaultSystem (system: let - systems = with flake-utils.lib.system; [ - aarch64-linux - aarch64-darwin - i686-linux - x86_64-darwin - x86_64-linux - ]; + pkgs = import nixpkgs { + inherit system; + overlays = [ + rust-overlay.overlays.default + ]; + }; + filterSrc = src: regexes: + pkgs.lib.cleanSourceWith { + inherit src; + filter = path: type: + let + relPath = pkgs.lib.removePrefix (toString src + "/") (toString path); + in + pkgs.lib.all (re: builtins.match re relPath == null) regexes; + }; in { - overlays.default = (final: prev: { - jujutsu = self.packages.${final.system}.jujutsu; - }); - } // - (flake-utils.lib.eachSystem systems (system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ - rust-overlay.overlays.default + packages = { + jujutsu = pkgs.rustPlatform.buildRustPackage rec { + pname = "jujutsu"; + version = "unstable-${self.shortRev or "dirty"}"; + buildNoDefaultFeatures = true; + buildFeatures = [ "jujutsu-lib/legacy-thrift" ]; + src = filterSrc ./. [ + ".*\\.nix$" + "^.jj/" + "^flake\\.lock$" + "^target/" ]; - }; - filterSrc = src: regexes: - pkgs.lib.cleanSourceWith { - inherit src; - filter = path: type: - let - relPath = pkgs.lib.removePrefix (toString src + "/") (toString path); - in - pkgs.lib.all (re: builtins.match re relPath == null) regexes; + cargoLock = { + lockFile = ./Cargo.lock; }; - in - { - packages = { - jujutsu = pkgs.rustPlatform.buildRustPackage rec { - pname = "jujutsu"; - version = "unstable-${self.shortRev or "dirty"}"; - buildNoDefaultFeatures = true; - buildFeatures = [ "jujutsu-lib/legacy-thrift" ]; - src = filterSrc ./. [ - ".*\\.nix$" - "^.jj/" - "^flake\\.lock$" - "^target/" - ]; - cargoLock = { - lockFile = ./Cargo.lock; - }; - nativeBuildInputs = with pkgs; [ - gzip - installShellFiles - makeWrapper - pkg-config - ]; - buildInputs = with pkgs; [ openssl dbus sqlite ] + nativeBuildInputs = with pkgs; [ + gzip + installShellFiles + makeWrapper + pkg-config + ]; + buildInputs = with pkgs; [ openssl dbus sqlite ] ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - libiconv - ]; - postInstall = '' - $out/bin/jj debug mangen > ./jj.1 - installManPage ./jj.1 - - $out/bin/jj debug completion --bash > ./completions.bash - installShellCompletion --bash --name ${pname}.bash ./completions.bash - $out/bin/jj debug completion --fish > ./completions.fish - installShellCompletion --fish --name ${pname}.fish ./completions.fish - $out/bin/jj debug completion --zsh > ./completions.zsh - installShellCompletion --zsh --name _${pname} ./completions.zsh - ''; - }; - default = self.packages.${system}.jujutsu; - }; - apps.default = { - type = "app"; - program = "${self.packages.${system}.jujutsu}/bin/jj"; - }; - checks.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: { - cargoBuildType = "debug"; - cargoCheckType = "debug"; - preCheck = '' - export RUST_BACKTRACE=1 - ''; - }); - formatter = pkgs.nixpkgs-fmt; - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - # Using the minimal profile with explicit "clippy" extension to avoid - # two versions of rustfmt - (rust-bin.stable."1.61.0".minimal.override { - extensions = [ - "rust-src" # for rust-analyzer - "clippy" - ]; - }) - - # The CI checks against the latest nightly rustfmt, so we should too. - (rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt)) - - # Required build dependencies - openssl - pkg-config # to find openssl - - # Additional tools recommended by contributing.md - cargo-deny - cargo-insta - cargo-nextest - cargo-watch + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + libiconv ]; + postInstall = '' + $out/bin/jj debug mangen > ./jj.1 + installManPage ./jj.1 + + $out/bin/jj debug completion --bash > ./completions.bash + installShellCompletion --bash --name ${pname}.bash ./completions.bash + $out/bin/jj debug completion --fish > ./completions.fish + installShellCompletion --fish --name ${pname}.fish ./completions.fish + $out/bin/jj debug completion --zsh > ./completions.zsh + installShellCompletion --zsh --name _${pname} ./completions.zsh + ''; }; - })); + default = self.packages.${system}.jujutsu; + }; + apps.default = { + type = "app"; + program = "${self.packages.${system}.jujutsu}/bin/jj"; + }; + checks.jujutsu = self.packages.${system}.jujutsu.overrideAttrs ({ ... }: { + cargoBuildType = "debug"; + cargoCheckType = "debug"; + preCheck = '' + export RUST_BACKTRACE=1 + ''; + }); + formatter = pkgs.nixpkgs-fmt; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + # Using the minimal profile with explicit "clippy" extension to avoid + # two versions of rustfmt + (rust-bin.stable."1.61.0".minimal.override { + extensions = [ + "rust-src" # for rust-analyzer + "clippy" + ]; + }) + + # The CI checks against the latest nightly rustfmt, so we should too. + (rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt)) + + # Required build dependencies + openssl + pkg-config # to find openssl + + # Additional tools recommended by contributing.md + cargo-deny + cargo-insta + cargo-nextest + cargo-watch + ]; + }; + })); }