greg-ng/flake.nix

76 lines
1.9 KiB
Nix
Raw Normal View History

2024-04-18 22:03:35 +02:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
2024-04-18 22:03:35 +02:00
outputs = { self, nixpkgs, rust-overlay }:
let
2024-08-04 04:08:34 +02:00
inherit (nixpkgs) lib;
2024-04-18 22:03:35 +02:00
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
2024-04-18 22:03:35 +02:00
"aarch64-darwin"
"armv7l-linux"
2024-04-18 22:03:35 +02:00
];
2024-08-04 04:08:34 +02:00
forAllSystems = f: lib.genAttrs systems (system: let
2024-04-18 22:03:35 +02:00
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
2024-04-18 22:03:35 +02:00
];
};
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
2024-10-20 19:47:55 +02:00
toolchain = rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "rust-std" ];
};
2024-04-18 22:03:35 +02:00
in f system pkgs toolchain);
in {
2024-08-04 04:08:34 +02:00
apps = forAllSystems (system: pkgs: _: {
default = self.apps.${system}.greg-ng;
greg-ng = let
package = self.packages.${system}.greg-ng-wrapped;
2024-08-04 04:08:34 +02:00
in {
type = "app";
2024-10-30 01:53:36 +01:00
program = toString (pkgs.writeShellScript "greg-ng" ''
${lib.getExe package} --mpv-socket-path /tmp/greg-ng-mpv.sock -vvvv
'');
2024-08-04 04:08:34 +02:00
};
});
devShells = forAllSystems (system: pkgs: toolchain: {
default = pkgs.mkShell {
nativeBuildInputs = [
toolchain
pkgs.mpv
];
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
};
2024-04-18 22:03:35 +02:00
});
2024-08-04 04:08:34 +02:00
2024-08-04 19:26:01 +02:00
overlays = {
default = self.overlays.greg-ng;
greg-ng = final: prev: {
inherit (self.packages.${prev.system}) greg-ng;
};
};
2024-08-04 04:08:34 +02:00
packages = forAllSystems (system: pkgs: _: {
default = self.packages.${system}.greg-ng;
greg-ng = pkgs.callPackage ./default.nix { };
greg-ng-wrapped = pkgs.callPackage ./default.nix {
wrapped = true;
};
2024-08-04 04:08:34 +02:00
});
2024-08-04 19:26:01 +02:00
} // {
nixosModules.default = ./module.nix;
2024-04-18 22:03:35 +02:00
};
2024-08-04 04:08:34 +02:00
}