From 61640c058021414b617757f417956c26cd03d3b9 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 26 Oct 2024 11:59:32 +0200 Subject: [PATCH] WIP: Working cosmic installation --- flake.lock | 95 ++++++++++++++++++++++++--- flake.nix | 184 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 210 insertions(+), 69 deletions(-) diff --git a/flake.lock b/flake.lock index 587d2e9..a0e1495 100644 --- a/flake.lock +++ b/flake.lock @@ -184,6 +184,22 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1717312683, + "narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1673956053, @@ -398,6 +414,29 @@ "url": "https://github.com/NixOS/nixos-artwork.git" } }, + "nixos-cosmic": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1729857853, + "narHash": "sha256-IVaFOTG4i2K0YWKrJui09YCAEWyTSK+zaUTUvj/SbC4=", + "owner": "lilyinstarlight", + "repo": "nixos-cosmic", + "rev": "04408bf4afe2bf2b15227c43914130c8bdf4ed3c", + "type": "github" + }, + "original": { + "owner": "lilyinstarlight", + "repo": "nixos-cosmic", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1729742320, @@ -416,16 +455,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729691686, - "narHash": "sha256-BAuPWW+9fa1moZTU+jFh+1cUtmsuF8asgzFwejM4wac=", - "owner": "nixos", + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "32e940c7c420600ef0d1ef396dc63b04ee9cad37", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-24.05", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -479,6 +518,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1729691686, + "narHash": "sha256-BAuPWW+9fa1moZTU+jFh+1cUtmsuF8asgzFwejM4wac=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "32e940c7c420600ef0d1ef396dc63b04ee9cad37", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1714912032, "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", @@ -547,8 +602,9 @@ "lanzaboote": "lanzaboote", "nix-index-database": "nix-index-database", "nixos-artwork": "nixos-artwork", + "nixos-cosmic": "nixos-cosmic", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur", "sops-nix": "sops-nix", @@ -580,6 +636,27 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "nixpkgs": [ + "nixos-cosmic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729736953, + "narHash": "sha256-Rb6JUop7NRklg0uzcre+A+Ebrn/ZiQPkm4QdKg6/3pw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "29b1275740d9283467b8117499ec8cbb35250584", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ @@ -610,10 +687,10 @@ "base16-kitty": "base16-kitty", "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1726776484, diff --git a/flake.nix b/flake.nix index f3edaea..c719444 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,12 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + # nixpkgs-cosmic.follows = "nixos-cosmic/nixpkgs-stable"; + nixos-cosmic = { + url = "github:lilyinstarlight/nixos-cosmic"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + }; }; outputs = @@ -46,7 +52,7 @@ , ... }@inputs: let - mkNixosSystem = extraModule: nixpkgs.lib.nixosSystem rec { + mkNixosSystem = {extraModule, nixpkgs' ? nixpkgs, useDefaultConfiguration ? true}: nixpkgs'.lib.nixosSystem rec { system = "x86_64-linux"; specialArgs = { @@ -55,96 +61,148 @@ }; modules = [ - ./configuration.nix extraModule - ]; + ] ++ nixpkgs'.lib.optional useDefaultConfiguration ./configuration.nix; }; in { nixosConfigurations = { - x260 = mkNixosSystem ({ pkgs, lib, ... }: { - imports = [ inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x260 ]; + x260 = mkNixosSystem { extraModule = ({ pkgs, lib, ... }: { + imports = [ inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x260 ]; - config = { - pim.lanzaboote.enable = true; - networking.hostName = "x260"; + config = { + pim.lanzaboote.enable = true; + networking.hostName = "x260"; - fprintd = { - enable = true; - - tod = { + fprintd = { enable = true; - driver = pkgs.libfprint-2-tod1-vfs0090; + + tod = { + enable = true; + driver = pkgs.libfprint-2-tod1-vfs0090; + }; }; + + swapDevices = [{ device = "/dev/disk/by-uuid/6028bf52-404d-4143-9cb0-9b06cd60a373"; }]; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "rtsx_pci_sdmmc" ]; }; + }); + }; - swapDevices = [{ device = "/dev/disk/by-uuid/6028bf52-404d-4143-9cb0-9b06cd60a373"; }]; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "rtsx_pci_sdmmc" ]; - }; - }); + x201 = mkNixosSystem {extraModule = ({ pkgs, lib, ... }: { + imports = [ inputs.disko.nixosModules.disko ]; + config = { + networking.hostName = "x201"; - x201 = mkNixosSystem ({ pkgs, lib, ... }: { - imports = [ inputs.disko.nixosModules.disko ]; - config = { - networking.hostName = "x201"; - - boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" ]; + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" ]; - disko.devices = { - disk = { - sda = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - boot = { - size = "1M"; - type = "EF02"; # for grub MBR - priority = 1; # Needs to be first partition - }; + disko.devices = { + disk = { + sda = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for grub MBR + priority = 1; # Needs to be first partition + }; - pv_os = { - size = "100%"; + pv_os = { + size = "100%"; - content = { - type = "lvm_pv"; - vg = "vg_os"; + content = { + type = "lvm_pv"; + vg = "vg_os"; + }; }; }; }; }; }; - }; - lvm_vg.vg_os = { - type = "lvm_vg"; + lvm_vg.vg_os = { + type = "lvm_vg"; - lvs = { - swap = { - size = "3GB"; - content.type = "swap"; - }; + lvs = { + swap = { + size = "3GB"; + content.type = "swap"; + }; - root = { - size = "100%FREE"; + root = { + size = "100%FREE"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - mountOptions = [ "defaults" ]; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ "defaults" ]; + }; }; }; }; }; }; - }; - }); + }); + }; - sue = mkNixosSystem ({ ... }: { + sue-cosmic = mkNixosSystem { + useDefaultConfiguration = false; + extraModule = ({ ... }: { + imports = [ + inputs.nixos-hardware.nixosModules.dell-xps-13-9310 + inputs.nixos-cosmic.nixosModules.default + ./modules/nixos/lanzaboote.nix + ]; + + config = { + nixpkgs.config.allowUnfree = true; + nix.settings = { + substituters = [ "https://cosmic.cachix.org/" ]; + trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; + }; + + users = { + users.pim = { + isNormalUser = true; + # extraGroups = [ "wheel" "docker" "input" "wireshark" "dialout" ]; + }; + }; + + services.desktopManager.cosmic.enable = true; + services.displayManager.cosmic-greeter.enable = true; + + pim.lanzaboote.enable = true; + networking.hostName = "xps-9315"; + swapDevices = [{ device = "/dev/disk/by-uuid/96a43c35-0174-4e92-81f0-168a5f601f0b"; }]; + + fileSystems = { + "/" = + { + device = "/dev/disk/by-uuid/31638735-5cc4-4013-8037-17e30edcbb0a"; + fsType = "ext4"; + }; + + "/boot" = + { + device = "/dev/disk/by-uuid/560E-F8A2"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + }; + + boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494"; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" ]; + }; + }); + }; + + sue = mkNixosSystem {extraModule = ({ ... }: { imports = [ inputs.nixos-hardware.nixosModules.dell-xps-13-9310 ]; config = { @@ -166,6 +224,11 @@ }; }; + nix.settings = { + substituters = [ "https://cosmic.cachix.org/" ]; + trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; + }; + boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494"; boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" ]; @@ -175,6 +238,7 @@ }; }; }); + }; }; }; }