-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
131 lines (114 loc) · 3.58 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
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
# sudo nix run 'github:nix-community/disko/latest#disko-install' -- --write-efi-boot-entries --flake '.#myvm' --disk main /dev/sda
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";
# Has no releases so far, and not using nixpkgs.
impermanence.url = "github:nix-community/impermanence";
# Organize folders according to this predefined structure.
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager?ref=release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-programs-sqlite = {
url = "github:wamserma/flake-programs-sqlite";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
git-hooks-nix = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
colmena = {
url = "github:zhaofengli/colmena";
inputs = {
nixpkgs.follows = "nixpkgs";
stable.follows = "nixpkgs";
};
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
let
lib = inputs.snowfall-lib.mkLib {
inherit inputs;
src = ./.;
snowfall = {
namespace = "nicdumz";
root = ./nix;
};
};
in
lib.mkFlake {
# Simplify eval, do not generate all systems ...
supportedSystems = [ "x86_64-linux" ];
channels-config = {
allowUnfree = true;
};
outputs-builder = channels: {
# inlined treefmt config.
formatter = inputs.treefmt-nix.lib.mkWrapper channels.nixpkgs {
projectRootFile = "flake.nix";
settings.global.excludes = [
"*.age"
"*.code-snippets"
"*.png"
"*.pub"
"*.webp"
".editorconfig"
".envrc"
"LICENSE"
];
programs = {
deadnix.enable = true;
fish_indent.enable = true;
mdformat.enable = true;
mdformat.package = channels.nixpkgs.mdformat.withPlugins (
p: with p; [
mdformat-gfm
mdformat-gfm-alerts
]
);
nixfmt.enable = true;
statix.enable = true;
yamlfmt.enable = true;
};
};
};
# Note: due to https://github.com/zhaofengli/colmena/issues/202 /
# Note: due to https://github.com/zhaofengli/colmena/issues/60 /
# https://github.com/zhaofengli/colmena/pull/228, in order to work from a dirty flake dir,
# I have to pass
# `colmena --experimental-flake-eval build` and friends.
colmenaHive = lib.mkColmenaHive inputs.self.pkgs.x86_64-linux.nixpkgs {
bistannix = {
allowLocalDeployment = true;
targetHost = null;
};
liveusb.targetHost = null;
};
# This loads a vm in the current shell:
# nix build .#qemu-vm && ./result/bin/run-qemu-vm
# Log into it via ssh:
# ssh -p 2222 root@localhost
qemu-vm = inputs.self.nixosConfigurations.qemu.config.system.build.vm;
templates = {
homemodule.description = "Simple Snowfall lib Home module template";
nixosmodule.description = "Simple Snowfall lib NixOS module template";
};
};
}