mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
feat: full bootstrapping
This commit is contained in:
parent
2cdbae7747
commit
67884944a3
16 changed files with 677 additions and 51 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ self, inputs, config, pkgs, lib, modulesPath, ... }:
|
||||
{ self, inputs, config, lib, modulesPath, ... }:
|
||||
let
|
||||
pubKeys = lib.filesystem.listFilesRecursive "${self}/secrets/keys/ssh";
|
||||
in
|
||||
|
|
@ -13,7 +13,7 @@ in
|
|||
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
"${modulesPath}/installer/cd-dvd/channel.nix"
|
||||
|
||||
"${self}/profiles/iso//minimal.nix"
|
||||
"${self}/profiles/iso/minimal.nix"
|
||||
|
||||
];
|
||||
|
||||
|
|
@ -38,18 +38,22 @@ in
|
|||
name = "swarsel";
|
||||
group = "swarsel";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
password = "setup"; # this is overwritten after install
|
||||
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
|
||||
extraGroups = [ "wheel" ];
|
||||
};
|
||||
root = {
|
||||
shell = pkgs.zsh;
|
||||
password = lib.mkForce config.users.users.swarsel.password; # this is overwritten after install
|
||||
# password = lib.mkForce config.users.users.swarsel.password; # this is overwritten after install
|
||||
openssh.authorizedKeys.keys = config.users.users.swarsel.openssh.authorizedKeys.keys;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader.systemd-boot.enable = lib.mkForce true;
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
targets = {
|
||||
|
|
|
|||
87
hosts/nixos/toto/default.nix
Normal file
87
hosts/nixos/toto/default.nix
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
{ self, inputs, outputs, config, pkgs, lib, ... }:
|
||||
let
|
||||
profilesPath = "${self}/profiles";
|
||||
in
|
||||
{
|
||||
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
"${self}/hosts/nixos/toto/disk-config.nix"
|
||||
{
|
||||
_module.args = {
|
||||
withSwap = false;
|
||||
};
|
||||
}
|
||||
./hardware-configuration.nix
|
||||
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
|
||||
"${profilesPath}/optional/nixos/autologin.nix"
|
||||
"${profilesPath}/common/nixos/settings.nix"
|
||||
"${profilesPath}/common/nixos/home-manager.nix"
|
||||
"${profilesPath}/common/nixos/xserver.nix"
|
||||
"${profilesPath}/common/nixos/users.nix"
|
||||
"${profilesPath}/common/nixos/sops.nix"
|
||||
"${profilesPath}/server/nixos/ssh.nix"
|
||||
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.swarsel.imports = [
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
"${profilesPath}/common/home/settings.nix"
|
||||
"${profilesPath}/common/home/sops.nix"
|
||||
"${profilesPath}/common/home/ssh.nix"
|
||||
|
||||
] ++ (builtins.attrValues outputs.homeManagerModules);
|
||||
}
|
||||
] ++ (builtins.attrValues outputs.nixosModules);
|
||||
|
||||
|
||||
nixpkgs = {
|
||||
overlays = [ outputs.overlays.default ];
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
git
|
||||
gnupg
|
||||
rsync
|
||||
ssh-to-age
|
||||
sops
|
||||
vim
|
||||
just
|
||||
];
|
||||
|
||||
system.stateVersion = lib.mkForce "23.05";
|
||||
|
||||
boot = {
|
||||
loader.systemd-boot.enable = lib.mkForce true;
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
supportedFilesystems = [ "btrfs" ];
|
||||
kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
};
|
||||
|
||||
|
||||
networking = {
|
||||
hostName = "toto";
|
||||
firewall.enable = false;
|
||||
};
|
||||
|
||||
swarselsystems = {
|
||||
wallpaper = self + /wallpaper/lenovowp.png;
|
||||
impermanence = false;
|
||||
isBtrfs = false;
|
||||
initialSetup = true;
|
||||
};
|
||||
|
||||
home-manager.users.swarsel.swarselsystems = {
|
||||
isLaptop = false;
|
||||
isNixos = true;
|
||||
isBtrfs = false;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
};
|
||||
|
||||
}
|
||||
87
hosts/nixos/toto/disk-config.nix
Normal file
87
hosts/nixos/toto/disk-config.nix
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# NOTE: ... is needed because dikso passes diskoFile
|
||||
{ lib
|
||||
, pkgs
|
||||
, withSwap ? false
|
||||
, swapSize
|
||||
, ...
|
||||
}:
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
disk0 = {
|
||||
type = "disk";
|
||||
device = "/dev/vda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "cryptroot";
|
||||
passwordFile = "/tmp/disko-password"; # this is populated by bootstrap-nixos.sh
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
# https://github.com/hmajid2301/dotfiles/blob/a0b511c79b11d9b4afe2a5e2b7eedb2af23e288f/systems/x86_64-linux/framework/disks.nix#L36
|
||||
crypttabExtraOpts = [
|
||||
"fido2-device=auto"
|
||||
"token-timeout=10"
|
||||
];
|
||||
};
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# unless their parent is mounted
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ]; # force overwrite
|
||||
subvolumes = {
|
||||
"@root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
# "@persist" = {
|
||||
# mountpoint = "${config.hostSpec.persistFolder}";
|
||||
# mountOptions = [
|
||||
# "compress=zstd"
|
||||
# "noatime"
|
||||
# ];
|
||||
# };
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
"@swap" = lib.mkIf withSwap {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "${swapSize}G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.yubikey-manager # For luks fido2 enrollment before full install
|
||||
];
|
||||
}
|
||||
25
hosts/nixos/toto/hardware-configuration.nix
Normal file
25
hosts/nixos/toto/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# 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.
|
||||
{ lib, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# 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;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue