Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding nix default package to flake #260

Closed
wants to merge 2 commits into from
Closed
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"swhkd",
"swhks"
]
resolver = "2"

[profile.release]
lto = true # Enable Link Time Optimization
Expand Down
39 changes: 39 additions & 0 deletions flake.lock

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

52 changes: 42 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
{
description = "Swhkd devel";

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

outputs = { self, nixpkgs, ... }:
outputs = { self, nixpkgs, fenix, ... }:
let
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ ];
overlays = [ fenix.overlays.default ];
};

targetSystems = [ "aarch64-linux" "x86_64-linux" ];
in {
in
{
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let pkgs = pkgsFor system;
in {
default = pkgs.mkShell {
name = "Swhkd-devel";
nativeBuildInputs = with pkgs; [
# Compilers
cargo
rustc
scdoc

(pkgs.fenix.complete.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
])
# libs
udev

Expand All @@ -32,13 +41,36 @@
clippy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using clippy here if we included it as a fenix component?

gdb
gnumake
rust-analyzer
rust-analyzer-nightly
rustfmt
strace
valgrind
zip
];
};
});
packages = nixpkgs.lib.genAttrs targetSystems (system:
let
toolchain = fenix.packages.${system}.minimal.toolchain;
pkgs = pkgsFor system;
in
{
default = (pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
}).buildRustPackage {
pname = "swhkd";
version = "1.2.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ udev ];
};
});
overlays = nixpkgs.lib.genAttrs targetSystems (system: {
default = final: prev: {
swhkd = self.packages.${system}.default;
};
});
};
}
Loading