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.age
|
||||||
pkgs.ssh-to-age
|
pkgs.ssh-to-age
|
||||||
pkgs.sops
|
pkgs.sops
|
||||||
pkgs.home-manager
|
|
||||||
pkgs.nixpkgs-fmt
|
pkgs.nixpkgs-fmt
|
||||||
self.packages.${system}.swarsel-build
|
self.packages.${system}.swarsel-build
|
||||||
self.packages.${system}.swarsel-deploy
|
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 = [
|
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.
|
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
|
#+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
|
let
|
||||||
inherit (config.swarselsystems) mainUser;
|
nix-version = "2_30";
|
||||||
in
|
in
|
||||||
{
|
lib.mkIf config.swarselmodules.general {
|
||||||
options.swarselmodules.general = lib.mkEnableOption "general nix settings";
|
nix = lib.mkIf (!config.swarselsystems.isNixos) {
|
||||||
config = let
|
package = lib.mkForce pkgs.nixVersions."nix_${nix-version}";
|
||||||
nix-version = "2_30";
|
# extraOptions = ''
|
||||||
in lib.mkIf config.swarselmodules.general {
|
# plugin-files = ${pkgs.dev.nix-plugins}/lib/nix/plugins
|
||||||
nix = lib.mkIf (!config.swarselsystems.isNixos) {
|
# extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||||
package = lib.mkForce pkgs.nixVersions."nix_${nix-version}";
|
# '';
|
||||||
# extraOptions = ''
|
extraOptions =
|
||||||
# plugin-files = ${pkgs.dev.nix-plugins}/lib/nix/plugins
|
let
|
||||||
# extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
|
||||||
# '';
|
|
||||||
extraOptions = let
|
|
||||||
nix-plugins = pkgs.nix-plugins.override {
|
nix-plugins = pkgs.nix-plugins.override {
|
||||||
nixComponents = pkgs.nixVersions."nixComponents_${nix-version}";
|
nixComponents = pkgs.nixVersions."nixComponents_${nix-version}";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
plugin-files = ${nix-plugins}/lib/nix/plugins
|
plugin-files = ${nix-plugins}/lib/nix/plugins
|
||||||
extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||||
'';
|
'';
|
||||||
settings = {
|
settings = {
|
||||||
experimental-features = [
|
experimental-features = [
|
||||||
"nix-command"
|
"nix-command"
|
||||||
"flakes"
|
"flakes"
|
||||||
"ca-derivations"
|
"ca-derivations"
|
||||||
"cgroups"
|
"cgroups"
|
||||||
"pipe-operators"
|
"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"
|
|
||||||
];
|
];
|
||||||
|
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
|
#+end_src
|
||||||
|
|
||||||
**** nixGL
|
**** nixGL
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,19 @@ in
|
||||||
nixpkgs.overlays = lib.mkIf config.swarselsystems.isNixos (lib.mkForce null);
|
nixpkgs.overlays = lib.mkIf config.swarselsystems.isNixos (lib.mkForce null);
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
|
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 = {
|
man = {
|
||||||
enable = true;
|
enable = true;
|
||||||
generateCaches = true;
|
generateCaches = true;
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,18 @@
|
||||||
pkgs.age
|
pkgs.age
|
||||||
pkgs.ssh-to-age
|
pkgs.ssh-to-age
|
||||||
pkgs.sops
|
pkgs.sops
|
||||||
pkgs.home-manager
|
|
||||||
pkgs.nixpkgs-fmt
|
pkgs.nixpkgs-fmt
|
||||||
self.packages.${system}.swarsel-build
|
self.packages.${system}.swarsel-build
|
||||||
self.packages.${system}.swarsel-deploy
|
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 = [
|
commands = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue