Compare commits
134 Commits
16480b3749
...
starship
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9513882870 | ||
|
|
71a6843b37 | ||
|
|
7d9d1ca80e | ||
|
|
2f2d33296b | ||
|
|
2c1cf54de0 | ||
|
|
65be133ffe | ||
|
|
ee47c3cfa3 | ||
|
|
ff8bb0653b | ||
|
|
ff98873b32 | ||
|
|
67ad4e2dff | ||
|
|
60452b0aeb | ||
|
|
e043320e5c | ||
|
|
2f8c4fbfe8 | ||
|
|
233bf4e967 | ||
|
|
f7adfaf54d | ||
|
|
78c9dec4c4 | ||
|
|
53c12a5b1e | ||
|
|
7d94210d8f | ||
|
|
1ebf31dc11 | ||
|
|
82c30bdb77 | ||
|
|
d5e7fdd097 | ||
|
|
40fd7931d0 | ||
|
|
835fd340a2 | ||
|
|
94ef9ff3c8 | ||
|
|
62d3c010f5 | ||
|
|
e9e792961c | ||
|
|
281dffc9c0 | ||
|
|
5bd67bb02a | ||
|
|
4a76097a5e | ||
|
|
facfd01661 | ||
|
|
2ce4520cd6 | ||
|
|
814769b3e9 | ||
|
|
6424129da3 | ||
|
|
415edbad91 | ||
|
|
a773f94593 | ||
|
|
226610c926 | ||
|
|
7c6afef2bb | ||
|
|
55654fafb1 | ||
|
|
8946868fd6 | ||
|
|
cd8e9002d0 | ||
|
|
e1a274c88e | ||
|
|
cdc4bdffb6 | ||
|
|
9b9a103e49 | ||
|
|
ea7bf809fc | ||
|
|
88a6d046b8 | ||
|
|
d8e16f0b05 | ||
|
|
e3fee206a1 | ||
|
|
3be710b4ad | ||
|
|
b37f8a8e1a | ||
|
|
509cceb220 | ||
|
|
47408cfce0 | ||
|
|
812dc40257 | ||
|
|
0e370c0d62 | ||
|
|
0598c796b7 | ||
|
|
df2efb728d | ||
|
|
62fc955b68 | ||
|
|
e0644a069d | ||
|
|
054e056d00 | ||
|
|
d3ea8b3667 | ||
|
|
3f945f8ae3 | ||
|
|
93c4aa4c76 | ||
|
|
4664804d90 | ||
|
|
edc48d00a2 | ||
|
|
37aa0e6732 | ||
|
|
a739728d41 | ||
|
|
48c5aebd82 | ||
|
|
c33a1b6c50 | ||
|
|
368c455b7f | ||
|
|
5a5d34911c | ||
|
|
d0c1bb1b65 | ||
|
|
9d49eb9d6a | ||
|
|
ccbc999744 | ||
|
|
d537aa599b | ||
|
|
95d06dfe0e | ||
|
|
f2adb9328b | ||
|
|
7bc6e0c470 | ||
|
|
99edb2d161 | ||
|
|
938f8676ff | ||
|
|
d365b6aea9 | ||
|
|
8d911ff893 | ||
|
|
2aca77ea1a | ||
|
|
1b342d3402 | ||
|
|
9976e232e6 | ||
|
|
3baf18f435 | ||
|
|
e00331bf94 | ||
|
|
8e22d8febb | ||
|
|
ed0d1e41d6 | ||
|
|
2c27d580f4 | ||
|
|
75ac4b91f3 | ||
|
|
9abe43096b | ||
|
|
1535800e2f | ||
|
|
dcffced35a | ||
|
|
1da36ab7c5 | ||
|
|
c694c6ae4c | ||
|
|
f524aa168a | ||
|
|
308206d1cc | ||
|
|
8ac235cb8c | ||
|
|
5170678a25 | ||
|
|
19cf31b094 | ||
|
|
4f0024c4f9 | ||
|
|
41138ab34a | ||
|
|
f9b18809f9 | ||
|
|
fefe46b512 | ||
|
|
b4947bcff6 | ||
|
|
14baaddcff | ||
|
|
1c8f2f1c74 | ||
|
|
1bfe24f457 | ||
|
|
08feb8bad6 | ||
|
|
cb3b01a74c | ||
|
|
0e95edd8e7 | ||
|
|
d172b1dea2 | ||
|
|
2a97a1ee92 | ||
|
|
ba4085df1a | ||
|
|
7c542364a2 | ||
|
|
0299ebcb43 | ||
|
|
c23245b97c | ||
|
|
491412c33c | ||
|
|
5a5839482d | ||
|
|
63408f5664 | ||
|
|
d338b77d23 | ||
|
|
ce9140aa73 | ||
|
|
dbf3f2e983 | ||
|
|
0ca26e73fb | ||
|
|
0fb53a4294 | ||
|
|
4019e6d132 | ||
|
|
8b1e76d9d7 | ||
|
|
477637ae62 | ||
|
|
5146a114eb | ||
|
|
a817464b38 | ||
|
|
1acf889c68 | ||
|
|
af07d43c18 | ||
|
|
33f13d898d | ||
|
|
47d9e203f3 | ||
|
|
1a2ff987fe |
@@ -64,6 +64,23 @@
|
|||||||
# force: true
|
# force: true
|
||||||
# diff: false
|
# diff: false
|
||||||
|
|
||||||
|
- name: Create directories
|
||||||
|
file:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0700
|
||||||
|
owner: nochainstounlock
|
||||||
|
group: nochainstounlock
|
||||||
|
loop:
|
||||||
|
- /home/nochainstounlock/.ssh
|
||||||
|
|
||||||
|
- name: Set authorized keys
|
||||||
|
authorized_key:
|
||||||
|
user: nochainstounlock
|
||||||
|
key: |
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMrjXsXjtxEm47XnRZfo67kJULoc0NBLrB0lPYFiS2Ar kodi@neelix
|
||||||
|
exclusive: true
|
||||||
|
|
||||||
- import_tasks: tasks/freebsd.yaml
|
- import_tasks: tasks/freebsd.yaml
|
||||||
when: 'os_flavor == "freebsd"'
|
when: 'os_flavor == "freebsd"'
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgs-unstable,
|
|
||||||
home-manager,
|
home-manager,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
@@ -10,8 +9,9 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./roles/reset
|
./roles/reset
|
||||||
|
./roles/global_options
|
||||||
|
./util/unfree_polyfill
|
||||||
./roles/iso
|
./roles/iso
|
||||||
./hosts/odo
|
|
||||||
"${
|
"${
|
||||||
builtins.fetchTarball {
|
builtins.fetchTarball {
|
||||||
url = "https://github.com/nix-community/disko/archive/refs/tags/v1.9.0.tar.gz";
|
url = "https://github.com/nix-community/disko/archive/refs/tags/v1.9.0.tar.gz";
|
||||||
@@ -23,9 +23,11 @@
|
|||||||
./roles/network
|
./roles/network
|
||||||
./roles/firewall
|
./roles/firewall
|
||||||
./roles/zsh
|
./roles/zsh
|
||||||
|
./roles/zrepl
|
||||||
./roles/graphics
|
./roles/graphics
|
||||||
./roles/sound
|
./roles/sound
|
||||||
./roles/sway
|
./roles/sway
|
||||||
|
./roles/kanshi
|
||||||
./roles/alacritty
|
./roles/alacritty
|
||||||
./roles/firefox
|
./roles/firefox
|
||||||
./roles/chromium
|
./roles/chromium
|
||||||
@@ -36,12 +38,31 @@
|
|||||||
./roles/waybar
|
./roles/waybar
|
||||||
./roles/qemu
|
./roles/qemu
|
||||||
./roles/wireguard
|
./roles/wireguard
|
||||||
./roles/bsnes
|
./roles/ares
|
||||||
./roles/ssh
|
./roles/ssh
|
||||||
./roles/python
|
./roles/python
|
||||||
./roles/docker
|
./roles/docker
|
||||||
./roles/kubernetes
|
./roles/kubernetes
|
||||||
./roles/rust
|
./roles/rust
|
||||||
|
./roles/media
|
||||||
|
./roles/steam
|
||||||
|
./roles/latex
|
||||||
|
./roles/launch_keyboard
|
||||||
|
./roles/lvfs
|
||||||
|
./roles/nvme
|
||||||
|
./roles/terraform
|
||||||
|
./roles/vscode
|
||||||
|
./roles/wasm
|
||||||
|
./roles/vnc_client
|
||||||
|
./roles/chromecast
|
||||||
|
./roles/memtest86
|
||||||
|
./roles/kodi
|
||||||
|
./roles/ansible
|
||||||
|
./roles/bluetooth
|
||||||
|
./roles/sm64ex
|
||||||
|
./roles/shipwright
|
||||||
|
./roles/2ship2harkinian
|
||||||
|
./roles/nix_index
|
||||||
];
|
];
|
||||||
|
|
||||||
nix.settings.experimental-features = [
|
nix.settings.experimental-features = [
|
||||||
@@ -91,12 +112,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Automatic garbage collection
|
# Automatic garbage collection
|
||||||
nix.gc = {
|
nix.gc = lib.mkIf (!config.me.buildingIso) {
|
||||||
# Runs nix-collect-garbage --delete-older-than 5d
|
# Runs nix-collect-garbage --delete-older-than 5d
|
||||||
automatic = true;
|
automatic = true;
|
||||||
randomizedDelaySec = "14m";
|
randomizedDelaySec = "14m";
|
||||||
options = "--delete-older-than 30d";
|
options = "--delete-older-than 30d";
|
||||||
};
|
};
|
||||||
|
nix.settings.auto-optimise-store = !config.me.buildingIso;
|
||||||
|
|
||||||
# Use doas instead of sudo
|
# Use doas instead of sudo
|
||||||
security.doas.enable = true;
|
security.doas.enable = true;
|
||||||
@@ -110,9 +132,6 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
# Do not use default packages (nixos includes some defaults like nano)
|
|
||||||
environment.defaultPackages = lib.mkForce [ ];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wget
|
wget
|
||||||
mg
|
mg
|
||||||
@@ -123,14 +142,16 @@
|
|||||||
file
|
file
|
||||||
usbutils # for lsusb
|
usbutils # for lsusb
|
||||||
pciutils # for lspci
|
pciutils # for lspci
|
||||||
mesa-demos # for glxgears TODO move to better role
|
|
||||||
vulkan-tools # for vkcube TODO move to better role
|
|
||||||
xorg.xeyes # to test which windows are using x11 TODO move to better role
|
|
||||||
ripgrep
|
ripgrep
|
||||||
strace
|
strace
|
||||||
|
ltrace
|
||||||
|
trace-cmd # ftrace
|
||||||
tcpdump
|
tcpdump
|
||||||
git-crypt
|
git-crypt
|
||||||
nix-index-unwrapped
|
gnumake
|
||||||
|
ncdu
|
||||||
|
nix-tree
|
||||||
|
libarchive # bsdtar
|
||||||
];
|
];
|
||||||
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
@@ -159,7 +180,6 @@
|
|||||||
"/var/lib/nixos" # Contains user information (uids/gids)
|
"/var/lib/nixos" # Contains user information (uids/gids)
|
||||||
"/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
|
"/var/lib/systemd" # Systemd state directory for random seed, persistent timers, core dumps, persist hardware state like backlight and rfkill
|
||||||
"/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
|
"/var/log/journal" # Logs, alternatively set `services.journald.storage = "volatile";` to write to /run/log/journal
|
||||||
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools. TODO consider setting cachefile=none on main pool.
|
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"
|
"/etc/machine-id" # Systemd unique machine id "otherwise, the system journal may fail to list earlier boots, etc"
|
||||||
@@ -168,10 +188,16 @@
|
|||||||
"/etc/ssh/ssh_host_ed25519_key"
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||||
];
|
];
|
||||||
# users.talexander = {
|
users.talexander = {
|
||||||
# directories = [];
|
directories = [
|
||||||
# files = [];
|
{
|
||||||
# };
|
directory = "persist";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Write a list of the currently installed packages to /etc/current-system-packages
|
# Write a list of the currently installed packages to /etc/current-system-packages
|
||||||
@@ -183,12 +209,24 @@
|
|||||||
in
|
in
|
||||||
formatted;
|
formatted;
|
||||||
|
|
||||||
|
# environment.etc."system-packages-with-source".text = builtins.concatStringsSep "\n\n" (
|
||||||
|
# builtins.map (
|
||||||
|
# x: x.file + "\n" + builtins.concatStringsSep "\n" (builtins.map (s: " " + s) x.value)
|
||||||
|
# ) config.environment.systemPackages.definitionsWithLocations
|
||||||
|
# );
|
||||||
|
|
||||||
# nixpkgs.overlays = [
|
# nixpkgs.overlays = [
|
||||||
# (final: prev: {
|
# (final: prev: {
|
||||||
# nix = pkgs-unstable.nix;
|
# nix = pkgs-unstable.nix;
|
||||||
# })
|
# })
|
||||||
# ];
|
# ];
|
||||||
|
|
||||||
|
# nixpkgs.overlays = [
|
||||||
|
# (final: prev: {
|
||||||
|
# foot = throw "foo";
|
||||||
|
# })
|
||||||
|
# ];
|
||||||
|
|
||||||
# Copy the NixOS configuration file and link it from the resulting system
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
# (/run/current-system/configuration.nix). This is useful in case you
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
# accidentally delete configuration.nix.
|
# accidentally delete configuration.nix.
|
||||||
|
|||||||
108
nix/configuration/flake.lock
generated
108
nix/configuration/flake.lock
generated
@@ -1,18 +1,30 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"ansible-sshjail": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"lanzaboote",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717535930,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-1hZ/txnbd/RmiBPNUs7i8UQw2N89uAK3UzrGAWdnFfU=",
|
"narHash": "sha256-c4Ds4E/10Zj5AQLuJ3JvJTuDK8o2WjVXLcIL7eyhTfw=",
|
||||||
|
"path": "flakes/ansible-sshjail",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"path": "flakes/ansible-sshjail",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crane": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731098351,
|
||||||
|
"narHash": "sha256-HQkYvKvaLQqNa10KEFGgWHfMAbWBfFp+4cAgkut+NNE=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "55e7754ec31dac78980c8be45f8a28e80e370946",
|
"rev": "ef80ead953c1b28316cc3f8613904edc2eb90c28",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -45,11 +57,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717285511,
|
"lastModified": 1730504689,
|
||||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -63,11 +75,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710146030,
|
"lastModified": 1731533236,
|
||||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -123,27 +135,26 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736373539,
|
"lastModified": 1737762889,
|
||||||
"narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=",
|
"narHash": "sha256-5HGG09bh/Yx0JA8wtBMAzt0HMCL1bYZ93x4IqzVExio=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "bd65bc3cde04c16755955630b344bc9e35272c56",
|
"rev": "daf04c5950b676f47a794300657f1d3d14c1a120",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"ref": "release-24.11",
|
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"impermanence": {
|
"impermanence": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1734945620,
|
"lastModified": 1737831083,
|
||||||
"narHash": "sha256-olIfsfJK4/GFmPH8mXMmBDAkzVQ1TWJmeGT3wBGfQPY=",
|
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "impermanence",
|
"repo": "impermanence",
|
||||||
"rev": "d000479f4f41390ff7cf9204979660ad5dd16176",
|
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -157,7 +168,6 @@
|
|||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
@@ -165,32 +175,32 @@
|
|||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1718178907,
|
"lastModified": 1737639419,
|
||||||
"narHash": "sha256-eSZyrQ9uoPB9iPQ8Y5H7gAmAgAvCw3InStmU3oEjqsE=",
|
"narHash": "sha256-AEEDktApTEZ5PZXNDkry2YV2k6t0dTgLPEmAZbnigXU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "lanzaboote",
|
"repo": "lanzaboote",
|
||||||
"rev": "b627ccd97d0159214cee5c7db1412b75e4be6086",
|
"rev": "a65905a09e2c43ff63be8c0e86a93712361f871e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"ref": "v0.4.1",
|
"ref": "v0.4.2",
|
||||||
"repo": "lanzaboote",
|
"repo": "lanzaboote",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736200483,
|
"lastModified": 1737885589,
|
||||||
"narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
|
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
|
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-24.11",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -213,32 +223,16 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710695816,
|
"lastModified": 1730741070,
|
||||||
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
|
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
|
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-23.11",
|
"ref": "nixos-24.05",
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-unstable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1736012469,
|
|
||||||
"narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -257,11 +251,11 @@
|
|||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717664902,
|
"lastModified": 1731363552,
|
||||||
"narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=",
|
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "pre-commit-hooks.nix",
|
"repo": "pre-commit-hooks.nix",
|
||||||
"rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1",
|
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -272,32 +266,28 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"ansible-sshjail": "ansible-sshjail",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"lanzaboote": "lanzaboote",
|
"lanzaboote": "lanzaboote",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5",
|
"nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
|
||||||
"zsh-histdb": "zsh-histdb"
|
"zsh-histdb": "zsh-histdb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": [
|
|
||||||
"lanzaboote",
|
|
||||||
"flake-utils"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"lanzaboote",
|
"lanzaboote",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717813066,
|
"lastModified": 1731897198,
|
||||||
"narHash": "sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28=",
|
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "6dc3e45fe4aee36efeed24d64fc68b1f989d5465",
|
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -345,7 +335,7 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-TFks1dvPwAXKQeePh9jmxj06ZfXArH1pN9yXVQWeL6w=",
|
"narHash": "sha256-5DWw7GnwVZ98HUp/UUJcyUmmy9Bh/mcQB8MQQ0t3ZRo=",
|
||||||
"path": "flakes/zsh-histdb",
|
"path": "flakes/zsh-histdb",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
# -display vnc=127.0.0.1:0
|
# -display vnc=127.0.0.1:0
|
||||||
#
|
#
|
||||||
# doas cp "$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF_VARS.fd" /tmp/OVMF_VARS.fd
|
# doas cp "$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF_VARS.fd" /tmp/OVMF_VARS.fd
|
||||||
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" -accel kvm -cpu host -smp cores=8 -m 32768 -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" -nic user,hostfwd=tcp::60022-:22 -boot order=d -cdrom /persist/machine_setup/nix/configuration/result/iso/nixos.iso -display vnc=127.0.0.1:0
|
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" -accel kvm -cpu host -smp cores=8 -m 32768 -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" -drive if=pflash,format=raw,file="/tmp/OVMF_VARS.fd" -nic user,hostfwd=tcp::60022-:22 -boot order=d -cdrom /persist/machine_setup/nix/configuration/result/iso/nixos*.iso -display vnc=127.0.0.1:0
|
||||||
|
|
||||||
# Get a repl for this flake
|
# Get a repl for this flake
|
||||||
# nix repl --expr "builtins.getFlake \"$PWD\""
|
# nix repl --expr "builtins.getFlake \"$PWD\""
|
||||||
@@ -30,13 +30,12 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
||||||
nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4";
|
nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4";
|
||||||
home-manager.url = "github:nix-community/home-manager/release-24.11";
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
lanzaboote = {
|
lanzaboote = {
|
||||||
url = "github:nix-community/lanzaboote/v0.4.1";
|
url = "github:nix-community/lanzaboote/v0.4.2";
|
||||||
|
|
||||||
# Optional but recommended to limit the size of your system closure.
|
# Optional but recommended to limit the size of your system closure.
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -44,6 +43,12 @@
|
|||||||
zsh-histdb = {
|
zsh-histdb = {
|
||||||
url = "path:flakes/zsh-histdb";
|
url = "path:flakes/zsh-histdb";
|
||||||
|
|
||||||
|
# Optional but recommended to limit the size of your system closure.
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
ansible-sshjail = {
|
||||||
|
url = "path:flakes/ansible-sshjail";
|
||||||
|
|
||||||
# Optional but recommended to limit the size of your system closure.
|
# Optional but recommended to limit the size of your system closure.
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
@@ -53,12 +58,12 @@
|
|||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-unstable,
|
|
||||||
nixpkgs-b93b4e9b5,
|
nixpkgs-b93b4e9b5,
|
||||||
impermanence,
|
impermanence,
|
||||||
home-manager,
|
home-manager,
|
||||||
lanzaboote,
|
lanzaboote,
|
||||||
zsh-histdb,
|
zsh-histdb,
|
||||||
|
ansible-sshjail,
|
||||||
...
|
...
|
||||||
}@inputs:
|
}@inputs:
|
||||||
let
|
let
|
||||||
@@ -68,9 +73,6 @@
|
|||||||
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
|
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
pkgs-unstable = import nixpkgs-unstable {
|
|
||||||
inherit system;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
impermanence.nixosModules.impermanence
|
impermanence.nixosModules.impermanence
|
||||||
@@ -80,19 +82,57 @@
|
|||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
}
|
}
|
||||||
{ nixpkgs.overlays = [ zsh-histdb.overlays.default ]; }
|
{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
zsh-histdb.overlays.default
|
||||||
|
ansible-sshjail.overlays.default
|
||||||
|
];
|
||||||
|
}
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
systems = {
|
systems = {
|
||||||
odo = {
|
odo = {
|
||||||
main = nixpkgs.lib.nixosSystem (base_x86_64_linux // { });
|
main = nixpkgs.lib.nixosSystem (
|
||||||
|
base_x86_64_linux
|
||||||
|
// {
|
||||||
|
modules = base_x86_64_linux.modules ++ [
|
||||||
|
./hosts/odo
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
iso = nixpkgs.lib.nixosSystem (
|
iso = nixpkgs.lib.nixosSystem (
|
||||||
base_x86_64_linux
|
base_x86_64_linux
|
||||||
// {
|
// {
|
||||||
modules = base_x86_64_linux.modules ++ [
|
modules = base_x86_64_linux.modules ++ [
|
||||||
|
./hosts/odo
|
||||||
|
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
|
||||||
|
# TODO: Figure out how to do image based appliances
|
||||||
|
# (nixpkgs + "/nixos/modules/profiles/image-based-appliance.nix")
|
||||||
|
{
|
||||||
|
isoImage.makeEfiBootable = true;
|
||||||
|
isoImage.makeUsbBootable = true;
|
||||||
|
me.buildingIso = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
neelix = {
|
||||||
|
main = nixpkgs.lib.nixosSystem (
|
||||||
|
base_x86_64_linux
|
||||||
|
// {
|
||||||
|
modules = base_x86_64_linux.modules ++ [
|
||||||
|
./hosts/neelix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
iso = nixpkgs.lib.nixosSystem (
|
||||||
|
base_x86_64_linux
|
||||||
|
// {
|
||||||
|
modules = base_x86_64_linux.modules ++ [
|
||||||
|
./hosts/neelix
|
||||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
|
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
|
||||||
# TODO: maybe? imports = [ "${modulesPath}/profiles/image-based-appliance.nix" ];
|
|
||||||
{
|
{
|
||||||
isoImage.makeEfiBootable = true;
|
isoImage.makeEfiBootable = true;
|
||||||
isoImage.makeUsbBootable = true;
|
isoImage.makeUsbBootable = true;
|
||||||
@@ -107,5 +147,7 @@
|
|||||||
{
|
{
|
||||||
nixosConfigurations.odo = systems.odo.main;
|
nixosConfigurations.odo = systems.odo.main;
|
||||||
iso.odo = systems.odo.iso.config.system.build.isoImage;
|
iso.odo = systems.odo.iso.config.system.build.isoImage;
|
||||||
|
nixosConfigurations.neelix = systems.neelix.main;
|
||||||
|
iso.neelix = systems.neelix.iso.config.system.build.isoImage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
61
nix/configuration/flakes/ansible-sshjail/flake.lock
generated
Normal file
61
nix/configuration/flakes/ansible-sshjail/flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1735141468,
|
||||||
|
"narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
34
nix/configuration/flakes/ansible-sshjail/flake.nix
Normal file
34
nix/configuration/flakes/ansible-sshjail/flake.nix
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
description = "A slightly better history for zsh";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
out =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
# Maybe pkgs = import nixpkgs { inherit system; }; ?
|
||||||
|
appliedOverlay = self.overlays.default pkgs pkgs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = rec {
|
||||||
|
default = ansible-sshjail;
|
||||||
|
ansible-sshjail = appliedOverlay.ansible-sshjail;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
flake-utils.lib.eachDefaultSystem out
|
||||||
|
// {
|
||||||
|
overlays.default = final: prev: {
|
||||||
|
ansible-sshjail = final.callPackage ./package.nix { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
33
nix/configuration/flakes/ansible-sshjail/package.nix
Normal file
33
nix/configuration/flakes/ansible-sshjail/package.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# unpackPhase
|
||||||
|
# patchPhase
|
||||||
|
# configurePhase
|
||||||
|
# buildPhase
|
||||||
|
# checkPhase
|
||||||
|
# installPhase
|
||||||
|
# fixupPhase
|
||||||
|
# installCheckPhase
|
||||||
|
# distPhase
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
fetchgit,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "ansible-sshjail";
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://github.com/austinhyde/ansible-sshjail.git";
|
||||||
|
rev = "a7b0076fdb680b915d35efafd1382919100532b6";
|
||||||
|
sha256 = "sha256-4QX/017fDRzb363NexgvHZ/VFKXOjRgGPDKKygyUylM=";
|
||||||
|
};
|
||||||
|
phases = [
|
||||||
|
"installPhase"
|
||||||
|
];
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/share/ansible/plugins/connection_plugins
|
||||||
|
cp $src/sshjail.py $out/share/ansible/plugins/connection_plugins/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
||||||
61
nix/configuration/flakes/starship-game/flake.lock
generated
Normal file
61
nix/configuration/flakes/starship-game/flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1735141468,
|
||||||
|
"narHash": "sha256-VIAjBr1qGcEbmhLwQJD6TABppPMggzOvqFsqkDoMsAY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "4005c3ff7505313cbc21081776ad0ce5dfd7a3ce",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
34
nix/configuration/flakes/starship-game/flake.nix
Normal file
34
nix/configuration/flakes/starship-game/flake.nix
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
description = "A slightly better history for zsh";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
out =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
# Maybe pkgs = import nixpkgs { inherit system; }; ?
|
||||||
|
appliedOverlay = self.overlays.default pkgs pkgs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = rec {
|
||||||
|
default = starship-game;
|
||||||
|
starship-game = appliedOverlay.starship-game;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
flake-utils.lib.eachDefaultSystem out
|
||||||
|
// {
|
||||||
|
overlays.default = final: prev: {
|
||||||
|
starship-game = final.callPackage ./package.nix { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
261
nix/configuration/flakes/starship-game/package.nix
Normal file
261
nix/configuration/flakes/starship-game/package.nix
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
SDL2,
|
||||||
|
cmake,
|
||||||
|
copyDesktopItems,
|
||||||
|
fetchFromGitHub,
|
||||||
|
fetchpatch,
|
||||||
|
fetchurl,
|
||||||
|
imagemagick,
|
||||||
|
imgui,
|
||||||
|
libpng,
|
||||||
|
libpulseaudio,
|
||||||
|
libzip,
|
||||||
|
lsb-release,
|
||||||
|
makeDesktopItem,
|
||||||
|
makeWrapper,
|
||||||
|
ninja,
|
||||||
|
nlohmann_json,
|
||||||
|
pkg-config,
|
||||||
|
python3,
|
||||||
|
spdlog,
|
||||||
|
stormlib,
|
||||||
|
tinyxml-2,
|
||||||
|
writeTextFile,
|
||||||
|
zenity,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
# This would get fetched at build time otherwise, see:
|
||||||
|
# https://github.com/HarbourMasters/2ship2harkinian/blob/1.0.2/mm/CMakeLists.txt#L708
|
||||||
|
gamecontrollerdb = fetchurl {
|
||||||
|
name = "gamecontrollerdb.txt";
|
||||||
|
url = "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/b1759cf84028aab89caa1c395e198c340b8dfd89/gamecontrollerdb.txt";
|
||||||
|
hash = "sha256-7C5EkqBIhLGNJuhi3832y0ffW5Ep7iuTYXb1bL5h2Js=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# 2ship needs a specific imgui version
|
||||||
|
imgui' = imgui.overrideAttrs rec {
|
||||||
|
version = "1.90.6";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "ocornut";
|
||||||
|
repo = "imgui";
|
||||||
|
rev = "v${version}-docking";
|
||||||
|
hash = "sha256-Y8lZb1cLJF48sbuxQ3vXq6GLru/WThR78pq7LlORIzc=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
libgfxd = fetchFromGitHub {
|
||||||
|
owner = "glankk";
|
||||||
|
repo = "libgfxd";
|
||||||
|
rev = "96fd3b849f38b3a7c7b7f3ff03c5921d328e6cdf";
|
||||||
|
hash = "sha256-dedZuV0BxU6goT+rPvrofYqTz9pTA/f6eQcsvpDWdvQ=";
|
||||||
|
};
|
||||||
|
|
||||||
|
yaml_cpp = fetchFromGitHub {
|
||||||
|
owner = "jbeder";
|
||||||
|
repo = "yaml-cpp";
|
||||||
|
rev = "f7320141120f720aecc4c32be25586e7da9eb978";
|
||||||
|
hash = "sha256-J87oS6Az1/vNdyXu3L7KmUGWzU0IAkGrGMUUha+xDXI=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# spdlog = fetchFromGitHub {
|
||||||
|
# owner = "gabime";
|
||||||
|
# repo = "spdlog";
|
||||||
|
# rev = "7e635fca68d014934b4af8a1cf874f63989352b7";
|
||||||
|
# hash = "sha256-cxTaOuLXHRU8xMz9gluYz0a93O0ez2xOxbloyc1m1ns=";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# stb_impl = writeTextFile {
|
||||||
|
# name = "stb_impl.c";
|
||||||
|
# text = ''
|
||||||
|
# #define STB_IMAGE_IMPLEMENTATION
|
||||||
|
# #include "stb_image.h"
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
|
||||||
|
# stb' = fetchurl {
|
||||||
|
# name = "stb_image.h";
|
||||||
|
# url = "https://raw.githubusercontent.com/nothings/stb/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h";
|
||||||
|
# hash = "sha256-xUsVponmofMsdeLsI6+kQuPg436JS3PBl00IZ5sg3Vw=";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Apply 2ship's patch for stormlib
|
||||||
|
stormlib' = stormlib.overrideAttrs (prev: rec {
|
||||||
|
version = "9.25";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "ladislav-zezula";
|
||||||
|
repo = "StormLib";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-HTi2FKzKCbRaP13XERUmHkJgw8IfKaRJvsK3+YxFFdc=";
|
||||||
|
};
|
||||||
|
nativeBuildInputs = prev.nativeBuildInputs ++ [ pkg-config ];
|
||||||
|
patches = (prev.patches or [ ]) ++ [
|
||||||
|
(fetchpatch {
|
||||||
|
name = "stormlib-optimizations.patch";
|
||||||
|
url = "https://github.com/briaguya-ai/StormLib/commit/ff338b230544f8b2bb68d2fbe075175ed2fd758c.patch";
|
||||||
|
hash = "sha256-Jbnsu5E6PkBifcx/yULMVC//ab7tszYgktS09Azs5+4=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
thread_pool = fetchFromGitHub {
|
||||||
|
owner = "bshoshany";
|
||||||
|
repo = "thread-pool";
|
||||||
|
rev = "v4.1.0";
|
||||||
|
hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88=";
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "starship-game";
|
||||||
|
version = "v1.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "HarbourMasters";
|
||||||
|
repo = "starship";
|
||||||
|
# rev = "5e5e49da93e066f51c3010ba38f09331d866f2db";
|
||||||
|
tag = finalAttrs.version;
|
||||||
|
hash = "sha256-kaLLlLuonqE2DJcRlWR4tCEBNjwIYFlzeDLcYsvMO7I=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# patches = [
|
||||||
|
# # remove fetching stb as we will patch our own
|
||||||
|
# ./0001-deps.patch
|
||||||
|
# ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
cmake
|
||||||
|
copyDesktopItems
|
||||||
|
imagemagick
|
||||||
|
lsb-release
|
||||||
|
makeWrapper
|
||||||
|
ninja
|
||||||
|
pkg-config
|
||||||
|
python3
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
SDL2
|
||||||
|
imgui'
|
||||||
|
libpng
|
||||||
|
libpulseaudio
|
||||||
|
libzip
|
||||||
|
nlohmann_json
|
||||||
|
spdlog
|
||||||
|
stormlib'
|
||||||
|
tinyxml-2
|
||||||
|
zenity
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
(lib.cmakeBool "NON_PORTABLE" true)
|
||||||
|
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/starship-game")
|
||||||
|
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_IMGUI" "${imgui'.src}")
|
||||||
|
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${libgfxd}")
|
||||||
|
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_STORMLIB" "${stormlib'}")
|
||||||
|
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_THREADPOOL" "${thread_pool}")
|
||||||
|
];
|
||||||
|
|
||||||
|
dontAddPrefix = true;
|
||||||
|
|
||||||
|
# Linking fails without this
|
||||||
|
hardeningDisable = [ "format" ];
|
||||||
|
|
||||||
|
# Pie needs to be enabled or else it segfaults
|
||||||
|
hardeningEnable = [ "pie" ];
|
||||||
|
|
||||||
|
# preConfigure = ''
|
||||||
|
# # mirror 2ship's stb
|
||||||
|
# mkdir stb
|
||||||
|
# cp ${stb'} ./stb/${stb'.name}
|
||||||
|
# cp ${stb_impl} ./stb/${stb_impl.name}
|
||||||
|
|
||||||
|
# substituteInPlace libultraship/cmake/dependencies/common.cmake \
|
||||||
|
# --replace-fail "\''${STB_DIR}" "/build/source/stb"
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# (cd tools/Torch && cmake -H. -Bbuild-cmake -GNinja \
|
||||||
|
# -DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${libgfxd} \
|
||||||
|
# -DFETCHCONTENT_SOURCE_DIR_YAML-CPP=${finalAttrs.yaml_cpp_src} \
|
||||||
|
# -DFETCHCONTENT_SOURCE_DIR_SPDLOG=${finalAttrs.spdlog_src}
|
||||||
|
# )
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
cmake -H. -Bbuild-cmake -GNinja \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_IMGUI=${imgui'.src} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_STORMLIB=${stormlib'} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_THREADPOOL=${thread_pool}
|
||||||
|
|
||||||
|
(cd tools/Torch && cmake -H. -Bbuild-cmake -GNinja \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${libgfxd} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_YAML-CPP=${yaml_cpp} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_SPDLOG=${spdlog}
|
||||||
|
)
|
||||||
|
|
||||||
|
(cd libultraship && cmake -H. -Bbuild-cmake -GNinja \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_LIBGFXD=${libgfxd} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_IMGUI=${imgui'.src} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_STORMLIB=${stormlib'} \
|
||||||
|
-DFETCHCONTENT_SOURCE_DIR_THREADPOOL=${thread_pool}
|
||||||
|
)
|
||||||
|
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
cmake --build build-cmake
|
||||||
|
'';
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
cp ${gamecontrollerdb} ${gamecontrollerdb.name}
|
||||||
|
pushd ../OTRExporter
|
||||||
|
python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../mm/assets/xml --custom-assets-path ../mm/assets/custom --custom-otr-file 2ship.o2r --port-ver ${finalAttrs.version}
|
||||||
|
popd
|
||||||
|
'';
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
# Cmake likes it here for its install paths
|
||||||
|
cp ../OTRExporter/2ship.o2r mm/
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s $out/2s2h/2s2h.elf $out/bin/2s2h
|
||||||
|
install -Dm644 ../mm/linux/2s2hIcon.png $out/share/pixmaps/2s2h.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
wrapProgram $out/2s2h/2s2h.elf --prefix PATH ":" ${lib.makeBinPath [ zenity ]}
|
||||||
|
'';
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "starship";
|
||||||
|
icon = "starship";
|
||||||
|
exec = "starship";
|
||||||
|
comment = finalAttrs.meta.description;
|
||||||
|
genericName = "Starship";
|
||||||
|
desktopName = "starship";
|
||||||
|
categories = [ "Game" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://github.com/HarbourMasters/2ship2harkinian";
|
||||||
|
description = "A PC port of Majora's Mask with modern controls, widescreen, high-resolution, and more";
|
||||||
|
mainProgram = "starship";
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
maintainers = with lib.maintainers; [ ];
|
||||||
|
license = with lib.licenses; [
|
||||||
|
# # OTRExporter, OTRGui, ZAPDTR, libultraship
|
||||||
|
# mit
|
||||||
|
# # 2 Ship 2 Harkinian
|
||||||
|
# cc0
|
||||||
|
# # Reverse engineering
|
||||||
|
# unfree
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
@@ -21,9 +21,16 @@ stdenv.mkDerivation {
|
|||||||
sha256 = "sha256-vtG1poaRVbfb/wKPChk1WpPgDq+7udLqLfYfLqap4Vg=";
|
sha256 = "sha256-vtG1poaRVbfb/wKPChk1WpPgDq+7udLqLfYfLqap4Vg=";
|
||||||
};
|
};
|
||||||
buildInputs = [ sqlite ];
|
buildInputs = [ sqlite ];
|
||||||
phases = [ "installPhase" ];
|
phases = [
|
||||||
|
"installPhase"
|
||||||
|
];
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
mkdir -p $out/share/zsh/plugins/zsh-histdb
|
mkdir -p $out/share/zsh/plugins/zsh-histdb
|
||||||
cp -r $src/histdb-* $src/*.zsh $src/db_migrations $out/share/zsh/plugins/zsh-histdb/
|
cp -r $src/histdb-* $src/*.zsh $src/db_migrations $out/share/zsh/plugins/zsh-histdb/
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
postInstall = ''
|
||||||
|
substituteInPlace $out/share/zsh/plugins/zsh-histdb/sqlite-history.zsh $out/share/zsh/plugins/zsh-histdb/histdb-merge $out/share/zsh/plugins/zsh-histdb/histdb-migrate --replace-fail "sqlite3" "${sqlite}/bin/sqlite3"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
38
nix/configuration/hosts/neelix/default.nix
Normal file
38
nix/configuration/hosts/neelix/default.nix
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./disk-config.nix
|
||||||
|
./optimized_build.nix
|
||||||
|
./power_management.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||||
|
networking.hostId = "fbd233d8";
|
||||||
|
|
||||||
|
networking.hostName = "neelix"; # Define your hostname.
|
||||||
|
|
||||||
|
time.timeZone = "America/New_York";
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
|
me.secureBoot.enable = false;
|
||||||
|
|
||||||
|
# Early KMS
|
||||||
|
boot.initrd.kernelModules = [ "i915" ];
|
||||||
|
|
||||||
|
# Mount tmpfs at /tmp
|
||||||
|
boot.tmp.useTmpfs = true;
|
||||||
|
|
||||||
|
me.bluetooth.enable = true;
|
||||||
|
me.emacs_flavor = "plainmacs";
|
||||||
|
me.graphical = true;
|
||||||
|
me.graphics_card_type = "intel";
|
||||||
|
me.kodi.enable = true;
|
||||||
|
me.lvfs.enable = true;
|
||||||
|
me.sound.enable = true;
|
||||||
|
me.wireguard.activated = [ "wgh" ];
|
||||||
|
me.wireguard.deactivated = [ "wgf" ];
|
||||||
|
me.zrepl.enable = true;
|
||||||
|
me.zsh.enable = true;
|
||||||
|
|
||||||
|
}
|
||||||
140
nix/configuration/hosts/neelix/disk-config.nix
Normal file
140
nix/configuration/hosts/neelix/disk-config.nix
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# Manual Step:
|
||||||
|
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||||
|
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
lib.mkIf (!config.me.buildingIso) {
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme0n1";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [
|
||||||
|
"umask=0077"
|
||||||
|
"noatime"
|
||||||
|
"discard"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "zroot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
zroot = {
|
||||||
|
type = "zpool";
|
||||||
|
# mode = "mirror";
|
||||||
|
# Workaround: cannot import 'zroot': I/O error in disko tests
|
||||||
|
options.cachefile = "none";
|
||||||
|
options = {
|
||||||
|
ashift = "12";
|
||||||
|
compatibility = "openzfs-2.2-freebsd";
|
||||||
|
autotrim = "on";
|
||||||
|
};
|
||||||
|
rootFsOptions = {
|
||||||
|
acltype = "posixacl";
|
||||||
|
atime = "off";
|
||||||
|
relatime = "off";
|
||||||
|
xattr = "sa";
|
||||||
|
mountpoint = "none";
|
||||||
|
compression = "lz4";
|
||||||
|
canmount = "off";
|
||||||
|
utf8only = "on";
|
||||||
|
dnodesize = "auto";
|
||||||
|
normalization = "formD";
|
||||||
|
};
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
"linux/nix" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "none";
|
||||||
|
};
|
||||||
|
"linux/nix/root" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
mountpoint = "/";
|
||||||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
|
||||||
|
};
|
||||||
|
"linux/nix/nix" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
|
||||||
|
options = {
|
||||||
|
recordsize = "1MiB";
|
||||||
|
compression = "lz4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"linux/nix/home" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
mountpoint = "/home";
|
||||||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
|
||||||
|
};
|
||||||
|
"linux/nix/persist" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
|
||||||
|
};
|
||||||
|
"linux/nix/state" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
mountpoint = "/state";
|
||||||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make sure all persistent volumes are marked as neededForBoot
|
||||||
|
#
|
||||||
|
# Also mounts /home so it is mounted before the user home directories are created.
|
||||||
|
fileSystems."/persist".neededForBoot = true;
|
||||||
|
fileSystems."/state".neededForBoot = true;
|
||||||
|
fileSystems."/home".neededForBoot = true;
|
||||||
|
|
||||||
|
fileSystems."/".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/nix".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/persist".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/state".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/home".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
}
|
||||||
32
nix/configuration/hosts/neelix/hardware-configuration.nix
Normal file
32
nix/configuration/hosts/neelix/hardware-configuration.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
||||||
78
nix/configuration/hosts/neelix/optimized_build.nix
Normal file
78
nix/configuration/hosts/neelix/optimized_build.nix
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{ }
|
||||||
|
(lib.mkIf (!config.me.buildingIso) {
|
||||||
|
nix.settings.system-features = lib.mkForce [
|
||||||
|
"gccarch-alderlake"
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
|
||||||
|
# nixpkgs.hostPlatform = {
|
||||||
|
# gcc.arch = "alderlake";
|
||||||
|
# gcc.tune = "alderlake";
|
||||||
|
# system = "x86_64-linux";
|
||||||
|
|
||||||
|
# };
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(
|
||||||
|
self: super:
|
||||||
|
let
|
||||||
|
optimizeWithFlags =
|
||||||
|
pkg: flags:
|
||||||
|
pkg.overrideAttrs (old: {
|
||||||
|
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
|
||||||
|
});
|
||||||
|
addConfig =
|
||||||
|
additionalConfig: pkg:
|
||||||
|
pkg.override (oldconfig: {
|
||||||
|
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
linux_alderlake =
|
||||||
|
addConfig
|
||||||
|
{
|
||||||
|
# Full preemption
|
||||||
|
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
|
||||||
|
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
|
||||||
|
|
||||||
|
# Google's BBRv3 TCP congestion Control
|
||||||
|
TCP_CONG_BBR = lib.kernel.yes;
|
||||||
|
DEFAULT_BBR = lib.kernel.yes;
|
||||||
|
|
||||||
|
# Preemptive Full Tickless Kernel at 300Hz
|
||||||
|
HZ = lib.kernel.freeform "300";
|
||||||
|
HZ_300 = lib.kernel.yes;
|
||||||
|
HZ_1000 = lib.kernel.no;
|
||||||
|
}
|
||||||
|
(
|
||||||
|
optimizeWithFlags super.linux_6_12 [
|
||||||
|
"-march=alderlake"
|
||||||
|
"-mtune=alderlake"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_alderlake;
|
||||||
|
})
|
||||||
|
(lib.mkIf (config.me.buildingIso) {
|
||||||
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_12;
|
||||||
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
35
nix/configuration/hosts/neelix/power_management.nix
Normal file
35
nix/configuration/hosts/neelix/power_management.nix
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
powertop
|
||||||
|
];
|
||||||
|
|
||||||
|
# pcie_aspm=force pcie_aspm.policy=powersupersave :: Enable PCIe active state power management for power reduction.
|
||||||
|
# nowatchdog :: Disable watchdog for power savings (related to disable_sp5100_watchdog above).
|
||||||
|
boot.kernelParams = [
|
||||||
|
"pcie_aspm=force"
|
||||||
|
# "pcie_aspm.policy=powersupersave"
|
||||||
|
"nowatchdog"
|
||||||
|
];
|
||||||
|
|
||||||
|
# default performance balance_performance balance_power power
|
||||||
|
# defaults to balance_performance
|
||||||
|
# systemd.tmpfiles.rules = [
|
||||||
|
# "w- /sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference - - - - power"
|
||||||
|
# "w- /sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference - - - - power"
|
||||||
|
# "w- /sys/devices/system/cpu/cpufreq/policy2/energy_performance_preference - - - - power"
|
||||||
|
# "w- /sys/devices/system/cpu/cpufreq/policy3/energy_performance_preference - - - - power"
|
||||||
|
# ];
|
||||||
|
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
options snd_hda_intel power_save=1
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
./optimized_build.nix
|
./optimized_build.nix
|
||||||
./power_management.nix
|
./power_management.nix
|
||||||
./screen_brightness.nix
|
./screen_brightness.nix
|
||||||
|
./wifi.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||||
@@ -23,4 +24,52 @@
|
|||||||
|
|
||||||
# Mount tmpfs at /tmp
|
# Mount tmpfs at /tmp
|
||||||
boot.tmp.useTmpfs = true;
|
boot.tmp.useTmpfs = true;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
fw-ectool
|
||||||
|
];
|
||||||
|
|
||||||
|
me.alacritty.enable = true;
|
||||||
|
me.ansible.enable = true;
|
||||||
|
me.ares.enable = true;
|
||||||
|
me.bluetooth.enable = true;
|
||||||
|
me.chromecast.enable = true;
|
||||||
|
me.chromium.enable = true;
|
||||||
|
me.docker.enable = true;
|
||||||
|
me.emacs_flavor = "full";
|
||||||
|
me.firefox.enable = true;
|
||||||
|
me.git.config = ../../roles/git/files/gitconfig_home;
|
||||||
|
me.gpg.enable = true;
|
||||||
|
me.graphical = true;
|
||||||
|
me.graphics_card_type = "amd";
|
||||||
|
me.kanshi.enable = true;
|
||||||
|
me.kubernetes.enable = true;
|
||||||
|
me.latex.enable = true;
|
||||||
|
me.launch_keyboard.enable = true;
|
||||||
|
me.lvfs.enable = true;
|
||||||
|
me.media.enable = true;
|
||||||
|
me.nix_index.enable = true;
|
||||||
|
me.python.enable = true;
|
||||||
|
me.qemu.enable = true;
|
||||||
|
me.rust.enable = true;
|
||||||
|
me.sound.enable = true;
|
||||||
|
me.steam.enable = true;
|
||||||
|
me.sway.enable = true;
|
||||||
|
me.terraform.enable = true;
|
||||||
|
me.vnc_client.enable = true;
|
||||||
|
me.vscode.enable = true;
|
||||||
|
me.wasm.enable = true;
|
||||||
|
me.waybar.enable = true;
|
||||||
|
me.wireguard.activated = [
|
||||||
|
"drmario"
|
||||||
|
"wgh"
|
||||||
|
"colo"
|
||||||
|
];
|
||||||
|
me.wireguard.deactivated = [ "wgf" ];
|
||||||
|
me.zrepl.enable = true;
|
||||||
|
me.zsh.enable = true;
|
||||||
|
|
||||||
|
me.sm64ex.enable = true;
|
||||||
|
me.shipwright.enable = true;
|
||||||
|
me.ship2harkinian.enable = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
# Manual Step:
|
||||||
|
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
|
||||||
|
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@@ -119,6 +122,27 @@ lib.mkIf (!config.me.buildingIso) {
|
|||||||
fileSystems."/state".neededForBoot = true;
|
fileSystems."/state".neededForBoot = true;
|
||||||
fileSystems."/home".neededForBoot = true;
|
fileSystems."/home".neededForBoot = true;
|
||||||
|
|
||||||
|
fileSystems."/".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/nix".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/persist".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/state".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
fileSystems."/home".options = [
|
||||||
|
"noatime"
|
||||||
|
"norelatime"
|
||||||
|
];
|
||||||
|
|
||||||
# Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
|
# Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
|
||||||
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
|
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"thunderbolt"
|
"thunderbolt"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
|
|||||||
@@ -2,17 +2,20 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgs-unstable,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{ }
|
||||||
|
(lib.mkIf (!config.me.buildingIso) {
|
||||||
nix.settings.system-features = lib.mkForce [
|
nix.settings.system-features = lib.mkForce [
|
||||||
"gccarch-znver4"
|
"gccarch-znver4"
|
||||||
"gccarch-skylake"
|
"gccarch-skylake"
|
||||||
# "gccarch-alderlake" missing pkgwait
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
"gccarch-x86-64-v3"
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
"benchmark"
|
"benchmark"
|
||||||
"big-parallel"
|
"big-parallel"
|
||||||
"kvm"
|
"kvm"
|
||||||
@@ -23,6 +26,7 @@
|
|||||||
# gcc.arch = "znver4";
|
# gcc.arch = "znver4";
|
||||||
# gcc.tune = "znver4";
|
# gcc.tune = "znver4";
|
||||||
# system = "x86_64-linux";
|
# system = "x86_64-linux";
|
||||||
|
|
||||||
# };
|
# };
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
@@ -34,18 +38,44 @@
|
|||||||
pkg.overrideAttrs (old: {
|
pkg.overrideAttrs (old: {
|
||||||
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
|
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
|
||||||
});
|
});
|
||||||
|
addConfig =
|
||||||
|
additionalConfig: pkg:
|
||||||
|
pkg.override (oldconfig: {
|
||||||
|
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
||||||
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
linux_znver4 = optimizeWithFlags super.linux_zen [
|
linux_znver4 =
|
||||||
|
addConfig
|
||||||
|
{
|
||||||
|
# Full preemption
|
||||||
|
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
|
||||||
|
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
|
||||||
|
|
||||||
|
# Google's BBRv3 TCP congestion Control
|
||||||
|
TCP_CONG_BBR = lib.kernel.yes;
|
||||||
|
DEFAULT_BBR = lib.kernel.yes;
|
||||||
|
|
||||||
|
# Preemptive Full Tickless Kernel at 300Hz
|
||||||
|
HZ = lib.kernel.freeform "300";
|
||||||
|
HZ_300 = lib.kernel.yes;
|
||||||
|
HZ_1000 = lib.kernel.no;
|
||||||
|
}
|
||||||
|
(
|
||||||
|
optimizeWithFlags super.linux_6_12 [
|
||||||
"-march=znver4"
|
"-march=znver4"
|
||||||
"-mtune=znver4"
|
"-mtune=znver4"
|
||||||
];
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
(final: prev: {
|
|
||||||
linux-firmware = pkgs-unstable.linux-firmware;
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.kernelPackages = lib.mkIf (!config.me.buildingIso) (pkgs.linuxPackagesFor pkgs.linux_znver4);
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_znver4;
|
||||||
|
})
|
||||||
|
(lib.mkIf (config.me.buildingIso) {
|
||||||
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_12;
|
||||||
|
boot.supportedFilesystems.zfs = true;
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"amdgpu.abmlevel=3"
|
"amdgpu.abmlevel=3"
|
||||||
"pcie_aspm=force"
|
"pcie_aspm=force"
|
||||||
"pcie_aspm.policy=powersupersave"
|
# "pcie_aspm.policy=powersupersave"
|
||||||
"nowatchdog"
|
"nowatchdog"
|
||||||
# I don't see a measurable benefit from these two:
|
# I don't see a measurable benefit from these two:
|
||||||
# "cpufreq.default_governor=powersave"
|
# "cpufreq.default_governor=powersave"
|
||||||
@@ -48,4 +48,12 @@
|
|||||||
"w- /sys/devices/system/cpu/cpufreq/policy14/energy_performance_preference - - - - power"
|
"w- /sys/devices/system/cpu/cpufreq/policy14/energy_performance_preference - - - - power"
|
||||||
"w- /sys/devices/system/cpu/cpufreq/policy15/energy_performance_preference - - - - power"
|
"w- /sys/devices/system/cpu/cpufreq/policy15/energy_performance_preference - - - - power"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
# Disable the hardware watchdog inside AMD 700 chipset series for power savings.
|
||||||
|
blacklist sp5100_tco
|
||||||
|
|
||||||
|
# Sound power-saving was causing chat notifications to be inaudible.
|
||||||
|
# options snd_hda_intel power_save=1
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
21
nix/configuration/hosts/odo/wifi.nix
Normal file
21
nix/configuration/hosts/odo/wifi.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
environment.loginShellInit = lib.mkIf (!config.me.buildingIso) ''
|
||||||
|
doas iw dev wlan0 set power_save off
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Enable debug logging for ath12k wifi card.
|
||||||
|
boot.kernelParams = [
|
||||||
|
"ath12k.debug_mask=0xffffffff"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
48
nix/configuration/roles/2ship2harkinian/default.nix
Normal file
48
nix/configuration/roles/2ship2harkinian/default.nix
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
ship2harkinian.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install 2ship2harkinian.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.ship2harkinian.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
allowedUnfree = [ "2ship2harkinian" ];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
_2ship2harkinian
|
||||||
|
];
|
||||||
|
|
||||||
|
# TODO perhaps install ~/.local/share/2ship/2ship2harkinian.json
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".local/share/2ship";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,7 +7,18 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
options.me = {
|
||||||
|
alacritty.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install alacritty.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.alacritty.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
alacritty
|
alacritty
|
||||||
xdg-utils # for xdg-open
|
xdg-utils # for xdg-open
|
||||||
@@ -20,5 +31,8 @@
|
|||||||
source = ./files/alacritty.toml;
|
source = ./files/alacritty.toml;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
86
nix/configuration/roles/ansible/default.nix
Normal file
86
nix/configuration/roles/ansible/default.nix
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
ansible.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install ansible.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.ansible.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
ansible
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
ansible = pkgs.symlinkJoin {
|
||||||
|
name = "ansible";
|
||||||
|
paths = [
|
||||||
|
(prev.ansible.overridePythonAttrs {
|
||||||
|
propagatedBuildInputs = prev.ansible.propagatedBuildInputs ++ [ prev.python3Packages.jmespath ];
|
||||||
|
})
|
||||||
|
pkgs.ansible-sshjail
|
||||||
|
];
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
${lib.concatMapStringsSep "\n"
|
||||||
|
(
|
||||||
|
prog:
|
||||||
|
(
|
||||||
|
"wrapProgram $out/bin/${prog} ${
|
||||||
|
lib.concatMapStringsSep " "
|
||||||
|
(
|
||||||
|
plugin_type:
|
||||||
|
"--set ANSIBLE_${lib.toUpper plugin_type}_PLUGINS $out/share/ansible/plugins/${lib.toLower plugin_type}_plugins"
|
||||||
|
)
|
||||||
|
[
|
||||||
|
"action"
|
||||||
|
"cache"
|
||||||
|
"callback"
|
||||||
|
"connection"
|
||||||
|
"filter"
|
||||||
|
"inventory"
|
||||||
|
"lookup"
|
||||||
|
"shell"
|
||||||
|
"strategy"
|
||||||
|
"test"
|
||||||
|
"vars"
|
||||||
|
]
|
||||||
|
} --prefix PATH : ${lib.makeBinPath [ ]}"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
[
|
||||||
|
"ansible"
|
||||||
|
"ansible-config"
|
||||||
|
"ansible-console"
|
||||||
|
"ansible-doc"
|
||||||
|
"ansible-galaxy"
|
||||||
|
"ansible-inventory"
|
||||||
|
"ansible-playbook"
|
||||||
|
"ansible-pull"
|
||||||
|
"ansible-test"
|
||||||
|
"ansible-vault"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
44
nix/configuration/roles/ares/default.nix
Normal file
44
nix/configuration/roles/ares/default.nix
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
ares.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install ares.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.ares.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{ }
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
ares
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".local/share/ares";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,4 +8,23 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
blank.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install blank.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.blank.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
46
nix/configuration/roles/bluetooth/default.nix
Normal file
46
nix/configuration/roles/bluetooth/default.nix
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
bluetooth.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install bluetooth.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.bluetooth.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
|
hardware.bluetooth = {
|
||||||
|
enable = true;
|
||||||
|
powerOnBoot = true;
|
||||||
|
settings = {
|
||||||
|
General = {
|
||||||
|
# Enable support for showing battery charge level.
|
||||||
|
Experimental = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
"/var/lib/bluetooth" # Bluetooth pairing information.
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -22,6 +22,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
tpm2-tools # For tpm2_eventlog to check for OptionRoms
|
||||||
|
# cp /sys/kernel/security/tpm0/binary_bios_measurements eventlog
|
||||||
|
# tpm2_eventlog eventlog | grep "BOOT_SERVICES_DRIVER"
|
||||||
|
sbctl # For debugging and troubleshooting Secure Boot.
|
||||||
|
];
|
||||||
|
}
|
||||||
(lib.mkIf (!config.me.buildingIso) {
|
(lib.mkIf (!config.me.buildingIso) {
|
||||||
|
|
||||||
boot.loader.grub.enable = false;
|
boot.loader.grub.enable = false;
|
||||||
@@ -33,6 +41,8 @@
|
|||||||
# Automatically delete old generations
|
# Automatically delete old generations
|
||||||
boot.loader.systemd-boot.configurationLimit = 3;
|
boot.loader.systemd-boot.configurationLimit = 3;
|
||||||
|
|
||||||
|
boot.loader.systemd-boot.memtest86.enable = true;
|
||||||
|
|
||||||
# Check what will be lost with `zfs diff zroot/linux/root@blank`
|
# Check what will be lost with `zfs diff zroot/linux/root@blank`
|
||||||
boot.initrd.systemd.enable = lib.mkDefault true;
|
boot.initrd.systemd.enable = lib.mkDefault true;
|
||||||
boot.initrd.systemd.services.zfs-rollback = {
|
boot.initrd.systemd.services.zfs-rollback = {
|
||||||
@@ -67,19 +77,19 @@
|
|||||||
# };
|
# };
|
||||||
})
|
})
|
||||||
(lib.mkIf (config.me.secureBoot.enable) {
|
(lib.mkIf (config.me.secureBoot.enable) {
|
||||||
# For debugging and troubleshooting Secure Boot.
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
sbctl
|
sbctl
|
||||||
];
|
];
|
||||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
boot.lanzaboote = {
|
boot.lanzaboote = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pkiBundle = "/etc/secureboot";
|
pkiBundle = "/var/lib/sbctl";
|
||||||
};
|
};
|
||||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
"/etc/secureboot" # Secure Boot Keys
|
"/var/lib/sbctl" # Secure Boot Keys
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
31
nix/configuration/roles/chromecast/default.nix
Normal file
31
nix/configuration/roles/chromecast/default.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
chromecast.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install chromecast.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.chromecast.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
catt
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,15 +8,23 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
# TODO: Read https://bbs.archlinux.org/viewtopic.php?pid=2209507#p2209507 and apply desired settings.
|
options.me = {
|
||||||
|
chromium.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install chromium.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.chromium.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{ }
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(chromium.override { enableWideVine = true; })
|
(chromium.override { enableWideVine = true; })
|
||||||
];
|
];
|
||||||
|
allowedUnfree = [
|
||||||
nixpkgs.config.allowUnfreePredicate =
|
|
||||||
pkg:
|
|
||||||
builtins.elem (lib.getName pkg) [
|
|
||||||
"chromium"
|
"chromium"
|
||||||
"chromium-unwrapped"
|
"chromium-unwrapped"
|
||||||
"widevine-cdm"
|
"widevine-cdm"
|
||||||
@@ -51,4 +59,7 @@
|
|||||||
|
|
||||||
# Enabling vulkan causes video to render as white
|
# Enabling vulkan causes video to render as white
|
||||||
# nixpkgs.config.chromium.commandLineArgs = "--enable-features=Vulkan";
|
# nixpkgs.config.chromium.commandLineArgs = "--enable-features=Vulkan";
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,31 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
options.me = {
|
||||||
virtualisation.docker.rootless = {
|
docker.enable = lib.mkOption {
|
||||||
enable = true;
|
type = lib.types.bool;
|
||||||
setSocketVariable = true;
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install docker.";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.docker.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
|
# Use docker activation
|
||||||
|
virtualisation.docker.enableOnBoot = false;
|
||||||
|
# Rootless docker breaks access to ssh for buildkit.
|
||||||
|
# virtualisation.docker.rootless = {
|
||||||
|
# enable = true;
|
||||||
|
# setSocketVariable = true;
|
||||||
|
# };
|
||||||
|
# Give docker access to ssh for fetching repos with buildkit.
|
||||||
|
virtualisation.docker.extraPackages = [ pkgs.openssh ];
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
docker-buildx
|
||||||
|
];
|
||||||
|
|
||||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
@@ -24,16 +44,21 @@
|
|||||||
mode = "0740";
|
mode = "0740";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
users.talexander = {
|
# users.talexander = {
|
||||||
directories = [
|
# directories = [
|
||||||
{
|
# {
|
||||||
directory = ".local/share/docker";
|
# directory = ".local/share/docker";
|
||||||
user = "talexander";
|
# user = "talexander";
|
||||||
group = "talexander";
|
# group = "talexander";
|
||||||
mode = "0740";
|
# mode = "0740";
|
||||||
}
|
# }
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Needed for non-rootless docker
|
||||||
|
users.users.talexander.extraGroups = [ "docker" ];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
plainmacs = pkgs.writeShellScriptBin "plainmacs" ''
|
plainmacs =
|
||||||
|
emacs_package:
|
||||||
|
pkgs.writeShellScriptBin "plainmacs" ''
|
||||||
INIT_SCRIPT=$(cat <<EOF
|
INIT_SCRIPT=$(cat <<EOF
|
||||||
(progn
|
(progn
|
||||||
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
|
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
|
||||||
@@ -34,32 +36,37 @@ let
|
|||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
exec ${pkgs.emacs29-pgtk}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
|
exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
|
||||||
'';
|
'';
|
||||||
e_shorthand = pkgs.writeShellScriptBin "e" ''
|
e_shorthand =
|
||||||
exec ${pkgs.emacs29-pgtk}/bin/emacs "''${@}"
|
emacs_package:
|
||||||
|
pkgs.writeShellScriptBin "e" ''
|
||||||
|
exec ${emacs_package}/bin/emacs "''${@}"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
options.me.emacs_flavor = lib.mkOption {
|
||||||
plainmacs
|
type = lib.types.nullOr (
|
||||||
e_shorthand
|
lib.types.enum [
|
||||||
emacs29-pgtk
|
"full"
|
||||||
clang # To compile tree-sitter grammars
|
"plainmacs"
|
||||||
nixd # nix language server
|
]
|
||||||
nixfmt-rfc-style # auto-formatting nix files through nixd
|
);
|
||||||
];
|
default = null;
|
||||||
|
example = "full";
|
||||||
|
description = "What flavor of emacs to set up.";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.talexander =
|
config = lib.mkIf (config.me.emacs_flavor != null) (
|
||||||
{ pkgs, ... }:
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
home.file.".config/emacs" = {
|
environment.systemPackages = with pkgs; [
|
||||||
source = ./files/emacs;
|
my_emacs
|
||||||
recursive = true;
|
(plainmacs my_emacs)
|
||||||
};
|
(e_shorthand my_emacs)
|
||||||
};
|
];
|
||||||
|
|
||||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
@@ -77,5 +84,84 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
|
environment.variables.EDITOR = "plainmacs";
|
||||||
|
}
|
||||||
|
(lib.mkIf (config.me.graphical) {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
my_emacs = final.emacs29-pgtk;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(lib.mkIf (!config.me.graphical) {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
my_emacs = final.emacs-nox;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(lib.mkIf (config.me.emacs_flavor == "full") {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
my_emacs = pkgs.buildEnv {
|
||||||
|
name = prev.my_emacs.name;
|
||||||
|
paths = with prev; [
|
||||||
|
my_emacs
|
||||||
|
];
|
||||||
|
extraOutputsToInstall = [
|
||||||
|
"man"
|
||||||
|
"doc"
|
||||||
|
"info"
|
||||||
|
];
|
||||||
|
buildInputs = [ final.makeWrapper ];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/emacs --prefix PATH : ${
|
||||||
|
lib.makeBinPath [
|
||||||
|
(final.aspellWithDicts (
|
||||||
|
dicts: with dicts; [
|
||||||
|
en
|
||||||
|
en-computers
|
||||||
|
]
|
||||||
|
))
|
||||||
|
final.nixd # nix language server
|
||||||
|
final.nixfmt-rfc-style # auto-formatting nix files through nixd
|
||||||
|
final.clang # To compile tree-sitter grammars
|
||||||
|
final.shellcheck
|
||||||
|
final.cmake-language-server
|
||||||
|
final.cmake # Used by cmake-language-server
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.talexander =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.file.".config/emacs" = {
|
||||||
|
source = ./files/emacs;
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
my_emacs = pkgs.buildEnv {
|
||||||
|
name = prev.my_emacs.name;
|
||||||
|
paths = with prev; [
|
||||||
|
my_emacs
|
||||||
|
];
|
||||||
|
extraOutputsToInstall = [
|
||||||
|
"man"
|
||||||
|
"doc"
|
||||||
|
"info"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
(require 'common-lsp)
|
||||||
|
|
||||||
|
(use-package cmake-mode
|
||||||
|
:commands cmake-mode
|
||||||
|
:hook (
|
||||||
|
(cmake-mode . (lambda ()
|
||||||
|
(eglot-ensure)
|
||||||
|
(defclass my/eglot-cmake (eglot-lsp-server) ()
|
||||||
|
:documentation
|
||||||
|
"Own eglot server class.")
|
||||||
|
|
||||||
|
(add-to-list 'eglot-server-programs
|
||||||
|
'(cmake-mode . (my/eglot-cmake "cmake-language-server")))
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(provide 'lang-cmake)
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
;; TODO: There is an option to set the compiler, could be better than manually doing this here https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html
|
;; TODO: There is an option to set the compiler, could be better than manually doing this here https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html
|
||||||
;; (setq org-latex-compiler "lualatex")
|
;; (setq org-latex-compiler "lualatex")
|
||||||
|
;; TODO: nixos latex page recommends this line, figure out what it does / why its needed:
|
||||||
|
;; (setq org-preview-latex-default-process 'dvisvgm)
|
||||||
(setq org-latex-pdf-process
|
(setq org-latex-pdf-process
|
||||||
'("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
'("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||||
"lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
"lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||||
|
|||||||
@@ -38,4 +38,6 @@
|
|||||||
|
|
||||||
(require 'lang-nix)
|
(require 'lang-nix)
|
||||||
|
|
||||||
|
(require 'lang-cmake)
|
||||||
|
|
||||||
(load-directory autoload-directory)
|
(load-directory autoload-directory)
|
||||||
|
|||||||
@@ -8,6 +8,18 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
firefox.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install firefox.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.firefox.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { });
|
package = (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { });
|
||||||
@@ -80,6 +92,14 @@
|
|||||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/netflix-party-is-now-teleparty/latest.xpi";
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/netflix-party-is-now-teleparty/latest.xpi";
|
||||||
installation_mode = "normal_installed";
|
installation_mode = "normal_installed";
|
||||||
};
|
};
|
||||||
|
"@ublacklist" = {
|
||||||
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublacklist/latest.xpi";
|
||||||
|
installation_mode = "normal_installed";
|
||||||
|
};
|
||||||
|
"@react-devtools" = {
|
||||||
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/react-devtools/latest.xpi";
|
||||||
|
installation_mode = "normal_installed";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -110,4 +130,7 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,15 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.graphical {
|
||||||
fonts = {
|
fonts = {
|
||||||
enableDefaultPackages = false;
|
enableDefaultPackages = false;
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
cascadia-code
|
cascadia-code
|
||||||
source-sans-pro
|
source-sans-pro
|
||||||
source-serif-pro
|
source-serif-pro
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-cjk-serif
|
||||||
noto-fonts-color-emoji
|
noto-fonts-color-emoji
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -22,4 +25,5 @@
|
|||||||
useEmbeddedBitmaps = true;
|
useEmbeddedBitmaps = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,78 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
git.config = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
default = null;
|
||||||
|
example = ./files/gitconfig_home;
|
||||||
|
description = "A git config file.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf (config.me.git.config != null) {
|
||||||
home-manager.users.talexander =
|
home-manager.users.talexander =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
home.file.".gitconfig" = {
|
home.file.".gitconfig" = {
|
||||||
source = ./files/gitconfig_home;
|
source = config.me.git.config;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
# (lib.mkIf (config.me.graphical) {
|
||||||
|
# nixpkgs.overlays = [
|
||||||
|
# (final: prev: {
|
||||||
|
# git = pkgs.buildEnv {
|
||||||
|
# name = prev.git.name;
|
||||||
|
# paths = [
|
||||||
|
# prev.git
|
||||||
|
# ];
|
||||||
|
# extraOutputsToInstall = [
|
||||||
|
# "man"
|
||||||
|
# "doc"
|
||||||
|
# "info"
|
||||||
|
# ];
|
||||||
|
# buildInputs = [ final.makeWrapper ];
|
||||||
|
# postBuild = ''
|
||||||
|
# wrapProgram $out/bin/git --prefix PATH : ${
|
||||||
|
# lib.makeBinPath [
|
||||||
|
# final.meld
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# })
|
||||||
|
# ];
|
||||||
|
# })
|
||||||
|
# (lib.mkIf (!config.me.graphical) {
|
||||||
|
# nixpkgs.overlays = [
|
||||||
|
# (final: prev: {
|
||||||
|
# git = pkgs.buildEnv {
|
||||||
|
# name = prev.git.name;
|
||||||
|
# paths = [
|
||||||
|
# prev.git
|
||||||
|
# ];
|
||||||
|
# extraOutputsToInstall = [
|
||||||
|
# "man"
|
||||||
|
# "doc"
|
||||||
|
# "info"
|
||||||
|
# ];
|
||||||
|
# buildInputs = [ final.makeWrapper ];
|
||||||
|
# postBuild = ''
|
||||||
|
# wrapProgram $out/bin/git --prefix PATH : ${
|
||||||
|
# lib.makeBinPath [
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# })
|
||||||
|
# ];
|
||||||
|
# })
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
34
nix/configuration/roles/global_options/default.nix
Normal file
34
nix/configuration/roles/global_options/default.nix
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# options.me.graphics_card_type = lib.mkOption {
|
||||||
|
# type = lib.types.nullOr (
|
||||||
|
# lib.types.enum [
|
||||||
|
# "amd"
|
||||||
|
# "intel"
|
||||||
|
# "nvidia"
|
||||||
|
# ]
|
||||||
|
# );
|
||||||
|
# default = null;
|
||||||
|
# example = "amd";
|
||||||
|
# description = "What graphics card type is in the computer.";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# options.me.graphical = lib.mkOption {
|
||||||
|
# type = lib.types.bool;
|
||||||
|
# default = false;
|
||||||
|
# example = true;
|
||||||
|
# description = "Whether we want to install graphical programs.";
|
||||||
|
# };
|
||||||
|
}
|
||||||
@@ -2,13 +2,32 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgs-unstable,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
gpg_test_wkd =
|
||||||
|
(pkgs.writeScriptBin "gpg_test_wkd" (builtins.readFile ./files/gpg_test_wkd.bash)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
gpg.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install gpg.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.gpg.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
# Fetch public keys:
|
# Fetch public keys:
|
||||||
# gpg --locate-keys tom@fizz.buzz
|
# gpg --locate-keys tom@fizz.buzz
|
||||||
#
|
#
|
||||||
@@ -71,66 +90,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(final: prev: {
|
|
||||||
# pcsclite = prev.pcsclite.overrideAttrs (old: {
|
|
||||||
# postPatch = ''
|
|
||||||
# substituteInPlace src/libredirect.c src/spy/libpcscspy.c \
|
|
||||||
# --replace-fail "libpcsclite_real.so.1" "$lib/lib/libpcsclite_real.so.1"
|
|
||||||
# '';
|
|
||||||
# });
|
|
||||||
|
|
||||||
# pcsclite = prev.pcsclite.overrideAttrs (old: {
|
|
||||||
# postPatch =
|
|
||||||
# old.postPatch
|
|
||||||
# + (lib.optionalString
|
|
||||||
# (!(lib.strings.hasInfix ''--replace-fail "libpcsclite_real.so.1"'' old.postPatch))
|
|
||||||
# ''
|
|
||||||
# substituteInPlace src/libredirect.c src/spy/libpcscspy.c \
|
|
||||||
# --replace-fail "libpcsclite_real.so.1" "$lib/lib/libpcsclite_real.so.1"
|
|
||||||
# ''
|
|
||||||
# );
|
|
||||||
# });
|
|
||||||
|
|
||||||
# pcsclite = prev.pcsclite.overrideAttrs (old: {
|
|
||||||
# postPatch =
|
|
||||||
# old.postPatch
|
|
||||||
# + ''
|
|
||||||
# substituteInPlace src/libredirect.c src/spy/libpcscspy.c \
|
|
||||||
# --replace-fail "libpcsclite_real.so.1" "$lib/lib/libpcsclite_real.so.1"
|
|
||||||
# '';
|
|
||||||
# });
|
|
||||||
|
|
||||||
# gnupg = prev.gnupg.override {
|
|
||||||
# pcsclite = pkgs.pcsclite.overrideAttrs (old: {
|
|
||||||
# postPatch =
|
|
||||||
# old.postPatch
|
|
||||||
# + (lib.optionalString
|
|
||||||
# (!(lib.strings.hasInfix ''--replace-fail "libpcsclite_real.so.1"'' old.postPatch))
|
|
||||||
# ''
|
|
||||||
# substituteInPlace src/libredirect.c src/spy/libpcscspy.c \
|
|
||||||
# --replace-fail "libpcsclite_real.so.1" "$lib/lib/libpcsclite_real.so.1"
|
|
||||||
# ''
|
|
||||||
# );
|
|
||||||
# });
|
|
||||||
# };
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
# security.polkit.extraConfig = ''
|
|
||||||
# polkit.addRule(function(action, subject) {
|
|
||||||
# if (action.id == "org.debian.pcsc-lite.access_card") {
|
|
||||||
# return polkit.Result.YES;
|
|
||||||
# }
|
|
||||||
# });
|
|
||||||
|
|
||||||
# polkit.addRule(function(action, subject) {
|
|
||||||
# if (action.id == "org.debian.pcsc-lite.access_pcsc") {
|
|
||||||
# return polkit.Result.YES;
|
|
||||||
# }
|
|
||||||
# });
|
|
||||||
# '';
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
pcsclite
|
pcsclite
|
||||||
pcsctools
|
pcsctools
|
||||||
@@ -139,27 +98,11 @@
|
|||||||
glibcLocales
|
glibcLocales
|
||||||
ccid
|
ccid
|
||||||
libusb-compat-0_1
|
libusb-compat-0_1
|
||||||
|
gpg_test_wkd
|
||||||
];
|
];
|
||||||
|
|
||||||
# nixpkgs.overlays = [
|
|
||||||
# (final: prev: {
|
|
||||||
# gnupg = pkgs-unstable.gnupg;
|
|
||||||
# scdaemon = pkgs-unstable.scdaemon;
|
|
||||||
# libgcrypt = pkgs-unstable.libgcrypt;
|
|
||||||
# })
|
|
||||||
# ];
|
|
||||||
|
|
||||||
# nixpkgs.overlays = [
|
|
||||||
# (final: prev: {
|
|
||||||
# gnupg = prev.gnupg.overrideAttrs (old: rec {
|
|
||||||
# version = "2.4.7";
|
|
||||||
# src = prev.fetchurl {
|
|
||||||
# url = "https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-${version}.tar.bz2";
|
|
||||||
# hash = "sha256-eyRwbk2n4OOwbKBoIxAnQB8jgQLEHJCWMTSdzDuF60Y=";
|
|
||||||
# };
|
|
||||||
# });
|
|
||||||
# })
|
|
||||||
# ];
|
|
||||||
|
|
||||||
programs.gnupg.agent.enableExtraSocket = true;
|
programs.gnupg.agent.enableExtraSocket = true;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
8
nix/configuration/roles/gpg/files/gpg_test_wkd.bash
Normal file
8
nix/configuration/roles/gpg/files/gpg_test_wkd.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Test that we can retrieve a PGP key using Web Key Directory (WKD)
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
gpg --no-default-keyring --keyring /tmp/gpg-$$ --auto-key-locate clear,wkd --locate-keys "${@}"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
reader-port Yubico Yubi
|
#reader-port Yubico Yubi
|
||||||
disable-ccid
|
disable-ccid
|
||||||
|
|
||||||
log-file /home/talexander/scd.log
|
#log-file /home/talexander/scd.log
|
||||||
verbose
|
#verbose
|
||||||
debug cardio
|
#debug cardio
|
||||||
debug-level 5
|
#debug-level 5
|
||||||
|
|||||||
@@ -8,5 +8,36 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me.graphics_card_type = lib.mkOption {
|
||||||
|
type = lib.types.nullOr (
|
||||||
|
lib.types.enum [
|
||||||
|
"amd"
|
||||||
|
"intel"
|
||||||
|
"nvidia"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
default = null;
|
||||||
|
example = "amd";
|
||||||
|
description = "What graphics card type is in the computer.";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.me.graphical = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install graphical programs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
mesa-demos # for glxgears
|
||||||
|
vulkan-tools # for vkcube
|
||||||
|
xorg.xeyes # to test which windows are using x11
|
||||||
|
];
|
||||||
hardware.graphics.enable = true;
|
hardware.graphics.enable = true;
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# TODO: Maybe replace with https://gitlab.com/w0lff/shikane because its written in rust
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@@ -5,13 +6,41 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
exec_kanshi = pkgs.writeTextFile {
|
||||||
|
name = "exec_kanshi.conf";
|
||||||
|
text = ''
|
||||||
|
exec kanshi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
kanshi.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install kanshi.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.kanshi.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
kanshi
|
kanshi
|
||||||
];
|
];
|
||||||
|
|
||||||
|
me.swayIncludes = [
|
||||||
|
exec_kanshi
|
||||||
|
];
|
||||||
|
|
||||||
home-manager.users.talexander =
|
home-manager.users.talexander =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
@@ -21,4 +50,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
99
nix/configuration/roles/kodi/default.nix
Normal file
99
nix/configuration/roles/kodi/default.nix
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
kodi.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install kodi.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.kodi.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
services.cage.user = "kodi";
|
||||||
|
services.cage.program = "${pkgs.kodi-wayland}/bin/kodi-standalone";
|
||||||
|
services.cage.enable = true;
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
kodi-wayland = prev.kodi-wayland.withPackages (
|
||||||
|
kodiPkgs: with kodiPkgs; [
|
||||||
|
joystick
|
||||||
|
vfs-sftp
|
||||||
|
]
|
||||||
|
);
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.kodi = {
|
||||||
|
isNormalUser = true;
|
||||||
|
createHome = true; # https://github.com/NixOS/nixpkgs/issues/6481
|
||||||
|
group = "kodi";
|
||||||
|
extraGroups = [ ];
|
||||||
|
uid = 12000;
|
||||||
|
packages = with pkgs; [
|
||||||
|
tree
|
||||||
|
];
|
||||||
|
# Generate with `mkpasswd -m scrypt`
|
||||||
|
hashedPassword = "$7$CU..../....VXvNQ8za3wSGpdzGXNT50/$HcFtn/yvwPMCw4888BelpiAPLAxe/zU87fD.d/N6U48";
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGu+k5lrirokdW5zVdRVBOqEOAvAPlIkG/MdJNc9g5ky"
|
||||||
|
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIEI6mu6I5Jp+Ib0vJxapGHbEShZjyvzV8jz5DnzDrI39AAAABHNzaDo="
|
||||||
|
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIAFNcSXwvy+brYTOGo56G93Ptuq2MmZsjvRWAfMqbmMLAAAABHNzaDo="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
users.groups.kodi.gid = 12000;
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.kodi = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".ssh";
|
||||||
|
user = "kodi";
|
||||||
|
group = "kodi";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".kodi";
|
||||||
|
user = "kodi";
|
||||||
|
group = "kodi";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.kodi =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
# home.file.".kodi/userdata/mediasources.xml".source = ./files/mediasources.xml;
|
||||||
|
|
||||||
|
# home.file.".kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/linux/DualSense_Wireless_Controller_13b_8a.xml".source =
|
||||||
|
# ./files/DualSense_Wireless_Controller_13b_8a.xml;
|
||||||
|
|
||||||
|
# TODO: Maybe .kodi/userdata/sources.xml
|
||||||
|
# TODO: ./userdata/guisettings.xml:303: <setting id="filecache.memorysize">128</setting>
|
||||||
|
|
||||||
|
# The state version is required and should stay at the version you
|
||||||
|
# originally installed.
|
||||||
|
home.stateVersion = "24.11";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<buttonmap>
|
||||||
|
<device name="DualSense Wireless Controller" provider="linux" buttoncount="13" axiscount="8">
|
||||||
|
<configuration>
|
||||||
|
<axis index="2" center="-1" range="2" />
|
||||||
|
<axis index="5" center="-1" range="2" />
|
||||||
|
</configuration>
|
||||||
|
<controller id="game.controller.default">
|
||||||
|
<feature name="a" button="0" />
|
||||||
|
<feature name="b" button="1" />
|
||||||
|
<feature name="back" button="9" />
|
||||||
|
<feature name="down" axis="+7" />
|
||||||
|
<feature name="guide" button="10" />
|
||||||
|
<feature name="left" axis="-6" />
|
||||||
|
<feature name="leftbumper" button="4" />
|
||||||
|
<feature name="leftstick">
|
||||||
|
<up axis="-1" />
|
||||||
|
<down axis="+1" />
|
||||||
|
<right axis="+0" />
|
||||||
|
<left axis="-0" />
|
||||||
|
</feature>
|
||||||
|
<feature name="lefttrigger" button="6" />
|
||||||
|
<feature name="right" axis="+6" />
|
||||||
|
<feature name="rightbumper" button="5" />
|
||||||
|
<feature name="rightstick">
|
||||||
|
<up axis="-4" />
|
||||||
|
<down axis="+4" />
|
||||||
|
<right axis="+3" />
|
||||||
|
<left axis="-3" />
|
||||||
|
</feature>
|
||||||
|
<feature name="righttrigger" button="7" />
|
||||||
|
<feature name="start" button="8" />
|
||||||
|
<feature name="up" axis="-7" />
|
||||||
|
<feature name="x" button="3" />
|
||||||
|
<feature name="y" button="2" />
|
||||||
|
</controller>
|
||||||
|
</device>
|
||||||
|
</buttonmap>
|
||||||
5
nix/configuration/roles/kodi/files/mediasources.xml
Normal file
5
nix/configuration/roles/kodi/files/mediasources.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<mediasources>
|
||||||
|
<network>
|
||||||
|
<location id="0">sftp://nochainstounlock@stuff.fizz.buzz:42069/readonly/library/</location>
|
||||||
|
</network>
|
||||||
|
</mediasources>
|
||||||
@@ -32,6 +32,18 @@ in
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
kubernetes.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install kubernetes.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.kubernetes.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
kubectl
|
kubectl
|
||||||
kubeswitch
|
kubeswitch
|
||||||
@@ -58,5 +70,7 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
45
nix/configuration/roles/latex/default.nix
Normal file
45
nix/configuration/roles/latex/default.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
tex = (
|
||||||
|
pkgs.texlive.combine {
|
||||||
|
inherit (pkgs.texlive)
|
||||||
|
scheme-basic
|
||||||
|
dvisvgm
|
||||||
|
dvipng # for preview and export as html in org-mode
|
||||||
|
wrapfig
|
||||||
|
amsmath
|
||||||
|
ulem
|
||||||
|
hyperref
|
||||||
|
capt-of
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
latex.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install latex.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.latex.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
tex
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
48
nix/configuration/roles/launch_keyboard/default.nix
Normal file
48
nix/configuration/roles/launch_keyboard/default.nix
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
launch_keyboard.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install launch_keyboard.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.launch_keyboard.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
system76-keyboard-configurator
|
||||||
|
dfu-programmer # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/
|
||||||
|
avrdude # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/
|
||||||
|
lxqt.lxqt-policykit # Need a polkit agent to launch the keyboard configurator
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
user.services.lxqt-policykit-agent = {
|
||||||
|
description = "lxqt-policykit-agent";
|
||||||
|
wantedBy = [ "graphical-session.target" ];
|
||||||
|
wants = [ "graphical-session.target" ];
|
||||||
|
after = [ "graphical-session.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${pkgs.lxqt.lxqt-policykit}/bin/lxqt-policykit-agent";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 1;
|
||||||
|
TimeoutStopSec = 10;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,894 @@
|
|||||||
|
{
|
||||||
|
"model": "system76/launch_2",
|
||||||
|
"version": 1,
|
||||||
|
"map": {
|
||||||
|
"K00": [
|
||||||
|
"ESC",
|
||||||
|
"RESET",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K01": [
|
||||||
|
"F1",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K02": [
|
||||||
|
"F2",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K03": [
|
||||||
|
"F3",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K04": [
|
||||||
|
"F4",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K05": [
|
||||||
|
"F5",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K06": [
|
||||||
|
"F6",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K07": [
|
||||||
|
"F7",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K08": [
|
||||||
|
"F8",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K09": [
|
||||||
|
"F9",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K0A": [
|
||||||
|
"F10",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K0B": [
|
||||||
|
"F11",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K0C": [
|
||||||
|
"F12",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K0D": [
|
||||||
|
"DEL",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K0E": [
|
||||||
|
"HOME",
|
||||||
|
"PLAY_PAUSE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K10": [
|
||||||
|
"TICK",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K11": [
|
||||||
|
"1",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K12": [
|
||||||
|
"2",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K13": [
|
||||||
|
"3",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K14": [
|
||||||
|
"4",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K15": [
|
||||||
|
"5",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K16": [
|
||||||
|
"6",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K17": [
|
||||||
|
"7",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K18": [
|
||||||
|
"8",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K19": [
|
||||||
|
"9",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K1A": [
|
||||||
|
"0",
|
||||||
|
"KBD_TOGGLE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K1B": [
|
||||||
|
"MINUS",
|
||||||
|
"KBD_DOWN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K1C": [
|
||||||
|
"EQUALS",
|
||||||
|
"KBD_UP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K1D": [
|
||||||
|
"BKSP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K1E": [
|
||||||
|
"PGUP",
|
||||||
|
"VOLUME_UP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K20": [
|
||||||
|
"TAB",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K21": [
|
||||||
|
"Q",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K22": [
|
||||||
|
"W",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K23": [
|
||||||
|
"E",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K24": [
|
||||||
|
"R",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K25": [
|
||||||
|
"T",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K26": [
|
||||||
|
"Y",
|
||||||
|
"HOME",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K27": [
|
||||||
|
"U",
|
||||||
|
"PGDN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K28": [
|
||||||
|
"I",
|
||||||
|
"PGUP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K29": [
|
||||||
|
"O",
|
||||||
|
"END",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K2A": [
|
||||||
|
"P",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K2B": [
|
||||||
|
"BRACE_OPEN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K2C": [
|
||||||
|
"BRACE_CLOSE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K2D": [
|
||||||
|
"BACKSLASH",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K2E": [
|
||||||
|
"PGDN",
|
||||||
|
"VOLUME_DOWN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K30": [
|
||||||
|
"CAPS",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K31": [
|
||||||
|
"A",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K32": [
|
||||||
|
"S",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K33": [
|
||||||
|
"D",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K34": [
|
||||||
|
"F",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K35": [
|
||||||
|
"G",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K36": [
|
||||||
|
"H",
|
||||||
|
"LEFT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K37": [
|
||||||
|
"J",
|
||||||
|
"DOWN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K38": [
|
||||||
|
"K",
|
||||||
|
"UP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K39": [
|
||||||
|
"L",
|
||||||
|
"RIGHT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K3A": [
|
||||||
|
"SEMICOLON",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K3B": [
|
||||||
|
"QUOTE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K3C": [
|
||||||
|
"ENTER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K3D": [
|
||||||
|
"END",
|
||||||
|
"MUTE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K40": [
|
||||||
|
"LEFT_SHIFT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K41": [
|
||||||
|
"Z",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K42": [
|
||||||
|
"X",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K43": [
|
||||||
|
"C",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K44": [
|
||||||
|
"V",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K45": [
|
||||||
|
"B",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K46": [
|
||||||
|
"N",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K47": [
|
||||||
|
"M",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K48": [
|
||||||
|
"COMMA",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K49": [
|
||||||
|
"PERIOD",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K4A": [
|
||||||
|
"SLASH",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K4B": [
|
||||||
|
"RIGHT_SHIFT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K4C": [
|
||||||
|
"UP",
|
||||||
|
"PGUP",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K50": [
|
||||||
|
"LEFT_CTRL",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K51": [
|
||||||
|
"LEFT_SUPER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K52": [
|
||||||
|
"LEFT_ALT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K53": [
|
||||||
|
"FN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K54": [
|
||||||
|
"SPACE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K55": [
|
||||||
|
"SPACE",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K56": [
|
||||||
|
"RIGHT_CTRL",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K57": [
|
||||||
|
"RIGHT_ALT",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K58": [
|
||||||
|
"PRINT_SCREEN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K59": [
|
||||||
|
"LEFT",
|
||||||
|
"HOME",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K5A": [
|
||||||
|
"DOWN",
|
||||||
|
"PGDN",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
],
|
||||||
|
"K5B": [
|
||||||
|
"RIGHT",
|
||||||
|
"END",
|
||||||
|
"ROLL_OVER",
|
||||||
|
"ROLL_OVER"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_leds": {
|
||||||
|
"K00": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K01": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K02": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K03": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K04": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K05": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K06": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K07": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K08": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K09": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K0A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K0B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K0C": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K0D": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K0E": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K10": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K11": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K12": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K13": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K14": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K15": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K16": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K17": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K18": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K19": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K1A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K1B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K1C": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K1D": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K1E": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K20": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K21": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K22": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K23": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K24": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K25": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K26": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K27": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K28": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K29": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K2A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K2B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K2C": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K2D": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K2E": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K30": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K31": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K32": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K33": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K34": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K35": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K36": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K37": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K38": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K39": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K3A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K3B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K3C": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K3D": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K40": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K41": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K42": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K43": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K44": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K45": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K46": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K47": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K48": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K49": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K4A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K4B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K4C": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K50": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K51": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K52": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K53": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K54": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K55": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K56": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K57": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K58": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K59": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K5A": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"K5B": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"mode": [
|
||||||
|
0,
|
||||||
|
127
|
||||||
|
],
|
||||||
|
"brightness": 109,
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mode": [
|
||||||
|
13,
|
||||||
|
127
|
||||||
|
],
|
||||||
|
"brightness": 109,
|
||||||
|
"color": [
|
||||||
|
21,
|
||||||
|
255
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mode": [
|
||||||
|
13,
|
||||||
|
127
|
||||||
|
],
|
||||||
|
"brightness": 109,
|
||||||
|
"color": [
|
||||||
|
142,
|
||||||
|
255
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mode": [
|
||||||
|
13,
|
||||||
|
127
|
||||||
|
],
|
||||||
|
"brightness": 109,
|
||||||
|
"color": [
|
||||||
|
142,
|
||||||
|
255
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
43
nix/configuration/roles/lvfs/default.nix
Normal file
43
nix/configuration/roles/lvfs/default.nix
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
lvfs.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install lvfs.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.lvfs.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
services.fwupd.enable = true;
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = "/var/lib/fwupd";
|
||||||
|
user = "root";
|
||||||
|
group = "root";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
gnome-firmware
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
64
nix/configuration/roles/media/default.nix
Normal file
64
nix/configuration/roles/media/default.nix
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cast_file_vaapi =
|
||||||
|
(pkgs.writeScriptBin "cast_file" (builtins.readFile ./files/cast_file_vaapi)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
cast_file_nvidia =
|
||||||
|
(pkgs.writeScriptBin "cast_file" (builtins.readFile ./files/cast_file_nvidia)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
media.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install media.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.media.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
ffmpeg
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
mpv
|
||||||
|
evince
|
||||||
|
gimp
|
||||||
|
# So far I prefer imv over swayimg because imv supports the 'p' hotkey to print the currently-viewed file to stdout (useful for pipelines) and afaik doesn't support the exec:// protocol which seems like a massive risk.
|
||||||
|
imv
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.talexander =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.file.".config/mpv/mpv.conf" = {
|
||||||
|
source = ./files/mpv.conf;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf (config.me.graphics_card_type == "amd" || config.me.graphics_card_type == "intel") {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
cast_file_vaapi
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
11
nix/configuration/roles/media/files/cast_file_nvidia
Normal file
11
nix/configuration/roles/media/files/cast_file_nvidia
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
|
||||||
|
ffmpeg -re -i "$1" -vcodec h264_nvenc -r 30 -g 30 -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp:172.16.16.44/live/test &
|
||||||
|
ffmpegpid=$!
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
castnow --exit 'https://broadcast.fizz.buzz/hls/hls/test.m3u8'
|
||||||
|
wait "$ffmpegpid"
|
||||||
|
|
||||||
|
sleep 10
|
||||||
237
nix/configuration/roles/media/files/cast_file_vaapi
Normal file
237
nix/configuration/roles/media/files/cast_file_vaapi
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: ${VIDEO_BITRATE:="1M"} # Only for encoding modes targeting bitrate
|
||||||
|
: ${AUDIO_BITRATE:="192k"}
|
||||||
|
|
||||||
|
############## Setup #########################
|
||||||
|
|
||||||
|
function die {
|
||||||
|
local status_code="$1"
|
||||||
|
shift
|
||||||
|
(>&2 echo "${@}")
|
||||||
|
exit "$status_code"
|
||||||
|
}
|
||||||
|
|
||||||
|
function log {
|
||||||
|
(>&2 echo "${@}")
|
||||||
|
}
|
||||||
|
|
||||||
|
############## Program #########################
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local cmd
|
||||||
|
cmd=$1
|
||||||
|
shift
|
||||||
|
if [ "$cmd" = "copy" ]; then
|
||||||
|
copy "${@}"
|
||||||
|
elif [ "$cmd" = "convert" ]; then
|
||||||
|
convert "${@}"
|
||||||
|
elif [ "$cmd" = "stream" ]; then
|
||||||
|
stream "${@}"
|
||||||
|
elif [ "$cmd" = "webcam" ]; then
|
||||||
|
webcam "${@}"
|
||||||
|
elif [ "$cmd" = "encode_webcam" ]; then
|
||||||
|
encode_webcam "${@}"
|
||||||
|
else
|
||||||
|
(>&2 echo "Unknown command: $cmd")
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy {
|
||||||
|
local file_to_cast
|
||||||
|
file_to_cast="$3"
|
||||||
|
|
||||||
|
local USERNAME PASSWORD
|
||||||
|
USERNAME="$1"
|
||||||
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
</dev/null exec ffmpeg \
|
||||||
|
-re \
|
||||||
|
-stream_loop -1 \
|
||||||
|
-i "$file_to_cast" \
|
||||||
|
-c copy \
|
||||||
|
-strict experimental \
|
||||||
|
-f rtsp \
|
||||||
|
-rtsp_transport tcp \
|
||||||
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
|
}
|
||||||
|
|
||||||
|
function convert {
|
||||||
|
local args=()
|
||||||
|
local acceleration_type="$1" # "software" or "hardware"
|
||||||
|
local codec="$2" # "h264" or "av1"
|
||||||
|
local file_to_cast="$3"
|
||||||
|
local file_to_save="$4"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Verify parameters
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
|
true
|
||||||
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
die 1 "Unknown acceleration type: $acceleration_type"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$codec" == "h264" ]; then
|
||||||
|
true
|
||||||
|
elif [ "$codec" == "av1" ]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
die 1 "Unknown codec: $codec"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Build command
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
|
true
|
||||||
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
|
args+=(-vaapi_device /dev/dri/renderD128)
|
||||||
|
fi
|
||||||
|
|
||||||
|
args+=(-i "$file_to_cast")
|
||||||
|
|
||||||
|
if [ "$codec" == "h264" ]; then
|
||||||
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
|
args+=(-c:v h264)
|
||||||
|
args+=(-profile:v high)
|
||||||
|
args+=(-b:v "$VIDEO_BITRATE")
|
||||||
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
|
args+=(-vf 'format=nv12|vaapi,hwupload')
|
||||||
|
args+=(-c:v h264_vaapi)
|
||||||
|
args+=(-profile:v high)
|
||||||
|
args+=(-b:v "$VIDEO_BITRATE")
|
||||||
|
fi
|
||||||
|
elif [ "$codec" == "av1" ]; then
|
||||||
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
|
args+=(-c:v libsvtav1)
|
||||||
|
args+=(-preset 4) # [0-13] default 10, lower = higher quality / slower encode
|
||||||
|
args+=(-crf 20) # [0-63] default 35, lower = higher quality / larger file
|
||||||
|
# Parameters: https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md
|
||||||
|
# fast-decode [0-2] default 0 (off), higher = faster decode
|
||||||
|
# tune [0-2] default 1, Specifies whether to use PSNR or VQ as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM]
|
||||||
|
# film-grain-denoise, setting to 0 uses the original frames instead of denoising the film grain
|
||||||
|
args+=(-svtav1-params "fast-decode=1:film-grain-denoise=0")
|
||||||
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
|
# -c:v av1_amf -quality quality
|
||||||
|
args+=(-vf 'format=nv12|vaapi,hwupload')
|
||||||
|
args+=(-c:v av1_vaapi)
|
||||||
|
args+=(-b:v "$VIDEO_BITRATE")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
|
args+=(-bf 0)
|
||||||
|
args+=(-strict -2)
|
||||||
|
args+=(-c:a opus)
|
||||||
|
args+=(-ac 2)
|
||||||
|
args+=(-b:a "$AUDIO_BITRATE")
|
||||||
|
args+=(-ar 48000)
|
||||||
|
args+=("$file_to_save")
|
||||||
|
set -x
|
||||||
|
</dev/null exec ffmpeg "${args[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function stream {
|
||||||
|
local args=()
|
||||||
|
local acceleration_type="$1" # "software" or "hardware"
|
||||||
|
local codec="$2" # "h264" or "av1"
|
||||||
|
|
||||||
|
local USERNAME="$3"
|
||||||
|
local PASSWORD="$4"
|
||||||
|
local file_to_cast="$5"
|
||||||
|
|
||||||
|
|
||||||
|
args+=(-re -stream_loop -1)
|
||||||
|
|
||||||
|
args+=(-f rtsp)
|
||||||
|
args+=(-rtsp_transport tcp)
|
||||||
|
args+=("rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch")
|
||||||
|
}
|
||||||
|
|
||||||
|
function webcam {
|
||||||
|
# Uses on-webcam h264 encoding.
|
||||||
|
|
||||||
|
local USERNAME PASSWORD
|
||||||
|
USERNAME="$1"
|
||||||
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
</dev/null exec ffmpeg \
|
||||||
|
-re \
|
||||||
|
-input_format h264 \
|
||||||
|
-video_size 1920x1080 \
|
||||||
|
-i /dev/video0 \
|
||||||
|
-c:v copy \
|
||||||
|
-an \
|
||||||
|
-f rtsp \
|
||||||
|
-rtsp_transport tcp \
|
||||||
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode_webcam {
|
||||||
|
# Uses hardware accelerated gpu-based encoding.
|
||||||
|
|
||||||
|
local USERNAME PASSWORD
|
||||||
|
USERNAME="$1"
|
||||||
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
</dev/null exec ffmpeg \
|
||||||
|
-re \
|
||||||
|
-vaapi_device /dev/dri/renderD128 \
|
||||||
|
-i /dev/video0 \
|
||||||
|
-vf 'format=nv12,hwupload' \
|
||||||
|
-c:v h264_vaapi \
|
||||||
|
-an \
|
||||||
|
-f rtsp \
|
||||||
|
-rtsp_transport tcp \
|
||||||
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
|
}
|
||||||
|
|
||||||
|
function speed_up_preprocess_vp8 {
|
||||||
|
local file_to_cast file_to_save
|
||||||
|
file_to_cast="$1"
|
||||||
|
file_to_save="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
|
# -strict -2 :: Enable support for experimental codecs like opus.
|
||||||
|
# -b:v 2M :: Target 2 megabit/s
|
||||||
|
# -crf 10 :: Target a quality level and adjust bitrate accordingly. This should be preferred, but ideally both should be used.
|
||||||
|
# Could also use -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]"
|
||||||
|
</dev/null exec ffmpeg \
|
||||||
|
-i "$file_to_cast" \
|
||||||
|
-filter:v "setpts=0.66666666*PTS" \
|
||||||
|
-filter:a "atempo=1.5" \
|
||||||
|
-c:v vp8 \
|
||||||
|
-b:v 2M \
|
||||||
|
-crf 10 \
|
||||||
|
-bf 0 \
|
||||||
|
-c:a opus \
|
||||||
|
-b:a 320k \
|
||||||
|
-ar 48000 \
|
||||||
|
-strict -2 \
|
||||||
|
"$file_to_save"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
main "${@}"
|
||||||
25
nix/configuration/roles/media/files/mpv.conf
Normal file
25
nix/configuration/roles/media/files/mpv.conf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# To debug hardware video acceleration:
|
||||||
|
# mpv --hwdec=auto --msg-level=vd=v,vo=v,vo/gpu/vaapi-egl=trace
|
||||||
|
|
||||||
|
# GPU Decoding
|
||||||
|
hwdec=auto
|
||||||
|
# Allow CPU processing via filters:
|
||||||
|
#hwdec=auto-copy
|
||||||
|
|
||||||
|
# Use higher quality gpu rendering
|
||||||
|
profile=gpu-hq
|
||||||
|
scale=ewa_lanczossharp
|
||||||
|
cscale=ewa_lanczossharp
|
||||||
|
|
||||||
|
# Instead of dropping frames, re-sample audio which may cause a slight pitch change
|
||||||
|
# ISSUE: caused frame stutter on Louie S01E03
|
||||||
|
# video-sync=display-resample
|
||||||
|
|
||||||
|
# Make motion smoother when video frame rate != monitor refresh rate
|
||||||
|
interpolation
|
||||||
|
tscale=oversample
|
||||||
|
|
||||||
|
# Load a lot of the file into memory
|
||||||
|
# cache=yes
|
||||||
|
# demuxer-max-bytes=123400KiB
|
||||||
|
# demuxer-readahead-secs=20
|
||||||
17
nix/configuration/roles/memtest86/default.nix
Normal file
17
nix/configuration/roles/memtest86/default.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{ }
|
||||||
|
(lib.mkIf (config.me.buildingIso) {
|
||||||
|
# boot.loader.systemd-boot.memtest86.enable = true;
|
||||||
|
boot.loader.grub.memtest86.enable = true;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -5,21 +5,31 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Alternative DNS servers:
|
||||||
|
# "1.0.0.1#cloudflare-dns.com"
|
||||||
|
# "1.1.1.1#cloudflare-dns.com"
|
||||||
|
# "2606:4700:4700::1001#cloudflare-dns.com"
|
||||||
|
# "2606:4700:4700::1111#cloudflare-dns.com"
|
||||||
|
# "8.8.4.4#dns.google"
|
||||||
|
# "8.8.8.8#dns.google"
|
||||||
|
# "2001:4860:4860::8844#dns.google"
|
||||||
|
# "2001:4860:4860::8888#dns.google"
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
networking.dhcpcd.enable = false;
|
networking.dhcpcd.enable = false;
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
# networking.nameservers = [
|
networking.nameservers = [
|
||||||
# "194.242.2.2#doh.mullvad.net"
|
"194.242.2.2#doh.mullvad.net"
|
||||||
# "2a07:e340::2#doh.mullvad.net"
|
"2a07:e340::2#doh.mullvad.net"
|
||||||
# ];
|
];
|
||||||
services.resolved = {
|
services.resolved = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# dnssec = "true";
|
# dnssec = "true";
|
||||||
# domains = [ "~." ];
|
domains = [ "~." ];
|
||||||
# fallbackDns = [ ];
|
fallbackDns = [ ];
|
||||||
# dnsovertls = "true";
|
dnsovertls = "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Without this, systemd-resolved will send DNS requests for <X>.home.arpa to the per-link DNS server (172.16.0.1) which does not support DNS-over-TLS. This leads to the connection anging and timing out. This causes firefox startup to take an extra 10+ seconds.
|
# Without this, systemd-resolved will send DNS requests for <X>.home.arpa to the per-link DNS server (172.16.0.1) which does not support DNS-over-TLS. This leads to the connection anging and timing out. This causes firefox startup to take an extra 10+ seconds.
|
||||||
@@ -29,7 +39,8 @@
|
|||||||
127.0.0.1 odo.home.arpa
|
127.0.0.1 odo.home.arpa
|
||||||
10.216.1.1 homeserver
|
10.216.1.1 homeserver
|
||||||
10.216.1.6 media
|
10.216.1.6 media
|
||||||
10.216.1.12 odo
|
#10.216.1.12 odo
|
||||||
|
10.216.1.14 neelix
|
||||||
10.217.1.1 drmario
|
10.217.1.1 drmario
|
||||||
10.217.2.1 mrmanager
|
10.217.2.1 mrmanager
|
||||||
'';
|
'';
|
||||||
@@ -51,4 +62,9 @@
|
|||||||
ldns # for drill
|
ldns # for drill
|
||||||
arp-scan # To find devices on the network
|
arp-scan # To find devices on the network
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
# Set wifi to US
|
||||||
|
options cfg80211 ieee80211_regdom=US
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
44
nix/configuration/roles/nix_index/default.nix
Normal file
44
nix/configuration/roles/nix_index/default.nix
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
nix_index.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install nix_index.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.nix_index.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nix-index-unwrapped
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".cache/nix-index";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -9,6 +9,6 @@
|
|||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
bsnes-hd
|
nvme-cli
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,18 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
python.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install python.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.python.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(python3.withPackages (python-pkgs: [
|
(python3.withPackages (python-pkgs: [
|
||||||
python-pkgs.distro # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
|
python-pkgs.distro # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
|
||||||
@@ -20,4 +32,7 @@
|
|||||||
isort
|
isort
|
||||||
black
|
black
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,22 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
qemu.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install qemu.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.qemu.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
qemu
|
qemu
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,8 @@
|
|||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
# Reset some defaults to start from a minimal more-arch-linux-like state. Think of this like a CSS reset sheet.
|
# Reset some defaults to start from a minimal more-arch-linux-like state. Think of this like a CSS reset sheet.
|
||||||
|
config = {
|
||||||
|
# Do not use default packages (nixos includes some defaults like nano)
|
||||||
|
environment.defaultPackages = lib.mkForce [ ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,18 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
rust.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install rust.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.rust.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
rustup
|
rustup
|
||||||
lldb # for lldb-vscode
|
lldb # for lldb-vscode
|
||||||
@@ -33,6 +45,9 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Install clippy, cranelift, rust-src
|
# TODO: Install clippy, cranelift, rust-src
|
||||||
|
|||||||
48
nix/configuration/roles/shipwright/default.nix
Normal file
48
nix/configuration/roles/shipwright/default.nix
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
shipwright.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install shipwright.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.shipwright.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
allowedUnfree = [ "shipwright" ];
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
shipwright
|
||||||
|
];
|
||||||
|
|
||||||
|
# TODO perhaps install ~/.local/share/soh/shipofharkinian.json
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".local/share/soh";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
55
nix/configuration/roles/sm64ex/default.nix
Normal file
55
nix/configuration/roles/sm64ex/default.nix
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
sm64ex.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install sm64ex.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.sm64ex.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
allowedUnfree = [ "sm64ex" ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
sm64ex
|
||||||
|
];
|
||||||
|
|
||||||
|
# nixpkgs.overlays = [
|
||||||
|
# (final: prev: {
|
||||||
|
# sm4ex = prev.sm64ex.override {
|
||||||
|
# baseRom.name = "SuperMario64.z64";
|
||||||
|
# };
|
||||||
|
# })
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# TODO perhaps install ~/.local/share/sm64ex/sm64config.txt
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".local/share/sm64ex";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,10 +8,18 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
options.me = {
|
||||||
pavucontrol
|
sound.enable = lib.mkOption {
|
||||||
];
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install sound.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.sound.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
# rtkit is optional but recommended
|
# rtkit is optional but recommended
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
@@ -72,5 +80,13 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
pavucontrol
|
||||||
|
];
|
||||||
|
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
sshfs
|
||||||
|
];
|
||||||
|
|
||||||
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
users.talexander = {
|
users.talexander = {
|
||||||
|
|||||||
50
nix/configuration/roles/steam/default.nix
Normal file
50
nix/configuration/roles/steam/default.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
steam.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install steam.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.steam.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
allowedUnfree = [
|
||||||
|
"steam"
|
||||||
|
"steam-original"
|
||||||
|
"steam-unwrapped"
|
||||||
|
"steam-run"
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.steam = {
|
||||||
|
enable = true;
|
||||||
|
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
||||||
|
# dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
||||||
|
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
".local/share/Steam"
|
||||||
|
".steam"
|
||||||
|
".factorio"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -30,23 +30,16 @@ let
|
|||||||
# Your preferred application launcher
|
# Your preferred application launcher
|
||||||
# Note: it's recommended that you pass the final command to sway
|
# Note: it's recommended that you pass the final command to sway
|
||||||
# set $menu dmenu_path | dmenu | xargs swaymsg exec
|
# set $menu dmenu_path | dmenu | xargs swaymsg exec
|
||||||
set $menu ${pkgs.wofi}/bin/wofi --show drun --gtk-dark
|
set $menu ${pkgs.tofi}/bin/tofi-drun | xargs swaymsg exec --
|
||||||
|
#set $menu ${pkgs.wofi}/bin/wofi --show drun --gtk-dark
|
||||||
|
|
||||||
# Do not show a title bar on windows
|
# Do not show a title bar on windows
|
||||||
default_border pixel 2
|
default_border pixel 2
|
||||||
|
hide_edge_borders smart_no_gaps
|
||||||
|
|
||||||
bindsym $mod+grave exec $term
|
bindsym $mod+grave exec $term
|
||||||
|
|
||||||
include ${base-hotkeys}
|
${lib.concatMapStringsSep "\n" (item: "include ${item}") config.me.swayIncludes}
|
||||||
include ${display-configs}
|
|
||||||
include ${window-management}
|
|
||||||
include ${movement}
|
|
||||||
include ${disable-focus-follows-mouse}
|
|
||||||
include ${background}
|
|
||||||
include ${touchpad_input}
|
|
||||||
include ${waybar}
|
|
||||||
include ${announce_sway_start}
|
|
||||||
include ${exec_kanshi}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
base-hotkeys = pkgs.writeTextFile {
|
base-hotkeys = pkgs.writeTextFile {
|
||||||
@@ -232,40 +225,12 @@ let
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
waybar = pkgs.writeTextFile {
|
|
||||||
name = "waybar.conf";
|
|
||||||
text = ''
|
|
||||||
#
|
|
||||||
# Status Bar:
|
|
||||||
#
|
|
||||||
# Read `man 5 sway-bar` for more information about this section.
|
|
||||||
bar {
|
|
||||||
position top
|
|
||||||
|
|
||||||
font pango:Cascadia Mono, FontAwesome 10
|
|
||||||
swaybar_command waybar
|
|
||||||
|
|
||||||
colors {
|
|
||||||
statusline #ffffff
|
|
||||||
background #323232
|
|
||||||
inactive_workspace #32323200 #32323200 #5c5c5c
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
announce_sway_start = pkgs.writeTextFile {
|
announce_sway_start = pkgs.writeTextFile {
|
||||||
name = "announce_sway_start.conf";
|
name = "announce_sway_start.conf";
|
||||||
text = ''
|
text = ''
|
||||||
# announce a running sway session to systemd
|
# announce a running sway session to systemd
|
||||||
exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
|
exec systemctl --user import-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME
|
||||||
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
|
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
exec_kanshi = pkgs.writeTextFile {
|
|
||||||
name = "exec_kanshi.conf";
|
|
||||||
text = ''
|
|
||||||
exec kanshi
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -292,9 +257,36 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../kanshi
|
./graphical_session_target.nix
|
||||||
|
./iso.nix
|
||||||
|
./rofimoji.nix
|
||||||
|
./lockscreen.nix
|
||||||
|
./screenshot.nix
|
||||||
|
./force_focus.nix
|
||||||
|
./notification.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
sway.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install sway.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
options.me.swayIncludes = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.package;
|
||||||
|
default = [ ];
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
[ (pkgs.writeTextFile {
|
||||||
|
name = "launch-kanshi.conf";
|
||||||
|
text = "exec kanshi";
|
||||||
|
}) ]'';
|
||||||
|
description = "List of packages to import as sway configs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
alacritty
|
alacritty
|
||||||
pcmanfm
|
pcmanfm
|
||||||
@@ -302,6 +294,23 @@ in
|
|||||||
stop_screen_share
|
stop_screen_share
|
||||||
];
|
];
|
||||||
|
|
||||||
|
programs.sway.extraPackages = lib.mkForce [ ];
|
||||||
|
|
||||||
|
me.swayIncludes = [
|
||||||
|
base-hotkeys
|
||||||
|
display-configs
|
||||||
|
window-management
|
||||||
|
movement
|
||||||
|
disable-focus-follows-mouse
|
||||||
|
background
|
||||||
|
touchpad_input
|
||||||
|
announce_sway_start
|
||||||
|
];
|
||||||
|
|
||||||
|
services.seatd.enable = true;
|
||||||
|
# TODO: Maybe use `seatd-launch -- sway` instead of running the seatd daemon
|
||||||
|
users.users.talexander.extraGroups = [ "seat" ];
|
||||||
|
|
||||||
# Probably would be cleaner to use environment.sessionVariables but programs.sway.extraSessionCommands is sway-specific.
|
# Probably would be cleaner to use environment.sessionVariables but programs.sway.extraSessionCommands is sway-specific.
|
||||||
programs.sway.extraSessionCommands =
|
programs.sway.extraSessionCommands =
|
||||||
if config.me.buildingIso then
|
if config.me.buildingIso then
|
||||||
@@ -323,14 +332,12 @@ in
|
|||||||
extraOptions =
|
extraOptions =
|
||||||
if config.me.buildingIso then
|
if config.me.buildingIso then
|
||||||
[
|
[
|
||||||
"--debug"
|
|
||||||
"--config"
|
"--config"
|
||||||
"${sway-config}"
|
"${sway-config}"
|
||||||
"--unsupported-gpu"
|
"--unsupported-gpu"
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
[
|
[
|
||||||
"--debug"
|
|
||||||
"--config"
|
"--config"
|
||||||
"${sway-config}"
|
"${sway-config}"
|
||||||
];
|
];
|
||||||
@@ -340,7 +347,8 @@ in
|
|||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
users.talexander = {
|
users.talexander = {
|
||||||
files = [
|
files = [
|
||||||
".cache/wofi-drun" # Execution history for wofi to sort results
|
".local/state/tofi-drun-history" # A cache of the desktop files for tofi
|
||||||
|
".cache/tofi-drun" # Execution history for tofi to sort results
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -349,7 +357,6 @@ in
|
|||||||
portal = {
|
portal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraPortals = with pkgs; [
|
extraPortals = with pkgs; [
|
||||||
xdg-desktop-portal-wlr
|
|
||||||
xdg-desktop-portal-gtk
|
xdg-desktop-portal-gtk
|
||||||
];
|
];
|
||||||
wlr = {
|
wlr = {
|
||||||
@@ -392,4 +399,11 @@ in
|
|||||||
|
|
||||||
# For mounting drives in pcmanfm
|
# For mounting drives in pcmanfm
|
||||||
services.gvfs.enable = true;
|
services.gvfs.enable = true;
|
||||||
|
|
||||||
|
# Auto-launch sway
|
||||||
|
# Run sway as the absolute last command in the login shell init. mkBefore = 500, plain = 1000, mkAfter = 1500
|
||||||
|
environment.loginShellInit = lib.mkOrder 2000 ''
|
||||||
|
[ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ] && [ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.systemd}/bin/systemd-cat --identifier=sway sway
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
3
nix/configuration/roles/sway/files/tofi-config
Normal file
3
nix/configuration/roles/sway/files/tofi-config
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
border-width = 4
|
||||||
|
outline-width = 1
|
||||||
|
border-color = #FF6600
|
||||||
27
nix/configuration/roles/sway/force_focus.nix
Normal file
27
nix/configuration/roles/sway/force_focus.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
force_focus_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "force_focus.conf";
|
||||||
|
text = ''
|
||||||
|
mode "force focus" {
|
||||||
|
bindsym $mod+Shift+Escape fullscreen; mode "default"
|
||||||
|
}
|
||||||
|
bindsym $mod+Shift+f fullscreen; mode "force focus"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
|
me.swayIncludes = [
|
||||||
|
force_focus_sway_config
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
25
nix/configuration/roles/sway/graphical_session_target.nix
Normal file
25
nix/configuration/roles/sway/graphical_session_target.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
start_sway_session = pkgs.writeTextFile {
|
||||||
|
name = "start_sway_session.conf";
|
||||||
|
text = ''
|
||||||
|
# Trigger graphical-session.target through sway-session.target so systemd user units can depend on it.
|
||||||
|
exec systemctl --user start sway-session.target
|
||||||
|
exec swaymsg -t subscribe '["shutdown"]' && systemctl --user stop sway-session.target
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
me.swayIncludes = lib.mkAfter [
|
||||||
|
start_sway_session
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
25
nix/configuration/roles/sway/iso.nix
Normal file
25
nix/configuration/roles/sway/iso.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
launch_terminal = pkgs.writeTextFile {
|
||||||
|
name = "launch_terminal.conf";
|
||||||
|
text = ''
|
||||||
|
exec ${pkgs.alacritty}/bin/alacritty
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.buildingIso && config.me.graphical && config.me.sway.enable) {
|
||||||
|
# Launch a terminal at boot in the live ISO for when hotkeys don't work.
|
||||||
|
me.swayIncludes = [
|
||||||
|
launch_terminal
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
33
nix/configuration/roles/sway/lockscreen.nix
Normal file
33
nix/configuration/roles/sway/lockscreen.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
lockscreen_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "lockscreen.conf";
|
||||||
|
text = ''
|
||||||
|
set $lock ${pkgs.swaylock}/bin/swaylock -f -c 000000
|
||||||
|
|
||||||
|
# Hotkey to lock the screen
|
||||||
|
bindsym $mod+l exec $lock
|
||||||
|
|
||||||
|
exec ${pkgs.swayidle}/bin/swayidle -w \
|
||||||
|
timeout 300 '$lock' \
|
||||||
|
timeout 600 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
|
||||||
|
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"' \
|
||||||
|
before-sleep '$lock'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
|
me.swayIncludes = [
|
||||||
|
lockscreen_sway_config
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
32
nix/configuration/roles/sway/notification.nix
Normal file
32
nix/configuration/roles/sway/notification.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
notification_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "notification.conf";
|
||||||
|
text =
|
||||||
|
builtins.replaceStrings
|
||||||
|
[ "@mako@" "@makoctl@" ]
|
||||||
|
[ "${pkgs.mako}/bin/mako" "${pkgs.mako}/bin/makoctl" ]
|
||||||
|
''
|
||||||
|
bindsym $mod+Escape exec @makoctl@ dismiss
|
||||||
|
bindsym $mod+Shift+Escape exec @makoctl@ invoke
|
||||||
|
|
||||||
|
# Notifications
|
||||||
|
exec @mako@
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
|
me.swayIncludes = [
|
||||||
|
notification_sway_config
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
63
nix/configuration/roles/sway/rofimoji.nix
Normal file
63
nix/configuration/roles/sway/rofimoji.nix
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
rofimoji_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "rofimoji.conf";
|
||||||
|
text = ''
|
||||||
|
# Emoji selector
|
||||||
|
bindsym $mod+backslash exec ${pkgs.rofimoji}/bin/rofimoji --selector tofi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
|
me.swayIncludes = [
|
||||||
|
rofimoji_sway_config
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".local/share/rofimoji";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
rofimoji = prev.rofimoji.overrideAttrs (old: {
|
||||||
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.tofi ];
|
||||||
|
src = builtins.fetchGit {
|
||||||
|
# https://github.com/fdw/rofimoji/issues/209
|
||||||
|
url = "https://github.com/fdw/rofimoji.git";
|
||||||
|
rev = "615f00abeb984f3e648ef712164aa4e61f2e1808";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
(final: prev: {
|
||||||
|
tofi = pkgs.symlinkJoin {
|
||||||
|
name = "tofi";
|
||||||
|
paths = [ prev.tofi ];
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/tofi-drun --add-flags --font=${pkgs.source-sans-pro}/share/fonts/opentype/SourceSansPro-Regular.otf --add-flags --config=${./files/tofi-config}
|
||||||
|
wrapProgram $out/bin/tofi --add-flags --config=${./files/tofi-config}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
42
nix/configuration/roles/sway/screenshot.nix
Normal file
42
nix/configuration/roles/sway/screenshot.nix
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
screenshot_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "screenshot.conf";
|
||||||
|
text =
|
||||||
|
builtins.replaceStrings
|
||||||
|
[ "@grim@" "@wl-screenrec@" "@pactl@" "@grep@" "@slurp@" ]
|
||||||
|
[
|
||||||
|
"${pkgs.grim}/bin/grim"
|
||||||
|
"${pkgs.wl-screenrec}/bin/wl-screenrec"
|
||||||
|
"${pkgs.pulseaudio}/bin/pactl"
|
||||||
|
"${pkgs.gnugrep}/bin/grep"
|
||||||
|
"${pkgs.slurp}/bin/slurp"
|
||||||
|
]
|
||||||
|
''
|
||||||
|
# Screenshots
|
||||||
|
#bindsym $mod+print exec @slurp@ | @grim@ -g - $(xdg-user-dir PICTURES)/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')
|
||||||
|
bindsym $mod+print exec @slurp@ | @grim@ -g - "$HOME/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')"
|
||||||
|
bindsym print exec @grim@ "$HOME/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')"
|
||||||
|
# Maybe add --audio flag? can optionally specify specific device name from `@pactl@ list sources | @grep@ Name`
|
||||||
|
bindsym $mod+Shift+print exec @wl-screenrec@ -g "$(@slurp@)" --codec av1 -f "$HOME/$(date +'screencast_%Y-%m-%d-%H%M%S.mkv')"
|
||||||
|
bindsym Shift+print exec @wl-screenrec@ --codec av1 -f "$HOME/$(date +'screencast_%Y-%m-%d-%H%M%S.mkv')"
|
||||||
|
bindsym $mod+ctrl+Shift+print exec pkill -SIGINT @wl-screenrec@
|
||||||
|
# Need to make a hotkey to end the recording
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
config = lib.mkIf (config.me.graphical && config.me.sway.enable) {
|
||||||
|
me.swayIncludes = [
|
||||||
|
screenshot_sway_config
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
53
nix/configuration/roles/terraform/default.nix
Normal file
53
nix/configuration/roles/terraform/default.nix
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
alias_tf = pkgs.writeShellScriptBin "tf" ''
|
||||||
|
exec ${pkgs.terraform}/bin/terraform "''${@}"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
terraform.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install terraform.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.terraform.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
terraform
|
||||||
|
alias_tf
|
||||||
|
];
|
||||||
|
|
||||||
|
allowedUnfree = [
|
||||||
|
"terraform"
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = ".terraform.d";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
29
nix/configuration/roles/vnc_client/default.nix
Normal file
29
nix/configuration/roles/vnc_client/default.nix
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
vnc_client.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install vnc_client.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.vnc_client.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
wlvncc
|
||||||
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
62
nix/configuration/roles/vscode/default.nix
Normal file
62
nix/configuration/roles/vscode/default.nix
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
vscode.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install vscode.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.vscode.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
allowedUnfree = [
|
||||||
|
"vscode"
|
||||||
|
"vscode-with-extensions"
|
||||||
|
"vscode-extension-ms-vscode-remote-remote-ssh"
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
(vscode-with-extensions.override {
|
||||||
|
vscodeExtensions = with vscode-extensions; [
|
||||||
|
bbenoist.nix
|
||||||
|
ms-python.python
|
||||||
|
ms-azuretools.vscode-docker
|
||||||
|
ms-vscode-remote.remote-ssh
|
||||||
|
]
|
||||||
|
# ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||||
|
# {
|
||||||
|
# name = "remote-ssh-edit";
|
||||||
|
# publisher = "ms-vscode-remote";
|
||||||
|
# version = "0.47.2";
|
||||||
|
# sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g";
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.talexander =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.file.".config/Code/User/settings.json" = {
|
||||||
|
source = ./files/settings.json;
|
||||||
|
};
|
||||||
|
home.file.".config/Code/User/keybindings.json" = {
|
||||||
|
source = ./files/keybindings.json;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
280
nix/configuration/roles/vscode/files/keybindings.json
Normal file
280
nix/configuration/roles/vscode/files/keybindings.json
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
// Place your key bindings in this file to override the defaultsauto[]
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"key": "alt+.",
|
||||||
|
"command": "editor.action.revealDefinition",
|
||||||
|
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "f12",
|
||||||
|
"command": "-editor.action.revealDefinition",
|
||||||
|
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+,",
|
||||||
|
"command": "workbench.action.navigateBack",
|
||||||
|
"when": "canNavigateBack"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+alt+-",
|
||||||
|
"command": "-workbench.action.navigateBack",
|
||||||
|
"when": "canNavigateBack"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+alt+/",
|
||||||
|
"command": "editor.action.goToReferences",
|
||||||
|
"when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+f12",
|
||||||
|
"command": "-editor.action.goToReferences",
|
||||||
|
"when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+alt+.",
|
||||||
|
"command": "workbench.action.showAllSymbols"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+t",
|
||||||
|
"command": "-workbench.action.showAllSymbols"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+;",
|
||||||
|
"command": "editor.action.commentLine",
|
||||||
|
"when": "editorTextFocus && !editorReadonly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+/",
|
||||||
|
"command": "-editor.action.commentLine",
|
||||||
|
"when": "editorTextFocus && !editorReadonly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x",
|
||||||
|
"command": "-editor.action.clipboardCutAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x",
|
||||||
|
"command": "-filesExplorer.cut",
|
||||||
|
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x 3",
|
||||||
|
"command": "workbench.action.splitEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+\\",
|
||||||
|
"command": "-workbench.action.splitEditor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x 2",
|
||||||
|
"command": "workbench.action.splitEditorDown"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+\\",
|
||||||
|
"command": "-workbench.action.splitEditorDown"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x 1",
|
||||||
|
"command": "workbench.action.joinAllGroups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x 0",
|
||||||
|
"command": "workbench.action.closeEditorsAndGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x shift+=",
|
||||||
|
"command": "workbench.action.evenEditorWidths"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+up",
|
||||||
|
"command": "workbench.action.focusAboveGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+up",
|
||||||
|
"command": "-workbench.action.focusAboveGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+down",
|
||||||
|
"command": "workbench.action.focusBelowGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+down",
|
||||||
|
"command": "-workbench.action.focusBelowGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+left",
|
||||||
|
"command": "workbench.action.focusLeftGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+left",
|
||||||
|
"command": "-workbench.action.focusLeftGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+right",
|
||||||
|
"command": "workbench.action.focusRightGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+right",
|
||||||
|
"command": "-workbench.action.focusRightGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x ctrl+s",
|
||||||
|
"command": "workbench.action.files.save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+s",
|
||||||
|
"command": "-workbench.action.files.save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+g g",
|
||||||
|
"command": "workbench.action.gotoLine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+g",
|
||||||
|
"command": "-workbench.action.gotoLine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+space",
|
||||||
|
"command": "editor.action.setSelectionAnchor",
|
||||||
|
"when": "editorTextFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+b",
|
||||||
|
"command": "-editor.action.setSelectionAnchor",
|
||||||
|
"when": "editorTextFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+w",
|
||||||
|
"command": "editor.action.clipboardCopyAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+c",
|
||||||
|
"command": "-editor.action.clipboardCopyAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+w",
|
||||||
|
"command": "editor.action.clipboardCutAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+y",
|
||||||
|
"command": "editor.action.clipboardPasteAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+v",
|
||||||
|
"command": "-editor.action.clipboardPasteAction"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x p f",
|
||||||
|
"command": "workbench.action.quickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+e",
|
||||||
|
"command": "-workbench.action.quickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+a",
|
||||||
|
"command": "cursorLineStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+e",
|
||||||
|
"command": "cursorLineEnd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+s",
|
||||||
|
"command": "actions.find",
|
||||||
|
"when": "editorFocus || editorIsOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+f",
|
||||||
|
"command": "-actions.find",
|
||||||
|
"when": "editorFocus || editorIsOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+shift+-",
|
||||||
|
"command": "undo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+z",
|
||||||
|
"command": "-undo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+x",
|
||||||
|
"command": "workbench.action.showCommands"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+shift+p",
|
||||||
|
"command": "-workbench.action.showCommands"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+c ctrl+a",
|
||||||
|
"command": "editor.action.quickFix",
|
||||||
|
"when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+.",
|
||||||
|
"command": "-editor.action.quickFix",
|
||||||
|
"when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+alt+5",
|
||||||
|
"command": "editor.action.startFindReplaceAction",
|
||||||
|
"when": "editorFocus || editorIsOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+h",
|
||||||
|
"command": "-editor.action.startFindReplaceAction",
|
||||||
|
"when": "editorFocus || editorIsOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+1",
|
||||||
|
"command": "editor.action.replaceAll",
|
||||||
|
"when": "editorFocus && findWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+alt+enter",
|
||||||
|
"command": "-editor.action.replaceAll",
|
||||||
|
"when": "editorFocus && findWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+alt+,",
|
||||||
|
"command": "cursorTop",
|
||||||
|
"when": "textInputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+home",
|
||||||
|
"command": "-cursorTop",
|
||||||
|
"when": "textInputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+alt+.",
|
||||||
|
"command": "cursorBottom",
|
||||||
|
"when": "textInputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+end",
|
||||||
|
"command": "-cursorBottom",
|
||||||
|
"when": "textInputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x ctrl+f",
|
||||||
|
"command": "workbench.action.files.openFile",
|
||||||
|
"when": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+o",
|
||||||
|
"command": "-workbench.action.files.openFile",
|
||||||
|
"when": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x k",
|
||||||
|
"command": "workbench.action.closeEditorInAllGroups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+x b",
|
||||||
|
"command": "workbench.action.showAllEditors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+p",
|
||||||
|
"command": "-workbench.action.showAllEditors"
|
||||||
|
}
|
||||||
|
]
|
||||||
41
nix/configuration/roles/vscode/files/settings.json
Normal file
41
nix/configuration/roles/vscode/files/settings.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"application.shellEnvironmentResolutionTimeout": 90,
|
||||||
|
"workbench.colorTheme": "Default High Contrast",
|
||||||
|
"remote.SSH.connectTimeout": 90,
|
||||||
|
"remote.SSH.enableDynamicForwarding": false,
|
||||||
|
"remote.SSH.enableAgentForwarding": false,
|
||||||
|
"remote.SSH.enableX11Forwarding": false,
|
||||||
|
"python.analysis.inlayHints.functionReturnTypes": true,
|
||||||
|
"python.analysis.inlayHints.variableTypes": true,
|
||||||
|
"editor.minimap.enabled": false,
|
||||||
|
"editor.fontSize": 12,
|
||||||
|
"editor.cursorStyle": "block",
|
||||||
|
"editor.fontFamily": "'Cascadia Mono', 'monospace', monospace",
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"editorCursor.foreground": "#ccff66",
|
||||||
|
"terminalCursor.foreground": "#ccff66"
|
||||||
|
},
|
||||||
|
"workbench.editor.showTabs": "none",
|
||||||
|
"workbench.activityBar.location": "hidden",
|
||||||
|
"window.menuBarVisibility": "toggle",
|
||||||
|
"explorer.autoReveal": false,
|
||||||
|
"[python]": {
|
||||||
|
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[terraform]": {
|
||||||
|
"editor.defaultFormatter": "hashicorp.terraform",
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[terraform-vars]": {
|
||||||
|
"editor.defaultFormatter": "hashicorp.terraform",
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"black-formatter.importStrategy": "fromEnvironment",
|
||||||
|
"workbench.statusBar.visible": false,
|
||||||
|
"git.openRepositoryInParentFolders": "never",
|
||||||
|
"files.autoSave": "afterDelay",
|
||||||
|
"editor.rulers": [
|
||||||
|
100
|
||||||
|
]
|
||||||
|
}
|
||||||
31
nix/configuration/roles/wasm/default.nix
Normal file
31
nix/configuration/roles/wasm/default.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
wasm.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install wasm.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.wasm.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
wabt
|
||||||
|
wasm-bindgen-cli
|
||||||
|
binaryen # for wasm-opt
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,7 +4,30 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
waybar_sway_config = pkgs.writeTextFile {
|
||||||
|
name = "waybar.conf";
|
||||||
|
text = ''
|
||||||
|
#
|
||||||
|
# Status Bar:
|
||||||
|
#
|
||||||
|
# Read `man 5 sway-bar` for more information about this section.
|
||||||
|
bar {
|
||||||
|
position top
|
||||||
|
|
||||||
|
font pango:Cascadia Mono, FontAwesome 10
|
||||||
|
swaybar_command waybar
|
||||||
|
|
||||||
|
colors {
|
||||||
|
statusline #ffffff
|
||||||
|
background #323232
|
||||||
|
inactive_workspace #32323200 #32323200 #5c5c5c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
waybar_available_memory =
|
waybar_available_memory =
|
||||||
(pkgs.writeScriptBin "waybar_custom_available_memory" (
|
(pkgs.writeScriptBin "waybar_custom_available_memory" (
|
||||||
builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash
|
builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash
|
||||||
@@ -57,6 +80,18 @@ in
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
waybar.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install waybar.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.waybar.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
waybar
|
waybar
|
||||||
waybar_available_memory
|
waybar_available_memory
|
||||||
@@ -72,6 +107,10 @@ in
|
|||||||
wlsunset # for night mode
|
wlsunset # for night mode
|
||||||
];
|
];
|
||||||
|
|
||||||
|
me.swayIncludes = [
|
||||||
|
waybar_sway_config
|
||||||
|
];
|
||||||
|
|
||||||
services.upower.enable = true; # for battery
|
services.upower.enable = true; # for battery
|
||||||
|
|
||||||
home-manager.users.talexander =
|
home-manager.users.talexander =
|
||||||
@@ -86,5 +125,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,24 +4,16 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
activatedWg = name: {
|
activatedWg = name: {
|
||||||
networking.wg-quick.interfaces."${name}".configFile = "/persist/manual/wireguard/${name}.conf";
|
networking.wg-quick.interfaces."${name}".configFile = "/persist/manual/wireguard/${name}.conf";
|
||||||
systemd.services."wg-quick-${name}" = {
|
systemd.services."wg-quick-${name}" = {
|
||||||
after = [
|
after = [
|
||||||
|
"network-online.target"
|
||||||
"nss-lookup.target"
|
"nss-lookup.target"
|
||||||
"systemd-resolved.service"
|
|
||||||
"multi-user.target"
|
|
||||||
];
|
];
|
||||||
preStart = "${pkgs.toybox}/bin/sleep 10";
|
preStart = "${pkgs.toybox}/bin/sleep 3";
|
||||||
};
|
};
|
||||||
# systemd.services."wg-quick-${name}".after = [
|
|
||||||
# "nss-lookup.target"
|
|
||||||
# "systemd-resolved.service"
|
|
||||||
# "multi-user.target"
|
|
||||||
# ];
|
|
||||||
# systemd.services."wg-quick-${name}".preStart = "${pkgs.toybox}/bin/sleep 10";
|
|
||||||
};
|
};
|
||||||
deactivatedWg = name: {
|
deactivatedWg = name: {
|
||||||
networking.wg-quick.interfaces."${name}" = {
|
networking.wg-quick.interfaces."${name}" = {
|
||||||
@@ -29,21 +21,36 @@ let
|
|||||||
autostart = false;
|
autostart = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
wgConfig = lib.attrsets.recursiveUpdate (lib.attrsets.recursiveUpdate (lib.attrsets.recursiveUpdate
|
wireguard_enable = (config.me.wireguard.activated != [ ] || config.me.wireguard.deactivated != [ ]);
|
||||||
(lib.attrsets.recursiveUpdate {
|
|
||||||
networking.firewall.allowedUDPPorts = [ 51821 ];
|
|
||||||
networking.wireguard.enable = true;
|
|
||||||
} (activatedWg "drmario"))
|
|
||||||
(activatedWg "wgh")
|
|
||||||
) (activatedWg "colo")) (deactivatedWg "wgf");
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
config = lib.mkIf (!config.me.buildingIso) wgConfig;
|
options.me = {
|
||||||
|
wireguard.activated = lib.mkOption {
|
||||||
# environment.systemPackages = with pkgs; [
|
type = lib.types.listOf lib.types.str;
|
||||||
# wireguard-tools
|
default = false;
|
||||||
# ];
|
example = true;
|
||||||
|
description = "List of wireguard config names that should be activated at boot.";
|
||||||
|
};
|
||||||
|
wireguard.deactivated = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "List of wireguard config names that are not activated at boot but can be manually activated later.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf wireguard_enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
networking.firewall.allowedUDPPorts = [ 51821 ];
|
||||||
|
networking.wireguard.enable = true;
|
||||||
|
}
|
||||||
|
(activatedWg "drmario")
|
||||||
|
(activatedWg "wgh")
|
||||||
|
(activatedWg "colo")
|
||||||
|
(deactivatedWg "wgf")
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,27 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
zfs_clone_send =
|
||||||
|
(pkgs.writeScriptBin "zfs_clone_send" (builtins.readFile ./files/zfs_clone_send.bash)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
zfs_clone_recv =
|
||||||
|
(pkgs.writeScriptBin "zfs_clone_recv" (builtins.readFile ./files/zfs_clone_recv.bash)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
zfs_clone_resume =
|
||||||
|
(pkgs.writeScriptBin "zfs_clone_resume" (builtins.readFile ./files/zfs_clone_resume.bash))
|
||||||
|
.overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
@@ -18,4 +39,16 @@
|
|||||||
trim.enable = true;
|
trim.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
zfs_clone_send
|
||||||
|
zfs_clone_recv
|
||||||
|
zfs_clone_resume
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
"/etc/zfs/zpool.cache" # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools.
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
13
nix/configuration/roles/zfs/files/zfs_clone_recv.bash
Normal file
13
nix/configuration/roles/zfs/files/zfs_clone_recv.bash
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# A zfs-send alias that creates a perfect clone with good defaults.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# -s if the stream is interrupted, save the partial stream. The stream can then be resumed by doing a zfs send -t token where token is the receive_resume_token prop on the dataset we received into.
|
||||||
|
# -u Do not mount the filesystem we are receiving. We can always mount afterwards but this avoids issues with streams with mountpoints to places like /
|
||||||
|
# Can optionally add -F to destroy the dataset in the recv location.
|
||||||
|
exec zfs recv -s -u "${@}"
|
||||||
|
|
||||||
|
# To delete an interrupted recv, run `zfs receive -A dataset`
|
||||||
17
nix/configuration/roles/zfs/files/zfs_clone_resume.bash
Normal file
17
nix/configuration/roles/zfs/files/zfs_clone_resume.bash
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Resume a zfs send.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local hst="$1"
|
||||||
|
local dst="$2"
|
||||||
|
local token
|
||||||
|
token=$(zfs get -H -o value receive_resume_token "$dst")
|
||||||
|
ssh "$hst" doas zfs send --verbose -t "$token" | doas zfs recv -s "$dst"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
||||||
8
nix/configuration/roles/zfs/files/zfs_clone_send.bash
Normal file
8
nix/configuration/roles/zfs/files/zfs_clone_send.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# A zfs-send alias that creates a perfect clone with good defaults.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
exec zfs send --compressed --replicate --large-block --embed --verbose --raw "${@}"
|
||||||
60
nix/configuration/roles/zrepl/default.nix
Normal file
60
nix/configuration/roles/zrepl/default.nix
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
zrepl.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install zrepl.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.zrepl.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
services.zrepl = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
jobs = [
|
||||||
|
{
|
||||||
|
name = "snapjob";
|
||||||
|
type = "snap";
|
||||||
|
filesystems = {
|
||||||
|
"zroot/linux/nix/persist<" = true;
|
||||||
|
"zroot/bridge<" = true;
|
||||||
|
};
|
||||||
|
snapshotting = {
|
||||||
|
type = "periodic";
|
||||||
|
interval = "15m";
|
||||||
|
prefix = "zrepl_";
|
||||||
|
};
|
||||||
|
pruning = {
|
||||||
|
keep = [
|
||||||
|
{
|
||||||
|
type = "grid";
|
||||||
|
grid = "1x1h(keep=all) | 24x1h | 14x1d";
|
||||||
|
regex = "^zrepl_.*";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "regex";
|
||||||
|
negate = true;
|
||||||
|
regex = "^zrepl_.*";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -49,22 +49,26 @@ let
|
|||||||
|
|
||||||
source ${pkgs.zsh-histdb}/share/zsh/plugins/zsh-histdb/histdb-interactive.zsh
|
source ${pkgs.zsh-histdb}/share/zsh/plugins/zsh-histdb/histdb-interactive.zsh
|
||||||
bindkey '^r' _histdb-isearch
|
bindkey '^r' _histdb-isearch
|
||||||
|
|
||||||
# TODO: Consider moving to /etc/profile.d
|
|
||||||
#while read file; do
|
|
||||||
# if [ -e "$file" ]; then
|
|
||||||
# source "$file"
|
|
||||||
# fi
|
|
||||||
#done <<<"$(find $HOME/.config/ansible_deploy/zshrc -maxdepth 1 -type f -name '*.zsh' -print)"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
zsh.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install zsh.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.zsh.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
zsh
|
zsh
|
||||||
sqlite # TODO: can this be pulled into zsh-histdb automatically?
|
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.talexander.shell = pkgs.zsh;
|
users.users.talexander.shell = pkgs.zsh;
|
||||||
@@ -95,4 +99,7 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
15
nix/configuration/util/unfree_polyfill/default.nix
Normal file
15
nix/configuration/util/unfree_polyfill/default.nix
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (builtins) elem;
|
||||||
|
inherit (lib) getName mkOption;
|
||||||
|
inherit (lib.types) listOf str;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Pending https://github.com/NixOS/nixpkgs/issues/55674
|
||||||
|
options.allowedUnfree = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
config.nixpkgs.config.allowUnfreePredicate = p: elem (getName p) config.allowedUnfree;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user