Skip to content

Commit b159c0c

Browse files
committed
feat: init Nix flake
1 parent c6fd4cd commit b159c0c

File tree

12 files changed

+1223
-0
lines changed

12 files changed

+1223
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# VM disk images
2+
*.qcow2
3+
4+
# Nix build results
5+
result
6+
result-*
7+
repl-result-*
8+
9+
# NixOS test driver REPL history
10+
.nixos-test-history
11+
12+
# Binary executable.
13+
/nix/pkgs/gpiosimtest/gpiosimtest

doc/nixos-modules.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
## services\.atx-raspi-shutdown\.enable
2+
3+
4+
5+
Whether to enable the ATX-Raspi shutdown daemon\.
6+
7+
8+
9+
*Type:*
10+
boolean
11+
12+
13+
14+
*Default:*
15+
` false `
16+
17+
18+
19+
*Example:*
20+
` true `
21+
22+
*Declared by:*
23+
- [flake\.nix](/flake.nix)
24+
25+
26+
27+
## services\.atx-raspi-shutdown\.package
28+
29+
30+
31+
Package providing the ATX-Raspi daemon\.
32+
33+
34+
35+
*Type:*
36+
package
37+
38+
39+
40+
*Default:*
41+
` <derivation atx-raspi-shutdownirq> `
42+
43+
*Declared by:*
44+
- [flake\.nix](/flake.nix)
45+
46+
47+
48+
## services\.atx-raspi-shutdown\.chip
49+
50+
The path to the GPIO chip\.
51+
52+
53+
54+
*Type:*
55+
null or absolute path
56+
57+
58+
59+
*Default:*
60+
` null `
61+
62+
63+
64+
*Example:*
65+
` "/dev/gpiochip42" `
66+
67+
*Declared by:*
68+
- [flake\.nix](/flake.nix)
69+
70+
71+
72+
## services\.atx-raspi-shutdown\.implementation
73+
74+
75+
76+
GPIO daemon implementation\. “irq” selects the
77+
edge-triggered Python implementation\. “check” selects
78+
the polling-based shell implementation\.
79+
80+
81+
82+
*Type:*
83+
one of “check”, “irq”
84+
85+
86+
87+
*Default:*
88+
` "irq" `
89+
90+
91+
92+
*Example:*
93+
` "check" `
94+
95+
*Declared by:*
96+
- [flake\.nix](/flake.nix)
97+
98+
99+
100+
## services\.atx-raspi-shutdown\.pins\.boot
101+
102+
103+
104+
Pin on ` chip ` to set high upon ATX-Raspi
105+
service startup\.
106+
107+
108+
109+
*Type:*
110+
null or (unsigned integer, meaning >=0)
111+
112+
113+
114+
*Default:*
115+
` null `
116+
117+
118+
119+
*Example:*
120+
` 8 `
121+
122+
*Declared by:*
123+
- [flake\.nix](/flake.nix)
124+
125+
126+
127+
## services\.atx-raspi-shutdown\.pins\.shutdown
128+
129+
130+
131+
Pin on ` chip ` to watch for the shutdown or
132+
reboot button press\.
133+
134+
135+
136+
*Type:*
137+
null or (unsigned integer, meaning >=0)
138+
139+
140+
141+
*Default:*
142+
` null `
143+
144+
145+
146+
*Example:*
147+
` 7 `
148+
149+
*Declared by:*
150+
- [flake\.nix](/flake.nix)
151+
152+
153+
154+
## services\.atx-raspi-shutdown\.pulses\.reboot
155+
156+
157+
158+
Minimum duration of high state on
159+
` pins.shutdown ` to trigger reboot\.
160+
161+
162+
163+
*Type:*
164+
null or floating point number
165+
166+
167+
168+
*Default:*
169+
` null `
170+
171+
172+
173+
*Example:*
174+
` 0.2 `
175+
176+
*Declared by:*
177+
- [flake\.nix](/flake.nix)
178+
179+
180+
181+
## services\.atx-raspi-shutdown\.pulses\.shutdown
182+
183+
184+
185+
Minimum duration of high state on
186+
` pins.shutdown ` to trigger shutdown\.
187+
188+
189+
190+
*Type:*
191+
null or floating point number
192+
193+
194+
195+
*Default:*
196+
` null `
197+
198+
199+
200+
*Example:*
201+
` 0.6 `
202+
203+
*Declared by:*
204+
- [flake\.nix](/flake.nix)
205+
206+

flake.lock

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
description = "Description for the project";
3+
4+
inputs = {
5+
devshell.url = "github:numtide/devshell";
6+
devshell.inputs.nixpkgs.follows = "nixpkgs";
7+
8+
flake-parts.url = "github:hercules-ci/flake-parts";
9+
10+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
11+
12+
treefmt-nix.url = "github:numtide/treefmt-nix";
13+
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
14+
};
15+
16+
outputs = inputs:
17+
inputs.flake-parts.lib.mkFlake {inherit inputs;} ({
18+
inputs,
19+
moduleWithSystem,
20+
self,
21+
...
22+
}: {
23+
systems = [
24+
"aarch64-darwin"
25+
"aarch64-linux"
26+
"x86_64-darwin"
27+
"x86_64-linux"
28+
];
29+
30+
imports = [
31+
inputs.devshell.flakeModule
32+
inputs.treefmt-nix.flakeModule
33+
34+
./nix/checks.nix
35+
./nix/devshells.nix
36+
./nix/nixos-modules.nix
37+
./nix/packages.nix
38+
];
39+
40+
flake = {
41+
nixosConfigurations = {
42+
default = inputs.nixpkgs.lib.nixosSystem {
43+
modules = [
44+
self.nixosModules.atx-raspi
45+
{
46+
boot.isContainer = true;
47+
fileSystems."/".fsType = "tmpfs";
48+
nixpkgs.hostPlatform = "x86_64-linux";
49+
system.stateVersion = "24.11";
50+
}
51+
];
52+
};
53+
};
54+
};
55+
56+
perSystem = {
57+
config,
58+
lib,
59+
...
60+
}: {
61+
apps = lib.mapAttrs (lib.const (lib.getAttr "flakeApp")) config.devShells;
62+
63+
treefmt = {config, ...}: {
64+
flakeFormatter = true;
65+
projectRootFile = "flake.nix";
66+
programs.alejandra.enable = true;
67+
};
68+
};
69+
});
70+
}

0 commit comments

Comments
 (0)