From e5af40f1115fc45606db4586ec775bcc17ec1974 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 6 Jul 2023 21:07:54 +0200 Subject: [PATCH] thanks raf :3 (https://github.com/NotAShelf) --- flake.nix | 42 +++++---------- homes/default.nix | 14 +++++ homes/jacek/default.nix | 27 ++++++++++ hosts/default.nix | 26 +++++++++ .../niksos/configuration.nix | 54 ++++++++----------- hosts/niksos/default.nix | 6 +++ .../niksos/hardware-configuration.nix | 0 7 files changed, 108 insertions(+), 61 deletions(-) create mode 100644 homes/default.nix create mode 100644 homes/jacek/default.nix create mode 100644 hosts/default.nix rename configuration.nix => hosts/niksos/configuration.nix (64%) create mode 100644 hosts/niksos/default.nix rename hardware-configuration.nix => hosts/niksos/hardware-configuration.nix (100%) diff --git a/flake.nix b/flake.nix index 136e4b9..2abc650 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 0000000..7ed0ab0 --- /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 0000000..f3d077e --- /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 0000000..f03825d --- /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 217fe5c..fe87c87 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 0000000..0ba368a --- /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