diff options
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | machines/x220-gnome/disko.nix | 72 | ||||
-rw-r--r-- | machines/x220-gnome/hardware-configuration.nix | 22 | ||||
-rw-r--r-- | machines/x220/default.nix | 62 | ||||
-rw-r--r-- | machines/x220/disko.nix | 12 | ||||
-rw-r--r-- | modules/gnome.nix | 2 |
6 files changed, 112 insertions, 60 deletions
diff --git a/flake.nix b/flake.nix index a480311..1f151c5 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/machines/x220-gnome/disko.nix b/machines/x220-gnome/disko.nix new file mode 100644 index 0000000..ecbd69c --- /dev/null +++ b/machines/x220-gnome/disko.nix @@ -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"; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/x220-gnome/hardware-configuration.nix b/machines/x220-gnome/hardware-configuration.nix index 7db32ec..4065509 100644 --- a/machines/x220-gnome/hardware-configuration.nix +++ b/machines/x220-gnome/hardware-configuration.nix @@ -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 diff --git a/machines/x220/default.nix b/machines/x220/default.nix index a4914ca..4fac58f 100644 --- a/machines/x220/default.nix +++ b/machines/x220/default.nix @@ -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. diff --git a/machines/x220/disko.nix b/machines/x220/disko.nix index 714cafa..c8f4ae4 100644 --- a/machines/x220/disko.nix +++ b/machines/x220/disko.nix @@ -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 = { diff --git a/modules/gnome.nix b/modules/gnome.nix index 4e8b082..caf42fe 100644 --- a/modules/gnome.nix +++ b/modules/gnome.nix @@ -118,7 +118,7 @@ in ]; fonts.packages = with pkgs; [ - nerdfonts + #nerdfonts ]; nixpkgs.config.allowUnfree = true; |