Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ tarpaulin-report.html
build_rs_cov.profraw
registry/data
data
manifest.schema.json
manifest.schema.json
/.direnv
**/result
11 changes: 11 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
flakeCompat = fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
};
pesde = import flakeCompat {
src = ./.;
};
in
pesde.defaultNix
76 changes: 76 additions & 0 deletions flake.lock

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

29 changes: 29 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
description = "pesde; A package manager for the Luau programming language, supporting multiple runtimes including Roblox and Lune";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = {
flake-utils,
nixpkgs,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
treefmtEval = inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} ./treefmt.nix;
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = import ./nix/shell.nix {inherit pkgs;};

packages = let
pesde = pkgs.callPackage ./nix/package.nix {};
in {
inherit pesde;
default = pesde;
};
});
}
37 changes: 37 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
rustPlatform,
pkg-config,
openssl,
dbus,
}:
rustPlatform.buildRustPackage (_finalAttrs: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Nix is to be added, I think I'd prefer for it to use crate2nix.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would agree for the packaging within this repository, but when upstreaming it to nixpkgs this would be a bad idea.

pname = "pesde";
version = "0.7.1";
Comment on lines +9 to +10
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally these would be read from the Cargo manifest.


src = ../.;

cargoHash = "sha256-7rEU4vU6qp6eaj777cC3BgrRyiLRe+5xZC+cqV5TTc4=";

buildNoDefaultFeatures = true;
buildFeatures = [
"bin"
"version-management"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually made version-management in mind to be disabled when using Nix, as it manages pesde's and engines' executables, which is impure. Additionally, you'd most likely want wally-compat and patches enabled for Nix users.

];

nativeBuildInputs = [
pkg-config
];
buildInputs = [
openssl
dbus
];

meta = {
mainProgram = "pesde";
description = "A package manager for the Luau programming language, supporting multiple runtimes including Roblox and Lune";
homepage = "https://github.com/pesde-pkg/pesde";
license = lib.licenses.mit;
maintainers = [];
};
})
14 changes: 14 additions & 0 deletions nix/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{pkgs ? import <nixpkgs> {}, ...}: pkgs.mkShell {
packages = with pkgs; [
pkg-config
openssl
dbus
cargo
rustc
clippy
rust-analyzer
(rustfmt.override {
asNightly = true;
})
];
}