Skip to content

Commit

Permalink
Move user home-manager into nixos config
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarfmaster committed Nov 21, 2022
1 parent bcd2d12 commit 89685da
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 323 deletions.
15 changes: 2 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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" ]);
};
}
2 changes: 2 additions & 0 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, self
, finalOverlays
, finalModules
, finalHMModules
}:
let
inherit (lib) types utils;
Expand All @@ -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
Expand Down
36 changes: 35 additions & 1 deletion profiles/nixos/users/luc-common/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ ... }:
{ lib, ... }:

{
users.users.luc = {
Expand All @@ -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 = "[email protected]";

manual = {
html.enable = true;
json.enable = true;
manpages.enable = true;
};
};
}
61 changes: 59 additions & 2 deletions profiles/nixos/users/luc-persist/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];
};
}
2 changes: 1 addition & 1 deletion profiles/nixos/users/luc-rpi4/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
];

home-manager.users.luc = {
imports = [ lib.hmConfigurations.luc-rpi4 ];
imports = [ ];

hardware.specs = {
cores = config.hardware.specs.cores;
Expand Down
89 changes: 89 additions & 0 deletions profiles/nixos/users/luc/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
}
41 changes: 0 additions & 41 deletions users/default.nix

This file was deleted.

35 changes: 0 additions & 35 deletions users/luc-common.nix

This file was deleted.

Loading

0 comments on commit 89685da

Please sign in to comment.