mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nix!: refactored nixosModules
This commit is contained in:
parent
3753271d60
commit
18f7c70bc9
17 changed files with 25 additions and 32 deletions
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
environment.pathsToLink = [
|
||||
"/share/fish/vendor_conf.d"
|
||||
"/share/fish/vendor_completions.d"
|
||||
"/share/fish/vendor_functions.d"
|
||||
];
|
||||
}
|
||||
28
nix/nixosModules/extra/i_am_builder/default.nix
Normal file
28
nix/nixosModules/extra/i_am_builder/default.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
nix.gc = lib.mkOverride 900 {
|
||||
# Garbage-collect often
|
||||
automatic = true;
|
||||
dates = "*:45";
|
||||
|
||||
# Randomize GC to avoid thundering herd effects.
|
||||
randomizedDelaySec = "1800";
|
||||
|
||||
options = "--delete-older-than 8d";
|
||||
};
|
||||
|
||||
users.users.nix-remote-builder = {
|
||||
isNormalUser = true;
|
||||
group = "nogroup";
|
||||
|
||||
# credit:
|
||||
# https://github.com/nix-community/srvos/blob/main/nixos/roles/nix-remote-builder.nix
|
||||
openssh.authorizedKeys.keys = map (key: ''restrict ${key}'') [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKf9AFsIEjkf0c5Hu73Vr4rKkGKzMkgYBJODw1Vvi2DL root@carbon"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEdzs65v65s5sVEv+BClW7qYb0tWuLOZ4e8lIAActeUq root@bismuth"
|
||||
];
|
||||
};
|
||||
|
||||
nix.settings.trusted-users = [ "nix-remote-builder" ];
|
||||
}
|
||||
39
nix/nixosModules/extra/layouts/README.md
Normal file
39
nix/nixosModules/extra/layouts/README.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
This folder contains my very awesome dvorak French layout on linux
|
||||
|
||||
# Ubuntu
|
||||
`$XDG_CONFIG_HOME/.config/xkb` doesn't work.
|
||||
[source](https://github.com/elias19r/xkb-layouts)
|
||||
|
||||
`# cp dvorak-french.xkb /usr/share/X11/xkb/symbols/`
|
||||
|
||||
`/usr/share/X11/xkb/rules/evdev.xml`
|
||||
```xml
|
||||
<layoutList>
|
||||
...
|
||||
<layout>
|
||||
<configItem>
|
||||
<name>dvorak-french</name>
|
||||
<shortDescription>Baguette</shortDescription>
|
||||
<description>French Dvorak</description>
|
||||
</configItem>
|
||||
</layout>
|
||||
...
|
||||
</layoutList>
|
||||
```
|
||||
|
||||
`/usr/share/X11/xkb/rules/evdev.lst`
|
||||
```xml
|
||||
! layout
|
||||
dvorak-french French Dvorak
|
||||
```
|
||||
|
||||
## Swap escape and capslock
|
||||
`dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:swapescape']"`
|
||||
(to undo, use `dconf reset`)
|
||||
|
||||
# Notes
|
||||
Use `setxkbmap -option caps:swapescape` to swap escape and capslock
|
||||
[source](https://askubuntu.com/a/830343)
|
||||
|
||||
## Sources
|
||||
https://help.ubuntu.com/community/Custom%20keyboard%20layout%20definitions
|
||||
22
nix/nixosModules/extra/layouts/default.nix
Normal file
22
nix/nixosModules/extra/layouts/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
services.xserver.xkb = {
|
||||
layout = lib.mkDefault "myDvorak";
|
||||
# TODO: figure out how to implement this conditionally
|
||||
# options = "caps:swapescape";
|
||||
extraLayouts = {
|
||||
"myDvorak" = {
|
||||
languages = [ "us" ];
|
||||
symbolsFile = ./dvorak.xkb;
|
||||
description = "Leana's dvorak";
|
||||
};
|
||||
"myDvorakFrench" = {
|
||||
languages = [ "fr" ];
|
||||
symbolsFile = ./dvorak-french.xkb;
|
||||
description = "Leana's dvorak but baguette";
|
||||
};
|
||||
};
|
||||
};
|
||||
console.useXkbConfig = true;
|
||||
}
|
||||
58
nix/nixosModules/extra/layouts/dvorak-french.xkb
Normal file
58
nix/nixosModules/extra/layouts/dvorak-french.xkb
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// vim:syntax=xkb
|
||||
|
||||
partial alphanumeric_keys
|
||||
xkb_symbols "dvorak-french" {
|
||||
|
||||
name[Group1]= "French Dvorak";
|
||||
|
||||
key <TLDE> {[ grave, asciitilde, dead_grave, dead_tilde ]};
|
||||
key <AE01> {[ VoidSymbol, exclam ]};
|
||||
key <AE02> {[ egrave, at ]};
|
||||
key <AE03> {[ eacute, numbersign ]};
|
||||
key <AE04> {[ U22c5, dollar ]};
|
||||
key <AE05> {[ oe, percent ]};
|
||||
key <AE06> {[ dead_diaeresis, asciicircum ]};
|
||||
key <AE07> {[ dead_circumflex, ampersand ]};
|
||||
key <AE08> {[ ccedilla, asterisk, Ccedilla ]};
|
||||
key <AE09> {[ agrave, parenleft, dead_grave, dead_breve ]};
|
||||
key <AE10> {[ ugrave, parenright, U00ba ]};
|
||||
key <AE11> {[ bracketleft, braceleft ]};
|
||||
key <AE12> {[ bracketright, braceright, dead_tilde ]};
|
||||
|
||||
key <AD01> {[apostrophe, quotedbl, dead_acute, dead_diaeresis ]};
|
||||
key <AD02> {[ comma, less, dead_cedilla, dead_caron ]};
|
||||
key <AD03> {[ period, greater, dead_abovedot, periodcentered ]};
|
||||
key <AD04> {[ p, P ]};
|
||||
key <AD05> {[ y, Y ]};
|
||||
key <AD06> {[ f, F ]};
|
||||
key <AD07> {[ g, G ]};
|
||||
key <AD08> {[ c, C ]};
|
||||
key <AD09> {[ r, R ]};
|
||||
key <AD10> {[ l, L ]};
|
||||
key <AD11> {[ slash, question ]};
|
||||
key <AD12> {[ equal, plus ]};
|
||||
key <AC01> {[ a, A ]};
|
||||
key <AC02> {[ o, O ]};
|
||||
key <AC03> {[ e, E ]};
|
||||
key <AC04> {[ u, U ]};
|
||||
key <AC05> {[ i, I ]};
|
||||
key <AC06> {[ d, D ]};
|
||||
key <AC07> {[ h, H ]};
|
||||
key <AC08> {[ t, T ]};
|
||||
key <AC09> {[ n, N ]};
|
||||
key <AC10> {[ s, S ]};
|
||||
key <AC11> {[ minus, underscore ]};
|
||||
key <BKSL> {[ backslash, bar ]};
|
||||
|
||||
key <AB01> {[ semicolon, colon, dead_ogonek, dead_doubleacute ]};
|
||||
key <AB02> {[ q, Q ]};
|
||||
key <AB03> {[ j, J ]};
|
||||
key <AB04> {[ k, K ]};
|
||||
key <AB05> {[ x, X ]};
|
||||
key <AB06> {[ b, B ]};
|
||||
key <AB07> {[ m, M ]};
|
||||
key <AB08> {[ w, W ]};
|
||||
key <AB09> {[ v, V ]};
|
||||
key <AB10> {[ z, Z ]};
|
||||
|
||||
};
|
||||
58
nix/nixosModules/extra/layouts/dvorak.xkb
Normal file
58
nix/nixosModules/extra/layouts/dvorak.xkb
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// vim:syntax=xkb
|
||||
|
||||
partial alphanumeric_keys
|
||||
xkb_symbols "dvorak" {
|
||||
|
||||
name[Group1]= "English (Dvorak)";
|
||||
|
||||
key <TLDE> {[ grave, asciitilde, dead_grave, dead_tilde ]};
|
||||
key <AE01> {[ 1, exclam ]};
|
||||
key <AE02> {[ 2, at ]};
|
||||
key <AE03> {[ 3, numbersign ]};
|
||||
key <AE04> {[ 4, dollar ]};
|
||||
key <AE05> {[ 5, percent ]};
|
||||
key <AE06> {[ 6, asciicircum, dead_circumflex, dead_circumflex ]};
|
||||
key <AE07> {[ 7, ampersand ]};
|
||||
key <AE08> {[ 8, asterisk ]};
|
||||
key <AE09> {[ 9, parenleft, dead_grave, dead_breve ]};
|
||||
key <AE10> {[ 0, parenright ]};
|
||||
key <AE11> {[ bracketleft, braceleft ]};
|
||||
key <AE12> {[bracketright, braceright, dead_tilde]};
|
||||
|
||||
key <AD01> {[apostrophe, quotedbl, dead_acute, dead_diaeresis ]};
|
||||
key <AD02> {[ comma, less, dead_cedilla, dead_caron ]};
|
||||
key <AD03> {[ period, greater, dead_abovedot, periodcentered ]};
|
||||
key <AD04> {[ p, P ]};
|
||||
key <AD05> {[ y, Y ]};
|
||||
key <AD06> {[ f, F ]};
|
||||
key <AD07> {[ g, G ]};
|
||||
key <AD08> {[ c, C ]};
|
||||
key <AD09> {[ r, R ]};
|
||||
key <AD10> {[ l, L ]};
|
||||
key <AD11> {[ slash, question ]};
|
||||
key <AD12> {[ equal, plus ]};
|
||||
|
||||
key <AC01> {[ a, A ]};
|
||||
key <AC02> {[ o, O ]};
|
||||
key <AC03> {[ e, E ]};
|
||||
key <AC04> {[ u, U ]};
|
||||
key <AC05> {[ i, I ]};
|
||||
key <AC06> {[ d, D ]};
|
||||
key <AC07> {[ h, H ]};
|
||||
key <AC08> {[ t, T ]};
|
||||
key <AC09> {[ n, N ]};
|
||||
key <AC10> {[ s, S ]};
|
||||
key <AC11> {[ minus, underscore ]};
|
||||
key <BKSL> {[ backslash, bar ]};
|
||||
|
||||
key <AB01> {[ semicolon, colon, dead_ogonek, dead_doubleacute ]};
|
||||
key <AB02> {[ q, Q ]};
|
||||
key <AB03> {[ j, J ]};
|
||||
key <AB04> {[ k, K ]};
|
||||
key <AB05> {[ x, X ]};
|
||||
key <AB06> {[ b, B ]};
|
||||
key <AB07> {[ m, M ]};
|
||||
key <AB08> {[ w, W ]};
|
||||
key <AB09> {[ v, V ]};
|
||||
key <AB10> {[ z, Z ]};
|
||||
};
|
||||
16
nix/nixosModules/extra/leana/default.nix
Normal file
16
nix/nixosModules/extra/leana/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
nix.settings.trusted-users = [ "leana" ];
|
||||
|
||||
users.users."leana" = {
|
||||
isNormalUser = true;
|
||||
home = "/home/leana";
|
||||
description = "Leana";
|
||||
group = "leana";
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
|
||||
};
|
||||
|
||||
users.groups.leana = { };
|
||||
}
|
||||
56
nix/nixosModules/extra/parrot/default.nix
Normal file
56
nix/nixosModules/extra/parrot/default.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.parrot;
|
||||
t = lib.types;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
services.parrot = {
|
||||
|
||||
enable = lib.mkEnableOption "parrot";
|
||||
|
||||
environmentFile = lib.mkOption {
|
||||
description = "Path to an environment file, you can set the token there";
|
||||
type = t.path;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
users.users."parrot" = {
|
||||
group = "parrot";
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups."parrot" = { };
|
||||
|
||||
systemd.services."parrot" = {
|
||||
description = " A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
User = "parrot";
|
||||
Group = "parrot";
|
||||
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
|
||||
ExecStart = "${lib.getExe pkgs.parrot}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
79
nix/nixosModules/extra/typst-bot/default.nix
Normal file
79
nix/nixosModules/extra/typst-bot/default.nix
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.typst-bot;
|
||||
t = lib.types;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
services.typst-bot = {
|
||||
|
||||
enable = lib.mkEnableOption "typst-bot";
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
description = "Cache directory";
|
||||
type = t.path;
|
||||
default = "/var/typst-bot";
|
||||
};
|
||||
|
||||
environmentFile = lib.mkOption {
|
||||
description = "Path to an environment file, you can set the token there";
|
||||
type = t.path;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
users.users."typst-bot" = {
|
||||
group = "typst-bot";
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups."typst-bot" = { };
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${cfg.dataDir}/cache 700 typst-bot typst-bot - -"
|
||||
"d ${cfg.dataDir}/sqlite 700 typst-bot typst-bot - -"
|
||||
];
|
||||
|
||||
systemd.services."typst-bot" = {
|
||||
description = "A discord bot to render Typst code";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart = ''
|
||||
touch ${cfg.dataDir}/sqlite/db.sqlite
|
||||
'';
|
||||
|
||||
# Don't pollute the global path
|
||||
path = [ pkgs.myPkgs.typst-bot ];
|
||||
script = "typst-bot";
|
||||
|
||||
serviceConfig = {
|
||||
User = "typst-bot";
|
||||
Group = "typst-bot";
|
||||
|
||||
EnvironmentFile = [
|
||||
"${pkgs.writeText "typst-bot-env" ''
|
||||
DB_PATH=${cfg.dataDir}/sqlite/db.sqlite
|
||||
CACHE_DIRECTORY=${cfg.dataDir}/cache
|
||||
''}"
|
||||
cfg.environmentFile
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
1
nix/nixosModules/extra/zram/default.nix
Normal file
1
nix/nixosModules/extra/zram/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ zramSwap.enable = true; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue