58 lines
1.5 KiB
Nix
58 lines
1.5 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
inputs.systems.url = "github:nix-systems/default-linux";
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
systems,
|
|
}:
|
|
let
|
|
forAllSystems =
|
|
function: nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system});
|
|
in
|
|
{
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
RUSTFLAGS = "-C prefer-dynamic=yes";
|
|
packages = builtins.attrValues {
|
|
inherit (pkgs)
|
|
rustc
|
|
cargo
|
|
rust-analyzer
|
|
rustfmt
|
|
clippy
|
|
just
|
|
;
|
|
};
|
|
shellHook =
|
|
let
|
|
justfile = ''
|
|
build:
|
|
nix build --offline
|
|
fresh:
|
|
nix build
|
|
'';
|
|
in
|
|
''
|
|
echo "${justfile}" > justfile
|
|
'';
|
|
};
|
|
});
|
|
packages = forAllSystems (pkgs: {
|
|
default =
|
|
let
|
|
project = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
|
|
in
|
|
pkgs.rustPlatform.buildRustPackage (finalAttrs: {
|
|
pname = project.name;
|
|
version = project.version;
|
|
src = ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
RUSTFLAGS = "-C prefer-dynamic=yes";
|
|
buildInputs = [ pkgs.sqlite ];
|
|
});
|
|
});
|
|
};
|
|
}
|