From 32dc0f69940dd6bcf45a63feac9a8cf515752d23 Mon Sep 17 00:00:00 2001 From: Gustav Bruhn Date: Sun, 24 Aug 2025 20:39:46 +0200 Subject: [PATCH] refactor part 2 --- hosts/desktop/configuration.nix | 10 ++- hosts/desktop/home.nix | 3 +- hosts/framework/configuration.nix | 115 +----------------------------- modules/nixos/common.nix | 10 +-- modules/nixos/niri.nix | 21 ++++++ 5 files changed, 34 insertions(+), 125 deletions(-) create mode 100644 modules/nixos/niri.nix diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 4df142c..ad286b8 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -8,6 +8,7 @@ # Include the results of the hardware scan. ./hardware-configuration.nix ../../modules/nixos/common.nix + ../../modules/options.nix ]; # Bootloader. boot.loader = { @@ -26,13 +27,16 @@ }; }; + myOptions.niri.enable = true; + networking.hostName = "desktop"; # Define your hostname. home-manager = { - extraSpecialArgs = {inherit inputs;}; - users = { - "bruhng" = import ./home.nix; + extraSpecialArgs = { + inherit inputs pkgs; + myOptions = config.myOptions; }; + users."bruhng" = import ./home.nix; }; system.stateVersion = "25.05"; # Do not channge diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 4d36757..57e57ea 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -1,11 +1,12 @@ { - config, + myOptions, pkgs, ... }: { imports = [ ../../modules/home-manager/helix.nix ../../modules/home-manager/zsh.nix + ../../modules/home-manager/niri.nix ]; home.username = "bruhng"; home.homeDirectory = "/home/bruhng"; diff --git a/hosts/framework/configuration.nix b/hosts/framework/configuration.nix index 684898b..331f222 100644 --- a/hosts/framework/configuration.nix +++ b/hosts/framework/configuration.nix @@ -7,103 +7,16 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix - inputs.home-manager.nixosModules.default ../../modules/options.nix + ../../modules/nixos/common.nix ]; - specialisation = { - cosmic = { - inheritParentConfig = true; - configuration = { - imports = [ - ../../modules/nixos/cosmic.nix - ]; - environment.etc."active-specialisation".text = "cosmic"; - }; - }; - wm = { - inheritParentConfig = true; - configuration = { - services.displayManager.ly = { - x11Support = false; - enable = true; - }; - - myOptions.niri.enable = true; - environment.etc."active-specialisation".text = "wm"; - programs.niri.enable = true; - environment.systemPackages = with pkgs; [ - ghostty - fuzzel - ]; - services.gnome.gnome-keyring.enable = true; - security.pam.services.swaylock = {}; - }; - }; - }; - # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "framework"; # Define your hostname. - nix.settings.experimental-features = ["nix-command" "flakes"]; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Stockholm"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "sv_SE.UTF-8"; - LC_IDENTIFICATION = "sv_SE.UTF-8"; - LC_MEASUREMENT = "sv_SE.UTF-8"; - LC_MONETARY = "sv_SE.UTF-8"; - LC_NAME = "sv_SE.UTF-8"; - LC_NUMERIC = "sv_SE.UTF-8"; - LC_PAPER = "sv_SE.UTF-8"; - LC_TELEPHONE = "sv_SE.UTF-8"; - LC_TIME = "sv_SE.UTF-8"; - }; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "se"; - variant = ""; - }; - - # Configure console keymap - console.keyMap = "sv-latin1"; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - - users.users.bruhng = { - isNormalUser = true; - description = "Gustav Bruhn"; - extraGroups = ["networkmanager" "wheel" "wireshark"]; - }; - - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - home-manager = { extraSpecialArgs = { inherit inputs pkgs; @@ -112,31 +25,5 @@ users."bruhng" = import ./home.nix; }; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - environment.systemPackages = with pkgs; [ - nil - discord - alejandra - inputs.zen-browser.packages.${pkgs.system}.default - tmux - fastfetch - spotify - evince - loupe - ]; - - programs.steam.enable = true; - - # List services that you want to enable: - services.fwupd.enable = true; - security.polkit.enable = true; - - # fonts - fonts.packages = with pkgs; [ - nerd-fonts.jetbrains-mono - ]; - system.stateVersion = "25.05"; # Do not channge } diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 5450cd7..35b8a44 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -1,4 +1,3 @@ - { config, pkgs, @@ -7,10 +6,10 @@ }: { imports = [ inputs.home-manager.nixosModules.default - ../../modules/nixos/cosmic.nix + # ../../modules/nixos/cosmic.nix + ./niri.nix ]; - nix.settings.experimental-features = ["nix-command" "flakes"]; # Enable networking @@ -21,7 +20,7 @@ # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; - + i18n.extraLocaleSettings = { LC_ADDRESS = "sv_SE.UTF-8"; LC_IDENTIFICATION = "sv_SE.UTF-8"; @@ -66,7 +65,6 @@ programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; - # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -83,7 +81,6 @@ loupe ]; - programs.steam.enable = true; # List services that you want to enable: @@ -94,5 +91,4 @@ fonts.packages = with pkgs; [ nerd-fonts.jetbrains-mono ]; - } diff --git a/modules/nixos/niri.nix b/modules/nixos/niri.nix new file mode 100644 index 0000000..f7fc4db --- /dev/null +++ b/modules/nixos/niri.nix @@ -0,0 +1,21 @@ +{ + myOptions, + pkgs, + lib, + ... +}: + lib.mkIf myOptions.niri.enable + { + services.displayManager.ly = { + x11Support = false; + enable = true; + }; + programs.niri.enable = true; + environment.systemPackages = with pkgs; [ + ghostty + fuzzel + ]; + services.gnome.gnome-keyring.enable = true; + security.pam.services.swaylock = {}; + + }