mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat[client]: make home-manager more convenient to use
Some checks are pending
Flake check / Check flake (push) Waiting to run
Some checks are pending
Flake check / Check flake (push) Waiting to run
This commit is contained in:
parent
64e6a9c159
commit
40b42028d2
3 changed files with 108 additions and 65 deletions
|
|
@ -1259,10 +1259,18 @@ Lastly, in the =perSystem= attribute set, we see that it is actually passed some
|
|||
pkgs.age
|
||||
pkgs.ssh-to-age
|
||||
pkgs.sops
|
||||
pkgs.home-manager
|
||||
pkgs.nixpkgs-fmt
|
||||
self.packages.${system}.swarsel-build
|
||||
self.packages.${system}.swarsel-deploy
|
||||
(pkgs.symlinkJoin {
|
||||
name = "home-manager";
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
paths = [ pkgs.home-manager ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/home-manager \
|
||||
--append-flags '--flake .#$(hostname)'
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
commands = [
|
||||
|
|
@ -11043,81 +11051,96 @@ This section sets up all the imports that are used in the home-manager section.
|
|||
Again, we adapt =nix= to our needs, enable the home-manager command for non-NixOS machines (NixOS machines are using it as a module) and setting user information that I always keep the same.
|
||||
|
||||
#+begin_src nix-ts :tangle modules/home/common/settings.nix
|
||||
{ self, lib, pkgs, config, ... }:
|
||||
{ self, lib, pkgs, config, ... }:
|
||||
let
|
||||
inherit (config.swarselsystems) mainUser;
|
||||
in
|
||||
{
|
||||
options.swarselmodules.general = lib.mkEnableOption "general nix settings";
|
||||
config =
|
||||
let
|
||||
inherit (config.swarselsystems) mainUser;
|
||||
nix-version = "2_30";
|
||||
in
|
||||
{
|
||||
options.swarselmodules.general = lib.mkEnableOption "general nix settings";
|
||||
config = let
|
||||
nix-version = "2_30";
|
||||
in lib.mkIf config.swarselmodules.general {
|
||||
nix = lib.mkIf (!config.swarselsystems.isNixos) {
|
||||
package = lib.mkForce pkgs.nixVersions."nix_${nix-version}";
|
||||
# extraOptions = ''
|
||||
# plugin-files = ${pkgs.dev.nix-plugins}/lib/nix/plugins
|
||||
# extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||
# '';
|
||||
extraOptions = let
|
||||
lib.mkIf config.swarselmodules.general {
|
||||
nix = lib.mkIf (!config.swarselsystems.isNixos) {
|
||||
package = lib.mkForce pkgs.nixVersions."nix_${nix-version}";
|
||||
# extraOptions = ''
|
||||
# plugin-files = ${pkgs.dev.nix-plugins}/lib/nix/plugins
|
||||
# extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||
# '';
|
||||
extraOptions =
|
||||
let
|
||||
nix-plugins = pkgs.nix-plugins.override {
|
||||
nixComponents = pkgs.nixVersions."nixComponents_${nix-version}";
|
||||
};
|
||||
in
|
||||
''
|
||||
''
|
||||
plugin-files = ${nix-plugins}/lib/nix/plugins
|
||||
extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||
'';
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
"ca-derivations"
|
||||
"cgroups"
|
||||
"pipe-operators"
|
||||
];
|
||||
trusted-users = [ "@wheel" "${mainUser}" ];
|
||||
connect-timeout = 5;
|
||||
bash-prompt-prefix = "[33m$SHLVL:\\w [0m";
|
||||
bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"[31m\"; else printf \"[32m\"; fi)λ [0m";
|
||||
fallback = true;
|
||||
min-free = 128000000;
|
||||
max-free = 1000000000;
|
||||
auto-optimise-store = true;
|
||||
warn-dirty = false;
|
||||
max-jobs = 1;
|
||||
use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.overlays = lib.mkIf config.swarselsystems.isNixos (lib.mkForce null);
|
||||
|
||||
programs = {
|
||||
home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
|
||||
man = {
|
||||
enable = true;
|
||||
generateCaches = true;
|
||||
};
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
|
||||
|
||||
home = {
|
||||
username = lib.mkDefault mainUser;
|
||||
homeDirectory = lib.mkDefault "/home/${mainUser}";
|
||||
stateVersion = lib.mkDefault "23.05";
|
||||
keyboard.layout = "us";
|
||||
sessionVariables = {
|
||||
FLAKE = "/home/${mainUser}/.dotfiles";
|
||||
};
|
||||
extraOutputsToInstall = [
|
||||
"doc"
|
||||
"info"
|
||||
"devdoc"
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
"ca-derivations"
|
||||
"cgroups"
|
||||
"pipe-operators"
|
||||
];
|
||||
trusted-users = [ "@wheel" "${mainUser}" ];
|
||||
connect-timeout = 5;
|
||||
bash-prompt-prefix = "[33m$SHLVL:\\w [0m";
|
||||
bash-prompt = "$(if [[ $? -gt 0 ]]; then printf \"[31m\"; else printf \"[32m\"; fi)λ [0m";
|
||||
fallback = true;
|
||||
min-free = 128000000;
|
||||
max-free = 1000000000;
|
||||
auto-optimise-store = true;
|
||||
warn-dirty = false;
|
||||
max-jobs = 1;
|
||||
use-cgroups = lib.mkIf config.swarselsystems.isLinux true;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
nixpkgs.overlays = lib.mkIf config.swarselsystems.isNixos (lib.mkForce null);
|
||||
|
||||
programs = {
|
||||
home-manager = lib.mkIf (!config.swarselsystems.isNixos)
|
||||
{
|
||||
enable = true;
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "home-manager";
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
paths = [ pkgs.home-manager ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/home-manager \
|
||||
--append-flags '--flake .#$(hostname)'
|
||||
'';
|
||||
};
|
||||
};
|
||||
man = {
|
||||
enable = true;
|
||||
generateCaches = true;
|
||||
};
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
|
||||
|
||||
home = {
|
||||
username = lib.mkDefault mainUser;
|
||||
homeDirectory = lib.mkDefault "/home/${mainUser}";
|
||||
stateVersion = lib.mkDefault "23.05";
|
||||
keyboard.layout = "us";
|
||||
sessionVariables = {
|
||||
FLAKE = "/home/${mainUser}/.dotfiles";
|
||||
};
|
||||
extraOutputsToInstall = [
|
||||
"doc"
|
||||
"info"
|
||||
"devdoc"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
#+end_src
|
||||
|
||||
**** nixGL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue