1
0
mirror of https://github.com/mfontanini/presenterm.git synced 2026-09-01 23:33:21 -06:00

nix: refactor and clean up flake

This commit is contained in:
faukah 2026-04-23 14:55:36 +02:00
parent 3bc5e91945
commit 1f3b4f07d0
5 changed files with 78 additions and 338 deletions

View File

@ -65,7 +65,7 @@ jobs:
- name: Install nix
uses: DeterminateSystems/nix-installer-action@v17
- name: Build
run: nix build .#dev.presenterm
run: nix build .#presenterm
bat-assets:
name: Validate bat assets

286
flake.lock generated
View File

@ -1,291 +1,21 @@
{
"nodes": {
"android-nixpkgs": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"flakebox",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762287806,
"narHash": "sha256-tmF7Fm2VNukLV32w60QiFLDJB4cO26lhKdDLR8k1BX0=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "d3cbdd2a82b3d054b4e283d28ba27548186a88e7",
"type": "github"
},
"original": {
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "d3cbdd2a82b3d054b4e283d28ba27548186a88e7",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1758758545,
"narHash": "sha256-NU5WaEdfwF6i8faJ2Yh+jcK9vVFrofLcwlD/mP65JrI=",
"owner": "ipetkov",
"repo": "crane",
"rev": "95d528a5f54eaba0d12102249ce42f4d01f4e364",
"type": "github"
},
"original": {
"owner": "ipetkov",
"ref": "v0.21.1",
"repo": "crane",
"type": "github"
}
},
"crane_2": {
"locked": {
"lastModified": 1755993354,
"narHash": "sha256-FCRRAzSaL/+umLIm3RU3O/+fJ2ssaPHseI2SSFL8yZU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "25bd41b24426c7734278c2ff02e53258851db914",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"flakebox",
"android-nixpkgs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"owner": "numtide",
"repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"flakebox",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1767941162,
"narHash": "sha256-7qJDycrXto4xrQWHbj5BkrRWt/hcfZtjlCstEJTyfJ8=",
"owner": "nix-community",
"repo": "fenix",
"rev": "80b1a19a713e2558c411f3259fecb1edd4b5b327",
"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"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"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"
}
},
"flake-utils_3": {
"inputs": {
"systems": [
"flakebox",
"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"
}
},
"flakebox": {
"inputs": {
"android-nixpkgs": "android-nixpkgs",
"crane": "crane",
"fenix": "fenix",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs",
"systems": "systems_3",
"wild": "wild"
},
"locked": {
"lastModified": 1768170748,
"narHash": "sha256-RZ1PQEVhNtlqBYCvAA8eRSm4zmtpxZEFa88stifg25o=",
"owner": "rustshop",
"repo": "flakebox",
"rev": "62af969ab344229d2a0d585a482293b3f186b221",
"type": "github"
},
"original": {
"owner": "rustshop",
"repo": "flakebox",
"rev": "62af969ab344229d2a0d585a482293b3f186b221",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1767799921,
"narHash": "sha256-r4GVX+FToWVE2My8VVZH4V0pTIpnu2ZE8/Z4uxGEMBE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d351d0653aeb7877273920cd3e823994e7579b0b",
"type": "github"
"lastModified": 1776329215,
"narHash": "sha256-mBqzkn7oJti2hqeO8iTbDxKw+1ifxpP53feQ0CEXies=",
"rev": "b86751bc4085f48661017fa226dee99fab6c651b",
"type": "tarball",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre981196.b86751bc4085/nixexprs.tar.xz"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
"type": "tarball",
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"flakebox": "flakebox"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1767905519,
"narHash": "sha256-mRU9VEhGQE9dnOU3pu1Rx3dZO4NpZO+cnC0rPMFcCqE=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "ff9a2e88b14907562294838f83963e5966f717de",
"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"
}
},
"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"
}
},
"wild": {
"inputs": {
"crane": "crane_2",
"nixpkgs": [
"flakebox",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762215977,
"narHash": "sha256-x0IZuWjj0LRMj4pu2FVaD8SENm/UVtE1e4rl0EOZZZM=",
"owner": "davidlattimore",
"repo": "wild",
"rev": "7daaf0c89f7b4b9c9ded36e7b3c72aa6512537a1",
"type": "github"
},
"original": {
"owner": "davidlattimore",
"ref": "0.7.0",
"repo": "wild",
"type": "github"
"nixpkgs": "nixpkgs"
}
}
},

View File

@ -1,64 +1,24 @@
{
description = "A terminal slideshow tool";
inputs = {
flakebox = {
url = "github:rustshop/flakebox?rev=62af969ab344229d2a0d585a482293b3f186b221";
inputs.nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
outputs =
{ nixpkgs, self }:
let
inherit (nixpkgs.lib) genAttrs systems;
forEachSystem = genAttrs systems.flakeExposed;
pkgsForEach = nixpkgs.legacyPackages;
rev = self.shortRev or self.dirtyShortRev or "unknown";
in
{
packages = forEachSystem (system: {
presenterm = pkgsForEach.${system}.callPackage ./package.nix { inherit rev; };
default = self.packages.${system}.presenterm;
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix { };
});
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-utils, flakebox }:
flake-utils.lib.eachDefaultSystem (system:
let
projectName = "presenterm";
pkgs = flakebox.inputs.nixpkgs.legacyPackages.${system};
flakeboxLib = flakebox.lib.mkLib pkgs {
config = {
github.ci.buildOutputs = [ ".#ci.${projectName}" ];
};
};
buildPaths = [
"build.rs"
"Cargo.toml"
"Cargo.lock"
".cargo"
"src"
"themes"
"bat"
"executors.yaml"
];
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 { };
}
);
}

31
package.nix Normal file
View File

@ -0,0 +1,31 @@
{
lib,
rustPlatform,
rev ? "dirty",
}:
let
cargoToml = lib.importTOML ./Cargo.toml;
in
rustPlatform.buildRustPackage {
pname = "presenterm";
version = "${cargoToml.package.version}-${rev}";
src =
let
fs = lib.fileset;
in
fs.toSource {
root = ./.;
fileset = fs.unions [
./build.rs
./Cargo.toml
./Cargo.lock
./src
./themes
./bat
./executors.yaml
];
};
cargoLock.lockFile = ./Cargo.lock;
}

19
shell.nix Normal file
View File

@ -0,0 +1,19 @@
{
mkShellNoCC,
rustc,
cargo,
rustfmt,
clippy,
}:
mkShellNoCC {
packages = [
rustc
cargo
# Tools
rustfmt
clippy
];
strictDeps = true;
}