summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSilas Schöffel <sils@sils.li>2024-10-05 19:49:08 +0200
committerSilas Schöffel <sils@sils.li>2024-10-05 19:49:08 +0200
commit522a453a5052838075d066999f2ad29d522a2247 (patch)
tree2db9986b91b0dc475879705207e1639083b64e07
parenthyprland: remove neo keyboard layout (diff)
downloadnix-config-522a453a5052838075d066999f2ad29d522a2247.tar.gz
nix-config-522a453a5052838075d066999f2ad29d522a2247.zip
various changes, needs rebase
Diffstat (limited to '')
-rw-r--r--flake.lock6
-rw-r--r--flake/default.nix13
-rw-r--r--flake/nixosConfigurations/default.nix3
-rw-r--r--hm/silas/default.nix43
-rw-r--r--hm/sils/default.nix (renamed from hm/default.nix)32
-rw-r--r--hosts/schrotti.nix14
-rw-r--r--modules/nixos/sils/basesystem.nix131
-rw-r--r--modules/nixos/sils/default.nix1
-rw-r--r--modules/nixos/sils/disks.nix128
-rw-r--r--modules/nixos/sils/roles.nix16
10 files changed, 304 insertions, 83 deletions
diff --git a/flake.lock b/flake.lock
index 037be9f..bb8200c 100644
--- a/flake.lock
+++ b/flake.lock
@@ -210,6 +210,7 @@
       "original": {
         "owner": "ipetkov",
         "repo": "crane",
+        "rev": "27025ab71bdca30e7ed0a16c88fd74c5970fc7f5",
         "type": "github"
       }
     },
@@ -623,9 +624,9 @@
         "type": "github"
       },
       "original": {
-        "owner": "NixOS",
-        "ref": "nixos-unstable-small",
+        "owner": "NixOs",
         "repo": "nixpkgs",
+        "rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
         "type": "github"
       }
     },
@@ -808,6 +809,7 @@
       "original": {
         "owner": "oxalica",
         "repo": "rust-overlay",
+        "rev": "1d8fcbbfcfd3476c2665384a46ee9d07ef2b4dd9",
         "type": "github"
       }
     },
diff --git a/flake/default.nix b/flake/default.nix
index 443999e..a0e3d57 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -50,5 +50,18 @@
   };
   flake = {
     nixosConfigurations = import ./nixosConfigurations inputs;
+      homeConfigurations."silas" = inputs.home-manager.lib.homeManagerConfiguration {
+    		pkgs = import inputs.nixpkgs {
+    		  system = "x86_64-linux";
+    		  overlays = [inputs.nixvim.overlays.default];
+    		};
+        # Specify your home configuration modules here, for example,
+        # the path to your home.nix.
+        modules = [ ../hm/silas ];
+
+        # Optionally use extraSpecialArgs
+        # to pass through arguments to home.nix
+				extraSpecialArgs = inputs;
+    };
   };
 }
diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix
index ca3c035..5e0e659 100644
--- a/flake/nixosConfigurations/default.nix
+++ b/flake/nixosConfigurations/default.nix
@@ -20,7 +20,7 @@
         backupFileExtension = "backup";
         useGlobalPkgs = true;
         useUserPackages = true;
-        users.sils = import ../../hm;
+        users.sils = import ../../hm/sils;
         extraSpecialArgs = attrs;
       };
     }
@@ -50,6 +50,7 @@ in {
   #    ++ defaultModules;
   #};
   thinklappi = mkNixosHost "x86_64-linux" ../../hosts/thinklappi.nix;
+  schrotti = mkNixosHost "x86_64-linux" ../../hosts/schrotti.nix;
   thinklappi-bootstrap = nixpkgs.lib.nixosSystem {
     system = "x86_64-linux";
     specialArgs = attrs;
diff --git a/hm/silas/default.nix b/hm/silas/default.nix
new file mode 100644
index 0000000..cf6671b
--- /dev/null
+++ b/hm/silas/default.nix
@@ -0,0 +1,43 @@
+{nixvim, ...}: {
+  imports = [
+    ../../modules/hm
+    ../gpg
+    ../gtk
+    ../hyfetch
+    ../mako
+    ../nixvim
+    ../packages
+    ../rofi
+    ../ssh
+    ../swayidle
+    ../swaylock
+    ../swayosd
+    ../xsession
+    ../waybar
+    ../xdg
+    ../zsh
+    nixvim.homeManagerModules.nixvim
+  ];
+
+  home = {
+    username = "silas";
+    homeDirectory = "/home/silas";
+    stateVersion = "23.05";
+  };
+
+  sils = {
+    bat.enable = true;
+    direnv.enable = true;
+    etesync-dav.enable = true;
+    firefox.enable = true;
+    foot.enable = true;
+    git.enable = true;
+    hyprland.enable = true;
+    jameica.enable = true;
+    kdeconnect.enable = true;
+    mail.enable = true;
+    sway.enable = true;
+    zathura.enable = true;
+  };
+  programs.home-manager.enable = true;
+}
diff --git a/hm/default.nix b/hm/sils/default.nix
index 7d6e482..8f0bb6b 100644
--- a/hm/default.nix
+++ b/hm/sils/default.nix
@@ -1,21 +1,21 @@
 {nixvim, ...}: {
   imports = [
-    ../modules/hm
-    ./gpg
-    ./gtk
-    ./hyfetch
-    ./mako
-    ./nixvim
-    ./packages
-    ./rofi
-    ./ssh
-    ./swayidle
-    ./swaylock
-    ./swayosd
-    ./xsession
-    ./waybar
-    ./xdg
-    ./zsh
+    ../../modules/hm
+    ../gpg
+    ../gtk
+    ../hyfetch
+    ../mako
+    ../nixvim
+    ../packages
+    ../rofi
+    ../ssh
+    ../swayidle
+    ../swaylock
+    ../swayosd
+    ../xsession
+    ../waybar
+    ../xdg
+    ../zsh
     nixvim.homeManagerModules.nixvim
   ];
 
diff --git a/hosts/schrotti.nix b/hosts/schrotti.nix
new file mode 100644
index 0000000..417b179
--- /dev/null
+++ b/hosts/schrotti.nix
@@ -0,0 +1,14 @@
+{...}: {
+  role.sils = "laptop-light";
+  sils = {
+    meta = {
+      bootPart = "/dev/disk/by-uuid/4064-2D6C";
+      globalDataDir = "/srv";
+      hostname = "schrotti";
+      mainDisk = "/dev/disk/by-uuid/68da1329-f5ea-4f2c-a38e-faffaaaa6b5a";
+      rootPart = "/dev/disk/by-uuid/6700d662-29a9-4ea5-8ca6-85d42550b3ab";
+      system = "x86_64-linux";
+    };
+  };
+  home-manager.backupFileExtension = "backup";
+}
diff --git a/modules/nixos/sils/basesystem.nix b/modules/nixos/sils/basesystem.nix
index 89b5a5f..21d7ab9 100644
--- a/modules/nixos/sils/basesystem.nix
+++ b/modules/nixos/sils/basesystem.nix
@@ -26,80 +26,83 @@ in {
       extraModulePackages = [];
       kernelPackages = pkgs.linuxPackages_latest;
       lanzaboote = {
-        enable = true;
+        enable = false;
         configurationLimit = 10;
         pkiBundle = "/etc/secureboot";
         settings = {
           editor = false;
         };
       };
+        loader.grub.enable = true;
+	loader.grub.efiSupport = true;
+   	loader.grub.efiInstallAsRemovable = true;
       resumeDevice = config.sils.meta.mainDisk;
-      kernelParams = ["resume_offset=369403136"];
+      #kernelParams = ["resume_offset=369403136"];
     };
 
-    fileSystems = {
-      "/" = {
-        device = "tmpfs";
-        fsType = "tmpfs";
-        options = ["defaults" "size=2G" "mode=755"];
-      };
-      "/tmp" = {
-        device = "tmpfs";
-        fsType = "tmpfs";
-        options = ["defaults" "size=5G" "mode=755"];
-      };
-      "/nix" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=nix" "compress-force=zstd"];
-      };
-      "/etc/NetworkManager" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=networkmanagerconfig" "compress-force=zstd"];
-      };
-      "/etc/secureboot" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=secureboot" "compress-force=zstd"];
-      };
-      "/etc/nixos" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=nixconfig" "compress-force=zstd"];
-      };
-      "/srv" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=srv" "compress-force=zstd"];
-        neededForBoot = true;
-      };
-      "/swap" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=swap" "noatime"];
-      };
-      "/home" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=home" "compress-force=zstd"];
-      };
-      "/srv/snapshots" = {
-        device = config.sils.meta.mainDisk;
-        fsType = "btrfs";
-        options = ["subvol=snapshots" "compress-force=zstd"];
-      };
-      "/boot" = {
-        device = config.sils.meta.bootPart;
-        fsType = "vfat";
-      };
-    };
+    #fileSystems = {
+    #  "/" = {
+    #    device = "tmpfs";
+    #    fsType = "tmpfs";
+    #    options = ["defaults" "size=2G" "mode=755"];
+    #  };
+    #  "/tmp" = {
+    #    device = "tmpfs";
+    #    fsType = "tmpfs";
+    #    options = ["defaults" "size=5G" "mode=755"];
+    #  };
+    #  "/nix" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=nix" "compress-force=zstd"];
+    #  };
+    #  "/etc/NetworkManager" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=networkmanagerconfig" "compress-force=zstd"];
+    #  };
+    #  "/etc/secureboot" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=secureboot" "compress-force=zstd"];
+    #  };
+    #  "/etc/nixos" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=nixconfig" "compress-force=zstd"];
+    #  };
+    #  "/srv" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=srv" "compress-force=zstd"];
+    #    neededForBoot = true;
+    #  };
+    #  "/swap" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=swap" "noatime"];
+    #  };
+    #  "/home" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=home" "compress-force=zstd"];
+    #  };
+    #  "/srv/snapshots" = {
+    #    device = config.sils.meta.mainDisk;
+    #    fsType = "btrfs";
+    #    options = ["subvol=snapshots" "compress-force=zstd"];
+    #  };
+    #  "/boot" = {
+    #    device = config.sils.meta.bootPart;
+    #    fsType = "vfat";
+    #  };
+    #};
 
-    swapDevices = [
-      {
-        device = "/swap/swapfile";
-      }
-    ];
+    #swapDevices = [
+    #  {
+    #    device = "/swap/swapfile";
+    #  }
+    #];
 
     system.stateVersion = "23.05";
 
diff --git a/modules/nixos/sils/default.nix b/modules/nixos/sils/default.nix
index 922d706..c169bfb 100644
--- a/modules/nixos/sils/default.nix
+++ b/modules/nixos/sils/default.nix
@@ -3,6 +3,7 @@
     ./apparmor.nix
     ./basesystem.nix
     ./bluetooth.nix
+    ./disks.nix
     ./environment.nix
     ./firejail.nix
     ./font.nix
diff --git a/modules/nixos/sils/disks.nix b/modules/nixos/sils/disks.nix
new file mode 100644
index 0000000..01c65e9
--- /dev/null
+++ b/modules/nixos/sils/disks.nix
@@ -0,0 +1,128 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}: let
+  cfg = config.sils.disks;
+  defaultMountOptions = [
+    "noatime" # should have some performance upsides, and I don't use it anyways
+    "lazytime" # make time changes in memory
+  ];
+in {
+  options.sils.disks = {
+    enable = lib.mkEnableOption "disk setup with disko";
+
+    disk = lib.mkOption {
+      type = lib.types.path;
+      example = lib.literalExpression "/dev/disk/by-uuid/0442cb6d-f13a-4635-b487-fa76189774c5";
+      description = "The disk used for installing the OS.";
+    };
+
+
+    #swap = {
+    #  uuid = lib.mkOption {
+    #    type = lib.types.str;
+    #    example = lib.literalExpression "d1d20ae7-3d8a-44da-86da-677dbbb10c89";
+    #    description = "The uuid of the swapfile";
+    #  };
+    #  resumeOffset = lib.mkOption {
+    #    type = lib.types.str;
+    #    example = lib.literalExpression "134324224";
+    #    description = "The resume offset of the swapfile";
+    #  };
+    #};
+  };
+
+  config = lib.mkIf cfg.enable {
+
+    disko.devices = {
+      disk = {
+        main = {
+          device = cfg.disk;
+          content = {
+            type = "gpt";
+            partitions = {
+              root = {
+                size = "100%";
+                name = "root";
+                content = {
+                  type = "luks";
+                  name = "cryptroot";
+                  extraOpenArgs = ["--allow-discards"];
+                  content = {
+                    type = "btrfs";
+                    extraArgs = ["-f" "--label nixos"]; # Override existing partitions
+                    subvolumes = {
+                      "root" = {
+                        mountpoint = "/";
+                        mountOptions = defaultMountOptions;
+                      };
+                      "nix" = {
+                        mountpoint = "/nix";
+                        mountOptions = defaultMountOptions;
+                      };
+                      "persistent-storage" = {
+                        mountpoint = "/srv";
+                        mountOptions = defaultMountOptions;
+                      };
+                      "persistent-storage@snapshots" = {
+                        mountpoint = "/srv/.snapshots";
+                        mountOptions = defaultMountOptions;
+                      };
+                      "swap" = {
+                        mountpoint = "/swap";
+                        mountOptions = defaultMountOptions;
+                      };
+                      "home" = {
+                        mountpoint = "/home";
+                        mountOptions = defaultMountOptions;
+                      };
+                    };
+                  };
+                };
+              };
+              boot = {
+                type = "EF00";
+                size = "512M";
+                name = "boot";
+                content = {
+                  type = "filesystem";
+                  format = "vfat";
+                  mountpoint = "/boot";
+                };
+              };
+            };
+          };
+        };
+      };
+      nodev = {
+        "/tmp" = {
+          fsType = "tmpfs";
+          mountOptions = ["defaults" "size=10G" "mode=755"];
+        };
+      };
+    };
+    fileSystems = {
+      "/srv" = {
+        neededForBoot = true;
+      };
+      "/swap" = {
+        neededForBoot = true;
+      };
+    };
+    swapDevices = [
+      #{
+      #        device = "/swap/swapfile";
+      #        priority = 1; # lower than zramSwap, just in case
+      #        # size = 2048; # TODO: can nixos create a btrfs swapfile correctly?
+      #}
+    ];
+    boot = {
+      kernelParams = [
+        #"resume_offset=${cfg.swap.resumeOffset}"
+      ];
+      #resumeDevice = "/dev/disk/by-uuid/${cfg.swap.uuid}";
+    };
+  };
+}
diff --git a/modules/nixos/sils/roles.nix b/modules/nixos/sils/roles.nix
index a39af33..c19bd42 100644
--- a/modules/nixos/sils/roles.nix
+++ b/modules/nixos/sils/roles.nix
@@ -22,6 +22,22 @@ in {
       sway.enable = lib.mkDefault false;
       theming.enable = lib.mkDefault true;
     }
+    else if roleCmp "laptop-light"
+    then {
+      apparmor.enable = lib.mkDefault true;
+      basesystem.enable = lib.mkDefault true;
+      bluetooth.enable = lib.mkDefault true;
+      environment.enable = lib.mkDefault true;
+      firejail.enable = false;
+      font.enable = lib.mkDefault true;
+      hyprland.enable = lib.mkDefault true;
+      impermanence.enable = lib.mkDefault true;
+      networking.enable = lib.mkDefault true;
+      nix-config.enable = lib.mkDefault true;
+      plymouth.enable = lib.mkDefault false;
+      sway.enable = lib.mkDefault false;
+      theming.enable = lib.mkDefault true;
+    }
     else if roleCmp "vm"
     then {}
     else {};