From 365845ea632abe33e4a1898bf2d7f1c0bb3dd806 Mon Sep 17 00:00:00 2001 From: Lyes Saadi Date: Tue, 18 Feb 2025 00:48:54 +0100 Subject: [PATCH] Switching to Framework 16 --- flake.lock | 57 +++++++++++++------ flake.nix | 14 +++-- hosts/lyes-pc/default.nix | 66 ++++++++++------------ hosts/lyes-pc/disko-config.nix | 71 ++++++++++++++++++++++++ hosts/lyes-pc/hardware-configuration.nix | 37 ++---------- modules/desktop/packages.nix | 2 +- modules/sway/default.nix | 3 - users/lyes/home.nix | 2 +- users/lyes/packages.nix | 16 ------ 9 files changed, 153 insertions(+), 115 deletions(-) create mode 100644 hosts/lyes-pc/disko-config.nix diff --git a/flake.lock b/flake.lock index 94174d5..dd93482 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739791827, + "narHash": "sha256-l6ooDEtfzet9qRQxlb5A+H6eY7VPpdiGMwqX0nqD1xM=", + "owner": "nix-community", + "repo": "disko", + "rev": "af4a580628e98302bb922c01e1169ce08d7bee57", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,11 +27,11 @@ ] }, "locked": { - "lastModified": 1736373539, - "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", + "lastModified": 1739757849, + "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=", "owner": "nix-community", "repo": "home-manager", - "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", + "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe", "type": "github" }, "original": { @@ -23,11 +43,11 @@ }, "nix-flatpak": { "locked": { - "lastModified": 1734128415, - "narHash": "sha256-HLwdVNxpuTsLlM3tCkpbQU6yCehdgf3kOS1G2SDlkzY=", + "lastModified": 1739444422, + "narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=", "owner": "gmodena", "repo": "nix-flatpak", - "rev": "8bdc2540da516006d07b04019eb57ae0781a04b3", + "rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177", "type": "github" }, "original": { @@ -39,11 +59,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1738471961, - "narHash": "sha256-cgXDFrplNGs7bCVzXhRofjD8oJYqqXGcmUzXjHmip6Y=", + "lastModified": 1739798439, + "narHash": "sha256-GyipmjbbQEaosel/+wq1xihCKbv0/e1LU00x/8b/fP4=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "537286c3c59b40311e5418a180b38034661d2536", + "rev": "3e2ea8a49d4d76276b0f4e2041df8ca5c0771371", "type": "github" }, "original": { @@ -55,11 +75,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738277201, - "narHash": "sha256-6L+WXKCw5mqnUIExvqkD99pJQ41xgyCk6z/H9snClwk=", + "lastModified": 1739758141, + "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "666e1b3f09c267afd66addebe80fb05a5ef2b554", + "rev": "c618e28f70257593de75a7044438efc1c1fc0791", "type": "github" }, "original": { @@ -71,11 +91,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1738410390, - "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "lastModified": 1739736696, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", + "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", "type": "github" }, "original": { @@ -103,6 +123,7 @@ }, "root": { "inputs": { + "disko": "disko", "home-manager": "home-manager", "nix-flatpak": "nix-flatpak", "nixos-hardware": "nixos-hardware", @@ -116,11 +137,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1738466371, - "narHash": "sha256-JYmciiqozFHCvx1fPo7XRVNrhMxbtN4lr7yJkwO4OvY=", + "lastModified": 1739667343, + "narHash": "sha256-fNEz+Yd0t9jXz27qKRMAEBradTwYBeBLOECx+ydG25s=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "55bf8e2936758fc026fb5585fa0965822079097a", + "rev": "8c7f6ca49f87b4e114f775a4dad956ceb6df4220", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8d607cb..3394dcc 100644 --- a/flake.nix +++ b/flake.nix @@ -9,28 +9,32 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nix-flatpak.url = "github:gmodena/nix-flatpak/latest"; zen-browser.url = "github:0xc000022070/zen-browser-flake"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, nix-flatpak, ... }@attrs: { + outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, nix-flatpak, disko, ... }@attrs: { nixosConfigurations = { lyes-pc = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = attrs; modules = [ ./hosts/lyes-pc + ./hosts/lyes-pc/disko-config.nix ./users/lyes ./modules ./modules/desktop ./modules/gaming - ./modules/nvidia - ./modules/specialisations/old-kernel.nix - ./modules/specialisations/gaming.nix + # ./modules/nvidia + # ./modules/specialisations/old-kernel.nix + # ./modules/specialisations/gaming.nix ./modules/sway nix-flatpak.nixosModules.nix-flatpak - nixos-hardware.nixosModules.lenovo-thinkpad-x1-extreme-gen4 + nixos-hardware.nixosModules.framework-16-7040-amd + disko.nixosModules.disko ]; }; diff --git a/hosts/lyes-pc/default.nix b/hosts/lyes-pc/default.nix index 21b53f8..2c35498 100644 --- a/hosts/lyes-pc/default.nix +++ b/hosts/lyes-pc/default.nix @@ -6,7 +6,10 @@ ]; # Networking - networking.hostName = "lyes-pc"; + networking = { + hostName = "lyes-pc"; + hostId = "ed183b8f"; + }; # Kernel # boot.kernelPackages = pkgs.linuxPackages_latest; @@ -14,14 +17,8 @@ # Boot boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.configurationLimit = 10; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.systemd-boot.extraEntries = { - "fedora.conf" = '' - title Fedora - efi /EFI/fedora/grubx64.efi - ''; - }; - boot.kernelParams = [ "quiet" ]; + # boot.loader.efi.canTouchEfiVariables = true; + # boot.kernelParams = [ "quiet" ]; # Reboot Timeout systemd.extraConfig = '' @@ -31,13 +28,6 @@ # Swap zramSwap.enable = true; - # Filesystem - fileSystems = { - "/".options = [ "compress=zstd:1" ]; - "/home".options = [ "compress=zstd:1" ]; - "/nix".options = [ "compress=zstd:1" "noatime" ]; - }; - # Optimisation # nixpkgs.hostPlatform = { @@ -81,28 +71,28 @@ # }; # Disabling failing test - nixpkgs.overlays = [ (final: prev: { - # orc = prev.orc.overrideAttrs (_: { doCheck = false; }); - # gsl = prev.gsl.overrideAttrs (_: { doCheck = false; }); - fprintd = prev.fprintd.overrideAttrs (super: { - # doCheck = false; - # buildInputs = super.buildInputs or [ ] ++ (with pkgs; [ libpam-wrapper (pkgs.python3.withPackages (python-pkgs: [ python-pkgs.pycairo python-pkgs.dbus-python python-pkgs.python-dbusmock ])) ]); - mesonCheckFlags = [ - # PAM related checks are timing out - "--no-suite" "fprintd" - ]; - }); - libsrtp = prev.libsrtp.overrideAttrs (_: { - mesonFlags = [ - "-Dcrypto-library=openssl" - "-Dcrypto-library-kdf=disabled" - "-Ddoc=disabled" - "-Dtests=disabled" - ]; - }); - # # haskellPackages.crypton = pkgs.haskell.lib.overrideCabal prev.crypton (_: { doCheck = false; }); - # # haskellPackages.cryptonite = pkgs.haskell.lib.overrideCabal prev.cryptonite (_: { doCheck = false; }); - }) ]; + # nixpkgs.overlays = [ (final: prev: { + # # orc = prev.orc.overrideAttrs (_: { doCheck = false; }); + # # gsl = prev.gsl.overrideAttrs (_: { doCheck = false; }); + # fprintd = prev.fprintd.overrideAttrs (super: { + # # doCheck = false; + # # buildInputs = super.buildInputs or [ ] ++ (with pkgs; [ libpam-wrapper (pkgs.python3.withPackages (python-pkgs: [ python-pkgs.pycairo python-pkgs.dbus-python python-pkgs.python-dbusmock ])) ]); + # mesonCheckFlags = [ + # # PAM related checks are timing out + # "--no-suite" "fprintd" + # ]; + # }); + # libsrtp = prev.libsrtp.overrideAttrs (_: { + # mesonFlags = [ + # "-Dcrypto-library=openssl" + # "-Dcrypto-library-kdf=disabled" + # "-Ddoc=disabled" + # "-Dtests=disabled" + # ]; + # }); + # # # haskellPackages.crypton = pkgs.haskell.lib.overrideCabal prev.crypton (_: { doCheck = false; }); + # # # haskellPackages.cryptonite = pkgs.haskell.lib.overrideCabal prev.cryptonite (_: { doCheck = false; }); + # }) ]; # nixpkgs.config.packageOverrides = pkgs: { # haskellPackages = pkgs.haskellPackages.override { diff --git a/hosts/lyes-pc/disko-config.nix b/hosts/lyes-pc/disko-config.nix new file mode 100644 index 0000000..bf50979 --- /dev/null +++ b/hosts/lyes-pc/disko-config.nix @@ -0,0 +1,71 @@ +{ disks ? [ "/dev/nvme0n1" ], ... }: { + disko.devices = { + disk = { + main = { + type = "disk"; + device = builtins.elemAt disks 0; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "nofail" ]; + }; + }; + zfs = { + size = "100%"; + content = { + type = "zfs"; + pool = "zroot"; + }; + }; + }; + }; + }; + }; + zpool = { + zroot = { + type = "zpool"; + rootFsOptions = { + mountpoint = "none"; + compression = "zstd"; + acltype = "posixacl"; + xattr = "sa"; + "com.sun:auto-snapshot" = "false"; + }; + options.ashift = "12"; + datasets = { + "root" = { + type = "zfs_fs"; + options = { + encryption = "aes-256-gcm"; + keyformat = "passphrase"; + keylocation = "prompt"; + }; + mountpoint = "/"; + + }; + "root/home" = { + type = "zfs_fs"; + options."com.sun:auto-snapshot" = "true"; + mountpoint = "/home"; + }; + "root/var" = { + type = "zfs_fs"; + mountpoint = "/var"; + }; + "root/nix" = { + type = "zfs_fs"; + options.mountpoint = "/nix"; + mountpoint = "/nix"; + }; + }; + }; + }; + }; +} diff --git a/hosts/lyes-pc/hardware-configuration.nix b/hosts/lyes-pc/hardware-configuration.nix index 834f6e3..706a299 100644 --- a/hosts/lyes-pc/hardware-configuration.nix +++ b/hosts/lyes-pc/hardware-configuration.nix @@ -8,47 +8,18 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/2a1aab81-a8df-4781-8946-f00ac1d48db7"; - fsType = "btrfs"; - options = [ "subvol=nixos_root" ]; - }; - - boot.initrd.luks.devices."luks-8d74423e-0529-46e3-87b9-b948c568a6c3".device = "/dev/disk/by-uuid/8d74423e-0529-46e3-87b9-b948c568a6c3"; - - fileSystems."/home" = - { device = "/dev/disk/by-uuid/2a1aab81-a8df-4781-8946-f00ac1d48db7"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/2a1aab81-a8df-4781-8946-f00ac1d48db7"; - fsType = "btrfs"; - options = [ "subvol=nixos_nix" ]; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/94CB-9035"; - fsType = "vfat"; - }; - - swapDevices = [ ]; - # 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..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - # high-resolution display + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/desktop/packages.nix b/modules/desktop/packages.nix index d7eb796..2060231 100644 --- a/modules/desktop/packages.nix +++ b/modules/desktop/packages.nix @@ -99,7 +99,7 @@ in { git git-lfs vscode - unstable.zed-editor + # zed-editor gcc rustup python3 diff --git a/modules/sway/default.nix b/modules/sway/default.nix index 9c79237..7def6cc 100644 --- a/modules/sway/default.nix +++ b/modules/sway/default.nix @@ -13,9 +13,6 @@ in base = true; gtk = true; }; - extraOptions = [ - "--unsupported-gpu" - ]; extraSessionCommands = '' # SDL: export SDL_VIDEODRIVER=wayland diff --git a/users/lyes/home.nix b/users/lyes/home.nix index 596c07a..3002ea5 100644 --- a/users/lyes/home.nix +++ b/users/lyes/home.nix @@ -7,7 +7,7 @@ userName = "Lyes Saadi"; userEmail = "dev@lyes.eu"; signing = { - key = "17418538BAA17767"; + key = "AD5FCAF65343CE7E"; signByDefault = true; }; extraConfig = { diff --git a/users/lyes/packages.nix b/users/lyes/packages.nix index 298db43..4ac40d4 100644 --- a/users/lyes/packages.nix +++ b/users/lyes/packages.nix @@ -7,21 +7,5 @@ starship wl-clipboard sl - - # Programming - git - git-lfs - vscode - unstable.zed-editor - gcc - rustup - python3 - ocaml - ocamlPackages.ocaml-lsp - ocamlPackages.ocamlformat - opam - ledit - nodejs - nil ]; }