-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
59 lines (54 loc) · 1.53 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
{
description = "A tool for deploying a nix flake to remote systems";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
fenix,
gitignore,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
nativeBuildInputs = [pkgs.libiconv];
in {
packages = {
deploy-flake = let
rustPlatform = pkgs.makeRustPlatform {
inherit (fenix.packages.${system}.stable) rustc cargo;
};
inherit (gitignore.lib) gitignoreSource;
in
rustPlatform.buildRustPackage {
pname = "deploy-flake";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
inherit nativeBuildInputs;
src = gitignoreSource ./.;
cargoLock.lockFile = ./Cargo.lock;
};
default = self.packages.${system}.deploy-flake;
};
formatter = pkgs.alejandra;
apps = {
deploy-flake = {
type = "app";
program = "${self.packages."${system}".deploy-flake}/bin/deploy-flake";
};
default = self.apps.${system}.deploy-flake;
};
});
}