summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--flake.lock77
-rw-r--r--flake.nix63
3 files changed, 104 insertions, 37 deletions
diff --git a/.gitignore b/.gitignore
index a35b68e..e7e3aaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/target
/hydrus
/assets
+/result
diff --git a/flake.lock b/flake.lock
index 2cdfc30..7114308 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,27 @@
{
"nodes": {
+ "fenix": {
+ "inputs": {
+ "nixpkgs": [
+ "naersk",
+ "nixpkgs"
+ ],
+ "rust-analyzer-src": "rust-analyzer-src"
+ },
+ "locked": {
+ "lastModified": 1752475459,
+ "narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=",
+ "owner": "nix-community",
+ "repo": "fenix",
+ "rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "fenix",
+ "type": "github"
+ }
+ },
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -18,34 +40,39 @@
"type": "github"
}
},
- "nixpkgs": {
+ "naersk": {
+ "inputs": {
+ "fenix": "fenix",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
"locked": {
- "lastModified": 1761907660,
- "narHash": "sha256-kJ8lIZsiPOmbkJypG+B5sReDXSD1KGu2VEPNqhRa/ew=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "2fb006b87f04c4d3bdf08cfdbc7fab9c13d94a15",
+ "lastModified": 1752689277,
+ "narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=",
+ "owner": "nix-community",
+ "repo": "naersk",
+ "rev": "0e72363d0938b0208d6c646d10649164c43f4d64",
"type": "github"
},
"original": {
- "owner": "NixOS",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
+ "owner": "nix-community",
+ "repo": "naersk",
"type": "github"
}
},
- "nixpkgs_2": {
+ "nixpkgs": {
"locked": {
- "lastModified": 1744536153,
- "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
+ "lastModified": 1762233356,
+ "narHash": "sha256-cGS3lLTYusbEP/IJIWGgnkzIl+FA5xDvtiHyjalGr4k=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
+ "rev": "ca534a76c4afb2bdc07b681dbc11b453bab21af8",
"type": "github"
},
"original": {
"owner": "NixOS",
- "ref": "nixpkgs-unstable",
+ "ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
@@ -53,13 +80,33 @@
"root": {
"inputs": {
"flake-utils": "flake-utils",
+ "naersk": "naersk",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
+ "rust-analyzer-src": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1752428706,
+ "narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=",
+ "owner": "rust-lang",
+ "repo": "rust-analyzer",
+ "rev": "591e3b7624be97e4443ea7b5542c191311aa141d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "rust-lang",
+ "ref": "nightly",
+ "repo": "rust-analyzer",
+ "type": "github"
+ }
+ },
"rust-overlay": {
"inputs": {
- "nixpkgs": "nixpkgs_2"
+ "nixpkgs": [
+ "nixpkgs"
+ ]
},
"locked": {
"lastModified": 1762137611,
diff --git a/flake.nix b/flake.nix
index 9335cc4..69e985c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,8 +1,17 @@
{
inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
- rust-overlay.url = "github:oxalica/rust-overlay";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils";
+
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ naersk = {
+ url = "github:nix-community/naersk";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs =
@@ -10,6 +19,7 @@
self,
nixpkgs,
rust-overlay,
+ naersk,
flake-utils,
...
}:
@@ -18,31 +28,40 @@
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
- in
- {
- devShells.default =
- with pkgs;
- mkShell {
- buildInputs = [
- glibc
- gcc
- lldb
- openssl
- pkg-config
- musl
- rust-bin.stable.latest.default
- rust-analyzer
- nixd
- nixfmt-rfc-style
- ];
- };
-
- rust-bin.stable.latest.default.override = {
+ rustToolchain = pkgs.rust-bin.stable.latest.default.override {
+ extensions = [
+ "rust-src"
+ "rust-analyzer"
+ ];
targets = [
"x86_64-unknown-linux-gnu"
"x86_64-unknown-linux-musl"
];
};
+
+ naersk-lib = pkgs.callPackage naersk {
+ cargo = rustToolchain;
+ rustc = rustToolchain;
+ };
+ in
+ {
+ devShells.default = pkgs.mkShell {
+ buildInputs = with pkgs; [ rustToolchain ];
+ RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
+ };
+
+ checks = {
+ build = self.packages.${system}.default;
+ };
+
+ packages.default = naersk-lib.buildPackage {
+ src = ./.;
+
+ buildInputs = with pkgs; [
+ openssl
+ glibc
+ ];
+ };
}
);
}