Skip to content

Commit

Permalink
nix: build with nix; move toolchain out of root
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Mar 19, 2024
1 parent 7fcdd5a commit 4c2c494
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
pkgsForEach = nixpkgs.legacyPackages;
in {
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
default = pkgsForEach.${system}.callPackage ./nix/shell.nix {};
});

packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./nix/package.nix {};
});
};
}
45 changes: 45 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
lib,
dbus,
python3,
pkg-config,
rustPlatform,
xorg,
rev ? "dirty",
}: let
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
in
rustPlatform.buildRustPackage {
pname = "tailray";
version = "${cargoToml.package.version}-${rev}";

src = lib.fileset.toSource {
root = ../.;
fileset =
lib.fileset.intersection
(lib.fileset.fromSource (lib.sources.cleanSource ../.))
(lib.fileset.unions [
../src
../Cargo.toml
../Cargo.lock
]);
};

cargoLock.lockFile = ../Cargo.lock;

strictDeps = true;

buildInputs = [dbus xorg.libxcb];
nativeBuildInputs = [
pkg-config
python3
];

meta = {
description = "Rust implementation of tailscale-systray";
homepage = "https://github.com/notashelf/tailray";
license = lib.licenses.gpl3Plus;
mainProgram = "tailray";
maintainers = with lib.maintainers; [NotAShelf];
};
}
File renamed without changes.

0 comments on commit 4c2c494

Please sign in to comment.