Skip to content

Commit

Permalink
nix files
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Apr 25, 2024
1 parent fadf5a3 commit 495cf17
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 61 deletions.
9 changes: 9 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs ? import <nixpkgs> { } }:
let manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in
pkgs.rustPlatform.buildRustPackage rec {
pname = manifest.name;
version = manifest.version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
}
47 changes: 7 additions & 40 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 15 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
{
description = "tex-fmt";
description = "A LaTeX formatter written in Rust";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
with flake-utils.lib;
eachSystem allSystems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
defaultPackage = pkgs.rustPlatform.buildRustPackage {
pname = "tex-fmt";
version = "0.1.0";
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
};
}
);
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./default.nix { };
});
devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./shell.nix { };
});
};
}
9 changes: 9 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
inputsFrom = [ (pkgs.callPackage ./default.nix { }) ];
buildInputs = with pkgs; [
rust-analyzer
rustfmt
clippy
];
}

0 comments on commit 495cf17

Please sign in to comment.