-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
86 lines (76 loc) · 2.12 KB
/
flake.nix
File metadata and controls
86 lines (76 loc) · 2.12 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
{
description = "VTLUUG nixos server flakes";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
agenix.url = "github:ryantm/agenix";
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
agenix,
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"aarch64-darwin"
"x86_64-linux"
];
flake = {
nixosConfigurations = {
vesuvius = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./hosts/vesuvius/configuration.nix)
agenix.nixosModules.default
];
};
zerocool = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./hosts/zerocool/configuration.nix)
agenix.nixosModules.default
];
};
};
};
perSystem = {
system,
pkgs,
...
}:
let pkgs = import nixpkgs { inherit system; }; in
{
packages.deploy = pkgs.writeShellScriptBin "deploy" ''
TARGET_HOST_NAME="$1"
TARGET_HOST_ADDRESS="$2"
echo "building $TARGET_HOST_NAME and deploying to $TARGET_HOST_ADDRESS"
NIX_SSHOPTS="-o ForwardAgent=yes -J acidburn.vtluug.org" \
${pkgs.nixos-rebuild}/bin/nixos-rebuild switch \
--fast --flake ".#$TARGET_HOST_NAME" \
--use-remote-sudo \
--target-host "papatux@$TARGET_HOST_ADDRESS" \
--build-host "papatux@$TARGET_HOST_ADDRESS"
'';
packages.ponyfetch = pkgs.writeShellApplication {
name = "ponyfetch";
runtimeInputs = [
pkgs.fastfetch
pkgs.ponysay
];
text = ''
if [[ $# -eq 1 ]]; then
ssh "papatux@$1" nix run nixpkgs#fastfetch -- --pipe false | ponysay -b round -W 120 -f "$1"
else
fastfetch --pipe false | ponysay -b round -W 120 -f "$(hostname)"
fi
'';
};
devShells.default = pkgs.mkShell {
packages = [
agenix.packages.${system}.default
];
};
};
};
}