Skip to content

Instantly share code, notes, and snippets.

@IQubic IQubic/desktop.nix
Last active Aug 18, 2019

Embed
What would you like to do?
Home-Manager Setup
{ pkgs, ...}:
{
nixpkgs.config.allowUnfree = true;
home.sessionVariables.EDITOR = "emacsclient";
xsession.profileExtra = ''
export XMODIFIERS=@im=exwm-xim
export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim
export CLUTTER_IM_MODULE=xim
systemctl --user import-environment XMODIFIERS GTK_IM_MODULE QT_IM_MODULE CLUTTER_IM_MODULE
'';
xsession.enable = true;
xsession.windowManager.command = "emacs";
home.keyboard = {
variant = "qwerty";
layout = "us, gr";
options = [ "grp:shift_toggle" "grp_led:caps" "caps:escape" "compose:menu" ];
};
}
{ pkgs, ... }:
{
home.file.".emacs".source = ~/.emacs.d/init.el;
home.sessionVariables.EDITOR = "emacsclient";
home.sessionVariables.XMODIFIERS = "@im=exim";
home.sessionVariables.GTK_IM_MODULE = "xim";
home.sessionVariables.QT_IM_MODULE = "xim";
home.sessionVariables.CLUTTER_IM_MODULE = "xim";
home.packages = [
((import ./use-package.nix { inherit pkgs; }).fromEmacsUsePackage {
config = builtins.readFile ~/.emacs.d/init.el;
});
];
}
{ config, pkgs, ... }:
{
imports = [
./desktop.nix
./emacs.nix
];
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/exwm-overlay/archive/master.tar.gz;
}))
];
programs.zsh = {
enable = true;
enableCompletion = true;
initExtra = ''
setopt correct
bindkey -v'';
shellAliases = {
am = "alsamixer";
xbl = "xbacklight";
grep = "rg -S";
tb = "nc termbin.com 9999";
uninstall = "nix-env -q | fzf | xargs -I{} nix-env -e {}";
config = "nano /etc/nixos/configuration.nix";
rebuild = "nixos-rebuild switch";
};
};
programs.command-not-found.enable = true;
programs.git = {
enable = true;
userName = "iqubic";
userEmail = "avi.caspe@gmail.com";
};
home.stateVersion = "19.03";
manual.manpages.enable = true;
programs.home-manager.enable = true;
}
# Taken from Adisbladis with permission
{ pkgs }:
let
isStrEmpty = s: (builtins.replaceStrings [" "] [""] s) == "";
splitString = _sep: _s: builtins.filter
(x: builtins.typeOf x == "string")
(builtins.split _sep _s);
stripComments = dotEmacs: let
lines = splitString "\n" dotEmacs;
stripped = builtins.map (l:
builtins.elemAt (splitString ";;" l) 0) lines;
in builtins.concatStringsSep " " stripped;
parsePackages = dotEmacs: let
strippedComments = stripComments dotEmacs;
tokens = builtins.filter (t: !(isStrEmpty t)) (builtins.map
(t: if builtins.typeOf t == "list" then builtins.elemAt t 0 else t)
(builtins.split "([\(\)])" strippedComments));
matches = builtins.map (t:
builtins.match "^use-package[[:space:]]+([A-Za-z0-9_-]+).*" t) tokens;
pkgs = builtins.map (m: builtins.elemAt m 0)
(builtins.filter (m: m != null) matches);
in pkgs;
fromEmacsUsePackage = {
config,
package ? pkgs.emacs,
override ? (epkgs: epkgs)
}:
let
packages = parsePackages config;
emacsPackages = pkgs.emacsPackagesNgGen package;
emacsWithPackages = emacsPackages.emacsWithPackages;
in emacsWithPackages (epkgs: let
overriden = override epkgs;
in builtins.map (name: overriden.${name}) (packages ++ [ "use-package" ]));
in {
inherit fromEmacsUsePackage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.