Skip to content

Commit

Permalink
Working boot on x220
Browse files Browse the repository at this point in the history
  • Loading branch information
pniedzwiedzinski committed Oct 5, 2024
1 parent 9143224 commit 39ebafe
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 60 deletions.
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
in {
nixosConfigurations = {
x220-gnome = nixosSystem "x86_64-linux" "x220-gnome" [
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x220
inputs.home-manager.nixosModules.default
inputs.disko.nixosModules.disko
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
Expand Down
72 changes: 72 additions & 0 deletions machines/x220-gnome/disko.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
device ? throw "Set this to your disk device, e.g. /dev/sda",
...
}: {
disko.devices = {
disk.main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "500M";
type = "EF02";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};

};
swap = {
size = "13G";
content = {
type = "swap";
resumeDevice = true;
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "root_vg";
};
};
};
};
};
lvm_vg = {
root_vg = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];

subvolumes = {
"/root" = {
mountpoint = "/";
};

"/persist" = {
mountOptions = ["subvol=persist" "noatime"];
mountpoint = "/persist";
};

"/nix" = {
mountOptions = ["subvol=nix" "noatime"];
mountpoint = "/nix";
};
};
};
};
};
};
};
};
}
22 changes: 1 addition & 21 deletions machines/x220-gnome/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,17 @@
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
(import ./disko.nix { device = "/dev/sda"; })
];

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

boot.initrd.luks.devices."luks-9f3a316a-7177-4122-a4f5-03fbd375d6e1".device = "/dev/disk/by-uuid/9f3a316a-7177-4122-a4f5-03fbd375d6e1";
networking.hostName = "nixos"; # Define your hostname.


boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/01db2679-e134-4870-b503-a0e616432175";
fsType = "ext4";
};

boot.initrd.luks.devices."luks-8a50e0b7-d2a7-4b0c-b092-9194536cae41".device = "/dev/disk/by-uuid/8a50e0b7-d2a7-4b0c-b092-9194536cae41";

fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D259-64AC";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};

swapDevices =
[ { device = "/dev/disk/by-uuid/a7366f52-418f-47a7-bb29-fbd394d559ee"; }
];

# 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
Expand Down
62 changes: 31 additions & 31 deletions machines/x220/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,37 @@
];

fileSystems."/persist".neededForBoot = true;
environment.persistence."/persistent" = {
enable = true; # NB: Defaults to true, not needed
hideMounts = true;
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
];
files = [
"/etc/machine-id"
"/etc/shadow"
{ file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
];
users.pn = {
directories = [
"Downloads"
"Music"
"Pictures"
"Documents"
"Videos"
"VirtualBox VMs"
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
{ directory = ".local/share/keyrings"; mode = "0700"; }
".local/share/direnv"
];
};
};
#environment.persistence."/persistent" = {
#enable = true; # NB: Defaults to true, not needed
#hideMounts = true;
#directories = [
#"/var/log"
#"/var/lib/bluetooth"
#"/var/lib/nixos"
#"/var/lib/systemd/coredump"
#"/etc/NetworkManager/system-connections"
#{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
#];
#files = [
#"/etc/machine-id"
#"/etc/shadow"
#{ file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
#];
#users.pn = {
#directories = [
#"Downloads"
#"Music"
#"Pictures"
#"Documents"
#"Videos"
#"VirtualBox VMs"
#{ directory = ".gnupg"; mode = "0700"; }
#{ directory = ".ssh"; mode = "0700"; }
#{ directory = ".local/share/keyrings"; mode = "0700"; }
#".local/share/direnv"
#];
#};
#};

# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
Expand Down
12 changes: 5 additions & 7 deletions machines/x220/disko.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
esp = {
ESP = {
priority = 1;
name = "ESP";
size = "500M";
start = "1M";
end = "256M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
swap = {
Expand Down
2 changes: 1 addition & 1 deletion modules/gnome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ in
];

fonts.packages = with pkgs; [
nerdfonts
#nerdfonts
];

nixpkgs.config.allowUnfree = true;
Expand Down

0 comments on commit 39ebafe

Please sign in to comment.