nix package

This commit is contained in:
Robin Appelman 2026-10-25 23:11:12 +01:00
commit 70edec329d
4 changed files with 91 additions and 87 deletions

83
flake.lock generated
View file

@ -1,5 +1,25 @@
{
"nodes": {
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1792489355,
"narHash": "sha256-2PmFySKU1QBQD2U8ni5Ww0Mj4VGG+JoWDdiUMe0rCMY=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "3d088d158d9b0606298d33b80a55ecc1f592104e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1788982361,
@ -15,39 +35,25 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flakelight": "flakelight",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1788938153,
"narHash": "sha256-czAKV0qN7TtdlGIREdDAJmoATGH0lfF7wNO8OMVToCw=",
"lastModified": 1792913333,
"narHash": "sha256-wjoZGhxH/Yr+OsFRpNyV9DpMGQIdNEjjAOinfzQvadk=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "5280ed136f4359ce3f977b0c4c4dab6a34254201",
"rev": "fad80eb74614f7dc37c1c83df8caae64361eda22",
"type": "github"
},
"original": {
@ -55,39 +61,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -1,23 +1,32 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/release-26.05";
rust-overlay.url = "github:oxalica/rust-overlay";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
utils,
flakelight,
rust-overlay,
...
}:
utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
flakelight ./. {
withOverlays = [
(import rust-overlay)
(import ./nix/overlay.nix)
];
packages = {
demostf-edit = pkgs: pkgs.demostf-edit;
};
in {
devShell = pkgs.mkShell {
devShells.default = pkgs:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(rust-bin.stable.latest.default.override {
targets = ["wasm32-unknown-unknown"];
@ -39,5 +48,5 @@
buildInputs = with pkgs; [openssl];
OPENSSL_NO_VENDOR = 1;
};
});
};
}

3
nix/overlay.nix Normal file
View file

@ -0,0 +1,3 @@
final: prev: {
demostf-edit = final.callPackage ./package.nix { };
}

19
nix/package.nix Normal file
View file

@ -0,0 +1,19 @@
{ rustPlatform }:
let
inherit (builtins) fromTOML readFile;
version = (fromTOML (readFile ../wasm/Cargo.toml)).package.version;
in
rustPlatform.buildRustPackage {
pname = "demostf-edit";
inherit version;
cargoBuildFlags = ''
--features cli
'';
src = ../wasm;
cargoLock = {
lockFile = ../wasm/Cargo.lock;
};
}