diff options
author | Alex <alex@adnab.me> | 2024-02-09 12:11:23 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-02-09 12:11:23 +0000 |
commit | 0c7ce001c907791518f93fd9d2db01eebc517c51 (patch) | |
tree | 08336bb7610c35b7707d3c87fd3f4eac7e2b21f7 /flake.nix | |
parent | e4a43bfd592c149af8e3eac58ab317a518f0968a (diff) | |
parent | f7ae966ed34d3ca8fb20afd2f20874dd42df7f7e (diff) | |
download | garage-0c7ce001c907791518f93fd9d2db01eebc517c51.tar.gz garage-0c7ce001c907791518f93fd9d2db01eebc517c51.zip |
Merge pull request 'Fix & simplify CI using Woodpecker' (#706) from nix-improvements into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/706
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 74 |
1 files changed, 52 insertions, 22 deletions
@@ -33,27 +33,57 @@ compile = import ./nix/compile.nix; in flake-utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in { - packages = { - default = (compile { - inherit system git_version; - pkgsSrc = nixpkgs; - cargo2nixOverlay = cargo2nix.overlays.default; - release = true; - }).workspace.garage { compileMode = "build"; }; - }; - devShell = (compile { - inherit system git_version; - pkgsSrc = nixpkgs; - cargo2nixOverlay = cargo2nix.overlays.default; - release = false; - }).workspaceShell { packages = with pkgs; [ - cargo-audit - cargo-outdated - rustfmt - clang - mold - ]; }; + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages = + let + packageFor = target: (compile { + inherit system git_version target; + pkgsSrc = nixpkgs; + cargo2nixOverlay = cargo2nix.overlays.default; + release = true; + }).workspace.garage { compileMode = "build"; }; + in + { + # default = native release build + default = packageFor null; + # other = cross-compiled, statically-linked builds + amd64 = packageFor "x86_64-unknown-linux-musl"; + i386 = packageFor "i686-unknown-linux-musl"; + arm64 = packageFor "aarch64-unknown-linux-musl"; + arm = packageFor "armv6l-unknown-linux-musl"; + }; + + # ---- developpment shell, for making native builds only ---- + devShells = + let + shellWithPackages = (packages: (compile { + inherit system git_version; + pkgsSrc = nixpkgs; + cargo2nixOverlay = cargo2nix.overlays.default; + }).workspaceShell { inherit packages; }); + in + { + default = shellWithPackages + (with pkgs; [ + rustfmt + clang + mold + ]); + + # import the full shell using `nix develop .#full` + full = shellWithPackages (with pkgs; [ + rustfmt + clang + mold + # ---- extra packages for dev tasks ---- + cargo-audit + cargo-outdated + cargo-machete + nixpkgs-fmt + ]); + }; }); } |