Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (83 loc) · 2.87 KB
/
Copy pathflake.nix
File metadata and controls
94 lines (83 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
description = "stoat: a terminal UI for local QEMU VMs (Alpine-first, no libvirt, no daemon)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
# Matches the systems built by .github/workflows/release.yml
# (linux/amd64, linux/arm64).
systems = [
"x86_64-linux"
"aarch64-linux"
];
eachSystem =
f:
nixpkgs.lib.genAttrs systems (
system: f nixpkgs.legacyPackages.${system}
);
in
{
packages = eachSystem (
pkgs:
let
# `git describe` isn't available in the nix build sandbox, so pin a
# version string here; bump on release the same way release.yml's
# ${GITHUB_REF_NAME} does for the tarball builds.
version = "0.7.1";
in
{
default = pkgs.buildGoModule {
pname = "stoat";
inherit version;
src = self;
# Recompute when go.mod or go.sum changes.
vendorHash = "sha256-FDNhtle3sILmi2ionRvWMwD+Fkbe2ZE4qsRdxrarUAY=";
subPackages = [ "cmd/stoat" ];
ldflags = [
"-s"
"-w"
"-X main.version=v${version}"
];
meta = {
description = "A terminal UI for local QEMU VMs. Alpine-first, no libvirt, no daemon.";
homepage = "https://github.com/NovusEdge/stoat";
license = pkgs.lib.licenses.agpl3Plus;
mainProgram = "stoat";
# stoat shells out to qemu-system-x86_64/qemu-img and reads
# /proc directly, so it only runs on Linux.
platforms = pkgs.lib.platforms.linux;
};
};
}
);
apps = eachSystem (pkgs: {
default = {
type = "app";
program = "${self.packages.${pkgs.system}.default}/bin/stoat";
};
});
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
# Mirrors the binaries `just doctor` checks for.
packages = [
pkgs.go
pkgs.just
pkgs.qemu
pkgs.openssh
];
};
});
# NOTE on runtime deps: stoat's QEMU/OpenSSH dependencies are shelled
# out to, not linked, so we deliberately do NOT wrapProgram the
# `stoat` binary to force nixpkgs' qemu/openssh onto its PATH. The
# README tells users to pick a QEMU build with GTK+OpenGL support for
# `-display gtk,gl=on`; silently substituting a different nixpkgs
# qemu build would risk breaking that display path in a way that's
# surprising and hard to debug. qemu-system-x86_64/qemu-img/ssh/
# ssh-keygen remain documented prerequisites the user supplies
# themselves (see devShells.default for a convenient dev environment
# that includes them).
};
}