diff --git a/README.md b/README.md index 1771994e..fafb72c9 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,14 @@ paru/yay -S presenterm-bin # for binary paru/yay -S presenterm-git # for Building from source ``` +## Nix Flake + +If you're a Nix user a Nix Flake is available: + +```shell +nix run github:mfontanini/presenterm +``` + # Features * Define your presentation in a single markdown file. diff --git a/build.rs b/build.rs index 78aaffbc..302c2020 100644 --- a/build.rs +++ b/build.rs @@ -28,7 +28,7 @@ fn main() -> io::Result<()> { output_file.write_all(format!("(\"{theme_name}\", {contents:?}.as_slice()),\n").as_bytes())?; // Rebuild if this theme changes. - println!("cargo:rerun-if-changed={path:?}"); + println!("cargo:rerun-if-changed={}", path.display()); } output_file.write_all(b"]));\n")?; Ok(()) diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..1f5117ec --- /dev/null +++ b/flake.lock @@ -0,0 +1,373 @@ +{ + "nodes": { + "android-nixpkgs": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "flakebox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695500413, + "narHash": "sha256-yinrAWIc4XZbWQoXOYkUO0lCNQ5z/vMyl+QCYuIwdPc=", + "owner": "dpc", + "repo": "android-nixpkgs", + "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "type": "github" + }, + "original": { + "owner": "dpc", + "repo": "android-nixpkgs", + "rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4", + "type": "github" + } + }, + "crane": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "flakebox", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1697596235, + "narHash": "sha256-4VTrrTdoA1u1wyf15krZCFl3c29YLesSNioYEgfb2FY=", + "owner": "dpc", + "repo": "crane", + "rev": "c97a0c0d83bfdf01c29113c5592a3defc27cb315", + "type": "github" + }, + "original": { + "owner": "dpc", + "repo": "crane", + "rev": "c97a0c0d83bfdf01c29113c5592a3defc27cb315", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": [ + "flakebox", + "android-nixpkgs", + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1695195896, + "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=", + "owner": "numtide", + "repo": "devshell", + "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "flakebox", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1696918968, + "narHash": "sha256-18rAHsM9YsGp7aKKemO4gKIeWfrSyDsdJZ/mk4dQ3JI=", + "owner": "nix-community", + "repo": "fenix", + "rev": "638fc95a2a3d01b372c76f71cbb6d73c63909d6e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": [ + "flakebox", + "systems" + ] + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flakebox": { + "inputs": { + "android-nixpkgs": "android-nixpkgs", + "crane": "crane", + "fenix": "fenix", + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "systems": "systems_5" + }, + "locked": { + "lastModified": 1697686719, + "narHash": "sha256-6zdm+kBKng88fl4LyuubTJrdUypFUlrtazE9OMgJjk0=", + "owner": "rustshop", + "repo": "flakebox", + "rev": "41e88a8c6910829ec598ee356325e515de043541", + "type": "github" + }, + "original": { + "owner": "rustshop", + "repo": "flakebox", + "rev": "41e88a8c6910829ec598ee356325e515de043541", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1696697597, + "narHash": "sha256-q26Qv4DQ+h6IeozF2o1secyQG0jt2VUT3V0K58jr3pg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5a237aecb57296f67276ac9ab296a41c23981f56", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1697456312, + "narHash": "sha256-roiSnrqb5r+ehnKCauPLugoU8S36KgmWraHgRqVYndo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ca012a02bf8327be9e488546faecae5e05d7d749", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "flakebox": "flakebox" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1696840854, + "narHash": "sha256-wphOvjDSDsUN5DMe3MOhdargANIab7YE3hkh3Qv7qso=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "aaa1e8e1b82d742b876d164a30dda02f318ce809", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flakebox", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "flakebox", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695003086, + "narHash": "sha256-d1/ZKuBRpxifmUf7FaedCqhy0lyVbqj44Oc2s+P5bdA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b87a14abea512d956f0b89d0d8a1e9b41f3e20ff", + "type": "github" + }, + "original": { + "owner": "oxalica", + "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" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "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 00000000..3767bcc4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,60 @@ +{ + description = "A terminal slideshow tool"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + flakebox = { + url = "github:rustshop/flakebox?rev=41e88a8c6910829ec598ee356325e515de043541"; + }; + }; + + outputs = { self, flake-utils, flakebox }: + flake-utils.lib.eachDefaultSystem (system: + let + projectName = "presenterm"; + + flakeboxLib = flakebox.lib.${system} { + config = { + github.ci.buildOutputs = [ ".#ci.${projectName}" ]; + }; + }; + + buildPaths = [ + "build.rs" + "Cargo.toml" + "Cargo.lock" + ".cargo" + "src" + "themes" + ]; + + buildSrc = flakeboxLib.filterSubPaths { + root = builtins.path { + name = projectName; + path = ./.; + }; + paths = buildPaths; + }; + + multiBuild = + (flakeboxLib.craneMultiBuild { }) (craneLib': + let + craneLib = (craneLib'.overrideArgs { + pname = projectName; + src = buildSrc; + nativeBuildInputs = [ ]; + }); + in + { + ${projectName} = craneLib.buildPackage { }; + }); + in + { + packages.default = multiBuild.${projectName}; + + legacyPackages = multiBuild; + + devShells = flakeboxLib.mkShells { }; + } + ); +}