new system config i001
This commit is contained in:
parent
a211913169
commit
ae6a2d9cd5
10 changed files with 1454 additions and 0 deletions
138
hosts/i001/flake.nix
Normal file
138
hosts/i001/flake.nix
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||||
|
home-manager.url = "github:rycee/home-manager/release-25.11";
|
||||||
|
|
||||||
|
common.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/common";
|
||||||
|
# de_plasma.url = "path:../../../../flakes/de_plasma";
|
||||||
|
de_plasma.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles?dir=flakes/de_plasma";
|
||||||
|
ros_neovim.url = "git+https://git.joshuabell.xyz/ringofstorms/nvim";
|
||||||
|
|
||||||
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}@inputs:
|
||||||
|
let
|
||||||
|
configurationName = "i001";
|
||||||
|
system = "x86_64-linux";
|
||||||
|
primaryUser = "luser";
|
||||||
|
configLocation = "/home/${primaryUser}/.config/nixos-config/hosts/${configurationName}";
|
||||||
|
lib = inputs.nixpkgs.lib;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nixosConfigurations = {
|
||||||
|
"${configurationName}" = (
|
||||||
|
lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
|
modules = [
|
||||||
|
inputs.impermanence.nixosModules.impermanence
|
||||||
|
inputs.home-manager.nixosModules.default
|
||||||
|
|
||||||
|
inputs.ros_neovim.nixosModules.default
|
||||||
|
({
|
||||||
|
ringofstorms-nvim.includeAllRuntimeDependencies = true;
|
||||||
|
})
|
||||||
|
|
||||||
|
inputs.de_plasma.nixosModules.default
|
||||||
|
({
|
||||||
|
ringofstorms.dePlasma = {
|
||||||
|
enable = true;
|
||||||
|
gpu.intel.enable = true;
|
||||||
|
sddm.autologinUser = "luser";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
inputs.common.nixosModules.essentials
|
||||||
|
inputs.common.nixosModules.git
|
||||||
|
inputs.common.nixosModules.tmux
|
||||||
|
inputs.common.nixosModules.boot_systemd
|
||||||
|
inputs.common.nixosModules.hardening
|
||||||
|
inputs.common.nixosModules.jetbrains_font
|
||||||
|
inputs.common.nixosModules.nix_options
|
||||||
|
inputs.common.nixosModules.no_sleep
|
||||||
|
inputs.common.nixosModules.timezone_auto
|
||||||
|
inputs.common.nixosModules.tty_caps_esc
|
||||||
|
inputs.common.nixosModules.zsh
|
||||||
|
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./impermanence.nix
|
||||||
|
./test.nix
|
||||||
|
(
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
upkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
rec {
|
||||||
|
system.stateVersion = "25.05";
|
||||||
|
# TODO allowing password auth for now
|
||||||
|
services.openssh.settings.PasswordAuthentication = lib.mkForce true;
|
||||||
|
|
||||||
|
# Home Manager
|
||||||
|
home-manager = {
|
||||||
|
useUserPackages = true;
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
backupFileExtension = "bak";
|
||||||
|
# add all normal users to home manager so it applies to them
|
||||||
|
users = lib.mapAttrs (name: user: {
|
||||||
|
home.stateVersion = "25.05";
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}) (lib.filterAttrs (name: user: user.isNormalUser or false) users.users);
|
||||||
|
|
||||||
|
sharedModules = [
|
||||||
|
inputs.common.homeManagerModules.tmux
|
||||||
|
inputs.common.homeManagerModules.atuin
|
||||||
|
inputs.common.homeManagerModules.direnv
|
||||||
|
inputs.common.homeManagerModules.git
|
||||||
|
inputs.common.homeManagerModules.postgres_cli_options
|
||||||
|
inputs.common.homeManagerModules.starship
|
||||||
|
inputs.common.homeManagerModules.zoxide
|
||||||
|
inputs.common.homeManagerModules.zsh
|
||||||
|
];
|
||||||
|
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
inherit upkgs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# System configuration
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
networking.hostName = configurationName;
|
||||||
|
programs.nh.flake = configLocation;
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
users.mutableUsers = false;
|
||||||
|
users.users = {
|
||||||
|
"${primaryUser}" = {
|
||||||
|
isNormalUser = true;
|
||||||
|
hashedPassword = "$y$j9T$v1QhXiZMRY1pFkPmkLkdp0$451GvQt.XFU2qCAi4EQNd1BEqjM/CH6awU8gjcULps6"; # "test" password
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"networkmanager"
|
||||||
|
];
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Specifics for this machine
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
qdirstat
|
||||||
|
google-chrome
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
1149
utilities/nixos-installers/examples/test/flake.lock
generated
Normal file
1149
utilities/nixos-installers/examples/test/flake.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,120 @@
|
||||||
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
|
# and may be overwritten by future invocations. Please make changes
|
||||||
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
let
|
||||||
|
NIXBOOT = "/dev/disk/by-uuid/641A-6BDB";
|
||||||
|
NIXROOT ="/dev/disk/by-uuid/ae94db42-ec46-4e2f-a98a-118359428a68";
|
||||||
|
cryptroot = "/dev/disk/by-uuid/49f11bf1-d4b7-4188-9203-4d7a42569afa";
|
||||||
|
|
||||||
|
USB_KEY = "/dev/disk/by-uuid/9985-EBD1";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" "ehci_pci" "uas" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/boot" =
|
||||||
|
{ device = NIXBOOT;
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0077" "dmask=0077" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.luks.devices."cryptroot" = {
|
||||||
|
device = NIXROOT;
|
||||||
|
|
||||||
|
# Auto decrypt
|
||||||
|
keyFile = USB_KEY;
|
||||||
|
keyFileSize = 5000;
|
||||||
|
keyFileOffset = 5443;
|
||||||
|
|
||||||
|
tryEmptyPassphrase = true;
|
||||||
|
fallbackToPassword = true;
|
||||||
|
crypttabExtraOpts = [ "tries=2" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/" =
|
||||||
|
{ device = cryptroot;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@root" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" =
|
||||||
|
{ device = cryptroot;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@nix" "compress=zstd" "noatime" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/persist" =
|
||||||
|
{ device = cryptroot;
|
||||||
|
neededForBoot = true;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@persist" "compress=zstd" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/.swap" =
|
||||||
|
{ device = cryptroot;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@swap" "noatime" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/.snapshots" =
|
||||||
|
{ device = cryptroot;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = [ "subvol=@snapshots" "compress=zstd" "noatime"];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.btrfs.autoScrub = {
|
||||||
|
enable = true;
|
||||||
|
# syntax as defined by https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Event s
|
||||||
|
interval = "monthly";
|
||||||
|
fileSystems = ["/"];
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [{
|
||||||
|
device = "/.swap/swapfile";
|
||||||
|
size = 8*1024; # Creates an 8GB swap file
|
||||||
|
}];
|
||||||
|
|
||||||
|
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||||
|
mkdir /btrfs_tmp
|
||||||
|
mount ${cryptroot} /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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
btrfs subvolume create /btrfs_tmp/@root
|
||||||
|
umount /btrfs_tmp
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
||||||
42
utilities/nixos-installers/examples/test/impermanence.nix
Normal file
42
utilities/nixos-installers/examples/test/impermanence.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
environment.persistence."/persist" = {
|
||||||
|
enable = true;
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
"/var/log"
|
||||||
|
"/var/lib/nixos"
|
||||||
|
"/var/lib/systemd/coredump"
|
||||||
|
"/var/lib/systemd/timers"
|
||||||
|
|
||||||
|
"/etc/nixos"
|
||||||
|
"/etc/ssh"
|
||||||
|
|
||||||
|
"/etc/NetworkManager/system-connections"
|
||||||
|
"/var/lib/bluetooth"
|
||||||
|
"/var/lib/fail2ban"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
"/etc/machine-id"
|
||||||
|
];
|
||||||
|
users.luser = {
|
||||||
|
directories = [
|
||||||
|
"projects"
|
||||||
|
".config/nixos-config"
|
||||||
|
|
||||||
|
".config/atuin"
|
||||||
|
".local/share/atuin"
|
||||||
|
|
||||||
|
".local/share/zoxide"
|
||||||
|
|
||||||
|
# KDE connect specific
|
||||||
|
".config/kdeconnect"
|
||||||
|
|
||||||
|
".local/state/nvim_ringofstorms_helium"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
5
utilities/nixos-installers/examples/test/test.nix
Normal file
5
utilities/nixos-installers/examples/test/test.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
powerMangement.enable = true;
|
||||||
|
# powerManagement.powertop.enable = true;
|
||||||
|
powerMangement.cpuFreqGovernor = "performance";
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue