From 7f146c0ef0cd8dfa9c7ee7a795559afe4f50bcad Mon Sep 17 00:00:00 2001 From: Thilo Billerbeck Date: Sat, 11 Nov 2023 21:52:08 +0100 Subject: [PATCH] splitted up nixos config --- configs/thilo-laptop/nixos.nix | 128 ++--------------------------- configs/thilo-pc/home.nix | 5 -- configs/thilo-pc/nixos.nix | 120 +--------------------------- nixos/common.nix | 142 +++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+), 245 deletions(-) create mode 100644 nixos/common.nix diff --git a/configs/thilo-laptop/nixos.nix b/configs/thilo-laptop/nixos.nix index dfc9898..45569b7 100644 --- a/configs/thilo-laptop/nixos.nix +++ b/configs/thilo-laptop/nixos.nix @@ -9,6 +9,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./../../nixos/common.nix ]; # Bootloader. @@ -21,41 +22,23 @@ }; networking.hostName = "thilo-laptop"; # Define your hostname. - networking.networkmanager.enable = true; - time.timeZone = "Europe/Berlin"; - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; # Configure console keymap console.keyMap = "de"; - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - environment.gnome.excludePackages = with pkgs; [ tracker tracker-miners ]; + hardware.bluetooth.enable = true; + services = { xserver = { enable = true; -# displayManager.gdm.enable = true; -# desktopManager.gnome.enable = true; - displayManager.sddm.enable = true; - desktopManager.plasma5.enable = true; + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; + defaultSession = "plasmawayland"; layout = "us"; xkbVariant = ""; }; @@ -63,105 +46,8 @@ tracker-miners.enable = false; tracker.enable = false; }; - printing.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - tailscale = { - enable = true; - }; - flatpak.enable = true; - mullvad-vpn = { - enable = true; - package = pkgs.mullvad-vpn; - }; + blueman.enable = true; }; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.thilo = { - uid = 1000; - description = "Thilo Billerbeck"; - shell = pkgs.zsh; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP9TwM1zgEQiU8Cl0OszpU/fba4NpG2rjNSoTvvm/Vcf thilo@thilo-pc" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHXL+1Q6MeNJoqaC4IlUXBIhLiRPzyM2Je11rQrXsiD" - # NEW - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN4DBDw+gSP6Wg/uf0unSxqSVV/y6OCcu7TLFdXYCmw7 thilo@avocadoom-laptop" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBX0RK+JzRkMsO/88NIyBXzQPr8/XkPX3IeClFmj9G8u thilo@thilo-pc" - ]; - extraGroups = [ - "dialout" - "adbusers" - "video" - "audio" - "wheel" - "docker" - "libvirtd" - "libvirt" - "networkmanager" - "qemu-libvirtd" - ]; - }; - - virtualisation = { - docker.enable = true; - podman.enable = true; - virtualbox.host.enable = true; - }; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - hardware.opengl.driSupport32Bit = true; - - hardware.bluetooth.enable = true; - services.blueman.enable = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - zsh - ]; - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - programs = { - steam.enable = true; - zsh.enable = true; - adb.enable = true; - droidcam.enable = true; - noisetorch.enable = true; - chromium = { - enable = true; - extensions = [ - "nngceckbapebfimnlniiiahkandclblb" # Bitwarden - "lhobafahddgcelffkeicbaginigeejlf" # Allow Cors - "dnhpnfgdlenaccegplpojghhmaamnnfp" # Augmented Steam - "mdjildafknihdffpkfmmpnpoiajfjnjd" # Consent-O-Matic - "eimadpbcbfnmbkopoojfekhnkhdbieeh" # Dark Reader - "ponfpcnoihfmfllpaingbgckeeldkhle" # Youtube Enhancer - "epocinhmkcnjfjobnglchpbncndobblj" # Mastodon Gaze - "blipmdconlkpinefehnmjammfjpmpbjk" # Lighthouse - "ggijpepdpiehgbiknmfpfbhcalffjlbj" # Open in mpv - "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock Origin - ]; - }; - }; - - security.polkit.enable = true; - services.xserver.displayManager.defaultSession = "plasmawayland"; - - nixpkgs.config.permittedInsecurePackages = [ - "electron-24.8.6" - ]; - system.stateVersion = "23.05"; } diff --git a/configs/thilo-pc/home.nix b/configs/thilo-pc/home.nix index 62ebd36..2275552 100644 --- a/configs/thilo-pc/home.nix +++ b/configs/thilo-pc/home.nix @@ -19,10 +19,5 @@ services.kdeconnect.enable = true; services.kdeconnect.indicator = true; - - programs.topgrade.settings = { - linux.nix_arguments = "--flake --impure "; - pre_commands.upgrade_flakes = "cd /home/thilo/.nixos-config && nix flake update"; - }; }; } diff --git a/configs/thilo-pc/nixos.nix b/configs/thilo-pc/nixos.nix index c71d346..fcad139 100644 --- a/configs/thilo-pc/nixos.nix +++ b/configs/thilo-pc/nixos.nix @@ -11,6 +11,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./../../nixos/common.nix ]; # Bootloader. @@ -21,25 +22,6 @@ ''; networking.hostName = "thilo-pc"; - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; # Enable the X11 windowing system. services = { @@ -51,107 +33,7 @@ layout = "us"; xkbVariant = ""; }; - printing.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - tailscale = { - enable = true; - }; - flatpak.enable = true; - avahi = { - enable = true; - nssmdns = true; - }; - }; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - - hardware.opengl.driSupport32Bit = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.thilo = { - uid = 1000; - description = "Thilo Billerbeck"; - shell = pkgs.zsh; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP9TwM1zgEQiU8Cl0OszpU/fba4NpG2rjNSoTvvm/Vcf thilo@thilo-pc" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHXL+1Q6MeNJoqaC4IlUXBIhLiRPzyM2Je11rQrXsiD" - # NEW - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN4DBDw+gSP6Wg/uf0unSxqSVV/y6OCcu7TLFdXYCmw7 thilo@avocadoom-laptop" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBX0RK+JzRkMsO/88NIyBXzQPr8/XkPX3IeClFmj9G8u thilo@thilo-pc" - ]; - extraGroups = [ - "dialout" - "adbusers" - "video" - "audio" - "wheel" - "docker" - "libvirtd" - "libvirt" - "networkmanager" - "qemu-libvirtd" - ]; - }; - - virtualisation = { - docker.enable = true; - podman.enable = true; - }; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - git - zsh - kitty - gnome3.adwaita-icon-theme - ]; - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - programs = { - hyprland.enable = true; - steam.enable = true; - zsh.enable = true; - adb.enable = true; - droidcam.enable = true; - noisetorch.enable = true; - chromium = { - enable = true; - extensions = [ - "nngceckbapebfimnlniiiahkandclblb" # Bitwarden - "lhobafahddgcelffkeicbaginigeejlf" # Allow Cors - "dnhpnfgdlenaccegplpojghhmaamnnfp" # Augmented Steam - "mdjildafknihdffpkfmmpnpoiajfjnjd" # Consent-O-Matic - "eimadpbcbfnmbkopoojfekhnkhdbieeh" # Dark Reader - "ponfpcnoihfmfllpaingbgckeeldkhle" # Youtube Enhancer - "epocinhmkcnjfjobnglchpbncndobblj" # Mastodon Gaze - "blipmdconlkpinefehnmjammfjpmpbjk" # Lighthouse - "ggijpepdpiehgbiknmfpfbhcalffjlbj" # Open in mpv - "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock Origin - ]; - }; }; system.stateVersion = "23.05"; - - time.hardwareClockInLocalTime = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - nix.settings.trusted-users = [ "root" "thilo" ]; - - nixpkgs.config.permittedInsecurePackages = [ - "electron-24.8.6" - ]; } diff --git a/nixos/common.nix b/nixos/common.nix new file mode 100644 index 0000000..c198e3f --- /dev/null +++ b/nixos/common.nix @@ -0,0 +1,142 @@ +{ config +, pkgs +, lib +, inputs +, ... +}: + +{ + nix = { + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + experimental-features = [ "nix-command" "flakes" ]; + trusted-users = [ "root" "thilo" ]; + }; + }; + + nixpkgs = { + config = { + permittedInsecurePackages = [ + "electron-24.8.6" + ]; + allowUnfree = true; + }; + }; + + time.timeZone = "Europe/Berlin"; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + users.users.thilo = { + uid = 1000; + description = "Thilo Billerbeck"; + shell = pkgs.zsh; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP9TwM1zgEQiU8Cl0OszpU/fba4NpG2rjNSoTvvm/Vcf thilo@thilo-pc" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHXL+1Q6MeNJoqaC4IlUXBIhLiRPzyM2Je11rQrXsiD" + # NEW + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN4DBDw+gSP6Wg/uf0unSxqSVV/y6OCcu7TLFdXYCmw7 thilo@avocadoom-laptop" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBX0RK+JzRkMsO/88NIyBXzQPr8/XkPX3IeClFmj9G8u thilo@thilo-pc" + ]; + extraGroups = [ + "dialout" + "adbusers" + "video" + "audio" + "wheel" + "docker" + "libvirtd" + "libvirt" + "networkmanager" + "qemu-libvirtd" + ]; + }; + + virtualisation = { + docker.enable = true; + podman.enable = true; + }; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + programs = { + steam.enable = true; + zsh.enable = true; + adb.enable = true; + droidcam.enable = true; + noisetorch.enable = true; + chromium = { + enable = true; + extensions = [ + "nngceckbapebfimnlniiiahkandclblb" # Bitwarden + "lhobafahddgcelffkeicbaginigeejlf" # Allow Cors + "dnhpnfgdlenaccegplpojghhmaamnnfp" # Augmented Steam + "mdjildafknihdffpkfmmpnpoiajfjnjd" # Consent-O-Matic + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # Dark Reader + "ponfpcnoihfmfllpaingbgckeeldkhle" # Youtube Enhancer + "epocinhmkcnjfjobnglchpbncndobblj" # Mastodon Gaze + "blipmdconlkpinefehnmjammfjpmpbjk" # Lighthouse + "ggijpepdpiehgbiknmfpfbhcalffjlbj" # Open in mpv + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock Origin + ]; + }; + }; + + environment.systemPackages = with pkgs; [ + git + zsh + kitty + ]; + + networking.networkmanager.enable = true; + + services = { + printing.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + tailscale = { + enable = true; + }; + flatpak.enable = true; + avahi = { + enable = true; + nssmdns = true; + }; + mullvad-vpn = { + enable = true; + package = pkgs.mullvad-vpn; + }; + }; + + hardware.opengl.driSupport32Bit = true; + + security.polkit.enable = true; + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + + time.hardwareClockInLocalTime = true; +} \ No newline at end of file