diff --git a/nix/configuration.nix b/nix/configuration.nix index b36a828..a9b3f8f 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -8,6 +8,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./modules/greetd/nixos.nix ]; # Use the systemd-boot EFI boot loader. @@ -77,15 +78,18 @@ tree ]; }; - + users.mutableUsers = false; + # users.users.doloro.hashedPasswordFile = config.sops.secrets."doloro-hashed_password".path; + # users.users.root.hashedPasswordFile = config.sops.secrets."root-hashed_password".path; + users.users.root.initialPassword = "root"; # programs.firefox.enable = true; # List packages installed in system profile. # You can use https://search.nixos.org/ to find more packages (and options). - # environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - # ]; + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + ]; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. @@ -129,6 +133,5 @@ # # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . system.stateVersion = "25.11"; # Did you read the comment? - } diff --git a/nix/disks.nix b/nix/disks.nix new file mode 100644 index 0000000..d0f0ed7 --- /dev/null +++ b/nix/disks.nix @@ -0,0 +1,66 @@ +{ + lib, + inputs, + ... +}: +{ + imports = [ + inputs.disko.nixosModules.disko + ]; + disko.devices = { + disk = { + main = { + device = lib.mkDefault "nvme-CT1000P2SSD8_2221E632CD1F"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + ESP = { + name = "ESP"; + priority = 1; + size = "4G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "@" = { + mountpoint = "/"; + }; + # Subvolume name is the same as the mountpoint + "@home" = { + mountpoint = "/home"; + }; + # Parent is not mounted so the mountpoint must be set + "@nix" = { + mountpoint = "/nix"; + }; + "@blackhole" = { + mountpoint = "/var/blackhole"; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/nix/flake.nix b/nix/flake.nix index 91da7b5..37a96c8 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -17,7 +17,10 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - }; + disko = { + url = "github:nix-community/disko/latest"; + inputs.nixpkgs.follows = "nixpkgs"; + }; outputs = inputs@{ nixpkgs, home-manager, ... }: @@ -40,7 +43,7 @@ # to pass through arguments to home.nix }; nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - modules = [ ./configuration.nix inputs.sops-nix.nixosModules.sops ]; + modules = [ ./configuration.nix inputs.sops-nix.nixosModules.sops inputs.disko.nixosModules.disko ]; }; }; } diff --git a/nix/modules/greetd/default.nix b/nix/modules/greetd/default.nix new file mode 100644 index 0000000..b56de85 --- /dev/null +++ b/nix/modules/greetd/default.nix @@ -0,0 +1,3 @@ +_: { + nixos: ./nixos.nix; +} diff --git a/nix/modules/greetd/nixos.nix b/nix/modules/greetd/nixos.nix new file mode 100644 index 0000000..f6ec6a1 --- /dev/null +++ b/nix/modules/greetd/nixos.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.modules.greetd; + tuigreet = "${pkgs.tuigreet}/bin/tuigreet"; +in +{ + options.modules.greetd = { + enable = lib.mkEnableOption "Greetd configuration module"; + }; + config = { + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${tuigreet} --time --remember --cmd Hyprland"; + user = "greeter"; + }; + }; + }; + systemd.services.greetd.serviceConfig = { + Type = "idle"; + StandardInput = "tty"; + StandardOutput = "tty"; + StandardError = "journal"; + + TTYReset = true; + TTYVHangup = true; + TTYVTDisallocate = true; + }; + }; +}