{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; systems.url = "github:nix-systems/default-linux"; naersk.url = "github:nix-community/naersk"; niri-flake.url = "github:sodiboo/niri-flake"; }; outputs = inputs: with inputs; let getPackages = builtins.attrValues; forAllSystems = function: nixpkgs.lib.genAttrs (import systems) (system: function nixpkgs.legacyPackages.${system}); deps = forAllSystems (pkgs: { naersk = pkgs.callPackages naersk { }; build = getPackages { inherit (pkgs) cargo rustc pkg-config systemdLibs ; }; dev = getPackages { inherit (pkgs) rust-analyzer rustfmt clippy ; }; }); in { devShells = forAllSystems (pkgs: { default = pkgs.mkShell { packages = with deps.${pkgs.system}; build ++ dev; RUST_SRC_DIR = "${pkgs.rustPlatform.rustLibSrc}"; RUST_LOG = "debug"; shellHook = '' cp -R ${niri-flake.inputs.niri-unstable} niri/ ''; }; }); packages = forAllSystems (pkgs: { unstable = deps.${pkgs.system}.naersk.buildPackage { src = ./.; RUSTFLAGS = "--cfg tokio_unstable"; preConfigure = '' cp -R ${niri-flake.inputs.niri-unstable} niri/ ''; }; stable = deps.${pkgs.system}.naersk.buildPackage { src = ./.; RUSTFLAGS = "--cfg tokio_unstable"; preBuild = '' cp -R ${niri-flake.inputs.niri-stable}/niri-ipc . ''; }; default = self.packages.${pkgs.system}.unstable; }); # TODO make module that compiles based on niri version }; }