diff --git a/flake.nix b/flake.nix index e11b379..c594d96 100644 --- a/flake.nix +++ b/flake.nix @@ -100,7 +100,6 @@ arkenfox = arkenfox.hmModules.default; nixvim = nixvim.homeManagerModules.nixvim; colors = colors.homeManagerModules.colorScheme; - # Use only if user config managed by nixos impermanence = impermanence.nixosModules.home-manager.impermanence; }; # All attributes to add to lib @@ -176,17 +175,10 @@ nurpkgs = pkgImport system false nixos; }; - hmConfigurations = - system: import ./users { - finalHMModules = finalHMModules system; - pkgs = pkgs system; - inherit (home.lib) homeManagerConfiguration; - }; - hosts = import ./hosts ({ inherit self pkgs lib; - inherit finalOverlays finalModules; + inherit finalOverlays finalModules finalHMModules; }); in { @@ -223,12 +215,9 @@ in lib.nixosSystem { inherit (config) system modules; lib = plib.extend (final: prev: { - hmConfigurations = (hmConfigurations config.system).configurations; profiles = nixosProfiles; + hm = hmProfiles; }); }) hosts; - - hmConfigurations = eachSupportedSystem (system: - builtins.removeAttrs (hmConfigurations system) [ "configurations" ]); }; } diff --git a/hosts/default.nix b/hosts/default.nix index 527b4e0..2d13856 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,6 +3,7 @@ , self , finalOverlays , finalModules +, finalHMModules }: let inherit (lib) types utils; @@ -18,6 +19,7 @@ let home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.sharedModules = builtins.attrValues (finalHMModules system); networking.hostName = hostName; nix.nixPath = let path = toString ../.; in diff --git a/profiles/nixos/users/luc-common/default.nix b/profiles/nixos/users/luc-common/default.nix index 6227fb0..f717ba0 100644 --- a/profiles/nixos/users/luc-common/default.nix +++ b/profiles/nixos/users/luc-common/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: { users.users.luc = { @@ -9,4 +9,38 @@ extraGroups = [ "wheel" "luc" "networkmanager" "adbusers" "video" ]; shell = "/run/current-system/sw/bin/zsh"; }; + + home-manager.users.luc = { + imports = builtins.attrValues { + # System + inherit (lib.hm.system) + xdg + direnv + encryption + ; + + # Interface + inherit (lib.hm.interface) + theme + ; + + # Programs + inherit (lib.hm.programs) + fzf + git + vim + neovim + ; + }; + + xdg.enable = true; + programs.git.userName = "DwarfMaster"; + programs.git.userEmail = "luc@dwarfmaster.net"; + + manual = { + html.enable = true; + json.enable = true; + manpages.enable = true; + }; + }; } diff --git a/profiles/nixos/users/luc-persist/default.nix b/profiles/nixos/users/luc-persist/default.nix index fafd016..9dcebaf 100644 --- a/profiles/nixos/users/luc-persist/default.nix +++ b/profiles/nixos/users/luc-persist/default.nix @@ -5,11 +5,68 @@ ]; home-manager.users.luc = { - imports = [ lib.hmConfigurations.luc-persist ]; - hardware.specs = { cores = config.hardware.specs.cores; threads = config.hardware.specs.threads; }; + + home.persistence."/persists/luc" = { + allowOther = true; + directories = [ + "data" + "downloads" + "repos" + "nextcloud" + ".gnupg" + ".ssh" + ".password-store" + ".local/share/direnv" + # Doom emacs needs its directory as long as the nix compilation is broken + ".emacs.d" + # Firefox + # TODO be more precise about what's saved + ".mozilla/firefox/Personal" + ".mozilla/firefox/Thesis" + ".mozilla/firefox/Media" + ".mozilla/firefox/Private" + ".mozilla/firefox/Config" + ".mozilla/firefox/Shopping" + ".mozilla/firefox/Secure" + # Neovim + ".local/share/nvim" + ".cache/nvim" + # Misc software + ".opam" + ".cargo" + ".julia" + ".cabal" + ".directory_history" + ".logseq" + ".config/discord" + ".local/share/xorg" + ".local/share/signal-cli" + ".local/share/zsh" + ".cache/bash" + ".local/share/Nextcloud" + ".config/Nextcloud" + ]; + files = [ + ".zdirs" + ".ghc/ghci_history" + ]; + }; + + systemd.user.tmpfiles.rules = [ + "L /home/luc/wiki - - - - /home/luc/data/wiki" + "L /home/luc/social - - - - /home/luc/data/social" + "L /home/luc/div - - - - /home/luc/data/div" + "L /home/luc/workflow - - - - /home/luc/data/workflow" + "L /home/luc/papers - - - - /home/luc/data/papers" + "L /home/luc/projects - - - - /home/luc/data/projects" + "L /home/luc/photos - - - - /home/luc/data/photos" + "L /home/luc/mail - - - - /home/luc/data/mail" + "L /home/luc/contact - - - - /home/luc/data/contact" + "L /home/luc/calendar - - - - /home/luc/data/calendar" + ]; }; } diff --git a/profiles/nixos/users/luc-rpi4/default.nix b/profiles/nixos/users/luc-rpi4/default.nix index 757df39..3c75ba0 100644 --- a/profiles/nixos/users/luc-rpi4/default.nix +++ b/profiles/nixos/users/luc-rpi4/default.nix @@ -9,7 +9,7 @@ ]; home-manager.users.luc = { - imports = [ lib.hmConfigurations.luc-rpi4 ]; + imports = [ ]; hardware.specs = { cores = config.hardware.specs.cores; diff --git a/profiles/nixos/users/luc/default.nix b/profiles/nixos/users/luc/default.nix index 899e17c..fcaaaf7 100644 --- a/profiles/nixos/users/luc/default.nix +++ b/profiles/nixos/users/luc/default.nix @@ -1,5 +1,94 @@ +{ lib, ... }: + { imports = [ ../luc-common ]; + + home-manager.users.luc = { + imports = builtins.attrValues { + # System + inherit (lib.hm.system) + android + direnv + encryption + xdg + templates + network + ; + + + # Interface + inherit (lib.hm.interface) + x11 + xmonad + visualisation + locking + brightness + ; + + + # Programs + inherit (lib.hm.programs) + firefox + emacs + audio + blender + documents + # drawing + # engineering + git-annex + maps + messaging + multimedia + neovim + passwords + games + cheat + vim + ; + + # Data + inherit (lib.hm.data) + mail + photos + music + book + papers + accounting + feeds + wiki + calendar + nextcloud + contacts + ; + + # Languages + inherit (lib.hm.languages) + agda + andromeda + coq + cpp + dedukti + haskell + idris + java + julia + latex + lean + lua + nix + ocaml + python3 + rust + tools + why3 + ; + }; + + hardware.specs = { + cores = lib.mkDefault 6; + threads = lib.mkDefault 12; + }; + }; } diff --git a/users/default.nix b/users/default.nix deleted file mode 100644 index 9b9eac5..0000000 --- a/users/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ homeManagerConfiguration, finalHMModules, pkgs, ... }: - -let - - inherit (pkgs) lib; - - mkConfig = path: - { imports = [ path lib.profiles.core ] ++ builtins.attrValues finalHMModules; }; - - configurations = { - luc = { - username = "luc"; - config = mkConfig ./luc.nix; - }; - luc-server = { - username = "luc"; - config = mkConfig ./luc-server.nix; - }; - luc-rpi4 = { - username = "luc"; - config = mkConfig ./luc-rpi4.nix; - }; - luc-persist = { - username = "luc"; - config = mkConfig ./luc-persist.nix; - }; - }; - - mkHm = name: config: - homeManagerConfiguration { - configuration = config.config; - system = "x86_64-linux"; - homeDirectory = "/home/${config.username}"; - username = config.username; - stateVersion = "21.11"; - inherit pkgs; - }; - - activations = builtins.mapAttrs mkHm configurations; - -in activations // { configurations = builtins.mapAttrs (_: config: config.config) configurations; } diff --git a/users/luc-common.nix b/users/luc-common.nix deleted file mode 100644 index 96ad56b..0000000 --- a/users/luc-common.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ lib, config, pkgs, ... }: - -{ - imports = builtins.attrValues { - # System - inherit (lib.profiles.system) - xdg - direnv - encryption - ; - - # Interface - inherit (lib.profiles.interface) - theme - ; - - # Programs - inherit (lib.profiles.programs) - fzf - git - vim - neovim - ; - }; - - xdg.enable = true; - programs.git.userName = "DwarfMaster"; - programs.git.userEmail = "luc@dwarfmaster.net"; - - manual = { - html.enable = true; - json.enable = true; - manpages.enable = true; - }; -} diff --git a/users/luc-persist.nix b/users/luc-persist.nix deleted file mode 100644 index d89e076..0000000 --- a/users/luc-persist.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ lib, ... }: - -# TODO move everything into own module - -{ - imports = [ ./luc.nix ]; - - home.persistence."/persists/luc" = { - allowOther = true; - directories = [ - "data" - "downloads" - "repos" - "nextcloud" - ".gnupg" - ".ssh" - ".password-store" - ".local/share/direnv" - # Doom emacs needs its directory as long as the nix compilation is broken - ".emacs.d" - # Firefox - # TODO be more precise about what's saved - ".mozilla/firefox/Personal" - ".mozilla/firefox/Thesis" - ".mozilla/firefox/Media" - ".mozilla/firefox/Private" - ".mozilla/firefox/Config" - ".mozilla/firefox/Shopping" - ".mozilla/firefox/Secure" - # Neovim - ".local/share/nvim" - ".cache/nvim" - # Misc software - ".opam" - ".cargo" - ".julia" - ".cabal" - ".directory_history" - ".logseq" - ".config/discord" - ".local/share/xorg" - ".local/share/signal-cli" - ".local/share/zsh" - ".cache/bash" - ".local/share/Nextcloud" - ".config/Nextcloud" - ]; - files = [ - ".zdirs" - ".ghc/ghci_history" - ]; - }; - - systemd.user.tmpfiles.rules = [ - "L /home/luc/wiki - - - - /home/luc/data/wiki" - "L /home/luc/social - - - - /home/luc/data/social" - "L /home/luc/div - - - - /home/luc/data/div" - "L /home/luc/workflow - - - - /home/luc/data/workflow" - "L /home/luc/papers - - - - /home/luc/data/papers" - "L /home/luc/projects - - - - /home/luc/data/projects" - "L /home/luc/photos - - - - /home/luc/data/photos" - "L /home/luc/mail - - - - /home/luc/data/mail" - "L /home/luc/contact - - - - /home/luc/data/contact" - "L /home/luc/calendar - - - - /home/luc/data/calendar" - ]; -} diff --git a/users/luc-rpi4.nix b/users/luc-rpi4.nix deleted file mode 100644 index 4b70b70..0000000 --- a/users/luc-rpi4.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ lib, ... }: - -{ - imports = [ ./luc-common.nix ] ++ (builtins.attrValues { - # System - inherit (lib.profiles.system) - direnv - encryption - xdg - templates - ; - - # Interface - inherit (lib.profiles.interface) - #x11 - #xmonad - #visualisation - #locking - #brightness - ; - - - # Programs - inherit (lib.profiles.programs) - #firefox - #chromium - #emacs - #audio - #documents - #drawing - #git-annex - #messaging - #multimedia - #passwords - vim - neovim - ; - - # Data - inherit (lib.profiles.data) - #mail - #photos - #music - #book - #papers - #accounting - #feeds - #wiki - #calendar - ; - - # Languages - inherit (lib.profiles.languages) - tools - #coq - #lean - #andromeda - #agda - #idris - #why3 - #cpp - #julia - #python3 - #haskell - #ocaml - #latex - #dedukti - ; - - }); -} diff --git a/users/luc-server.nix b/users/luc-server.nix deleted file mode 100644 index b5f698b..0000000 --- a/users/luc-server.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./luc-common.nix - ]; -} diff --git a/users/luc.nix b/users/luc.nix deleted file mode 100644 index 91f321b..0000000 --- a/users/luc.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ lib, ... }: - -{ - imports = [ ./luc-common.nix ] ++ (builtins.attrValues { - # System - inherit (lib.profiles.system) - android - direnv - encryption - xdg - templates - network - ; - - - # Interface - inherit (lib.profiles.interface) - x11 - xmonad - visualisation - locking - brightness - ; - - - # Programs - inherit (lib.profiles.programs) - firefox - emacs - audio - blender - documents - # drawing - # engineering - git-annex - maps - messaging - multimedia - neovim - passwords - games - cheat - vim - ; - - # Data - inherit (lib.profiles.data) - mail - photos - music - book - papers - accounting - feeds - wiki - calendar - nextcloud - contacts - ; - - # Languages - inherit (lib.profiles.languages) - agda - andromeda - coq - cpp - dedukti - haskell - idris - java - julia - latex - lean - lua - nix - ocaml - python3 - rust - tools - why3 - ; - }); - - hardware.specs = { - cores = lib.mkDefault 6; - threads = lib.mkDefault 12; - }; -}