Skip to content

Commit

Permalink
nix: Use flake-parts
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Salvador <[email protected]>
  • Loading branch information
otavio committed Oct 22, 2024
1 parent 8fdd518 commit a3cf767
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 38 deletions.
119 changes: 94 additions & 25 deletions flake.lock

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

60 changes: 47 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,30 +1,64 @@
{
description = "rsget";

inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
flake-utils = {
url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};

nix-github-actions = {
url = "github:nix-community/nix-github-actions";
inputs.nixpkgs.follows = "nixpkgs";
};

rust-flake = {
url = "github:juspay/rust-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell = pkgs.mkShell {
outputs = inputs@{ flake-parts, ... }:
let
inherit (inputs.nixpkgs) lib;
inherit (inputs) self;
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.rust-flake.flakeModules.default
inputs.rust-flake.flakeModules.nixpkgs
];

systems = lib.systems.flakeExposed;

flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks = lib.getAttrs [ "x86_64-linux" ] self.checks;
};

perSystem = { self', config, pkgs, ... }: {
packages.default = self'.packages.rsget;

rust-project.crates.rsget.crane.args = {
buildInputs = with pkgs; [
pkg-config
openssl
];
};


devShells.default = pkgs.mkShell {
inputsFrom = [
self'.packages.rsget
];

packages = with pkgs; [
cargo
rustc
rustfmt
clippy
rust-analyzer
];
};
});
};
};
}
1 change: 1 addition & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stable

0 comments on commit a3cf767

Please sign in to comment.