updated host switching

This commit is contained in:
Bit Borealis 2023-03-29 06:23:15 +00:00
parent 37407ec69a
commit 9ecc8a3f6e
6 changed files with 76 additions and 25 deletions

View File

@ -1,18 +1,23 @@
# welcome to saturnOS config, run nixos-help if you need it .
{ config, pkgs, lib, ... }:
let
unstableTarball = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
unstable = import unstableTarball { config = { allowUnfree = true; }; };
unstableTarball = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
homeManagerTarball = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz";
home-manager = import "${homeManagerTarball}/nixos";
homeManager = import "${homeManagerTarball}/nixos";
deviceConf = import "/home/${sysConf.user}/.saturn/hosts/${sysConf.host}/";
unstable = import unstableTarball config.nixpkgs.config;
sysConf = import ./saturn/system.nix;
in {
imports = [
home-manager
./hosts/vulkan
homeManager
deviceConf
./modules
./saturn/system.nix
];
# import system.nix configuration
saturn.hostname = sysConf.host;
saturn.prettyHostname = sysConf.prettyHost;
# nix options
nix.settings = {
experimental-features = "nix-command flakes";
@ -26,7 +31,6 @@ in {
options = "--delete-older-than 30d";
};
# bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
@ -35,20 +39,7 @@ in {
boot.plymouth.enable = true;
boot.kernelParams = ["quiet"];
# init keyfile
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
# enable swap on luks
boot.initrd.luks.devices."luks-4130c26c-7546-42e9-9d61-8f112e244460".device =
"/dev/disk/by-uuid/4130c26c-7546-42e9-9d61-8f112e244460";
boot.initrd.luks.devices."luks-4130c26c-7546-42e9-9d61-8f112e244460".keyFile =
"/crypto_keyfile.bin";
# configure networking
networking.hostName = "vulkan";
environment.machineInfo.prettyHostname = "🌋 vulkan";
networking.networkmanager.enable = true;
networking.hosts = {
"162.255.119.254" = ["www.librepunk.club"];

7
hosts/terra/default.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./hardware-configuration.nix
./luks.nix
];
}

View File

@ -0,0 +1,42 @@
# 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, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/39ab92ec-67bb-49ef-b458-90d43b63d1c6";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-8dd98ede-339f-470d-97f9-92dd2d6687f7".device = "/dev/disk/by-uuid/8dd98ede-339f-470d-97f9-92dd2d6687f7";
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/50A2-D8BD";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/825ae105-4f03-44a0-81c6-0da642d0c77d"; }
];
# 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.enp0s25.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

10
hosts/terra/luks.nix Normal file
View File

@ -0,0 +1,10 @@
{ ... }:
{
# Setup keyfile
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
# Enable swap on luks
boot.initrd.luks.devices."luks-55171762-776c-4297-a762-1a570618a78a".device = "/dev/disk/by-uuid/55171762-776c-4297-a762-1a570618a78a";
boot.initrd.luks.devices."luks-55171762-776c-4297-a762-1a570618a78a".keyFile = "/crypto_keyfile.bin";
}

View File

@ -1,4 +1,4 @@
{ lib, ... }: with lib;
{ config, lib, ... }: with lib;
{
options.saturn = {
user = mkOption {
@ -20,4 +20,6 @@
device sharing, and is fully unicode.";
};
};
config.networking.hostName = config.saturn.hostname;
config.environment.machineInfo.prettyHostname = config.saturn.prettyHostname;
}

View File

@ -1,8 +1,7 @@
{ config, ... }:
{
saturn.user = "hive";
saturn.hostname = "vulkan";
saturn.prettyHostname = "🌋 vulkan";
user = "hive";
host = "terra";
prettyHost = "🌍 terra";
# packages = {
# }
# userPackages = {