Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup t420 #351

Merged
merged 8 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

flake-parts.url = "github:hercules-ci/flake-parts";

disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs@{ ... }:
Expand Down
2 changes: 1 addition & 1 deletion home-manager/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
./modules/1password/darwin.nix
./modules/zsh/darwin-aarch64.nix
];
linux.imports = [
x86_64-linux.imports = [
./modules/1password/linux.nix
./modules/zsh/linux.nix
];
Expand Down
7 changes: 3 additions & 4 deletions home-manager/modules/1password/linux.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{ ... }:
{ config, ... }:

{
imports = [ ./common.nix ];

# TODO: configure this properly for Linux
_1password = {
sockPath = "";
sshProgram = "";
sockPath = "${config.home.homeDirectory}/.1password/agent.sock";
sshProgram = "/run/current-system/sw/bin/op-ssh-sign";
};
}
31 changes: 31 additions & 0 deletions home-manager/modules/alacritty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@
programs.alacritty = {
enable = false;
settings = {
# Nord theme taken from: https://github.com/alacritty/alacritty-theme/blob/95a7d695605863ede5b7430eb80d9e80f5f504bc/themes/nord.toml
colors = {
primary = {
background = "#2E3440";
foreground = "#D8DEE9";
};
normal = {
black = "#3B4252";
red = "#BF616A";
green = "#A3BE8C";
yellow = "#EBCB8B";
blue = "#81A1C1";
magenta = "#B48EAD";
cyan = "#88C0D0";
white = "#E5E9F0";
};
bright = {
black = "#4C566A";
red = "#BF616A";
green = "#A3BE8C";
yellow = "#EBCB8B";
blue = "#81A1C1";
magenta = "#B48EAD";
cyan = "#8FBCBB";
white = "#ECEFF4";
};
};
font.normal = {
family = "FiraCode Nerd Font";
style = "Regular";
};
window = {
dynamic_title = false;
option_as_alt = "Both";
Expand Down
1 change: 1 addition & 0 deletions home-manager/modules/zellij.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
enableZshIntegration = true;
settings = {
default_layout = "compact";
default_mode = "locked";
on_force_close = "quit";
theme = "nord";
ui.pane_frames.rounded_corners = true;
Expand Down
29 changes: 29 additions & 0 deletions hosts/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,41 @@
home-manager.users.francis = {
imports = [
self.homeModules.common
# TODO: rename to aarch64-darwin
self.homeModules.darwin-aarch64
];
};
}
];
};
};
nixosConfigurations = {
"t420" = inputs.nixpkgs.lib.nixosSystem {
modules = [
./t420
self.nixosModules.common
inputs.home-manager.nixosModules.home-manager
inputs.disko.nixosModules.default
{
nixpkgs.hostPlatform = "x86_64-linux";

networking.hostName = "t420";

# These 2 lines are needed to ensure we reuse the nixpkgs config
# so that we allow unfree packages
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;

# TODO: parameterize this
home-manager.users.francis = {
imports = [
self.homeModules.common
self.homeModules.x86_64-linux
];
};
}
];
};
};
};
}
43 changes: 43 additions & 0 deletions hosts/t420/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ pkgs, ... }:

{
imports = [
./hardware-configuration.nix
./disk-config.nix
];

boot.loader.systemd-boot.enable = true;

networking.networkmanager.enable = true;

services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};

services.pipewire = {
enable = true;
pulse.enable = true;
};

users.defaultUserShell = pkgs.zsh;

users.users.francis = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
initialPassword = "qwerty12345";
};

programs.firefox.enable = true;

programs.zsh.enable = true;

programs._1password.enable = true;
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "francis" ];
};

system.stateVersion = "24.11";
}
64 changes: 64 additions & 0 deletions hosts/t420/disk-config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [
"defaults"
];
};
};
home = {
size = "10G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
};
};
};
};
};
};
}
27 changes: 27 additions & 0 deletions hosts/t420/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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, modulesPath, ... }:

{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];

boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "sd_mod" "sr_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
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.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;
}
3 changes: 0 additions & 3 deletions modules/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

gc = {
automatic = true;
interval = {
Weekday = 0;
};
options = "--delete-older-than 30d";
};

Expand Down
Loading