refactor: organizing some imports
This commit is contained in:
parent
c4f7a64329
commit
db319ed5af
8 changed files with 184 additions and 95 deletions
|
|
@ -1,9 +1,21 @@
|
|||
{...}: {
|
||||
services.blueman.enable = true;
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
bluetooth.enable = lib.mkEnableOption "Enables Bluetooth";
|
||||
};
|
||||
|
||||
services.upower = {enable = true;};
|
||||
config = lib.mkIf config.bluetooth.enable {
|
||||
services.blueman.enable = true;
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
|
||||
services.upower = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
13
common/nixos/default.nix
Normal file
13
common/nixos/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{lib, ...}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
./laptop.nix
|
||||
./nfs.nix
|
||||
./restic.nix
|
||||
./ssh/default.nix
|
||||
];
|
||||
|
||||
laptop.enable = lib.mkDefault false;
|
||||
nfs.enable = lib.mkDefault false;
|
||||
restic.enable = lib.mkDefault true;
|
||||
}
|
||||
|
|
@ -1,8 +1,20 @@
|
|||
{...}: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [./bluetooth.nix];
|
||||
# enable's backlight switching
|
||||
programs.light.enable = true;
|
||||
options = {
|
||||
laptop.enable = lib.mkEnableOption "Enables Laptop options";
|
||||
};
|
||||
|
||||
# use TLP for power management
|
||||
services.tlp.enable = true;
|
||||
config = lib.mkIf config.laptop.enable {
|
||||
# enable's backlight switching
|
||||
programs.light.enable = true;
|
||||
|
||||
# use TLP for power management
|
||||
services.tlp.enable = true;
|
||||
|
||||
bluetooth.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,68 @@
|
|||
{...}: {
|
||||
fileSystems = {
|
||||
"/media" = {
|
||||
device = "192.168.10.2:/mnt/tank/media";
|
||||
fsType = "nfs";
|
||||
options = ["x-systemd.automount" "noauto" "x-systemd.after=network-online.target" "x-systemd.mount-timeout=90"];
|
||||
};
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
nfs.enable = lib.mkEnableOption "Enables NFS and sets up mounts";
|
||||
};
|
||||
|
||||
"/books" = {
|
||||
device = "192.168.10.2:/mnt/tank/books";
|
||||
fsType = "nfs";
|
||||
options = ["x-systemd.automount" "noauto" "x-systemd.after=network-online.target" "x-systemd.mount-timeout=90"];
|
||||
};
|
||||
config = lib.mkIf config.nfs.enable {
|
||||
fileSystems = {
|
||||
"/media" = {
|
||||
device = "192.168.10.2:/mnt/tank/media";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"x-systemd.after=network-online.target"
|
||||
"x-systemd.mount-timeout=90"
|
||||
];
|
||||
};
|
||||
|
||||
"/music" = {
|
||||
device = "192.168.10.2:/mnt/tank/music";
|
||||
fsType = "nfs";
|
||||
options = ["x-systemd.automount" "noauto" "x-systemd.after=network-online.target" "x-systemd.mount-timeout=90"];
|
||||
};
|
||||
"/books" = {
|
||||
device = "192.168.10.2:/mnt/tank/books";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"x-systemd.after=network-online.target"
|
||||
"x-systemd.mount-timeout=90"
|
||||
];
|
||||
};
|
||||
|
||||
"/projects" = {
|
||||
device = "192.168.10.2:/mnt/tank/projects";
|
||||
fsType = "nfs";
|
||||
options = ["x-systemd.automount" "noauto" "x-systemd.after=network-online.target" "x-systemd.mount-timeout=90"];
|
||||
};
|
||||
"/music" = {
|
||||
device = "192.168.10.2:/mnt/tank/music";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"x-systemd.after=network-online.target"
|
||||
"x-systemd.mount-timeout=90"
|
||||
];
|
||||
};
|
||||
|
||||
"/backups" = {
|
||||
device = "192.168.10.2:/mnt/tank/backups";
|
||||
fsType = "nfs";
|
||||
options = ["x-systemd.automount" "noauto" "x-systemd.after=network-online.target" "x-systemd.mount-timeout=90"];
|
||||
"/projects" = {
|
||||
device = "192.168.10.2:/mnt/tank/projects";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"x-systemd.after=network-online.target"
|
||||
"x-systemd.mount-timeout=90"
|
||||
];
|
||||
};
|
||||
|
||||
"/backups" = {
|
||||
device = "192.168.10.2:/mnt/tank/backups";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"x-systemd.after=network-online.target"
|
||||
"x-systemd.mount-timeout=90"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,33 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
user,
|
||||
...
|
||||
}: {
|
||||
sops.secrets.restic_key = {
|
||||
owner = config.users.users.${user}.name;
|
||||
options = {
|
||||
restic.enable = lib.mkEnableOption "Enables Restic";
|
||||
};
|
||||
|
||||
services.restic.backups = {
|
||||
backups = {
|
||||
user = "${user}";
|
||||
repository = "/backups";
|
||||
initialize = true;
|
||||
passwordFile = "${config.sops.secrets.restic_key.path}";
|
||||
paths = ["/home/${user}/repos" "/home/${user}/Documents" "/home/${user}/.local/share/password-store" "/home/${user}/.local/share/buku"];
|
||||
timerConfig = {
|
||||
onCalendar = "saturday 23:00";
|
||||
config = lib.mkIf config.nfs.enable {
|
||||
sops.secrets.restic_key = {
|
||||
owner = config.users.users.${user}.name;
|
||||
};
|
||||
|
||||
services.restic.backups = {
|
||||
backups = {
|
||||
user = "${user}";
|
||||
repository = "/backups";
|
||||
initialize = true;
|
||||
passwordFile = "${config.sops.secrets.restic_key.path}";
|
||||
paths = [
|
||||
"/home/${user}/repos"
|
||||
"/home/${user}/Documents"
|
||||
"/home/${user}/.local/share/password-store"
|
||||
"/home/${user}/.local/share/buku"
|
||||
];
|
||||
timerConfig = {
|
||||
onCalendar = "saturday 23:00";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue