nix/package: init

This commit is contained in:
2026-04-25 19:29:13 +09:00
parent 1f68f0df5d
commit cdc4b7d03e
3 changed files with 130 additions and 1 deletions
+29 -1
View File
@@ -4,9 +4,11 @@
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
};
outputs = { self, nixpkgs, rust-overlay }:
outputs = { self, nixpkgs, rust-overlay, crane }:
let
inherit (nixpkgs) lib;
@@ -31,6 +33,32 @@
};
in f system pkgs toolchain);
in {
apps = forAllSystems (system: _: _: {
default = self.apps.${system}.kagami;
kagami = {
type = "app";
program = lib.getExe self.packages.${system}.kagami;
};
});
packages = forAllSystems (system: pkgs: _: {
default = self.packages.${system}.kagami;
kagami = let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
cargoLock = ./Cargo.lock;
craneLib = crane.mkLib pkgs;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
(craneLib.fileset.commonCargoSources ./.)
];
};
in pkgs.callPackage ./nix/package.nix {
useCrane = true;
inherit cargoToml cargoLock src craneLib;
};
});
devShells = forAllSystems (system: pkgs: toolchain: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [