cosmic-comp/flake.nix

70 lines
2.1 KiB
Nix
Raw Normal View History

2022-12-31 14:04:06 -08:00
{
description = "Compositor for the COSMIC desktop environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, crane, fenix }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.stable.toolchain;
pkgDef = {
src = pkgs.nix-gitignore.gitignoreSource [
"flake.nix"
"flake.lock"
"data"
"debian"
"LICENSE"
] ./.;
nativeBuildInputs = with pkgs; [ pkg-config autoPatchelfHook ];
buildInputs = with pkgs; [
wayland
systemd # For libudev
seatd # For libseat
libxkbcommon
libinput
mesa # For libgbm
];
runtimeDependencies = with pkgs; [ libglvnd ]; # For libEGL
};
cargoArtifacts = craneLib.buildDepsOnly pkgDef;
cosmic-comp = craneLib.buildPackage (pkgDef // {
inherit cargoArtifacts;
});
in {
checks = {
inherit cosmic-comp;
};
packages.default = cosmic-comp;
apps.default = flake-utils.lib.mkApp {
drv = cosmic-comp;
};
devShells.default = pkgs.mkShell rec {
inputsFrom = builtins.attrValues self.checks.${system};
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath (builtins.concatMap (d: d.runtimeDependencies) inputsFrom);
};
});
nixConfig = {
# Cache for the Rust toolchain in fenix
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
}