Skip to content

Commit

Permalink
style: format flake
Browse files Browse the repository at this point in the history
  • Loading branch information
nydragon committed May 24, 2024
1 parent 3455391 commit 9876c63
Showing 1 changed file with 36 additions and 22 deletions.
58 changes: 36 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
nixpkgs,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
overlays = [ (import rust-overlay) ];
Expand All @@ -23,32 +30,39 @@
src = ./.;
cargoLock.lockFile = ./Cargo.lock;

meta = with nixpkgs.lib; {
meta = {
description = manifest.description;
license = licenses.unlicense;
license = nixpkgs.lib.licenses.unlicense;
maintainers = [ ];
};
};
in {
packages = { rustPackage = myRustBuild; };
in
{
packages = {
rustPackage = myRustBuild;
};
defaultPackage = myRustBuild;
devShell = pkgs.mkShell {
buildInputs =
[ (rustVersion.override { extensions = [ "rust-src" ]; }) ];
shellHook = let
cargo = "${pkgs.cargo}/bin/cargo";
rofi = "${pkgs.rofi}/bin/rofi";
bin = "rofi-obsidian";
rofiDebug = "rofi-obsidian-debug";
rofiRelease = "rofi-obsidian-release";
in ''
alias ${rofiDebug}="${cargo} build && ${rofi} -show o -modes o:./target/debug/${bin}"
alias ${rofiRelease}="${cargo} build --profile release && ${rofi} -show o -modes o:./target/release/${bin}"
buildInputs = [
(rustVersion.override { extensions = [ "rust-src" ]; })
pkgs.git-cliff
];
shellHook =
let
cargo = "${pkgs.cargo}/bin/cargo";
rofi = "${pkgs.rofi}/bin/rofi";
bin = "rofi-obsidian";
rofiDebug = "rofi-obsidian-debug";
rofiRelease = "rofi-obsidian-release";
in
''
alias ${rofiDebug}="${cargo} build && ${rofi} -show o -modes o:./target/debug/${bin}"
alias ${rofiRelease}="${cargo} build --profile release && ${rofi} -show o -modes o:./target/release/${bin}"
echo "Use ${rofiDebug} to build and run the debuging version with rofi."
echo "Use ${rofiRelease} to build and run the release version with rofi."
'';
echo "Use ${rofiDebug} to build and run the debuging version with rofi."
echo "Use ${rofiRelease} to build and run the release version with rofi."
'';
};
});

}
);
}

0 comments on commit 9876c63

Please sign in to comment.