-
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
<!--
Copyright 2023 Shota FUJI <pockawoooh@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
SPDX-License-Identifier: 0BSD
-->
# pocka/system
Home Manager and NixOS configurations for my machines.
## Home Manager configurations
Every file under `modules/hm` is Home Manager module.
A configuration imports a profile module inside `modules/hm/profiles`, which imports other modules.
A root of an import graph should be a profile module.
### Apply with Home Manager installed
To apply configuration, go to repository root and run the below command on system with Nix Flakes enabled and Home Manager installed.
Replace `$NAME` with configuration name (an attribute name in `homeConfigurations` attrset.)
```sh
home-manager switch --flake .#$NAME
```
As the most profiles installs `home-manager` CLI, this will be the most frequently used command after the initial setup.
### Apply using `nix-shell`
To apply configuration without `home-manager` CLI, go to repository root and run the below command on Nix installed system.
Replace `$NAME` with configuration name (an attribute name in `homeConfigurations` attrset.)
```sh
nix-shell --run "home-manager switch --flake .#$NAME"
```
This is useful for initial setup.
### Apply without cloning the repository
To apply configuration without cloning repository, run the below command on Nix Flakes enabled system.
Replace `$NAME` with configuration name (an attribute name in `homeConfigurations` attrset.)
```sh
nix run home-manager/master -- switch --flake git+https://codeberg.org/pocka/system#$NAME
```
This is useful for initial setup and for ephemeral environment.
### Display changes between generations
First, find the directory that contains Nix profiles.
For defaults location, see this page: <https://nix.dev/manual/nix/2.18/command-ref/files/profiles>.
Then run the following:
```sh
nix profile diff-closures --profile <profiles directory>/home-manager
```
## NixOS configurations
Every file under `modules/nixos` is NixOS module.
A configuration imports a profile module inside `modules/nixos/profiles`, which imports other modules.
A root of an import graph should be a profile module.
### Create a NixOS Incus system container
To create an Incus system container image, run the following command:
```sh
nix run .#incus-import workerbee
```
this will generate and import `pocka/workerbee/nixos` image.
### Launch VM
Run the following to launch NixOS VM using QEMU.
```sh
nix run .#nixosConfigurations.queenbee.config.system.build.vm -- -device virtio-vga-gl -display gtk,gl=on -enable-kvm -cpu host -m $MEMORY_SIZE
```
You can see a list of options using `--help` option.
## License
This project is compliant with [REUSE specification](https://reuse.software/).
Commentable files have copyright and license header and uncommentable files (e.g. binary, JSON) have an adjacent text file named `<filename>.license`.
- Files under `programs/` are licensed under [Apache-2.0](./LICENSES/Apache-2.0.txt).
- Other files, including Nix config files, are licensed under [Zero-Clause BSD](./LICENSES/0BSD.txt).