Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
67 lines (62 loc) · 1.9 KB
/
Copy pathflake.nix
File metadata and controls
67 lines (62 loc) · 1.9 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
{
description = "A thin wrapper around the devcontainer CLI: one command, workspace auto-detection";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
# The version lives in the script, where release-please keeps it.
version = lib.pipe (builtins.readFile ./devcontainer-sh) [
(lib.splitString "\n")
(lib.findFirst (lib.hasPrefix "DEVCONTAINER_SH_VERSION=") null)
(builtins.match "DEVCONTAINER_SH_VERSION=\"([^\"]+)\".*")
builtins.head
];
devcontainer-sh = pkgs.stdenvNoCC.mkDerivation {
pname = "devcontainer-sh";
inherit version;
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./devcontainer-sh
./completions
];
};
dontBuild = true;
# The devcontainer CLI and docker are the user's, not wrapped in.
installPhase = ''
install -Dm0755 devcontainer-sh $out/bin/devcontainer-sh
install -Dm0644 -t $out/share/zsh/site-functions \
completions/_devcontainer-sh completions/_devcontainer
'';
meta = {
description = "A thin wrapper around the devcontainer CLI";
mainProgram = "devcontainer-sh";
license = lib.licenses.mit;
};
};
in
{
packages.default = devcontainer-sh;
devShells.default = pkgs.mkShell {
name = "devcontainer-sh";
packages = with pkgs; [
zsh
bats
shellcheck
actionlint
];
};
}
);
}