From 59842a4ba45b13d6465e527709301f3385891684 Mon Sep 17 00:00:00 2001 From: caem Date: Thu, 4 Apr 2024 13:49:19 +0200 Subject: [PATCH] Restructure to allow for modularity and add home-manager with tmux and git --- flake.lock | 37 ++++++++++++++++++++++++++++++++++- flake.nix | 6 ++++-- machines/workstation.nix | 8 +------- packages/sets/basic.nix | 12 ++++++++++++ packages/sets/x.nix | 13 ++++++++++++ users/hu/packages/git.nix | 13 ++++++++++++ users/hu/packages/tmux.nix | 15 ++++++++++++++ users/{hu.nix => hu/user.nix} | 13 +++++++++++- wm/xmonad.nix | 4 ++++ 9 files changed, 110 insertions(+), 11 deletions(-) create mode 100644 packages/sets/basic.nix create mode 100644 packages/sets/x.nix create mode 100644 users/hu/packages/git.nix create mode 100644 users/hu/packages/tmux.nix rename users/{hu.nix => hu/user.nix} (50%) diff --git a/flake.lock b/flake.lock index 57ddecb..3102134 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1712212014, + "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1708968331, @@ -16,6 +34,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1712026416, "narHash": "sha256-N/3VR/9e1NlN49p7kCiATiEY6Tzdo+CbrAG8kqCQKcI=", @@ -31,8 +65,9 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "impermanence": "impermanence", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index 1acd55e..e651ace 100644 --- a/flake.nix +++ b/flake.nix @@ -3,16 +3,18 @@ inputs = { impermanence.url = "github:nix-community/impermanence"; + home-manager.url = "github:nix-community/home-manager"; }; - outputs = { self, nixpkgs, impermanence, ... }: + outputs = { self, nixpkgs, impermanence, home-manager, ... }: { nixosConfigurations.workstation = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ impermanence.nixosModules.impermanence + home-manager.nixosModules.home-manager ./machines/workstation.nix - ./users/hu.nix + ./users/hu/user.nix ]; }; }; diff --git a/machines/workstation.nix b/machines/workstation.nix index 41b283a..348d27d 100644 --- a/machines/workstation.nix +++ b/machines/workstation.nix @@ -5,6 +5,7 @@ ./hardware/workstation.nix ./persist/workstation.nix ../wm/xmonad.nix + ../packages/sets/basic.nix ]; boot.loader.systemd-boot.enable = true; @@ -66,14 +67,7 @@ # Todo: Move these packages out in the correct files. environment.systemPackages = with pkgs; [ - fastfetch neovim - firefox - rofi - wget - unzip - git - tree ]; system.stateVersion = "23.11"; diff --git a/packages/sets/basic.nix b/packages/sets/basic.nix new file mode 100644 index 0000000..dcd5027 --- /dev/null +++ b/packages/sets/basic.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + fastfetch + wget + unzip + git + tree + dos2unix + ]; +} diff --git a/packages/sets/x.nix b/packages/sets/x.nix new file mode 100644 index 0000000..2e95583 --- /dev/null +++ b/packages/sets/x.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + firefox + xdotool + xorg.xkill + xorg.xinput + xclip + yt-dlp + ffmpeg + ]; +} diff --git a/users/hu/packages/git.nix b/users/hu/packages/git.nix new file mode 100644 index 0000000..80f2bff --- /dev/null +++ b/users/hu/packages/git.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +{ + programs.git = { + enable = true; + userName = "caem"; + userEmail = "caem@dirae.org"; + signing = { + key = "D125101DC74D392FEFDFD54AF4F7229F8B860E9F"; + signByDefault = true; + }; + }; +} diff --git a/users/hu/packages/tmux.nix b/users/hu/packages/tmux.nix new file mode 100644 index 0000000..ba667c6 --- /dev/null +++ b/users/hu/packages/tmux.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + programs.tmux = { + enable = true; + prefix = "C-Space"; + customPaneNavigationAndResize = true; + baseIndex = 1; + extraConfig = '' + bind v split-window -v + bind c split-window -h + bind n new-window + ''; + }; +} diff --git a/users/hu.nix b/users/hu/user.nix similarity index 50% rename from users/hu.nix rename to users/hu/user.nix index 505fc26..ec3d735 100644 --- a/users/hu.nix +++ b/users/hu/user.nix @@ -13,5 +13,16 @@ hashedPasswordFile = "/nix/config/secrets/hu/pass"; }; - # Todo: home-manager configuration + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = false; + home-manager.users.hu = { pkgs, ... }: { + home.username = "hu"; + home.homeDirectory = "/home/hu"; + home.stateVersion = config.system.stateVersion; + + imports = [ + ./packages/git.nix + ./packages/tmux.nix + ]; + }; } diff --git a/wm/xmonad.nix b/wm/xmonad.nix index a37d27e..a1409af 100644 --- a/wm/xmonad.nix +++ b/wm/xmonad.nix @@ -1,6 +1,10 @@ { config, lib, pkgs, ... }: { + imports = [ + ../packages/sets/x.nix + ]; + environment.systemPackages = with pkgs; [ xmobar flameshot