From c415ed10bffb1ed6bce03a06409c014f71e4fbdf Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Tue, 3 Sep 2024 08:16:04 +0200 Subject: [PATCH 1/2] Flake: update follows, remove deprecated attrs --- flake.nix | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 8c68eaa..1d91d81 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,8 @@ rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-utils.follows = "flake-utils"; - }; - crane = { - url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "nixpkgs"; }; + crane.url = "github:ipetkov/crane"; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -55,18 +51,12 @@ # `nix build` packages.${name} = pkgs.callPackage ./default.nix { }; packages.default = packages.${name}; - defaultPackage = lib.warnIf (builtins.compareVersions builtins.nixVersion "2.7" >= 0) - "ragenix's flake output `defaultPackage` is deprecated in favor of `packages.default` for Nix >= 2.7" - packages.default; # `nix run` apps.${name} = flake-utils.lib.mkApp { drv = packages.${name}; }; apps.default = apps.${name}; - defaultApp = lib.warnIf (builtins.compareVersions builtins.nixVersion "2.7" >= 0) - "ragenix's flake output `defaultApp` is deprecated in favor of `apps.default` for Nix >= 2.7" - apps.default; # Regenerate the roff and HTML manpages and commit the changes, if any apps.update-manpage = flake-utils.lib.mkApp { @@ -372,10 +362,6 @@ ragenix = self.packages.${prev.stdenv.hostPlatform.system}.ragenix; agenix = ragenix; }; - - overlay = lib.warnIf (builtins.compareVersions builtins.nixVersion "2.7" >= 0) - "ragenix's flake output `overlay` is deprecated in favor of `overlays.default` for Nix >= 2.7" - self.overlays.default; } ]; } From 14fe57bf93845ed3d702d64cc2c991162dc9fd2e Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Tue, 3 Sep 2024 08:26:48 +0200 Subject: [PATCH 2/2] Add static musl build Use it as a default on supported systems --- default.nix | 3 +++ flake.nix | 11 ++++++++++- rust-toolchain | 8 +++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index a6b7b86..03c9ae3 100644 --- a/default.nix +++ b/default.nix @@ -11,6 +11,7 @@ # Allowing running the tests without the "recursive-nix" feature to allow # building the package without having a recursive-nix-enabled Nix. , enableRecursiveNixTests ? false +, target ? stdenv.targetPlatform.rust.cargoShortTarget }: let commonArgs = { @@ -47,6 +48,8 @@ in craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; + cargoExtraArgs = "--target ${target}"; + cargoTestExtraArgs = lib.optionalString (!enableRecursiveNixTests) "--no-default-features"; requiredSystemFeatures = lib.optionals enableRecursiveNixTests [ "recursive-nix" ]; diff --git a/flake.nix b/flake.nix index 1d91d81..e902757 100644 --- a/flake.nix +++ b/flake.nix @@ -237,6 +237,15 @@ }) ) # + # PACKAGES SPECIFIC TO LINUX SYSTEMS + # + (eachLinuxSystem (pkgs: { + packages.ragenix-static = self.packages.${pkgs.stdenv.system}.ragenix.override { + target = pkgs.pkgsStatic.stdenv.targetPlatform.rust.cargoShortTarget; + }; + packages.default = self.packages.${pkgs.stdenv.system}.ragenix-static; + })) + # # CHECKS SPECIFIC TO LINUX SYSTEMS # (eachLinuxSystem (pkgs: { @@ -359,7 +368,7 @@ # Overlay to add ragenix and replace agenix overlays.default = _final: prev: rec { - ragenix = self.packages.${prev.stdenv.hostPlatform.system}.ragenix; + ragenix = self.packages.${prev.stdenv.hostPlatform.system}.default; agenix = ragenix; }; } diff --git a/rust-toolchain b/rust-toolchain index 3aafe51..11bbfd0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -2,4 +2,10 @@ profile = "minimal" channel = "stable" components = [ "rust-src", "clippy-preview", "rustfmt-preview" ] -targets = [ ] +targets = [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", +]