Move some (all) files around
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
11
hosts/common/system/configs/bluetooth/default.nix
Normal file
11
hosts/common/system/configs/bluetooth/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
settings = {
|
||||
General.Experimental = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = [ "/var/lib/bluetooth" ];
|
||||
}
|
21
hosts/common/system/configs/boot/default.nix
Normal file
21
hosts/common/system/configs/boot/default.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
editor = false;
|
||||
};
|
||||
|
||||
timeout = 1;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
initrd.systemd.enable = true;
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
supportedFilesystems = [
|
||||
"btrfs"
|
||||
"ntfs"
|
||||
];
|
||||
};
|
||||
}
|
32
hosts/common/system/configs/brightnessctl/default.nix
Normal file
32
hosts/common/system/configs/brightnessctl/default.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ brightnessctl ];
|
||||
|
||||
services.udev.extraRules =
|
||||
let
|
||||
chgrp = "${pkgs.coreutils}/bin/chgrp";
|
||||
chmod = "${pkgs.coreutils}/bin/chmod";
|
||||
in
|
||||
''
|
||||
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${chgrp} video /sys/class/backlight/%k/brightness"
|
||||
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${chmod} g+w /sys/class/backlight/%k/brightness"
|
||||
ACTION=="add", SUBSYSTEM=="leds", RUN+="${chgrp} input /sys/class/leds/%k/brightness"
|
||||
ACTION=="add", SUBSYSTEM=="leds", RUN+="${chmod} g+w /sys/class/leds/%k/brightness"
|
||||
'';
|
||||
|
||||
users.groups =
|
||||
let
|
||||
members = builtins.attrNames (
|
||||
lib.attrsets.filterAttrs (_: config: config.isNormalUser) config.users.users
|
||||
);
|
||||
in
|
||||
{
|
||||
video.members = members;
|
||||
input.members = members;
|
||||
};
|
||||
}
|
4
hosts/common/system/configs/btop/default.nix
Normal file
4
hosts/common/system/configs/btop/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ btop ];
|
||||
}
|
4
hosts/common/system/configs/fastfetch/default.nix
Normal file
4
hosts/common/system/configs/fastfetch/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ fastfetch ];
|
||||
}
|
9
hosts/common/system/configs/getty/default.nix
Normal file
9
hosts/common/system/configs/getty/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
services.getty.extraArgs = lib.mkIf (config.services.getty.autologinUser != null) [
|
||||
"--skip-login"
|
||||
"--noissue"
|
||||
"--nohints"
|
||||
"--nohostname"
|
||||
];
|
||||
}
|
6
hosts/common/system/configs/git/default.nix
Normal file
6
hosts/common/system/configs/git/default.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
};
|
||||
}
|
1
hosts/common/system/configs/gpg-agent/default.nix
Normal file
1
hosts/common/system/configs/gpg-agent/default.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ programs.gnupg.agent.enable = true; }
|
8
hosts/common/system/configs/neovim/default.nix
Normal file
8
hosts/common/system/configs/neovim/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
}
|
5
hosts/common/system/configs/networking/default.nix
Normal file
5
hosts/common/system/configs/networking/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
environment.persistence."/persist".directories = [ "/etc/NetworkManager/system-connections" ];
|
||||
}
|
6
hosts/common/system/configs/nix-ld/default.nix
Normal file
6
hosts/common/system/configs/nix-ld/default.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = [ ];
|
||||
};
|
||||
}
|
18
hosts/common/system/configs/nix/default.nix
Normal file
18
hosts/common/system/configs/nix/default.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
nix = {
|
||||
settings = {
|
||||
use-xdg-base-directories = true;
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
|
||||
registry.self.flake = inputs.self;
|
||||
gc.automatic = true;
|
||||
optimise.automatic = true;
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
}
|
43
hosts/common/system/configs/persist/default.nix
Normal file
43
hosts/common/system/configs/persist/default.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
||||
|
||||
boot.initrd.systemd =
|
||||
let
|
||||
bins = with pkgs; [
|
||||
coreutils
|
||||
util-linux
|
||||
findutils
|
||||
btrfs-progs
|
||||
];
|
||||
in
|
||||
{
|
||||
initrdBin = bins;
|
||||
|
||||
services.impermanence = {
|
||||
description = "Rollback BTRFS subvolumes to a pristine state";
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
after = [ "cryptsetup.target" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
|
||||
path = bins;
|
||||
script = builtins.readFile ./impermanence.sh;
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/etc/nixos"
|
||||
"/var/lib/nixos"
|
||||
"/var/lib/systemd/coredump"
|
||||
"/var/log"
|
||||
];
|
||||
files = [ "/etc/machine-id" ];
|
||||
};
|
||||
}
|
25
hosts/common/system/configs/persist/impermanence.sh
Normal file
25
hosts/common/system/configs/persist/impermanence.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/mnt/btrfs/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
mkdir -p /mnt/btrfs
|
||||
mount /dev/mapper/luks /mnt/btrfs
|
||||
|
||||
if [[ -e /mnt/btrfs/@ ]]; then
|
||||
mkdir -p /mnt/btrfs/@.bak
|
||||
timestamp=$(date --date="@$(stat -c %Y /mnt/btrfs/@)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /mnt/btrfs/@ "/mnt/btrfs/@.bak/$timestamp"
|
||||
fi
|
||||
|
||||
find /mnt/btrfs/@.bak/ -maxdepth 1 -mtime +14 | while IFS= read -r i; do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /mnt/btrfs/@
|
||||
|
||||
umount /mnt/btrfs
|
||||
rmdir /mnt/btrfs
|
19
hosts/common/system/configs/pipewire/default.nix
Normal file
19
hosts/common/system/configs/pipewire/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
extraConfig.pipewire-pulse = {
|
||||
pulse.cmd = [
|
||||
{
|
||||
cmd = "load-module";
|
||||
args = "module-switch-on-connect";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
27
hosts/common/system/configs/plymouth/default.nix
Normal file
27
hosts/common/system/configs/plymouth/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
plymouth =
|
||||
let
|
||||
theme = "connect";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
inherit theme;
|
||||
themePackages = with pkgs; [ (adi1090x-plymouth-themes.override { selected_themes = [ theme ]; }) ];
|
||||
};
|
||||
|
||||
initrd.verbose = false;
|
||||
consoleLogLevel = 0;
|
||||
|
||||
kernelParams = [
|
||||
"quiet"
|
||||
"loglevel=3"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"rd.systemd.show_status=false"
|
||||
"rd.udev.log_level=3"
|
||||
"udev.log_priority=3"
|
||||
];
|
||||
};
|
||||
}
|
4
hosts/common/system/configs/ranger/default.nix
Normal file
4
hosts/common/system/configs/ranger/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ ranger ];
|
||||
}
|
15
hosts/common/system/configs/sops/default.nix
Normal file
15
hosts/common/system/configs/sops/default.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||
|
||||
environment = {
|
||||
persistence."/persist".files = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
systemPackages = with pkgs; [ sops ];
|
||||
};
|
||||
|
||||
sops.age = {
|
||||
generateKey = true;
|
||||
sshKeyPaths = [ "/persist/etc/ssh/ssh_host_ed25519_key" ];
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
};
|
||||
}
|
7
hosts/common/system/configs/ssh/default.nix
Normal file
7
hosts/common/system/configs/ssh/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
programs.ssh = {
|
||||
knownHosts = {
|
||||
eirene.publicKeyFile = ../../../../eirene/secrets/ssh_host_ed25519_key.pub;
|
||||
};
|
||||
};
|
||||
}
|
17
hosts/common/system/configs/system/default.nix
Normal file
17
hosts/common/system/configs/system/default.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
system = {
|
||||
autoUpgrade = {
|
||||
enable = true;
|
||||
flake = inputs.self.outPath;
|
||||
flags = [
|
||||
"--update-input"
|
||||
"nixpkgs"
|
||||
"-L"
|
||||
];
|
||||
dates = "02:00";
|
||||
};
|
||||
|
||||
stateVersion = "24.05";
|
||||
};
|
||||
}
|
9
hosts/common/system/configs/tmux/default.nix
Normal file
9
hosts/common/system/configs/tmux/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
clock24 = true;
|
||||
historyLimit = 10000;
|
||||
keyMode = "vi";
|
||||
newSession = true;
|
||||
};
|
||||
}
|
4
hosts/common/system/configs/tree/default.nix
Normal file
4
hosts/common/system/configs/tree/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ tree ];
|
||||
}
|
11
hosts/common/system/configs/users/default.nix
Normal file
11
hosts/common/system/configs/users/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
defaultUserShell = pkgs.zsh;
|
||||
};
|
||||
|
||||
security.sudo.extraConfig = ''
|
||||
Defaults lecture = never
|
||||
'';
|
||||
}
|
11
hosts/common/system/configs/zsh/default.nix
Normal file
11
hosts/common/system/configs/zsh/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
histFile = "/var/lib/zsh/history";
|
||||
};
|
||||
|
||||
environment = {
|
||||
persistence."/persist".directories = [ "/var/lib/zsh" ];
|
||||
pathsToLink = [ "/share/zsh" ];
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user