-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
87 lines (73 loc) · 2.18 KB
/
flake.nix
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
{
description = "Upload OS images to cloud provider";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
treefmt-nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
uplosi = pkgs.buildGoModule {
pname = "uplosi";
version = "devel";
src =
let
inherit (pkgs.lib) fileset path hasSuffix;
root = ./.;
in
fileset.toSource {
inherit root;
fileset = fileset.unions [
(fileset.fileFilter (file: hasSuffix ".go" file.name) root)
(path.append root "go.mod")
(path.append root "go.sum")
(path.append root "config/validation.rego")
(path.append root "measured-boot/internal/testdata/uki.efi")
];
};
# this needs to be updated together with go.mod / go.sum
vendorHash = "sha256-2lJmPNLpI1ksFb0EtcjPjyTy7eX1DKeX0F80k9FtGno=";
CGO_ENABLED = 0;
ldflags = [ "-s" ];
nativeBuildInputs = [ pkgs.installShellFiles ];
postInstall = ''
installShellCompletion --cmd uplosi \
--bash <($out/bin/uplosi completion bash) \
--fish <($out/bin/uplosi completion fish) \
--zsh <($out/bin/uplosi completion zsh)
'';
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
devShells.default = import ./shell.nix { inherit pkgs; };
packages = {
default = uplosi;
inherit uplosi;
};
legacyPackages = {
nixpkgs = nixpkgs.legacyPackages.${system};
};
formatter = treefmtEval.config.build.wrapper;
checks = {
formatting = treefmtEval.config.build.check self;
};
}
);
}