From 86eafdbeba68117e0ce0bc602b639b91b5a1d83a Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Thu, 21 Mar 2024 17:42:09 +0300 Subject: [PATCH] Home : Create Default config and add Dasha and Root HM. --- flake.nix | 2 +- user/Dasha.nix | 3 ++ {module/common => user}/Root.nix | 3 ++ user/home/Dasha.nix | 9 ++++++ user/home/Default.nix | 39 ++++++++++++++++++++++++++ user/home/Root.nix | 9 ++++++ user/home/Voronind.nix | 48 ++++++-------------------------- 7 files changed, 72 insertions(+), 41 deletions(-) rename {module/common => user}/Root.nix (82%) create mode 100644 user/home/Dasha.nix create mode 100644 user/home/Default.nix create mode 100644 user/home/Root.nix diff --git a/flake.nix b/flake.nix index de436116..26b0ca12 100644 --- a/flake.nix +++ b/flake.nix @@ -127,7 +127,6 @@ ./module/common/Nix.nix ./module/common/Nvim.nix ./module/common/Package.nix - ./module/common/Root.nix ./module/common/Ssh.nix ./module/common/Sshd.nix ./module/common/Swap.nix @@ -135,6 +134,7 @@ ./module/common/Users.nix ./module/common/Wallpaper.nix ./module/common/YtDlp.nix + ./user/Root.nix ]; # Function to create a host. diff --git a/user/Dasha.nix b/user/Dasha.nix index af780f5b..3d2f65b1 100644 --- a/user/Dasha.nix +++ b/user/Dasha.nix @@ -1,4 +1,7 @@ { pkgs, lib, ... }: { + imports = [ + ./home/Dasha.nix + ]; users.users.dasha = { hashedPassword = "$y$j9T$WGMPv/bRhGBUidcZLZ7CE/$raZhwFFdI/XvegVZVHLILJLMiBkOxSErc6gao/Cxt33"; # Use `mkpasswd`. uid = 1001; diff --git a/module/common/Root.nix b/user/Root.nix similarity index 82% rename from module/common/Root.nix rename to user/Root.nix index 4b907a57..84ea7417 100644 --- a/module/common/Root.nix +++ b/user/Root.nix @@ -1,4 +1,7 @@ { const, ... }: { + imports = [ + ./home/Root.nix + ]; users.users.root.hashedPassword = const.hashedPassword; security.sudo = { enable = false; diff --git a/user/home/Dasha.nix b/user/home/Dasha.nix new file mode 100644 index 00000000..d6b44a41 --- /dev/null +++ b/user/home/Dasha.nix @@ -0,0 +1,9 @@ +{ const, ... }: { + imports = [ + (import ./Default.nix { + const = const; + username = "dasha"; + homeDir = "/home/dasha"; + }) + ]; +} diff --git a/user/home/Default.nix b/user/home/Default.nix new file mode 100644 index 00000000..e33e13e5 --- /dev/null +++ b/user/home/Default.nix @@ -0,0 +1,39 @@ +{ const, username, homeDir, ... }: { + home-manager.users.${username} = { + programs.home-manager.enable = true; + home.username = username; + home.homeDirectory = homeDir; + home.stateVersion = const.stateVersion; + + home.file = { + ".config/btop".source = ./module/top/btop; + ".config/gtk-2.0".source = ./module/gtk/2; + ".config/gtk-3.0".source = ./module/gtk/3; + ".config/gtk-4.0".source = ./module/gtk/4; + ".config/htop".source = ./module/top/htop; + ".editorconfig".source = ./module/Editorconfig; + ".parallel/will-cite".text = ""; + "app/bin".source = ./module/bin; + "media/template".source = ./module/template; + }; + + # Directories. + xdg.userDirs = { + enable = true; + createDirectories = true; + desktop = "${homeDir}/"; + documents = "${homeDir}/document/"; + download = "${homeDir}/download/"; + music = "${homeDir}/media/music/"; + pictures = "${homeDir}/media/picture/"; + publicShare = "${homeDir}/media/share/"; + templates = "${homeDir}/media/template/"; + videos = "${homeDir}/media/video/"; + extraConfig = { + XDG_APP_DIR = "${homeDir}/app/"; + XDG_TMP_DIR = "${homeDir}/tmp/"; + }; + }; + }; +} + diff --git a/user/home/Root.nix b/user/home/Root.nix new file mode 100644 index 00000000..6138c77e --- /dev/null +++ b/user/home/Root.nix @@ -0,0 +1,9 @@ +{ const, ... }: { + imports = [ + (import ./Default.nix { + const = const; + username = "root"; + homeDir = "/root"; + }) + ]; +} diff --git a/user/home/Voronind.nix b/user/home/Voronind.nix index f3d40b19..b0da4218 100644 --- a/user/home/Voronind.nix +++ b/user/home/Voronind.nix @@ -1,41 +1,9 @@ -{ const, ... }: let - username = "voronind"; - homeDir = "/home/voronind"; -in { - home-manager.users.voronind = { - programs.home-manager.enable = true; - home.username = username; - home.homeDirectory = homeDir; - home.stateVersion = const.stateVersion; - - home.file = { - ".config/btop".source = ./module/top/btop; - ".config/gtk-2.0".source = ./module/gtk/2; - ".config/gtk-3.0".source = ./module/gtk/3; - ".config/gtk-4.0".source = ./module/gtk/4; - ".config/htop".source = ./module/top/htop; - ".editorconfig".source = ./module/Editorconfig; - ".parallel/will-cite".text = ""; - "app/bin".source = ./module/bin; - "media/template".source = ./module/template; - }; - - # Directories. - xdg.userDirs = { - enable = true; - createDirectories = true; - desktop = "${homeDir}/"; - documents = "${homeDir}/document/"; - download = "${homeDir}/download/"; - music = "${homeDir}/media/music/"; - pictures = "${homeDir}/media/picture/"; - publicShare = "${homeDir}/media/share/"; - templates = "${homeDir}/media/template/"; - videos = "${homeDir}/media/video/"; - extraConfig = { - XDG_APP_DIR = "${homeDir}/app/"; - XDG_TMP_DIR = "${homeDir}/tmp/"; - }; - }; - }; +{ const, ... }: { + imports = [ + (import ./Default.nix { + const = const; + username = "voronind"; + homeDir = "/home/voronind"; + }) + ]; }