Skip to content

Commit 3c8858a

Browse files
committed
update flake to match main
1 parent 1d1e2d1 commit 3c8858a

File tree

2 files changed

+58
-88
lines changed

2 files changed

+58
-88
lines changed

flake.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 40 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,91 +6,61 @@
66
flake-parts.url = "github:hercules-ci/flake-parts";
77
rust-overlay.url = "github:oxalica/rust-overlay";
88
systems = {
9-
url = "github:nix-systems/default";
10-
flake = false;
9+
url = "github:nix-systems/default";
10+
flake = false;
1111
};
1212
};
1313

14-
outputs = inputs@{ flake-parts, ... }:
14+
outputs = inputs @ { flake-parts, ... }:
1515
flake-parts.lib.mkFlake { inherit inputs; } {
16-
imports = [];
16+
imports = [ ];
1717

1818
systems = import inputs.systems;
1919

20-
perSystem = { config, self', inputs', pkgs, system, lib, ... }:
20+
perSystem =
21+
{ config
22+
, self'
23+
, inputs'
24+
, pkgs
25+
, system
26+
, lib
27+
, ...
28+
}:
2129
let
22-
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
2330
rust-toolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
24-
extensions = [ "rust-src" "rust-analyzer" ];
31+
extensions = [ "rust-src" "rust-analyzer" ];
2532
};
2633

27-
runtimeDeps = with pkgs; if stdenv.isDarwin then [
28-
darwin.libobjc
29-
darwin.apple_sdk_11_0.frameworks.AppKit
30-
darwin.apple_sdk_11_0.frameworks.AVFoundation
31-
darwin.apple_sdk_11_0.frameworks.Vision
32-
] else (with pkgs; [
33-
(lib.getLib gcc-unwrapped)
34-
fontconfig
35-
libGL
36-
libxkbcommon
37-
vulkan-loader
38-
wayland
39-
]) ++ (with pkgs.xorg; [
40-
libX11
41-
libXcursor
42-
libXi
43-
libXrandr
44-
libxcb
45-
]);
34+
mkRio = import ./pkgRio.nix;
4635

47-
buildDeps = with pkgs; [
48-
ncurses
49-
] ++ lib.optionals stdenv.isLinux [
50-
pkg-config
51-
cmake
52-
autoPatchelfHook
53-
];
54-
55-
rustPackage = rust-toolchain: pkgs.rustPlatform.buildRustPackage {
56-
inherit (cargoToml.workspace.package) version;
57-
name = "rio";
58-
src = ./.;
59-
cargoLock.lockFile = ./Cargo.lock;
60-
buildInputs = runtimeDeps ++ buildDeps;
61-
nativeBuildInputs = buildDeps;
62-
buildNoDefaultFeatures = true;
63-
buildFeatures = [ "x11" "wayland" ];
64-
meta = {
65-
description = "A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers";
66-
homepage = "https://raphamorim.io/rio";
67-
license = lib.licenses.mit;
68-
platforms = lib.platforms.unix;
69-
changelog = "https://github.com/raphamorim/rio/blob/master/CHANGELOG.md";
70-
mainProgram = "rio";
71-
};
72-
};
73-
74-
mkDevShell = rust-toolchain: pkgs.mkShell {
75-
LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath (runtimeDeps ++ buildDeps)}:$LD_LIBRARY_PATH";
76-
packages = buildDeps ++ runtimeDeps ++ [ rust-toolchain ];
36+
mkDevShell = rust-toolchain:
37+
let
38+
dependencies = self'.packages.rio.nativeBuildInputs ++ self'.packages.rio.buildInputs;
39+
in
40+
pkgs.mkShell {
41+
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath dependencies}:$LD_LIBRARY_PATH";
42+
packages = dependencies ++ [ rust-toolchain ];
43+
};
44+
in
45+
{
46+
_module.args.pkgs = import inputs.nixpkgs {
47+
inherit system;
48+
overlays = [ (import inputs.rust-overlay) ];
7749
};
78-
in
79-
{
80-
_module.args.pkgs = import inputs.nixpkgs {
81-
inherit system;
82-
overlays = [ (import inputs.rust-overlay) ];
83-
};
8450

85-
formatter = pkgs.alejandra;
86-
packages.default = self'.packages.rio;
87-
devShells.default = self'.devShells.msrv;
51+
formatter = pkgs.alejandra;
52+
packages.default = self'.packages.rio;
53+
devShells.default = self'.devShells.msrv;
8854

89-
packages.rio = (rustPackage "rio");
55+
apps.default = {
56+
type = "app";
57+
program = self'.packages.default;
58+
};
59+
packages.rio = pkgs.callPackage mkRio { };
9060

91-
devShells.msrv = (mkDevShell rust-toolchain);
92-
devShells.stable = (mkDevShell pkgs.rust-bin.stable.latest.default);
93-
devShells.nightly = (mkDevShell (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)));
61+
devShells.msrv = mkDevShell rust-toolchain;
62+
devShells.stable = mkDevShell pkgs.rust-bin.stable.latest.default;
63+
devShells.nightly = mkDevShell (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default));
64+
};
9465
};
95-
};
9666
}

0 commit comments

Comments
 (0)