mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 19:58:03 +01:00
35
default.nix
Normal file
35
default.nix
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
rust,
|
||||||
|
makeRustPlatform,
|
||||||
|
packageToml,
|
||||||
|
libiconv,
|
||||||
|
darwin,
|
||||||
|
python3,
|
||||||
|
}:
|
||||||
|
(makeRustPlatform {
|
||||||
|
cargo = rust;
|
||||||
|
rustc = rust;
|
||||||
|
})
|
||||||
|
.buildRustPackage {
|
||||||
|
pname = packageToml.name;
|
||||||
|
inherit (packageToml) version;
|
||||||
|
|
||||||
|
src = builtins.path {
|
||||||
|
path = ./.;
|
||||||
|
inherit (packageToml) name;
|
||||||
|
};
|
||||||
|
|
||||||
|
dontUseCargoParallelTests = true;
|
||||||
|
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
nativeBuildInputs = [rust];
|
||||||
|
buildInputs = lib.optional stdenv.isDarwin [
|
||||||
|
libiconv
|
||||||
|
darwin.apple_sdk.frameworks.Foundation
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeCheckInputs = [python3];
|
||||||
|
}
|
||||||
75
flake.lock
generated
75
flake.lock
generated
@@ -1,5 +1,23 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717285511,
|
||||||
|
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
@@ -18,38 +36,32 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"nixpkgs": {
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705309234,
|
"lastModified": 1717786204,
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
"narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=",
|
||||||
"owner": "numtide",
|
"owner": "NixOS",
|
||||||
"repo": "flake-utils",
|
"repo": "nixpkgs",
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
"rev": "051f920625ab5aabe37c920346e3e69d7d34400e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "NixOS",
|
||||||
"repo": "flake-utils",
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707877513,
|
"lastModified": 1717284937,
|
||||||
"narHash": "sha256-sp0w2apswd3wv0sAEF7StOGHkns3XUQaO5erhWFZWXk=",
|
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
|
||||||
"owner": "nixos",
|
"type": "tarball",
|
||||||
"repo": "nixpkgs",
|
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
||||||
"rev": "89653a03e0915e4a872788d10680e7eec92f8600",
|
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"type": "tarball",
|
||||||
"ref": "nixpkgs-unstable",
|
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
@@ -70,14 +82,14 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-parts": "flake-parts",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -108,21 +120,6 @@
|
|||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|||||||
72
flake.nix
72
flake.nix
@@ -2,53 +2,41 @@
|
|||||||
description = "Terminal session recorder";
|
description = "Terminal session recorder";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
|
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||||
rust-overlay.url = github:oxalica/rust-overlay;
|
rust-overlay.url = github:oxalica/rust-overlay;
|
||||||
flake-utils.url = github:numtide/flake-utils;
|
flake-parts.url = github:hercules-ci/flake-parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
|
outputs = inputs @ {
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-parts,
|
||||||
let
|
rust-overlay,
|
||||||
overlays = [ (import rust-overlay) ];
|
...
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
}:
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
msrv = cargoToml.package.rust-version;
|
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
|
||||||
|
perSystem = {
|
||||||
|
self',
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
packageToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
|
||||||
|
in {
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
buildDeps = rust: with pkgs; [
|
_module.args = {
|
||||||
rust
|
pkgs = import inputs.nixpkgs {
|
||||||
] ++ (lib.optionals stdenv.isDarwin [
|
inherit system;
|
||||||
libiconv
|
overlays = [(import rust-overlay)];
|
||||||
darwin.apple_sdk.frameworks.Foundation
|
};
|
||||||
]) ++ testDeps;
|
|
||||||
|
|
||||||
testDeps = with pkgs; [
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
|
|
||||||
mkDevShell = rust: pkgs.mkShell {
|
|
||||||
nativeBuildInputs = buildDeps (rust.override {
|
|
||||||
extensions = [ "rust-src" ];
|
|
||||||
});
|
|
||||||
|
|
||||||
RUST_BACKTRACE = 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mkPackage = rust: (pkgs.makeRustPlatform {
|
devShells = pkgs.callPackages ./shell.nix {inherit packageToml self';};
|
||||||
cargo = rust;
|
|
||||||
rustc = rust;
|
packages.default = pkgs.callPackage ./default.nix {
|
||||||
}).buildRustPackage {
|
inherit packageToml;
|
||||||
inherit (cargoToml.package) name version;
|
rust = pkgs.rust-bin.stable.latest.minimal;
|
||||||
src = ./.;
|
};
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
};
|
||||||
nativeBuildInputs = buildDeps rust;
|
|
||||||
dontUseCargoParallelTests = true;
|
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
|
||||||
devShells.default = mkDevShell pkgs.rust-bin.stable.latest.default;
|
|
||||||
devShells.msrv = mkDevShell pkgs.rust-bin.stable.${msrv}.default;
|
|
||||||
packages.default = mkPackage pkgs.rust-bin.stable.latest.minimal;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
24
shell.nix
Normal file
24
shell.nix
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
self',
|
||||||
|
packageToml,
|
||||||
|
rust-bin,
|
||||||
|
mkShell,
|
||||||
|
}: let
|
||||||
|
msrv = packageToml.rust-version;
|
||||||
|
|
||||||
|
mkDevShell = rust:
|
||||||
|
mkShell {
|
||||||
|
inputsFrom = [
|
||||||
|
(self'.packages.default.override {
|
||||||
|
rust = rust.override {
|
||||||
|
extensions = ["rust-src"];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
env.RUST_BACKTRACE = 1;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
default = mkDevShell rust-bin.stable.latest.default;
|
||||||
|
msrv = mkDevShell rust-bin.stable.${msrv}.default;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user