-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathflake.nix
More file actions
144 lines (132 loc) · 3.98 KB
/
flake.nix
File metadata and controls
144 lines (132 loc) · 3.98 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
description = "Manage system configurations using Nix on any Linux distribution.";
nixConfig = {
extra-substituters = [ "https://cache.numtide.com" ];
extra-trusted-public-keys = [ "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" ];
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.userborn = {
url = "github:jfroche/userborn/system-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-compat.follows = "flake-compat";
};
outputs =
{
self,
nixpkgs,
userborn,
...
}:
let
systems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
];
eachSystem =
f:
nixpkgs.lib.genAttrs systems (
system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
packageOverlay = final: _prev: rec {
system-manager-unwrapped = final.callPackage ./package.nix { };
system-manager = final.callPackage ./nix/packages/wrapper.nix { inherit system-manager-unwrapped; };
};
in
{
lib = (import ./nix/lib.nix { inherit nixpkgs userborn; }) // {
# Container test library for external projects
containerTest = import ./lib/container-test-driver { inherit (nixpkgs) lib; };
};
# Get overlayed packages in toplevel output
packages = eachSystem (
{ pkgs, system }:
{
system-manager-unwrapped = pkgs.system-manager-unwrapped;
default = pkgs.system-manager;
}
);
# Documentation outputs
docs = eachSystem ({ pkgs, ... }: import ./docs/options.nix { inherit pkgs; });
overlays.default = packageOverlay;
# Overlay packages onto internal nixpkgs
nixpkgs.overlays = [ packageOverlay ];
# Only useful for quick tests
systemConfigs.default = self.lib.makeSystemConfig {
modules = [
./examples/example.nix
{ nixpkgs.hostPlatform = "x86_64-linux"; }
];
};
formatter = eachSystem ({ pkgs, ... }: pkgs.treefmt);
devShells = eachSystem (
{ pkgs, ... }:
{
default =
let
llvm = pkgs.llvmPackages_latest;
in
pkgs.mkShellNoCC {
shellHook = ''
${pkgs.pre-commit}/bin/pre-commit install --install-hooks --overwrite
export PKG_CONFIG_PATH="${pkgs.lib.makeSearchPath "lib/pkgconfig" [ pkgs.dbus.dev ]}"
export LIBCLANG_PATH="${llvm.libclang}/lib"
# for rust-analyzer
export RUST_SRC_PATH="${pkgs.rustPlatform.rustLibSrc}"
export RUST_BACKTRACE=1
'';
buildInputs = [
pkgs.dbus
]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [ pkgs.libiconv ];
nativeBuildInputs = with pkgs; [
llvm.clang
pkg-config
rustc
cargo
# Formatting
pre-commit
treefmt
nixfmt
rustfmt
clippy
mdbook
mdformat
rust-analyzer
gh
# Testing tools
parallel
];
};
}
);
checks = eachSystem (
{ system, ... }:
{
system-manager = self.packages.${system}.default;
}
);
nixosModules = rec {
system-manager = ./nix/modules;
default = system-manager;
};
templates = {
standalone = {
path = ./templates/standalone;
description = "System Manager standalone setup";
};
nixos = {
path = ./templates/nixos;
description = "System Manager as a NixOS module";
};
};
};
}