This commit is contained in:
mjallen18
2025-07-23 09:50:11 -05:00
parent f8e80bd44c
commit 1bc7856d93
14 changed files with 105 additions and 88 deletions

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, namespace, ... }:
let let
shellAliases = { shellAliases = {
update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.3"; update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.3";

View File

@@ -1,41 +1,25 @@
{ config, lib, ... }: { config, lib, namespace, ... }:
let let
cfg = config.mjallen.sops; cfg = config.mjallen.sops;
user = config.${namespace}.user.name;
hostname = config.${namespace}.network.hostname;
in in
{ {
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops = { sops = {
age.keyFile = "/home/admin/.config/sops/age/keys.txt"; age.keyFile = "/home/${user}/.config/sops/age/keys.txt";
defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; defaultSopsFile = "/etc/nixos/secrets/secrets.yaml";
validateSopsFiles = false; validateSopsFiles = false;
secrets = { secrets = {
"ssh-keys-public/jallen-nas" = { "ssh-keys-public/desktop-nixos" = {
path = "/home/admin/.ssh/id_ed25519.pub"; path = "/home/${user}/.ssh/id_ed25519.pub";
mode = "0644"; mode = "0644";
}; };
"ssh-keys-private/jallen-nas" = { "ssh-keys-private/desktop-nixos" = {
path = "/home/admin/.ssh/id_ed25519"; path = "/home/${user}/.ssh/id_ed25519";
mode = "0600";
};
"ssh-keys-public/desktop-nixos" = {
path = "/home/admin/.ssh/authorized_keys";
mode = "0600";
};
"ssh-keys-public/desktop-nixos-root" = {
path = "/home/admin/.ssh/authorized_keys2";
mode = "0600";
};
"ssh-keys-public/desktop-windows" = {
path = "/home/admin/.ssh/authorized_keys3";
mode = "0600";
};
"ssh-keys-public/macbook-macos" = {
path = "/home/admin/.ssh/authorized_keys4";
mode = "0600"; mode = "0600";
}; };
}; };

View File

@@ -0,0 +1,10 @@
{ ... }:
{
boot = {
kernelParams = [
"quiet"
];
};
zramSwap.enable = true;
}

View File

@@ -0,0 +1,6 @@
{ ... }:
{
boot.plymouth = {
enable = true;
};
}

View File

@@ -87,6 +87,13 @@ in
]; ];
mountpoint = "/etc"; mountpoint = "/etc";
}; };
"tmp" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/tmp";
};
"log" = { "log" = {
mountOptions = [ mountOptions = [
"compress=zstd" "compress=zstd"

View File

@@ -0,0 +1,14 @@
{ lib, ... }:
{
services.btrfs = {
autoScrub.enable = lib.mkDefault true;
autoScrub.fileSystems = lib.mkDefault [
"/nix"
"/root"
"/etc"
"/tmp"
"/var/log"
"/home"
];
};
}

View File

@@ -43,6 +43,8 @@ in
# Enable Network Manager # Enable Network Manager
networkmanager = { networkmanager = {
enable = true; enable = true;
wifi.powersave = lib.mkDefault false;
settings.connectivity.uri = lib.mkDefault "http://nmcheck.gnome.org/check_network_status.txt";
ensureProfiles = { ensureProfiles = {
environmentFiles = [ environmentFiles = [
config.sops.secrets.wifi.path config.sops.secrets.wifi.path

View File

@@ -36,6 +36,11 @@ in
default = "matt"; default = "matt";
description = "The name to use for the user account."; description = "The name to use for the user account.";
}; };
passwordFile = lib.mkOption {
type = nullOr path;
default = null;
description = "Path to the password file for this user account";
};
}; };
config = { config = {
@@ -44,6 +49,10 @@ in
extraGroups = [ extraGroups = [
"wheel" "wheel"
"keys"
"networkmanager"
"ratbagd"
"scanner"
"systemd-journal" "systemd-journal"
"mpd" "mpd"
"audio" "audio"
@@ -54,13 +63,15 @@ in
"tss" "tss"
"power" "power"
"nix" "nix"
"i2c"
] ++ cfg.extraGroups; ] ++ cfg.extraGroups;
group = "users"; group = "users";
home = "/home/${cfg.name}"; home = "/home/${cfg.name}";
isNormalUser = true; isNormalUser = true;
shell = lib.mkDefault pkgs.zsh; shell = lib.mkForce pkgs.zsh;
uid = 1000; uid = 1000;
hashedPasswordFile = cfg.passwordFile;
} // cfg.extraOptions; } // cfg.extraOptions;
}; };
} }

View File

@@ -1,7 +1,5 @@
{ config, pkgs, namespace, ... }: { config, pkgs, ... }:
let let
configLimit = 5;
# default = "@saved";
kernel = pkgs.linuxPackages_cachyos; kernel = pkgs.linuxPackages_cachyos;
pkgsVersion = pkgs; #.unstable; pkgsVersion = pkgs; #.unstable;
in in
@@ -36,14 +34,9 @@ in
]; ];
}; };
plymouth = {
enable = true;
};
kernelPackages = kernel; kernelPackages = kernel;
kernelParams = [ kernelParams = [
"quiet"
# needed cause ssd powersaving is broken af I guess # needed cause ssd powersaving is broken af I guess
"nvme_core.default_ps_max_latency_us=0" "nvme_core.default_ps_max_latency_us=0"
"pcie_aspm=off" "pcie_aspm=off"
@@ -53,8 +46,6 @@ in
bootspec.enable = true; bootspec.enable = true;
}; };
zramSwap.enable = true;
environment.systemPackages = with pkgsVersion; [ environment.systemPackages = with pkgsVersion; [
edk2-uefi-shell edk2-uefi-shell
]; ];

View File

@@ -5,7 +5,6 @@
{ {
lib, lib,
pkgs, pkgs,
inputs,
... ...
}: }:
let let

View File

@@ -1,33 +1,35 @@
{ # Snowfall Lib provides a customized `lib` instance with access to your flake's library { # Snowfall Lib provides a customized `lib` instance with access to your flake's library
# as well as the libraries available from your flake's inputs. # as well as the libraries available from your flake's inputs.
lib, # lib,
# An instance of `pkgs` with your overlays and packages applied is also available. # # An instance of `pkgs` with your overlays and packages applied is also available.
pkgs, # pkgs,
# You also have access to your flake's inputs. # # You also have access to your flake's inputs.
inputs, # inputs,
# Additional metadata is provided by Snowfall Lib. # Additional metadata is provided by Snowfall Lib.
namespace, # The namespace used for your flake, defaulting to "internal" if not set. namespace, # The namespace used for your flake, defaulting to "internal" if not set.
system, # The system architecture for this host (eg. `x86_64-linux`). # system, # The system architecture for this host (eg. `x86_64-linux`).
target, # The Snowfall Lib target for this system (eg. `x86_64-iso`). # target, # The Snowfall Lib target for this system (eg. `x86_64-iso`).
format, # A normalized name for the system target (eg. `iso`). # format, # A normalized name for the system target (eg. `iso`).
virtual, # A boolean to determine whether this system is a virtual target using nixos-generators. # virtual, # A boolean to determine whether this system is a virtual target using nixos-generators.
systems, # An attribute map of your defined hosts. # systems, # An attribute map of your defined hosts.
# All other arguments come from the system system. # All other arguments come from the system system.
config, config,
... ...
}: }:
{ let
passwordFile = config.sops.secrets."desktop/matt_password".path;
in
{
imports = [ imports = [
./boot.nix ./boot.nix
./configuration.nix ./configuration.nix
./filesystems.nix ./filesystems.nix
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix # ./networking.nix
./nix.nix ./nix.nix
./sops.nix ./sops.nix
./users.nix
./specialisations/hyprland ./specialisations/hyprland
@@ -36,5 +38,11 @@
${namespace} = { ${namespace} = {
bootloader.lanzaboote.enable = true; bootloader.lanzaboote.enable = true;
desktop.gnome.enable = true; desktop.gnome.enable = true;
network = {
hostName = "matt-nixos";
};
user = {
passwordFile = passwordFile;
};
}; };
} }

View File

@@ -1,6 +1,8 @@
{ config, ... }: { config, lib, ... }:
let let
user = "matt"; user = "matt";
desktopSopsFile = (lib.snowfall.fs.get-file "secrets/desktop-secrets.yaml");
commonSopsFile = (lib.snowfall.fs.get-file "secrets/secrets.yaml");
in in
{ {
# Permission modes are in octal representation (same as chmod), # Permission modes are in octal representation (same as chmod),
@@ -18,7 +20,7 @@ in
# Either the group id or group name representation of the secret group # Either the group id or group name representation of the secret group
# It is recommended to get the group name from `config.users.users.<?name>.group` to avoid misconfiguration # It is recommended to get the group name from `config.users.users.<?name>.group` to avoid misconfiguration
sops = { sops = {
defaultSopsFile = ../../../secrets/desktop-secrets.yaml; defaultSopsFile = desktopSopsFile;
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# ------------------------------ # ------------------------------
@@ -44,34 +46,34 @@ in
mode = "0600"; mode = "0600";
}; };
"wifi" = { "wifi" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
}; };
# ------------------------------ # ------------------------------
# SSH keys # SSH keys
# ------------------------------ # ------------------------------
"ssh-keys-public/desktop-nixos" = { "ssh-keys-public/desktop-nixos" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
mode = "0644"; mode = "0644";
owner = config.users.users."${user}".name; owner = config.users.users."${user}".name;
group = config.users.users."${user}".group; group = config.users.users."${user}".group;
restartUnits = [ "sshd.service" ]; restartUnits = [ "sshd.service" ];
}; };
"ssh-keys-private/desktop-nixos" = { "ssh-keys-private/desktop-nixos" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
mode = "0600"; mode = "0600";
owner = config.users.users."${user}".name; owner = config.users.users."${user}".name;
group = config.users.users."${user}".group; group = config.users.users."${user}".group;
restartUnits = [ "sshd.service" ]; restartUnits = [ "sshd.service" ];
}; };
"ssh-keys-public/desktop-nixos-root" = { "ssh-keys-public/desktop-nixos-root" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/root/.ssh/id_ed25519.pub"; path = "/root/.ssh/id_ed25519.pub";
mode = "0600"; mode = "0600";
restartUnits = [ "sshd.service" ]; restartUnits = [ "sshd.service" ];
}; };
"ssh-keys-private/desktop-nixos-root" = { "ssh-keys-private/desktop-nixos-root" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/root/.ssh/id_ed25519"; path = "/root/.ssh/id_ed25519";
mode = "0600"; mode = "0600";
restartUnits = [ "sshd.service" ]; restartUnits = [ "sshd.service" ];
@@ -81,37 +83,37 @@ in
# Secureboot keys # Secureboot keys
# ------------------------------ # ------------------------------
"secureboot/GUID" = { "secureboot/GUID" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/GUID"; path = "/etc/secureboot/GUID";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/db-key" = { "secureboot/keys/db-key" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/db/db.key"; path = "/etc/secureboot/keys/db/db.key";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/db-pem" = { "secureboot/keys/db-pem" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/db/db.pem"; path = "/etc/secureboot/keys/db/db.pem";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/KEK-key" = { "secureboot/keys/KEK-key" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/KEK/KEK.key"; path = "/etc/secureboot/keys/KEK/KEK.key";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/KEK-pem" = { "secureboot/keys/KEK-pem" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/KEK/KEK.pem"; path = "/etc/secureboot/keys/KEK/KEK.pem";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/PK-key" = { "secureboot/keys/PK-key" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/PK/PK.key"; path = "/etc/secureboot/keys/PK/PK.key";
mode = "0600"; mode = "0600";
}; };
"secureboot/keys/PK-pem" = { "secureboot/keys/PK-pem" = {
sopsFile = ../../../secrets/secrets.yaml; sopsFile = commonSopsFile;
path = "/etc/secureboot/keys/PK/PK.pem"; path = "/etc/secureboot/keys/PK/PK.pem";
mode = "0600"; mode = "0600";
}; };

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, lib, ... }:
let let
theme = import ../../../../../../modules/home/desktop/theme/nord.nix; theme = import (lib.snowfall.fs.get-file "modules/home/desktop/theme/nord.nix");
fontName = "JetBrainsMono NFM"; fontName = "JetBrainsMono NFM";
fontPackage = pkgs.nerd-fonts.jetbrains-mono; fontPackage = pkgs.nerd-fonts.jetbrains-mono;
in in

View File

@@ -1,26 +1,9 @@
{ config, lib, pkgs, ... }: { config, namespace, ... }:
let let
user = "matt";
passwordFile = config.sops.secrets."desktop/matt_password".path; passwordFile = config.sops.secrets."desktop/matt_password".path;
pkgsVersion = pkgs; #.unstable;
in in
{ {
users.users."${user}" = { ${namespace}.user = {
isNormalUser = lib.mkDefault true; passwordFile = passwordFile;
extraGroups = [
"wheel"
"keys"
"networkmanager"
"ratbagd"
"input"
"scanner"
"lp"
"video"
"i2c"
]; # Enable sudo for the user.
hashedPasswordFile = passwordFile;
shell = pkgsVersion.zsh;
}; };
users.users.root.shell = pkgsVersion.zsh;
} }