mirror of
https://github.com/nerdypepper/statix.git
synced 2024-10-26 14:14:03 +03:00
fix flake builds
This commit is contained in:
parent
e4c4a77d03
commit
a1886854d9
77
flake.lock
77
flake.lock
@ -16,6 +16,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"import-cargo": {
|
||||
"locked": {
|
||||
"lastModified": 1594305518,
|
||||
"narHash": "sha256-frtArgN42rSaEcEOYWg8sVPMUK+Zgch3c+wejcpX3DY=",
|
||||
"owner": "edolstra",
|
||||
"repo": "import-cargo",
|
||||
"rev": "25d40be4a73d40a2572e0cc233b83253554f06c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "import-cargo",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mozillapkgs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -32,74 +47,28 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1631004250,
|
||||
"narHash": "sha256-LGh0CjAZwh13AVkTi9w9lITEC7x6bwSQyFViOZ6HyNo=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "08afb3d1dbfe016108b72e05b02ba0f6ecb3c8e1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1631279684,
|
||||
"narHash": "sha256-IxRRCEW+8crDkbYj+uzwkfjZ8swugtnAmfRpPOpKq6I=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1633422745,
|
||||
"narHash": "sha256-gA6Ok64nPbkjHk3Oanq4641EeYkjcKhisDF9wBjLxEk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ded7b6cb1bf3d6d03328b3f592069f2c4956a97f",
|
||||
"rev": "8e1eab9eae4278c9bb1dcae426848a581943db5a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1631279684,
|
||||
"narHash": "sha256-IxRRCEW+8crDkbYj+uzwkfjZ8swugtnAmfRpPOpKq6I=",
|
||||
"owner": "NixOS",
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ded7b6cb1bf3d6d03328b3f592069f2c4956a97f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"import-cargo": "import-cargo",
|
||||
"mozillapkgs": "mozillapkgs",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1629481132,
|
||||
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
128
flake.nix
128
flake.nix
@ -1,80 +1,102 @@
|
||||
{
|
||||
inputs = {
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
naersk.url = "github:nmattia/naersk";
|
||||
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
mozillapkgs = {
|
||||
url = "github:mozilla/nixpkgs-mozilla";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
import-cargo.url = github:edolstra/import-cargo;
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, utils
|
||||
, naersk
|
||||
, mozillapkgs
|
||||
, import-cargo
|
||||
, ...
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
|
||||
# Get a specific rust version
|
||||
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { };
|
||||
inherit (import-cargo.builders) importCargo;
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
nixpkgsFor = forAllSystems (system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
});
|
||||
mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { };
|
||||
chanspec = {
|
||||
date = "2021-03-31";
|
||||
date = "2021-09-30";
|
||||
channel = "nightly";
|
||||
sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
|
||||
sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date
|
||||
};
|
||||
|
||||
rustChannel = mozilla.rustChannelOf chanspec;
|
||||
rust = rustChannel.rust;
|
||||
rust-src = rustChannel.rust-src;
|
||||
|
||||
naersk-lib = naersk.lib."${system}".override {
|
||||
cargo = rust;
|
||||
rustc = rust;
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [ ];
|
||||
|
||||
in
|
||||
rec {
|
||||
packages.statix = naersk-lib.buildPackage {
|
||||
pname = "statix";
|
||||
version = "0.1.0";
|
||||
root = ./.;
|
||||
inherit nativeBuildInputs;
|
||||
};
|
||||
{
|
||||
|
||||
defaultPackage = packages.statix;
|
||||
apps.statix = utils.lib.mkApp {
|
||||
drv = packages.statix;
|
||||
};
|
||||
overlay = final: prev:
|
||||
let
|
||||
rustChannel = (mozilla final.pkgs).rustChannelOf chanspec;
|
||||
inherit (rustChannel) rust rustc rust-src;
|
||||
in
|
||||
{
|
||||
|
||||
apps.check = {
|
||||
type = "app";
|
||||
program = "${pkgs.cargo-watch}/bin/cargo-watch";
|
||||
};
|
||||
statix = with final; pkgs.stdenv.mkDerivation {
|
||||
pname = "statix";
|
||||
version = "v0.1.0";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
(importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome
|
||||
rust
|
||||
cargo
|
||||
];
|
||||
buildPhase = ''
|
||||
cargo build -p statix --release --offline
|
||||
'';
|
||||
installPhase = ''
|
||||
install -Dm775 ./target/release/statix $out/bin/statix
|
||||
'';
|
||||
};
|
||||
|
||||
defaultApp = apps.statix;
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
rust
|
||||
rust-src
|
||||
pkgs.rust-analyzer
|
||||
pkgs.rustfmt
|
||||
pkgs.cargo
|
||||
pkgs.cargo-watch
|
||||
];
|
||||
RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
|
||||
RUST_LOG = "info";
|
||||
RUST_BACKTRACE = 1;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
packages = forAllSystems (system: {
|
||||
inherit (nixpkgsFor."${system}") statix;
|
||||
});
|
||||
|
||||
defaultPackage =
|
||||
forAllSystems (system: self.packages."${system}".statix);
|
||||
|
||||
devShell = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
rustChannel = (mozilla pkgs).rustChannelOf chanspec;
|
||||
in
|
||||
with pkgs;
|
||||
mkShell rec {
|
||||
buildInputs =
|
||||
(with pkgs; [
|
||||
rust-analyzer
|
||||
rustfmt
|
||||
cargo
|
||||
cargo-watch
|
||||
]) ++ (with rustChannel; [
|
||||
rust
|
||||
rust-src
|
||||
]);
|
||||
RUST_SRC_PATH = "${rustChannel.rust-src}/lib/rustlib/src/rust/library";
|
||||
RUST_LOG = "info";
|
||||
RUST_BACKTRACE = 1;
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user