mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-09-19 16:49:04 +05:30
style: format code
This commit is contained in:
@@ -1,59 +1,57 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.boot =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.boot;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
];
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.boot = {
|
||||
config,
|
||||
lib,
|
||||
userName,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.boot;
|
||||
in {
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
];
|
||||
|
||||
options.tnix.boot.impermanence = {
|
||||
enable = lib.mkEnableOption "Enable impermanence";
|
||||
options.tnix.boot.impermanence = {
|
||||
enable = lib.mkEnableOption "Enable impermanence";
|
||||
|
||||
directories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
files = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
directories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
options.tnix.boot.impermanence.home = {
|
||||
directories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
files = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
files = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
options.tnix.boot.impermanence.home = {
|
||||
directories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.impermanence.enable {
|
||||
programs.fuse.userAllowOther = true;
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
files = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.impermanence.enable {
|
||||
programs.fuse.userAllowOther = true;
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories =
|
||||
[
|
||||
"/var/log"
|
||||
"/var/lib"
|
||||
"/etc/NetworkManager/system-connections"
|
||||
]
|
||||
++ cfg.impermanence.directories;
|
||||
|
||||
files = [
|
||||
files =
|
||||
[
|
||||
"/etc/machine-id"
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||
@@ -61,11 +59,12 @@
|
||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||
]
|
||||
++ cfg.impermanence.files;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${userName} = {
|
||||
home.persistence."/persist" = {
|
||||
directories = [
|
||||
home-manager.users.${userName} = {
|
||||
home.persistence."/persist" = {
|
||||
directories =
|
||||
[
|
||||
"Downloads"
|
||||
"Music"
|
||||
"Wallpapers"
|
||||
@@ -77,46 +76,46 @@
|
||||
]
|
||||
++ cfg.impermanence.home.directories;
|
||||
|
||||
files = cfg.impermanence.home.files;
|
||||
};
|
||||
files = cfg.impermanence.home.files;
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.systemd = {
|
||||
enable = true;
|
||||
boot.initrd.systemd = {
|
||||
enable = true;
|
||||
|
||||
services.wipe-my-fs = {
|
||||
wantedBy = [ "initrd.target" ];
|
||||
after = [ "initrd-root-device.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
|
||||
services.wipe-my-fs = {
|
||||
wantedBy = ["initrd.target"];
|
||||
after = ["initrd-root-device.target"];
|
||||
before = ["sysroot.mount"];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
|
||||
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
{
|
||||
flake.modules.nixos.boot =
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.tnix.boot;
|
||||
in
|
||||
{
|
||||
options.tnix.boot.legacy = {
|
||||
enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
|
||||
boot.loader = {
|
||||
timeout = 1;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
}
|
||||
|
||||
(lib.mkIf (!cfg.legacy.enable && !cfg.secure-boot.enable) {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.legacy.enable {
|
||||
boot.loader.grub.enable = true;
|
||||
})
|
||||
];
|
||||
flake.modules.nixos.boot = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.boot;
|
||||
in {
|
||||
options.tnix.boot.legacy = {
|
||||
enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
||||
|
||||
boot.loader = {
|
||||
timeout = 1;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
}
|
||||
|
||||
(lib.mkIf (!cfg.legacy.enable && !cfg.secure-boot.enable) {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.legacy.enable {
|
||||
boot.loader.grub.enable = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{
|
||||
flake.modules.nixos.boot =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
consoleLogLevel = 0;
|
||||
initrd.verbose = false;
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
supportedFilesystems = [ "ntfs" ];
|
||||
};
|
||||
flake.modules.nixos.boot = {pkgs, ...}: {
|
||||
boot = {
|
||||
consoleLogLevel = 0;
|
||||
initrd.verbose = false;
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
supportedFilesystems = ["ntfs"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,43 +1,39 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.boot =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.boot;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.boot = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.boot;
|
||||
in {
|
||||
imports = [inputs.lanzaboote.nixosModules.lanzaboote];
|
||||
|
||||
options.tnix.boot.secure-boot = {
|
||||
enable = lib.mkEnableOption "Enable secure-boot";
|
||||
};
|
||||
options.tnix.boot.secure-boot = {
|
||||
enable = lib.mkEnableOption "Enable secure-boot";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.secure-boot.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !cfg.legacy.enable;
|
||||
message = "secure-boot and legacy boot (GRUB) cannot be enabled at the same time";
|
||||
}
|
||||
];
|
||||
config = lib.mkIf cfg.secure-boot.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !cfg.legacy.enable;
|
||||
message = "secure-boot and legacy boot (GRUB) cannot be enabled at the same time";
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = [ pkgs.sbctl ];
|
||||
environment.systemPackages = [pkgs.sbctl];
|
||||
|
||||
# Lanzaboote replaces systemd-boot, so force it off
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
# Lanzaboote replaces systemd-boot, so force it off
|
||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
|
||||
boot.lanzaboote = {
|
||||
enable = true;
|
||||
autoGenerateKeys.enable = true;
|
||||
autoEnrollKeys.enable = true;
|
||||
boot.lanzaboote = {
|
||||
enable = true;
|
||||
autoGenerateKeys.enable = true;
|
||||
autoEnrollKeys.enable = true;
|
||||
|
||||
configurationLimit = 10;
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
};
|
||||
configurationLimit = 10;
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
{ inputs, config, ... }:
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
hostName,
|
||||
userName,
|
||||
userEmail,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
flake.modules.nixos.core = {
|
||||
hostName,
|
||||
userName,
|
||||
userEmail,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
backupFileExtension = "bak";
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
hostName
|
||||
userName
|
||||
userEmail
|
||||
;
|
||||
};
|
||||
home-manager = {
|
||||
backupFileExtension = "bak";
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
hostName
|
||||
userName
|
||||
userEmail
|
||||
;
|
||||
};
|
||||
|
||||
users.${userName} = {
|
||||
imports = [
|
||||
config.flake.modules.homeManager.core
|
||||
config.flake.modules.homeManager.shell
|
||||
config.flake.modules.homeManager.${hostName}
|
||||
];
|
||||
};
|
||||
users.${userName} = {
|
||||
imports = [
|
||||
config.flake.modules.homeManager.core
|
||||
config.flake.modules.homeManager.shell
|
||||
config.flake.modules.homeManager.${hostName}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
config,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.nh = {
|
||||
enable = true;
|
||||
flake.modules.nixos.core = {
|
||||
config,
|
||||
userName,
|
||||
...
|
||||
}: {
|
||||
programs.nh = {
|
||||
enable = true;
|
||||
|
||||
clean = {
|
||||
enable = !config.nix.gc.automatic;
|
||||
dates = "weekly";
|
||||
};
|
||||
|
||||
flake = "/home/${userName}/Projects/nixos-config";
|
||||
clean = {
|
||||
enable = !config.nix.gc.automatic;
|
||||
dates = "weekly";
|
||||
};
|
||||
|
||||
flake = "/home/${userName}/Projects/nixos-config";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.core = { pkgs, ... }: {
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.core = {pkgs, ...}: {
|
||||
imports = [
|
||||
inputs.nix-index-database.nixosModules.default
|
||||
];
|
||||
|
||||
@@ -1,88 +1,86 @@
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{ userName, ... }:
|
||||
{
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
flake.modules.nixos.core = {userName, ...}: {
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
dates = "weekly";
|
||||
persistent = true;
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
dates = "weekly";
|
||||
persistent = true;
|
||||
};
|
||||
|
||||
optimise.automatic = true;
|
||||
optimise.automatic = true;
|
||||
|
||||
settings = {
|
||||
extra-platforms = [
|
||||
"aarch64-linux"
|
||||
"arm-linux"
|
||||
];
|
||||
settings = {
|
||||
extra-platforms = [
|
||||
"aarch64-linux"
|
||||
"arm-linux"
|
||||
];
|
||||
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
|
||||
max-jobs = "auto";
|
||||
max-jobs = "auto";
|
||||
|
||||
# Make legacy nix commands use the XDG base directories instead of creating directories in $HOME.
|
||||
use-xdg-base-directories = true;
|
||||
# Make legacy nix commands use the XDG base directories instead of creating directories in $HOME.
|
||||
use-xdg-base-directories = true;
|
||||
|
||||
# The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads.
|
||||
# It defaults to 25. 0 means no limit.
|
||||
http-connections = 128;
|
||||
# The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads.
|
||||
# It defaults to 25. 0 means no limit.
|
||||
http-connections = 128;
|
||||
|
||||
# This option defines the maximum number of substitution jobs that Nix will try to run in
|
||||
# parallel. The default is 16. The minimum value one can choose is 1 and lower values will be
|
||||
# interpreted as 1.
|
||||
max-substitution-jobs = 128;
|
||||
# This option defines the maximum number of substitution jobs that Nix will try to run in
|
||||
# parallel. The default is 16. The minimum value one can choose is 1 and lower values will be
|
||||
# interpreted as 1.
|
||||
max-substitution-jobs = 128;
|
||||
|
||||
# The number of lines of the tail of the log to show if a build fails.
|
||||
log-lines = 25;
|
||||
# The number of lines of the tail of the log to show if a build fails.
|
||||
log-lines = 25;
|
||||
|
||||
# When free disk space in /nix/store drops below min-free during a build, Nix performs a
|
||||
# garbage-collection until max-free bytes are available or there is no more garbage.
|
||||
# A value of 0 (the default) disables this feature.
|
||||
min-free = 128000000; # 128 MB
|
||||
max-free = 1000000000; # 1 GB
|
||||
# When free disk space in /nix/store drops below min-free during a build, Nix performs a
|
||||
# garbage-collection until max-free bytes are available or there is no more garbage.
|
||||
# A value of 0 (the default) disables this feature.
|
||||
min-free = 128000000; # 128 MB
|
||||
max-free = 1000000000; # 1 GB
|
||||
|
||||
# Prevent garbage collection from altering nix-shells managed by nix-direnv
|
||||
# https://github.com/nix-community/nix-direnv#installation
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
# Prevent garbage collection from altering nix-shells managed by nix-direnv
|
||||
# https://github.com/nix-community/nix-direnv#installation
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
|
||||
# If set to true, Nix will keep building derivations even if some fail. The default is false.
|
||||
keep-going = true;
|
||||
# If set to true, Nix will keep building derivations even if some fail. The default is false.
|
||||
keep-going = true;
|
||||
|
||||
# Automatically detect files in the store that have identical contents, and replaces
|
||||
# them with hard links to a single copy. This saves disk space.
|
||||
auto-optimise-store = true;
|
||||
# Automatically detect files in the store that have identical contents, and replaces
|
||||
# them with hard links to a single copy. This saves disk space.
|
||||
auto-optimise-store = true;
|
||||
|
||||
# Whether to warn about dirty Git/Mercurial trees.
|
||||
warn-dirty = false;
|
||||
# Whether to warn about dirty Git/Mercurial trees.
|
||||
warn-dirty = false;
|
||||
|
||||
# The timeout (in seconds) for establishing connections in the binary cache substituter.
|
||||
# It corresponds to curl’s –connect-timeout option. A value of 0 means no limit.
|
||||
connect-timeout = 5;
|
||||
# The timeout (in seconds) for establishing connections in the binary cache substituter.
|
||||
# It corresponds to curl’s –connect-timeout option. A value of 0 means no limit.
|
||||
connect-timeout = 5;
|
||||
|
||||
# Allow the use of cachix
|
||||
trusted-users = [
|
||||
"root"
|
||||
"${userName}"
|
||||
];
|
||||
allowed-users = [
|
||||
"root"
|
||||
"${userName}"
|
||||
];
|
||||
# Allow the use of cachix
|
||||
trusted-users = [
|
||||
"root"
|
||||
"${userName}"
|
||||
];
|
||||
allowed-users = [
|
||||
"root"
|
||||
"${userName}"
|
||||
];
|
||||
|
||||
builders-use-substitutes = true;
|
||||
builders-use-substitutes = true;
|
||||
|
||||
# If set to true, Nix will fall back to building from source if a binary substitute
|
||||
# fails. This is equivalent to the –fallback flag. The default is false.
|
||||
fallback = true;
|
||||
};
|
||||
# If set to true, Nix will fall back to building from source if a binary substitute
|
||||
# fails. This is equivalent to the –fallback flag. The default is false.
|
||||
fallback = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.core = {
|
||||
nixpkgs = {
|
||||
config = {
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
isEd25519 = k: k.type == "ed25519";
|
||||
getKeyPath = k: k.path;
|
||||
keys = builtins.filter isEd25519 config.services.openssh.hostKeys;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.core = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
isEd25519 = k: k.type == "ed25519";
|
||||
getKeyPath = k: k.path;
|
||||
keys = builtins.filter isEd25519 config.services.openssh.hostKeys;
|
||||
in {
|
||||
imports = [inputs.sops-nix.nixosModules.sops];
|
||||
|
||||
sops.age = {
|
||||
sshKeyPaths = map getKeyPath keys;
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
generateKey = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ sops ];
|
||||
sops.age = {
|
||||
sshKeyPaths = map getKeyPath keys;
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
generateKey = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [sops];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,51 +1,48 @@
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
userName,
|
||||
userEmail,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hasPasswordSecret = lib.hasAttrByPath [ "sops" "secrets" "tux-password" ] config;
|
||||
in
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
flake.modules.nixos.core = {
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
userName,
|
||||
userEmail,
|
||||
...
|
||||
}: let
|
||||
hasPasswordSecret = lib.hasAttrByPath ["sops" "secrets" "tux-password"] config;
|
||||
in {
|
||||
programs.zsh.enable = true;
|
||||
|
||||
time.timeZone = "Asia/Kolkata";
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
extraLocaleSettings = lib.genAttrs [
|
||||
"LC_ADDRESS"
|
||||
"LC_IDENTIFICATION"
|
||||
"LC_MEASUREMENT"
|
||||
"LC_MONETARY"
|
||||
"LC_NAME"
|
||||
"LC_NUMERIC"
|
||||
"LC_PAPER"
|
||||
"LC_TELEPHONE"
|
||||
"LC_TIME"
|
||||
] (_: "en_IN");
|
||||
};
|
||||
time.timeZone = "Asia/Kolkata";
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
extraLocaleSettings = lib.genAttrs [
|
||||
"LC_ADDRESS"
|
||||
"LC_IDENTIFICATION"
|
||||
"LC_MEASUREMENT"
|
||||
"LC_MONETARY"
|
||||
"LC_NAME"
|
||||
"LC_NUMERIC"
|
||||
"LC_PAPER"
|
||||
"LC_TELEPHONE"
|
||||
"LC_TIME"
|
||||
] (_: "en_IN");
|
||||
};
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
defaultUserShell = pkgs.zsh;
|
||||
users.${userName} = {
|
||||
hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path;
|
||||
initialPassword = lib.mkIf (!hasPasswordSecret) userName;
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
"storage"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}"
|
||||
];
|
||||
};
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
defaultUserShell = pkgs.zsh;
|
||||
users.${userName} = {
|
||||
hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path;
|
||||
initialPassword = lib.mkIf (!hasPasswordSecret) userName;
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
"storage"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
fonts.packages = with pkgs.nerd-fonts; [
|
||||
fira-code
|
||||
jetbrains-mono
|
||||
bigblue-terminal
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
fonts.packages = with pkgs.nerd-fonts; [
|
||||
fira-code
|
||||
jetbrains-mono
|
||||
bigblue-terminal
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.gpu-screen-recorder = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
gpu-screen-recorder-gtk
|
||||
];
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
programs.gpu-screen-recorder = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
gpu-screen-recorder-gtk
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = pkgs.hyprland-git.hyprland;
|
||||
portalPackage = pkgs.hyprland-git.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = pkgs.hyprland-git.hyprland;
|
||||
portalPackage = pkgs.hyprland-git.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,36 +1,30 @@
|
||||
{
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.mango.nixosModules.mango
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.desktop = {
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.mango.nixosModules.mango
|
||||
];
|
||||
|
||||
programs.mango.enable = true;
|
||||
|
||||
xdg.portal = {
|
||||
enable = lib.mkDefault true;
|
||||
extraPortals = with pkgs; [
|
||||
hyprland-git.xdg-desktop-portal-hyprland
|
||||
xdg-desktop-portal-wlr
|
||||
xdg-desktop-portal-gtk
|
||||
];
|
||||
|
||||
programs.mango.enable = true;
|
||||
|
||||
xdg.portal = {
|
||||
enable = lib.mkDefault true;
|
||||
extraPortals = with pkgs; [
|
||||
hyprland-git.xdg-desktop-portal-hyprland
|
||||
xdg-desktop-portal-wlr
|
||||
xdg-desktop-portal-gtk
|
||||
config.mango = {
|
||||
default = lib.mkForce [
|
||||
"hyprland"
|
||||
"gtk"
|
||||
];
|
||||
config.mango = {
|
||||
default = lib.mkForce [
|
||||
"hyprland"
|
||||
"gtk"
|
||||
];
|
||||
"org.freedesktop.impl.portal.ScreenCast" = lib.mkForce [ "hyprland" ];
|
||||
"org.freedesktop.impl.portal.ScreenShot" = lib.mkForce [ "hyprland" ];
|
||||
};
|
||||
"org.freedesktop.impl.portal.ScreenCast" = lib.mkForce ["hyprland"];
|
||||
"org.freedesktop.impl.portal.ScreenShot" = lib.mkForce ["hyprland"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ brightnessctl ];
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [brightnessctl];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.obs-studio = {
|
||||
enable = true;
|
||||
enableVirtualCamera = true;
|
||||
plugins = with pkgs.obs-studio-plugins; [
|
||||
obs-vaapi
|
||||
wlrobs
|
||||
obs-source-record
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
programs.obs-studio = {
|
||||
enable = true;
|
||||
enableVirtualCamera = true;
|
||||
plugins = with pkgs.obs-studio-plugins; [
|
||||
obs-vaapi
|
||||
wlrobs
|
||||
obs-source-record
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services = {
|
||||
gvfs.enable = true;
|
||||
tumbler.enable = true;
|
||||
};
|
||||
|
||||
programs.thunar = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
thunar-archive-plugin
|
||||
thunar-volman
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
services = {
|
||||
gvfs.enable = true;
|
||||
tumbler.enable = true;
|
||||
};
|
||||
|
||||
programs.thunar = {
|
||||
enable = true;
|
||||
plugins = with pkgs; [
|
||||
thunar-archive-plugin
|
||||
thunar-volman
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
flake.modules.nixos.desktop =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ tshell ];
|
||||
};
|
||||
flake.modules.nixos.desktop = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [tshell];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
{
|
||||
flake.modules.nixos.gaming =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
protontricks.enable = true;
|
||||
extraCompatPackages = with pkgs; [ proton-ge-bin ];
|
||||
};
|
||||
flake.modules.nixos.gaming = {pkgs, ...}: {
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
protontricks.enable = true;
|
||||
extraCompatPackages = with pkgs; [proton-ge-bin];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
flake.modules.nixos.hardware = { pkgs, ... }: {
|
||||
flake.modules.nixos.hardware = {pkgs, ...}: {
|
||||
security.rtkit.enable = true;
|
||||
|
||||
services.pipewire = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
flake.modules.nixos.hardware = { pkgs, ... }: {
|
||||
flake.modules.nixos.hardware = {pkgs, ...}: {
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
{
|
||||
flake.modules.nixos.networking =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
hostName,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.networking = {
|
||||
config,
|
||||
lib,
|
||||
hostName,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.networking.netbird-client;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.networking.netbird-client = {
|
||||
enable = mkEnableOption "Enable netbird client";
|
||||
};
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
{
|
||||
flake.modules.nixos.networking =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.networking = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.networking.newt;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.networking.newt = {
|
||||
enable = mkEnableOption "Newt";
|
||||
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
{
|
||||
flake.modules.nixos.networking =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.networking = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.networking.openssh;
|
||||
|
||||
# Sops needs acess to the keys before the persist dirs are even mounted; so
|
||||
# just persisting the keys won't work, we must point at /persist
|
||||
hasOptinPersistence = config.tnix.boot.impermanence.enable;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.networking.openssh = {
|
||||
enable = mkEnableOption "Enable OpenSSH server";
|
||||
|
||||
ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ 22 ];
|
||||
default = [22];
|
||||
description = ''
|
||||
Specifies on which ports the SSH daemon listens.
|
||||
'';
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.aiostreams;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.aiostreams = {
|
||||
enable = mkEnableOption "AIOStreams";
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
{ inputs, ... }: {
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.copyparty;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
inputs.copyparty.nixosModules.default
|
||||
];
|
||||
@@ -75,7 +72,7 @@
|
||||
accounts = cfg.accounts;
|
||||
volumes = cfg.volumes;
|
||||
package = pkgs.copyparty.override {
|
||||
extraPackages = [ pkgs.exiftool ];
|
||||
extraPackages = [pkgs.exiftool];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.cyber-tux;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.cyber-tux = {
|
||||
enable = mkEnableOption "CyberTux Discord bot";
|
||||
|
||||
@@ -41,9 +38,9 @@
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.cyber-tux = {
|
||||
description = "CyberTux Discord bot";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = ["network-online.target"];
|
||||
wants = ["network-online.target"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
@@ -83,7 +80,7 @@
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [ "@system-service" ];
|
||||
SystemCallFilter = ["@system-service"];
|
||||
UMask = "0077";
|
||||
};
|
||||
};
|
||||
@@ -99,7 +96,7 @@
|
||||
};
|
||||
|
||||
users.groups = mkIf (cfg.group == "cyber-tux") {
|
||||
${cfg.group} = { };
|
||||
${cfg.group} = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.gitea;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.gitea = {
|
||||
enable = mkEnableOption "Gitea";
|
||||
|
||||
@@ -109,7 +106,7 @@
|
||||
|
||||
postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "gitea" ];
|
||||
ensureDatabases = ["gitea"];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "gitea";
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
{ inputs, ... }: {
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.hermes-agent;
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
inputs.hermes-agent.nixosModules.default
|
||||
];
|
||||
@@ -42,7 +39,7 @@
|
||||
];
|
||||
};
|
||||
|
||||
users.users.${userName}.extraGroups = [ "hermes" ];
|
||||
users.users.${userName}.extraGroups = ["hermes"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.mediaflow-proxy;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.mediaflow-proxy = {
|
||||
enable = mkEnableOption "MediaFlow Proxy";
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
userEmail,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
userEmail,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.nginx;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.nginx = {
|
||||
enable = mkEnableOption "Nginx";
|
||||
|
||||
@@ -30,7 +27,7 @@
|
||||
"${cfg.domain}" = {
|
||||
group = "nginx";
|
||||
domain = "*.${cfg.domain}";
|
||||
extraDomainNames = [ "${cfg.domain}" ];
|
||||
extraDomainNames = ["${cfg.domain}"];
|
||||
dnsProvider = "cloudflare";
|
||||
credentialFiles = {
|
||||
CLOUDFLARE_EMAIL_FILE = config.sops.secrets."cloudflare-credentials/email".path;
|
||||
@@ -41,7 +38,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
users.users.nginx.extraGroups = [ "acme" ];
|
||||
users.users.nginx.extraGroups = ["acme"];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
userEmail,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
userEmail,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.pangolin;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.pangolin = {
|
||||
enable = mkEnableOption "Pangolin";
|
||||
|
||||
@@ -77,7 +74,7 @@
|
||||
|
||||
postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "pangolin" ];
|
||||
ensureDatabases = ["pangolin"];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "pangolin";
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
{ inputs, ... }: {
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
{inputs, ...}: {
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.trok;
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
inputs.trok.nixosModules.default
|
||||
];
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.uptime-kuma;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.uptime-kuma = {
|
||||
enable = mkEnableOption "Uptime Kuma";
|
||||
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
{
|
||||
flake.modules.nixos.services =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
flake.modules.nixos.services = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.tnix.services.vaultwarden;
|
||||
port = toString cfg.port;
|
||||
acmeHost = config.tnix.services.nginx.domain;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.tnix.services.vaultwarden = {
|
||||
enable = mkEnableOption "Vaultwarden";
|
||||
|
||||
@@ -106,7 +103,7 @@
|
||||
|
||||
postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "vaultwarden" ];
|
||||
ensureDatabases = ["vaultwarden"];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "vaultwarden";
|
||||
|
||||
@@ -1,118 +1,115 @@
|
||||
{
|
||||
flake.modules.nixos.virtualisation =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in
|
||||
{
|
||||
options.tnix.virtualisation.distrobox = {
|
||||
enable = lib.mkEnableOption "Enable DistroBox";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.distrobox.enable {
|
||||
virtualisation.waydroid.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
distrobox
|
||||
|
||||
(writeShellScriptBin "dbox-create" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 1. Initialize variables
|
||||
IMAGE=""
|
||||
NAME=""
|
||||
|
||||
# Array to hold optional arguments (like volumes)
|
||||
declare -a EXTRA_ARGS
|
||||
|
||||
# 2. Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-i|--image)
|
||||
IMAGE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-n|--name)
|
||||
NAME="$2"
|
||||
shift 2
|
||||
;;
|
||||
-p|--profile)
|
||||
echo ":: Profile mode enabled: Mounting Nix store and user profiles (Read-Only)"
|
||||
# Add volume flags to the array
|
||||
EXTRA_ARGS+=( "--volume" "/nix/store:/nix/store:ro" )
|
||||
EXTRA_ARGS+=( "--volume" "/etc/profiles/per-user:/etc/profiles/per-user:ro" )
|
||||
EXTRA_ARGS+=( "--volume" "/etc/static/profiles/per-user:/etc/static/profiles/per-user:ro" )
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$IMAGE" ] || [ -z "$NAME" ]; then
|
||||
echo "Usage: dbox-create -i <image> -n <name> [-p]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Define the custom home path
|
||||
CUSTOM_HOME="$HOME/Distrobox/$NAME"
|
||||
|
||||
echo "------------------------------------------------"
|
||||
echo "Creating Distrobox: $NAME"
|
||||
echo "Location: $CUSTOM_HOME"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
# 4. Run Distrobox Create
|
||||
# We expand "''${EXTRA_ARGS[@]}" to properly pass the volume arguments
|
||||
${pkgs.distrobox}/bin/distrobox create \
|
||||
--image "$IMAGE" \
|
||||
--name "$NAME" \
|
||||
--home "$CUSTOM_HOME" \
|
||||
"''${EXTRA_ARGS[@]}"
|
||||
|
||||
# Check exit code
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Distrobox creation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 5. Post-Creation: Symlink Config Files
|
||||
echo "--> Linking configurations to $NAME..."
|
||||
|
||||
# Helper function to symlink
|
||||
link_config() {
|
||||
SRC="$1"
|
||||
DEST="$2"
|
||||
DEST_DIR=$(dirname "$DEST")
|
||||
|
||||
# Create parent directory if it doesn't exist
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
if [ -e "$SRC" ]; then
|
||||
# ln -sf: symbolic link, force overwrite
|
||||
ln -sf "$SRC" "$DEST"
|
||||
echo " [LINK] $DEST -> $SRC"
|
||||
else
|
||||
echo " [SKIP] $SRC not found on host"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create Symlinks
|
||||
link_config "$HOME/.zshrc" "$CUSTOM_HOME/.zshrc"
|
||||
link_config "$HOME/.zshenv" "$CUSTOM_HOME/.zshenv"
|
||||
link_config "$HOME/.config/fastfetch" "$CUSTOM_HOME/.config/fastfetch"
|
||||
link_config "$HOME/.config/starship.toml" "$CUSTOM_HOME/.config/starship.toml"
|
||||
|
||||
echo "--> Done! Enter via: distrobox enter $NAME"
|
||||
'')
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.virtualisation = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in {
|
||||
options.tnix.virtualisation.distrobox = {
|
||||
enable = lib.mkEnableOption "Enable DistroBox";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.distrobox.enable {
|
||||
virtualisation.waydroid.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
distrobox
|
||||
|
||||
(writeShellScriptBin "dbox-create" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 1. Initialize variables
|
||||
IMAGE=""
|
||||
NAME=""
|
||||
|
||||
# Array to hold optional arguments (like volumes)
|
||||
declare -a EXTRA_ARGS
|
||||
|
||||
# 2. Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-i|--image)
|
||||
IMAGE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-n|--name)
|
||||
NAME="$2"
|
||||
shift 2
|
||||
;;
|
||||
-p|--profile)
|
||||
echo ":: Profile mode enabled: Mounting Nix store and user profiles (Read-Only)"
|
||||
# Add volume flags to the array
|
||||
EXTRA_ARGS+=( "--volume" "/nix/store:/nix/store:ro" )
|
||||
EXTRA_ARGS+=( "--volume" "/etc/profiles/per-user:/etc/profiles/per-user:ro" )
|
||||
EXTRA_ARGS+=( "--volume" "/etc/static/profiles/per-user:/etc/static/profiles/per-user:ro" )
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$IMAGE" ] || [ -z "$NAME" ]; then
|
||||
echo "Usage: dbox-create -i <image> -n <name> [-p]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Define the custom home path
|
||||
CUSTOM_HOME="$HOME/Distrobox/$NAME"
|
||||
|
||||
echo "------------------------------------------------"
|
||||
echo "Creating Distrobox: $NAME"
|
||||
echo "Location: $CUSTOM_HOME"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
# 4. Run Distrobox Create
|
||||
# We expand "''${EXTRA_ARGS[@]}" to properly pass the volume arguments
|
||||
${pkgs.distrobox}/bin/distrobox create \
|
||||
--image "$IMAGE" \
|
||||
--name "$NAME" \
|
||||
--home "$CUSTOM_HOME" \
|
||||
"''${EXTRA_ARGS[@]}"
|
||||
|
||||
# Check exit code
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Distrobox creation failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 5. Post-Creation: Symlink Config Files
|
||||
echo "--> Linking configurations to $NAME..."
|
||||
|
||||
# Helper function to symlink
|
||||
link_config() {
|
||||
SRC="$1"
|
||||
DEST="$2"
|
||||
DEST_DIR=$(dirname "$DEST")
|
||||
|
||||
# Create parent directory if it doesn't exist
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
if [ -e "$SRC" ]; then
|
||||
# ln -sf: symbolic link, force overwrite
|
||||
ln -sf "$SRC" "$DEST"
|
||||
echo " [LINK] $DEST -> $SRC"
|
||||
else
|
||||
echo " [SKIP] $SRC not found on host"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create Symlinks
|
||||
link_config "$HOME/.zshrc" "$CUSTOM_HOME/.zshrc"
|
||||
link_config "$HOME/.zshenv" "$CUSTOM_HOME/.zshenv"
|
||||
link_config "$HOME/.config/fastfetch" "$CUSTOM_HOME/.config/fastfetch"
|
||||
link_config "$HOME/.config/starship.toml" "$CUSTOM_HOME/.config/starship.toml"
|
||||
|
||||
echo "--> Done! Enter via: distrobox enter $NAME"
|
||||
'')
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,32 +1,29 @@
|
||||
{
|
||||
flake.modules.nixos.virtualisation =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in
|
||||
{
|
||||
options.tnix.virtualisation.docker = {
|
||||
enable = lib.mkEnableOption "Docker container runtime";
|
||||
nvidia = {
|
||||
enable = lib.mkEnableOption "NVIDIA Container Toolkit for Docker";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.docker.enable {
|
||||
virtualisation = {
|
||||
oci-containers.backend = "docker";
|
||||
docker.enable = true;
|
||||
};
|
||||
|
||||
hardware.nvidia-container-toolkit.enable = lib.mkIf cfg.docker.nvidia.enable true;
|
||||
environment.systemPackages = with pkgs; [ lazydocker ];
|
||||
users.users.${userName}.extraGroups = [ "docker" ];
|
||||
flake.modules.nixos.virtualisation = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userName,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in {
|
||||
options.tnix.virtualisation.docker = {
|
||||
enable = lib.mkEnableOption "Docker container runtime";
|
||||
nvidia = {
|
||||
enable = lib.mkEnableOption "NVIDIA Container Toolkit for Docker";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.docker.enable {
|
||||
virtualisation = {
|
||||
oci-containers.backend = "docker";
|
||||
docker.enable = true;
|
||||
};
|
||||
|
||||
hardware.nvidia-container-toolkit.enable = lib.mkIf cfg.docker.nvidia.enable true;
|
||||
environment.systemPackages = with pkgs; [lazydocker];
|
||||
users.users.${userName}.extraGroups = ["docker"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,38 +1,34 @@
|
||||
{
|
||||
flake.modules.nixos.virtualisation =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userName,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in
|
||||
{
|
||||
options.tnix.virtualisation.qemu = {
|
||||
enable = lib.mkEnableOption "QEMU/KVM virtualization with libvirtd";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.qemu.enable {
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
spiceUSBRedirection.enable = true;
|
||||
};
|
||||
|
||||
users.users.${userName}.extraGroups = [ "libvirtd" ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
virt-manager
|
||||
virt-viewer
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.virtualisation = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userName,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in {
|
||||
options.tnix.virtualisation.qemu = {
|
||||
enable = lib.mkEnableOption "QEMU/KVM virtualization with libvirtd";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.qemu.enable {
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu = {
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
spiceUSBRedirection.enable = true;
|
||||
};
|
||||
|
||||
users.users.${userName}.extraGroups = ["libvirtd"];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
virt-manager
|
||||
virt-viewer
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
{
|
||||
flake.modules.nixos.virtualisation =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in
|
||||
{
|
||||
options.tnix.virtualisation.waydroid = {
|
||||
enable = lib.mkEnableOption "Waydroid Android container";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.waydroid.enable {
|
||||
virtualisation.waydroid.enable = true;
|
||||
};
|
||||
flake.modules.nixos.virtualisation = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.tnix.virtualisation;
|
||||
in {
|
||||
options.tnix.virtualisation.waydroid = {
|
||||
enable = lib.mkEnableOption "Waydroid Android container";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.waydroid.enable {
|
||||
virtualisation.waydroid.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user