Merge branch 'main' of github.com:bloxx12/nichts

This commit is contained in:
Charlie Root 2024-09-26 00:35:14 +02:00
commit 90cc4f9ca9
4 changed files with 68 additions and 60 deletions

View file

@ -14,7 +14,6 @@
# Unstable nixpkgs baby! # Unstable nixpkgs baby!
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Lix, a faster nix fork. # Lix, a faster nix fork.
lix-module = { lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz"; url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";

View file

@ -20,6 +20,10 @@
printing.enable = true; printing.enable = true;
}; };
meta = {
users = ["vali"];
# mainUser = "vali";
};
modules = { modules = {
system = { system = {
hardware = { hardware = {
@ -43,6 +47,7 @@
eza.enable = true; eza.enable = true;
firefox.enable = true; firefox.enable = true;
spotify.enable = true; spotify.enable = true;
starship.enable = true;
zellij.enable = true; zellij.enable = true;
terminals = { terminals = {
foot.enable = true; foot.enable = true;

View file

@ -71,7 +71,9 @@ in {
sound = { sound = {
enable = mkEnableOption "sound related programs and audio-dependent programs"; enable = mkEnableOption "sound related programs and audio-dependent programs";
}; };
impermanence = {
enable = mkEnableOption "Enable Impermanence";
};
video = { video = {
enable = mkEnableOption "video drivers and programs that require a graphical user interface"; enable = mkEnableOption "video drivers and programs that require a graphical user interface";
nvidia = mkEnableOption "Nvidia graphics drivers"; nvidia = mkEnableOption "Nvidia graphics drivers";

View file

@ -4,7 +4,7 @@
lib, lib,
... ...
}: let }: let
inherit (lib) mkForce; inherit (lib) mkIf mkForce;
inherit (builtins) map; inherit (builtins) map;
cfg = config.modules.system.impermanence; cfg = config.modules.system.impermanence;
@ -12,69 +12,71 @@ in {
imports = [ imports = [
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
]; ];
users = { config = mkIf cfg.enable {
mutableUsers = false;
users = { users = {
cr = { mutableUsers = false;
hashedPasswordFile = "/persist/passwords/cr"; users = {
cr = {
hashedPasswordFile = "/persist/passwords/cr";
};
root.hashedPasswordFile = "/persist/passwords/root";
}; };
root.hashedPasswordFile = "/persist/passwords/root";
}; };
};
environment.persistence."/persist" = { environment.persistence."/persist" = {
enable = true; enable = true;
hideMounts = true; hideMounts = true;
directories = [ directories = [
"/etc/nixos" "/etc/nixos"
"/etc/nix" "/etc/nix"
"/etc/NetworkManager/system-connections" "/etc/NetworkManager/system-connections"
"/var/db/sudo" "/var/db/sudo"
"/var/log" "/var/log"
"/var/lib/bluetooth" "/var/lib/bluetooth"
"/var/lib/nixos" "/var/lib/nixos"
"/var/lib/pipewire" "/var/lib/pipewire"
"/var/lib/systemd/coredump" "/var/lib/systemd/coredump"
];
files = [
"/etc/machine-id"
];
users.cr = {
directories =
[
"cloud"
"repos"
]
++ map (
dir: ".config/${dir}"
) ["nicotine" "Signal" "Nextcloud" "emacs" "doom"]
++ map (
dir: ".cache/${dir}"
) ["tealdeer" "keepassxc" "nix" "starship" "nix-index" "mozilla" "zsh" "nvim"]
++ map (
dir: ".local/share/${dir}"
) ["direnv" "Steam" "TelegramDesktop" "PrismLauncher" "nicotine" "zoxide" ".ssh" ".keepass"];
};
};
# for some reason *this* is what makes networkmanager not get screwed completely instead of the impermanence module
systemd.tmpfiles.rules = [
"L /var/lib/NetworkManager/secret_key - - - - /persist/var/lib/NetworkManager/secret_key"
"L /var/lib/NetworkManager/seen-bssids - - - - /persist/var/lib/NetworkManager/seen-bssids"
"L /var/lib/NetworkManager/timestamps - - - - /persist/var/lib/NetworkManager/timestamps"
]; ];
files = [ services.openssh.hostKeys = mkForce [
"/etc/machine-id" {
bits = 4096;
path = "/persist/etc/ssh/ssh_host_rsa_key";
type = "rsa";
}
{
bits = 4096;
path = "/persist/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
]; ];
users.cr = {
directories =
[
"cloud"
"repos"
]
++ map (
dir: ".config/${dir}"
) ["nicotine" "Signal" "Nextcloud" "emacs" "doom"]
++ map (
dir: ".cache/${dir}"
) ["tealdeer" "keepassxc" "nix" "starship" "nix-index" "mozilla" "zsh" "nvim"]
++ map (
dir: ".local/share/${dir}"
) ["direnv" "Steam" "TelegramDesktop" "PrismLauncher" "nicotine" "zoxide" ".ssh" ".keepass"];
};
}; };
# for some reason *this* is what makes networkmanager not get screwed completely instead of the impermanence module
systemd.tmpfiles.rules = [
"L /var/lib/NetworkManager/secret_key - - - - /persist/var/lib/NetworkManager/secret_key"
"L /var/lib/NetworkManager/seen-bssids - - - - /persist/var/lib/NetworkManager/seen-bssids"
"L /var/lib/NetworkManager/timestamps - - - - /persist/var/lib/NetworkManager/timestamps"
];
services.openssh.hostKeys = mkForce [
{
bits = 4096;
path = "/persist/etc/ssh/ssh_host_rsa_key";
type = "rsa";
}
{
bits = 4096;
path = "/persist/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
];
} }