~vonfry/dotfiles

66280baab914cb565159a577292b1cd50ca9aeb7 — Vonfry 2 years ago 04e3c06 home-manager/compatible
home-manager: add compatible for non nixos
2 files changed, 33 insertions(+), 7 deletions(-)

M etc/nixos/modules/user/base.nix
M etc/nixos/modules/user/x.nix
M etc/nixos/modules/user/base.nix => etc/nixos/modules/user/base.nix +14 -4
@@ 1,4 1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, nixosConfig ? null, ... }:

with lib;
let


@@ 7,8 7,13 @@ let
  inherit (config.xdg) configHome;

  overlayPath = ../overlay/overlays.nix;
  nixpkgsConfigPath = ./files/nixpkgs.nix;

  isNixOS = nixosConfig != null;

  hmSelfNixpkgs = (!isNixOS) || (!nixosConfig.home-manager.useGlobalPkgs);
in {
  config = mkIf cfg.enable {
  config = mkIf cfg.enable ({
    xdg.configFile = {
      "nix/nix.conf".text = ''
        auto-optimise-store = true


@@ 17,7 22,7 @@ in {
        max-jobs = auto
        cores = 0
      '';
      "nixpkgs/config.nix".source = ./files/nixpkgs.nix;
      "nixpkgs/config.nix".source = nixpkgsConfigPath;
    };

    home = {


@@ 77,5 82,10 @@ in {
        };
      };
    };
  };
  } // (optionalAttrs hmSelfNixpkgs {
    nixpkgs = {
      config = import nixpkgsConfigPath;
      overlays = import overlayPath;
    };
  }));
}

M etc/nixos/modules/user/x.nix => etc/nixos/modules/user/x.nix +19 -3
@@ 1,4 1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, nixosConfig ? null, ... }:

with lib;
let


@@ 9,6 9,10 @@ let
  bgFile = "${homeDirectory}/.background-image";

  defaultBgFile = pkgs.vonfryPackages.desktopBackground.outPath;

  xmonadWithNixOS = nixosConfig != null &&
    (with nixosConfig.services.xserver.windowManager.xmonad;
      enable && enableContribAndExtras);
in {
  config = mkIf cfg.enable {
    # QT is set by qt5ct manually and the qt5ct is configured in nixos module.


@@ 37,7 41,19 @@ in {

    xsession = {
      enable = true;
      windowManager.command = ''test -n "$1" && eval "$@"'';
      windowManager = {
        command = mkIf xmonadWithNixOS ''test -n "$1" && eval "$@"'';
        xmonad = mkIf (!xmonadWithNixOS) {
          enable = true;
          config = ./files/xmonad.hs;
          enableContribAndExtras = true;
        };
      };
      initExtra = mkIf (!xmonadWithNixOS) ''
        ${pkgs.feh}/bin/feh --bg-center ~/.background-image

        # TODO xdg auto start
      '';

      pointerCursor = {
        package = pkgs.capitaine-cursors;


@@ 151,7 167,7 @@ in {
      '';

      file = {
        ".xmonad/xmonad.hs".source = ./files/xmonad.hs;
        ".xmonad/xmonad.hs".source = mkIf xmonadWithNixOS ./files/xmonad.hs;
      };

      packages = with pkgs; [