summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakka <jakka@jakka.su>2026-05-10 20:57:37 +0300
committerjakka <jakka@jakka.su>2026-05-10 20:57:37 +0300
commiteda73353c4a9c90edac0c71d6cd25ebc54aebc59 (patch)
tree94891b7f37a15b4db9f344f508750f858d2813cf
parent55dba532207bcf8c575550e177b782ba9b002029 (diff)
set up flake for development
-rw-r--r--.envrc1
-rw-r--r--flake.lock122
-rw-r--r--flake.nix52
3 files changed, 175 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..fe81da1
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,122 @@
+{
+ "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"
+ },
+ "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"
+ }
+ },
+ "naersk": {
+ "inputs": {
+ "fenix": "fenix",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1778151388,
+ "narHash": "sha256-lldMJPUeouEjO8/7aLuwhcsIw29vVihm2ZALzjiqfec=",
+ "owner": "nix-community",
+ "repo": "naersk",
+ "rev": "efdddff9ff4d8e7d0056d57ec67dac50f75ab8f6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "naersk",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1778274207,
+ "narHash": "sha256-I4puXmX1iovcCHZlRmztO3vW0mAbbRvq4F8wgIMQ1MM=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "naersk": "naersk",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "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"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ca8a0ad
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,52 @@
+{
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ naersk = {
+ url = "github:nix-community/naersk";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ };
+
+ outputs =
+ {
+ flake-utils,
+ naersk,
+ nixpkgs,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = (import nixpkgs) { inherit system; };
+
+ naersk' = pkgs.callPackage naersk { };
+
+ in
+ {
+ # For `nix build` & `nix run`:
+ packages.default = naersk'.buildPackage {
+ src = ./.;
+ nativeBuildInputs = with pkgs; [
+ cmake
+ flac
+ sqlite
+ ];
+ };
+
+ # For `nix develop`:
+ devShell = pkgs.mkShell {
+ nativeBuildInputs = with pkgs; [
+ cargo
+ rustc
+ ];
+ packages = with pkgs; [
+ nixd
+ nixfmt
+ rust-analyzer
+ clippy
+ ];
+ };
+ }
+ );
+}