From 339bd28d1ddd3f1e1c796a5928006fb279e5a48d Mon Sep 17 00:00:00 2001 From: Jo Date: Mon, 20 May 2024 18:08:16 +0200 Subject: [PATCH] [general] add work and gaming user, tweak configs feat: added new ssh configuration modules for home-manager feat: add user work with configurations for my work environment feat: added gaming user with configuration for my gaming enviornment eg. lutris and steam Signed-off-by: Jo --- flake.lock | 12 ++--- flake.nix | 35 +++++++++----- hosts/puzzlevision/configuration.nix | 42 +++++++---------- modules/home-manager/default.nix | 11 +++++ modules/home-manager/development/ssh.nix | 42 +++++++++++++++++ .../home-manager/themes/gruvbox/plasma.nix | 5 +- modules/nixos/default.nix | 7 +++ modules/nixos/desktop/kde.nix | 3 +- .../kde.nix => gaming/desktop/plasma.nix} | 0 users/gaming/home.nix | 42 +++++++++++++++++ users/jo/desktop/kde.nix | 27 +++++++++++ users/{jo_puzzlevision => jo}/home.nix | 46 ++++++++++++++----- users/work/desktop/plasma.nix | 27 +++++++++++ users/work/home.nix | 39 ++++++++++++++++ 14 files changed, 280 insertions(+), 58 deletions(-) create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/development/ssh.nix create mode 100644 modules/nixos/default.nix rename users/{jo_puzzlevision/desktop/kde.nix => gaming/desktop/plasma.nix} (100%) create mode 100644 users/gaming/home.nix create mode 100644 users/jo/desktop/kde.nix rename users/{jo_puzzlevision => jo}/home.nix (60%) create mode 100644 users/work/desktop/plasma.nix create mode 100644 users/work/home.nix diff --git a/flake.lock b/flake.lock index feda459..43be47a 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1715077503, - "narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "6e277d9566de9976f47228dd8c580b97488734d4", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715087517, - "narHash": "sha256-CLU5Tsg24Ke4+7sH8azHWXKd0CFd4mhLWfhYgUiDBpQ=", + "lastModified": 1715787315, + "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b211b392b8486ee79df6cdfb1157ad2133427a29", + "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a55dad9..ab40ff0 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,8 @@ # Haumea (map directory structure into an attribute set) haumea = { - url = "github:nix-community/haumea/v0.2.2"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:nix-community/haumea/v0.2.2"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -38,23 +38,17 @@ # It takes each system as an argument forAllSystems = nixpkgs.lib.genAttrs systems; in { - # My custom packages + # My custom packagess packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # External resources (wallpapers, icons, dotfiles) resources = import ./resources; # My reusable modules for nixos - nixosModules = haumea.lib.load { - src = ./modules/nixos; - inputs = { inherit inputs outputs; pkgs = nixpkgs.legacyPackages.x86_64-linux; }; - }; + nixosModules = import ./modules/nixos; # My reusable modules for home-manager - homeManagerModules = haumea.lib.load { - src = ./modules/home-manager; - inputs = { inherit inputs outputs; pkgs = nixpkgs.legacyPackages.x86_64-linux; }; - }; + homeManagerModules = import ./modules/home-manager; # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' @@ -62,6 +56,7 @@ puzzlevision = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ + home-manager.nixosModules.home-manager ./hosts/puzzlevision/configuration.nix ]; }; @@ -74,7 +69,23 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./users/jo_puzzlevision/home.nix + ./users/jo/home.nix + ]; + }; + + "work@puzzlevision" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + ./users/work/home.nix + ]; + }; + + "gaming@puzzlevision" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + ./users/gaming/home.nix ]; }; }; diff --git a/hosts/puzzlevision/configuration.nix b/hosts/puzzlevision/configuration.nix index ff57994..743f446 100644 --- a/hosts/puzzlevision/configuration.nix +++ b/hosts/puzzlevision/configuration.nix @@ -96,9 +96,8 @@ # Configure console keymap console.keyMap = "de"; - # Enable the TLP service for improved battery management - services.tlp.enable = true; - services.power-profiles-daemon.enable = false; + # Enable the power-profiles-daemon service for improved battery health + services.power-profiles-daemon.enable = true; # Enable CUPS to print documents. services.printing.enable = true; @@ -118,6 +117,9 @@ hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; + # Enable automatic screen rotation and similar features + hardware.sensor.iio.enable = true; + # Enable docker virtualisation.docker.enable = true; @@ -136,28 +138,24 @@ users.users = { jo = { isNormalUser = true; - description = "Jo"; + description = "Personal account for general tasks"; + initialPassword = "jo"; extraGroups = [ "networkmanager" "wheel" "docker" "tty" "dialout" ]; }; work = { isNormalUser = true; - description = "Work"; - initialPassword = "fortnite"; - extraGroups = [ "networkmanager" ]; - packages = with pkgs; [ - jetbrains.phpstorm - teams-for-linux - enpass - thunderbird - ]; + description = "Work account"; + initialPassword = "work"; + extraGroups = [ "networkmanager" "wheel" "docker" ]; }; - }; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + gaming = { + isNormalUser = true; + description = "Gaming account"; + initialPassword = "gaming"; + extraGroups = [ "networkmanager" "wheel" ]; + }; }; environment.systemPackages = with pkgs; [ @@ -165,13 +163,7 @@ firefox vlc libreoffice - - # For development - git - bun - - # Home manager - home-manager + spotify ]; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..559cfc5 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,11 @@ +{ + themes = { + gruvbox = { + plasma = import ./themes/gruvbox/plasma.nix; + }; + }; + + development = { + ssh = import ./development/ssh.nix; + }; +} \ No newline at end of file diff --git a/modules/home-manager/development/ssh.nix b/modules/home-manager/development/ssh.nix new file mode 100644 index 0000000..8b2b540 --- /dev/null +++ b/modules/home-manager/development/ssh.nix @@ -0,0 +1,42 @@ +{ + pkgs, + config, + ... +}: let + sshDir = "${config.home.homeDirectory}/.ssh"; +in { + home.packages = with pkgs; [ + openssh + ]; + + services.ssh-agent.enable = true; + + programs.ssh = { + enable = true; + extraConfig = '' + AddKeysToAgent yes + ''; + + matchBlocks = { + "github.com" = { + identityFile = "${sshDir}/id_ed25519"; + identitiesOnly = true; + user = "git"; + }; + + + "gitlab.com" = { + identityFile = "${sshDir}/id_ed25519"; + identitiesOnly = true; + user = "git"; + }; + + + "bitbucket.org" = { + identityFile = "${sshDir}/id_ed25519"; + identitiesOnly = true; + user = "git"; + }; + }; + }; +} diff --git a/modules/home-manager/themes/gruvbox/plasma.nix b/modules/home-manager/themes/gruvbox/plasma.nix index 2cf3838..677cb9c 100644 --- a/modules/home-manager/themes/gruvbox/plasma.nix +++ b/modules/home-manager/themes/gruvbox/plasma.nix @@ -1,6 +1,9 @@ { + inputs, pkgs, - outputs + outputs, + lib, + ... }: { home.packages = with pkgs; [ tela-icon-theme diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..ecd07d6 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,7 @@ +{ + desktop = { + kde = import ./desktop/kde.nix; + gnome = import ./desktop/gnome.nix; + cosmic = import ./desktop/cosmic.nix; + }; +} \ No newline at end of file diff --git a/modules/nixos/desktop/kde.nix b/modules/nixos/desktop/kde.nix index eb27bdc..604b96e 100644 --- a/modules/nixos/desktop/kde.nix +++ b/modules/nixos/desktop/kde.nix @@ -17,9 +17,8 @@ # Enable KDE-Connect programs.kdeconnect.enable = true; - # On-screen keyboard and automatic screen rotation dependencies + # On-screen keyboard dependency environment.systemPackages = with pkgs; [ maliit-keyboard - iio-sensor-proxy ]; } diff --git a/users/jo_puzzlevision/desktop/kde.nix b/users/gaming/desktop/plasma.nix similarity index 100% rename from users/jo_puzzlevision/desktop/kde.nix rename to users/gaming/desktop/plasma.nix diff --git a/users/gaming/home.nix b/users/gaming/home.nix new file mode 100644 index 0000000..e219d92 --- /dev/null +++ b/users/gaming/home.nix @@ -0,0 +1,42 @@ +{ + inputs, + lib, + config, + pkgs, + outputs, + ... +}: { + imports = [ + ./desktop/plasma.nix + ]; + + nixpkgs = { + config = { + allowUnfree = true; + + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + # Username and home directory + home = { + username = "gaming"; + homeDirectory = "/home/gaming"; + }; + + # General packages + home.packages = with pkgs; [ + lutris + vesktop + steam + ]; + + # Enable home-manager + programs.home-manager.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + home.stateVersion = "23.05"; +} diff --git a/users/jo/desktop/kde.nix b/users/jo/desktop/kde.nix new file mode 100644 index 0000000..85aa0e8 --- /dev/null +++ b/users/jo/desktop/kde.nix @@ -0,0 +1,27 @@ +{ + inputs, + lib, + config, + pkgs, + outputs, + ... +}: { + imports = [ + inputs.plasma-manager.homeManagerModules.plasma-manager + outputs.homeManagerModules.themes.gruvbox.plasma + ]; + + home.packages = with pkgs; [ + kdePackages.sierra-breeze-enhanced + kde-rounded-corners + ]; + + # Plasma configuration + programs.plasma = { + enable = true; + + workspace = { + clickItemTo = "select"; + }; + }; +} \ No newline at end of file diff --git a/users/jo_puzzlevision/home.nix b/users/jo/home.nix similarity index 60% rename from users/jo_puzzlevision/home.nix rename to users/jo/home.nix index 8dccc51..95a88fa 100644 --- a/users/jo_puzzlevision/home.nix +++ b/users/jo/home.nix @@ -6,9 +6,9 @@ outputs, ... }: { - # You can import other home-manager modules here imports = [ ./desktop/kde.nix + outputs.homeManagerModules.development.ssh ]; nixpkgs = { @@ -28,20 +28,19 @@ # General packages home.packages = with pkgs; [ - spotify qflipper wineWowPackages.waylandFull vesktop + + # For development avra avrdude + vscodium jetbrains.phpstorm - teams-for-linux - enpass - thunderbird + git + bun ]; - # home.file.".config/gtk-4.0/gtk.css".source = "${orchis}/share/themes/Orchis-Green-Dark-Compact/gtk-4.0/gtk.css"; - # Enable home-manager programs.home-manager.enable = true; @@ -52,17 +51,40 @@ userEmail = "jo@thevoid.cafe"; userName = "Jo"; - # Enable git-credential-helper extraConfig = { - credential.helper = "${ - pkgs.git.override { withLibsecret = true; } - }/bin/git-credential-libsecret"; + user = { + signingkey = "$HOME/.ssh/id_ed25519"; + }; + + init = { + defaultBranch = "main"; + }; + + color = { + ui = true; + }; + }; + }; + + programs.gh = { + enable = true; + + gitCredentialHelper = { + enable = true; + + hosts = [ + "https://github.com" + "https://gist.github.com" + "https://git.thevoid.cafe" + "https://gitlab.org" + "https://git.semiko.dev" + "https://bitbucket.org" + ]; }; }; # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion home.stateVersion = "23.05"; } diff --git a/users/work/desktop/plasma.nix b/users/work/desktop/plasma.nix new file mode 100644 index 0000000..85aa0e8 --- /dev/null +++ b/users/work/desktop/plasma.nix @@ -0,0 +1,27 @@ +{ + inputs, + lib, + config, + pkgs, + outputs, + ... +}: { + imports = [ + inputs.plasma-manager.homeManagerModules.plasma-manager + outputs.homeManagerModules.themes.gruvbox.plasma + ]; + + home.packages = with pkgs; [ + kdePackages.sierra-breeze-enhanced + kde-rounded-corners + ]; + + # Plasma configuration + programs.plasma = { + enable = true; + + workspace = { + clickItemTo = "select"; + }; + }; +} \ No newline at end of file diff --git a/users/work/home.nix b/users/work/home.nix new file mode 100644 index 0000000..b38feec --- /dev/null +++ b/users/work/home.nix @@ -0,0 +1,39 @@ +{ + pkgs, + lib, + outputs, + inputs, + config, + ... +}: { + imports = [ + ./desktop/plasma.nix + outputs.homeManagerModules.development.ssh + ]; + + nixpkgs = { + config = { + allowUnfree = true; + + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + home = { + username = "work"; + homeDirectory = "/home/work"; + }; + + home.packages = with pkgs; [ + jetbrains.phpstorm + thunderbird + teams-for-linux + enpass + vscodium + ]; + + systemd.user.startServices = "sd-switch"; + + home.stateVersion = "23.05"; +}