flake: using crane now
This commit is contained in:
parent
44eaf50255
commit
4bd5075d5d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
/target
|
||||
result
|
69
flake.lock
69
flake.lock
|
@ -1,24 +1,75 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1716137900,
|
||||
"narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1",
|
||||
"lastModified": 1727060013,
|
||||
"narHash": "sha256-/fC5YlJy4IoAW9GhkJiwyzk0K/gQd9Qi4rRcoweyG9E=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "6b40cc876c929bfe1e3a24bf538ce3b5622646ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1727089097,
|
||||
"narHash": "sha256-ZMHMThPsthhUREwDebXw7GX45bJnBCVbfnH1g5iuSPc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "568bfef547c14ca438c56a0bece08b8bb2b71a9c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
133
flake.nix
133
flake.nix
|
@ -1,77 +1,80 @@
|
|||
{
|
||||
description = "romodoro builder";
|
||||
description = "Romodoro flake";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
supportedSystems =
|
||||
[
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system;
|
||||
});
|
||||
outputs = { self, nixpkgs, crane, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
in
|
||||
{
|
||||
craneLib = crane.mkLib pkgs;
|
||||
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
in
|
||||
{
|
||||
default = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "romodoro";
|
||||
version = "0.1.1";
|
||||
src = ./.;
|
||||
commonArgs = {
|
||||
src = craneLib.cleanCargoSource ./.;
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = with pkgs;[
|
||||
pkg-config
|
||||
alsa-oss
|
||||
alsa-lib.dev
|
||||
alsa-utils
|
||||
git
|
||||
cmake
|
||||
];
|
||||
buildInputs = with pkgs;[
|
||||
alsa-oss
|
||||
alsa-lib.dev
|
||||
alsa-utils
|
||||
git
|
||||
pkg-config
|
||||
git
|
||||
cmake
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
romodoro = craneLib.buildPackage (commonArgs // {
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.pkg-config
|
||||
pkgs.alsa-oss
|
||||
pkgs.alsa-lib.dev
|
||||
pkgs.alsa-utils
|
||||
pkgs.git
|
||||
pkgs.cmake
|
||||
];
|
||||
buildInputs = [
|
||||
pkgs.alsa-oss
|
||||
pkgs.alsa-lib.dev
|
||||
pkgs.alsa-utils
|
||||
pkgs.git
|
||||
pkgs.pkg-config
|
||||
pkgs.git
|
||||
pkgs.cmake
|
||||
];
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
inherit romodoro;
|
||||
};
|
||||
|
||||
devShells.default =
|
||||
with nixpkgs; mkShell
|
||||
{
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages_17.libclang.lib}/lib";
|
||||
RUST_BACKTRACE = 1;
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
packages.default = romodoro;
|
||||
|
||||
packages = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
rustup
|
||||
pkg-config
|
||||
openssl
|
||||
];
|
||||
};
|
||||
};
|
||||
apps.default = flake-utils.lib.mkApp {
|
||||
drv = romodoro;
|
||||
};
|
||||
|
||||
devShells.default = craneLib.devShell {
|
||||
# Inherit inputs from checks.
|
||||
checks = self.checks.${system};
|
||||
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages_17.libclang.lib}/lib";
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
packages = with pkgs; [
|
||||
openssl
|
||||
pkg-config
|
||||
libiconv
|
||||
|
||||
alsa-oss
|
||||
alsa-lib.dev
|
||||
alsa-utils
|
||||
git
|
||||
pkg-config
|
||||
git
|
||||
cmake
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue