Added nixify as an input and refactored flake outputs using nixify utilities. Updated dependencies and build configurations, including platform-specific enhancements and new package sources for streamlined builds.
This commit is contained in:
parent
0dbbc6a778
commit
c38fc8ef17
3 changed files with 519 additions and 50 deletions
96
flake.nix
96
flake.nix
|
@ -1,39 +1,67 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-25.05-darwin";
|
||||
nixify.url = "github:rvolosatovs/nixify";
|
||||
nixify.inputs.nixpkgs-nixos.follows = "nixpkgs";
|
||||
nixify.inputs.nixpkgs-darwin.follows = "nixpkgs-darwin";
|
||||
};
|
||||
outputs = { self, nixpkgs, rust-overlay, ... }:
|
||||
let
|
||||
namespace = "hello";
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
forEachSystem = systems: f: nixpkgs.lib.genAttrs systems f;
|
||||
forAllSystems = function:
|
||||
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
|
||||
(system: function (import nixpkgs { inherit system overlays; }));
|
||||
in {
|
||||
packages =
|
||||
forAllSystems (pkgs: (self.overlays.default pkgs pkgs).${namespace});
|
||||
cross = forAllSystems (pkgs:
|
||||
(forEachSystem (nixpkgs.lib.filter (sys: sys != pkgs.system)
|
||||
nixpkgs.lib.systems.flakeExposed) (crossSystem:
|
||||
let
|
||||
crossPkgs = import nixpkgs {
|
||||
localSystem = pkgs.system;
|
||||
inherit crossSystem;
|
||||
|
||||
outputs =
|
||||
{ nixify, ... }:
|
||||
with nixify.lib;
|
||||
rust.mkFlake {
|
||||
src = ./.;
|
||||
|
||||
withDevShells =
|
||||
{ devShells
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
extendDerivations
|
||||
{
|
||||
env.LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${
|
||||
with pkgs;
|
||||
pkgs.lib.makeLibraryPath [
|
||||
openssl
|
||||
]
|
||||
}";
|
||||
buildInputs = with pkgs; [
|
||||
openssl
|
||||
];
|
||||
}
|
||||
devShells;
|
||||
|
||||
buildOverrides =
|
||||
{ pkgs
|
||||
, pkgsCross ? pkgs
|
||||
, ...
|
||||
}:
|
||||
{ buildInputs ? [ ]
|
||||
, nativeBuildInputs ? [ ]
|
||||
, depsBuildBuild ? [ ]
|
||||
, env ? { }
|
||||
, ...
|
||||
}:
|
||||
with pkgs.lib;
|
||||
{
|
||||
nativeBuildInputs =
|
||||
nativeBuildInputs
|
||||
++ optional (pkgs.stdenv.hostPlatform.isLinux) [ pkgs.pkg-config ];
|
||||
|
||||
buildInputs =
|
||||
buildInputs
|
||||
++ optional pkgs.stdenv.hostPlatform.isDarwin pkgs.libiconv
|
||||
++ optional (pkgs.stdenv.hostPlatform.isLinux) [
|
||||
pkgs.openssl.dev
|
||||
];
|
||||
|
||||
depsBuildBuild =
|
||||
depsBuildBuild
|
||||
++ optional pkgsCross.stdenv.hostPlatform.isDarwin pkgsCross.xcbuild.xcrun;
|
||||
env = env // {
|
||||
OPENSSL_NO_VENDOR = "1";
|
||||
};
|
||||
in (self.overlays.default crossPkgs crossPkgs).${namespace})));
|
||||
devShells =
|
||||
forAllSystems (pkgs: (self.overlays.default pkgs pkgs).devShells);
|
||||
formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt);
|
||||
overlays.default = final: prev:
|
||||
let pkgs = final;
|
||||
in {
|
||||
devShells.default = pkgs.callPackage ./shell.nix { };
|
||||
${namespace} = {
|
||||
hello = pkgs.callPackage ./default.nix { };
|
||||
default = pkgs.callPackage ./default.nix { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue