diff --git a/flake.nix b/flake.nix index 136e4b9a..2abc6500 100644 --- a/flake.nix +++ b/flake.nix @@ -1,39 +1,25 @@ { - description = "A very basic flake"; + description = "Jacekpoz's Nixos Configurations"; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + inherit (nixpkgs) lib; # we isolate lib from nixpkgs to be able to pass it to specific flake options, alternatively use nixpkgs.lib + in { + # instead of cluttering flake.nix, import all nixosConfigurations from their own dedicated file + nixosConfigurations = import ./hosts {inherit nixpkgs inputs lib;}; + }; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + hyprland.url = "github:hyprwm/Hyprland"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - - outputs = inputs@{ self, nixpkgs, hyprland, home-manager, ... }: { - nixosConfigurations.niksos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - home-manager.nixosModules.home-manager - hyprland.nixosModules.default - { - home-manager.useGlobalPkgs = true; - #home-manager.users.jacek = import ./home.nix; - programs.hyprland = { - enable = true; - xwayland = { - enable = true; - hidpi = true; - }; - nvidiaPatches = false; - }; - } - ]; - }; - - packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello; - - packages.x86_64-linux.default = self.packages.x86_64-linux.hello; - }; } diff --git a/homes/default.nix b/homes/default.nix new file mode 100644 index 00000000..7ed0ab0c --- /dev/null +++ b/homes/default.nix @@ -0,0 +1,14 @@ +{ + inputs, + self, + ... +}: { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = {inherit inputs self;}; # let home-manager access inputs and self + users = { + jacek = import ./jacek; # if more users to be added, create a directory for each one of them with a file called default.nix in them + }; + }; +} diff --git a/homes/jacek/default.nix b/homes/jacek/default.nix new file mode 100644 index 00000000..f3d077e6 --- /dev/null +++ b/homes/jacek/default.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + pkgs, + ... +}: { + # your home-manager configuration goes in this file + programs = { + zsh.enable = true; # enable zsh on home-manager's end + home-manager.enable = true; # let home-manager enable itself + }; + + home = { + username = "jacek"; + homeDirectory = "/home/jacek"; + packages = with pkgs; [ + neofetch + tree + git + librewolf-wayland + foot + keepassxc + neovim + ]; + stateVersion = lib.mkDefault "23.11"; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 00000000..f03825d2 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,26 @@ +{ + lib, + inputs, + ... +}: let + self = inputs.self; + + home-manager = inputs.home-manager.nixosModules.home-manager; + home-configs = import ../homes; +in { + niksos = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit lib inputs self;}; + modules = + [ + {networking.hostName = "niksos";} + ./niksos + ] + ++ [ + # this concatenates to lists + # this list includes an alias for the home-manager module, and another for the global home-manager configuration directory + home-manager + home-configs + ]; + }; +} diff --git a/configuration.nix b/hosts/niksos/configuration.nix similarity index 64% rename from configuration.nix rename to hosts/niksos/configuration.nix index 217fe5cc..fe87c873 100644 --- a/configuration.nix +++ b/hosts/niksos/configuration.nix @@ -1,10 +1,12 @@ -{ config, pkgs, ... }: - { - imports = - [ - ./hardware-configuration.nix - ]; + config, + pkgs, + inputs, + ... +}: { + imports = [ + inputs.hyprland.nixosModules.default + ]; nixpkgs.config.allowUnfree = true; @@ -12,7 +14,6 @@ boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/sda"; - networking.hostName = "niksos"; networking.networkmanager.enable = true; time.timeZone = "Europe/Warsaw"; @@ -20,18 +21,14 @@ # Enable the X11 windowing system. # services.xserver.enable = true; - nix.settings = { experimental-features = [ "flakes" "nix-command" - "recursive-nix" - "ca-derivations" ]; - substituters = [ "https://hyprland.cachix.org" ]; - trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; }; - # Enable sound. # sound.enable = true; @@ -42,30 +39,22 @@ programs.zsh.enable = true; + programs.hyprland = { + enable = true; + xwayland = { + enable = true; + hidpi = true; + }; + nvidiaPatches = false; + }; + users.users.jacek = { isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" ]; + extraGroups = ["wheel" "networkmanager"]; shell = pkgs.zsh; }; - home-manager.users.jacek = { pkgs, ... }: { - home = { - packages = with pkgs; [ - neofetch - tree - git - librewolf-wayland - foot - keepassxc - neovim - home-manager - ]; - stateVersion = "23.11"; - }; - programs.zsh.enable = true; - }; - - environment.shells = with pkgs; [ zsh ]; + environment.shells = with pkgs; [zsh]; #environment.systemPackages = with pkgs; [ # neovim @@ -79,4 +68,3 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? } - diff --git a/hosts/niksos/default.nix b/hosts/niksos/default.nix new file mode 100644 index 00000000..0ba368a5 --- /dev/null +++ b/hosts/niksos/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./configuration.nix + ./hardware-configuration.nix + ]; +} diff --git a/hardware-configuration.nix b/hosts/niksos/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to hosts/niksos/hardware-configuration.nix