Compare commits
3 Commits
runtime-co
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bee679d3e1 | ||
|
|
0660130653 | ||
| 659ec6af18 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -5,3 +5,7 @@ nimcache/
|
||||
demo.png/
|
||||
diag.png/
|
||||
diag.tape
|
||||
|
||||
# Nix
|
||||
result
|
||||
result-*
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1776548001,
|
||||
"narHash": "sha256-ZSK0NL4a1BwVbbTBoSnWgbJy9HeZFXLYQizjb2DPF24=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b12141ef619e0a9c1c84dc8c684040326f27cdcc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
116
flake.nix
Normal file
116
flake.nix
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
description = "Terminal oscilloscope with CRT phosphor rendering";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
forAllSystems = lib.genAttrs systems;
|
||||
|
||||
mkPkgs = system:
|
||||
import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = mkPkgs system;
|
||||
ffmpegForOsc = pkgs.ffmpeg-full;
|
||||
runtimeLibraryPath = lib.makeLibraryPath [ ffmpegForOsc ];
|
||||
in
|
||||
{
|
||||
default = pkgs.stdenv.mkDerivation {
|
||||
pname = "terminal-oscilloscope";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.nim
|
||||
pkgs.makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
ffmpegForOsc
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
nim c -d:release --threads:on --nimcache:$TMPDIR/nimcache-osc_braille -o:osc_braille src/osc_braille.nim
|
||||
nim c -d:release --threads:on --nimcache:$TMPDIR/nimcache-osc_braille -o:osc src/osc.nim
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm755 osc $out/bin/osc-unwrapped
|
||||
install -Dm755 osc_braille $out/bin/osc_braille-unwrapped
|
||||
|
||||
makeWrapper $out/bin/osc-unwrapped $out/bin/osc \
|
||||
--prefix LD_LIBRARY_PATH : ${runtimeLibraryPath}
|
||||
|
||||
makeWrapper $out/bin/osc_braille-unwrapped $out/bin/osc_braille \
|
||||
--prefix LD_LIBRARY_PATH : ${runtimeLibraryPath}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Terminal oscilloscope with CRT phosphor rendering";
|
||||
mainProgram = "osc";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/osc";
|
||||
};
|
||||
|
||||
osc = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/osc";
|
||||
};
|
||||
|
||||
osc_braille = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/osc_braille";
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
let
|
||||
pkgs = mkPkgs system;
|
||||
ffmpegForOsc = pkgs.ffmpeg-full;
|
||||
runtimeLibraryPath = lib.makeLibraryPath [ ffmpegForOsc ];
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.nim
|
||||
pkgs.nimble
|
||||
pkgs.pkg-config
|
||||
ffmpegForOsc
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH=${runtimeLibraryPath}:''${LD_LIBRARY_PATH:-}
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user