Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Flake update #25

Merged
merged 2 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
Cargo.lock
/.direnv
67 changes: 47 additions & 20 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 58 additions & 38 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,66 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, utils, naersk }:
utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}";
in rec
{
packages.amethyst = naersk-lib.buildPackage {
pname = "ame";
root = ./.;
nativeBuildInputs = with pkgs; [
openssl
sqlite
pkg-config
];
};

packages.default = packages.amethyst;
outputs = {
self,
nixpkgs,
utils,
naersk,
fenix,
...
}:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
toolchain = with fenix.packages."${system}";
combine [
latest.rustc
latest.cargo
latest.clippy
latest.rustfmt
latest.rust-analyzer
latest.rust-src
];
naersk-lib = naersk.lib."${system}".override {
cargo = toolchain;
rustc = toolchain;
clippy = toolchain;
rustfmt = toolchain;
rust-analyzer = toolchain;
rust-src = toolchain;
};
in rec
{
packages.jade = naersk-lib.buildPackage {
pname = "Jade";
root = ./.;
};

apps.amethyst = utils.lib.mkApp {
drv = packages.amethyst;
};

apps.default = apps.amethyst;
packages.default = packages.jade;

devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
rustfmt
cargo-audit
clippy
openssl
sqlite
pkg-config
];
};
});
}
apps.jade = utils.lib.mkApp {
drv = packages.jade;
};

apps.default = apps.jade;

devShells.default = pkgs.mkShell {
nativeBuildInputs = [
toolchain
];
# For rust-analyzer
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};

formatter = pkgs.alejandra;
});
}