Fixes to Nix flake

main
Michal S 2 years ago
parent 60667232e5
commit a6d6ee2d8d

@ -1,26 +1,5 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1658644019,
"narHash": "sha256-P4ZEkrJSvtiBVnXZUagg6QtiVRc6k9XgTbWLZ7Q73Ow=",
"owner": "nix-community",
"repo": "fenix",
"rev": "a844a251dcd8aac45d47a81adae6117ff4f57b8d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -43,45 +22,26 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1658644204, "lastModified": 1664281702,
"narHash": "sha256-MWyfCH9K3eVTXJUxBi67OQSAh9jJAnvWklM6qm4j8w8=", "narHash": "sha256-haixZ4TJLu1Dciow54wrHrHvlGDVr5sW6MTeAV/ZLuI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2f0c3be57c348f4cfd8820f2d189e29a685d9c41", "rev": "7e52b35fe98481a279d89f9c145f8076d049d2b9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"utils": "utils" "utils": "utils"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1658612252,
"narHash": "sha256-mO2M5pgrkxjSURWILT91w+ChkQ3mU+oOpdxF+yFaBEc=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "977e12a0bdc3e329af179ef3a9d466af9eb613bb",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1656928814, "lastModified": 1656928814,

@ -1,15 +1,11 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs";
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
naersk = { naersk = {
url = "github:nix-community/naersk"; url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
@ -17,21 +13,11 @@
nixpkgs, nixpkgs,
utils, utils,
naersk, naersk,
fenix, ...
}: }:
utils.lib.eachDefaultSystem (system: let utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}"; pkgs = nixpkgs.legacyPackages."${system}";
toolchain = with fenix.packages."${system}"; naersk-lib = naersk.lib."${system}";
combine [
minimal.rustc
minimal.cargo
targets.x86_64-pc-windows-gnu.latest.rust-std
targets.x86_64-unknown-linux-gnu.latest.rust-std
];
naersk-lib = naersk.lib."${system}".override {
cargo = toolchain;
rustc = toolchain;
};
in rec in rec
{ {
packages.malachite = naersk-lib.buildPackage { packages.malachite = naersk-lib.buildPackage {
@ -39,32 +25,9 @@
root = ./.; root = ./.;
}; };
packages.malachite-win = naersk-lib.buildPackage {
pname = "Malachite";
root = ./.;
strictDeps = true;
depsBuildBuild = with pkgs; [
pkgsCross.mingwW64.stdenv.cc
pkgsCross.mingwW64.windows.pthreads
];
nativeBuildInputs = with pkgs; [
(
if system == "x86_64-linux"
then wineWowPackages.stable
else hello
)
];
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = pkgs.writeScript "wine-wrapper" ''
export WINEPREFIX="$(mktemp -d)"
exec wine64 $@
'';
doCheck = true;
};
packages.default = packages.malachite; packages.default = packages.malachite;
apps.apod = utils.lib.mkApp { apps.malachite = utils.lib.mkApp {
drv = packages.malachite; drv = packages.malachite;
}; };
@ -77,9 +40,17 @@
cargo-audit cargo-audit
rustfmt rustfmt
clippy clippy
rust-analyzer
# For `alpm` libs
pkg-config
pacman
openssl
]; ];
# For rust-analyzer
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}; };
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
}); });
} }
Loading…
Cancel
Save