Replace my-packages with home-manager

Move all packages to home.nix and remove `my-packages` derivate.
Also define dunst service and remove readme entry related to
configuration and services. Those are now maintained via home-manager.

The "update" section in readme got updated to reflect new home-manager.
This commit is contained in:
Daniel Siepmann 2022-02-02 17:21:27 +01:00
parent e311c072f3
commit 749785f9f4
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
3 changed files with 138 additions and 54 deletions

128
home.nix
View file

@ -20,6 +20,134 @@
programs.home-manager.enable = true;
home.packages = [
# System tools
pkgs.dmenu
pkgs.st
pkgs.dunst
pkgs.i3lock-color
# System monitoring
pkgs.htop
# Dev tools
pkgs.litecli
pkgs.mycli
pkgs.mkcert
# Writing
pkgs.languagetool
# Media
pkgs.vlc
];
services.dunst = {
enable = true;
settings = {
global = {
monitor = 0;
follow = "none";
width = 1000000;
height = 300;
origin = "top-left";
offset = "0x0";
scale = 0;
corner_radius = 0;
notification_limit = 0;
progress_bar = true;
indicate_hidden = "yes";
transparency = 0;
separator_height = 2;
separator_color = "frame";
padding = 8;
horizontal_padding = 8;
text_icon_padding = 0;
frame_width = 1;
frame_color = "#72B3CC";
sort = "yes";
idle_threshold = 120;
font = "Monospace 14";
line_height = 0;
markup = "full";
format = "<b>%s</b>\\n%b\\n(%a)";
alignment = "left";
vertical_alignment = "center";
show_age_threshold = 60;
ellipsize = "middle";
ignore_newline = "no";
stack_duplicates = true;
hide_duplicate_count = false;
show_indicators = "yes";
icon_position = "left";
min_icon_size = 0;
max_icon_size = 32;
icon_path = "/usr/share/icons/gnome/32x32/emblems/:/usr/share/icons/gnome/32x32/status/:/usr/share/icons/gnome/32x32/actions/:/usr/share/icons/gnome/32x32/emotes/:/usr/share/icons/gnome/32x32/apps/:/usr/share/icons/gnome/32x32/devices/";
sticky_history = "yes";
history_length = 20;
};
# Define format of different urgencies
urgency_low = {
background = "#000000";
foreground = "#72B3CC";
timeout = 10;
};
urgency_normal = {
background = "#000000";
foreground = "#72B3CC";
timeout = 10;
};
urgency_critical = {
background = "#000000";
foreground = "#E09690";
timeout = 30;
};
# Define explicit rules
# Prefix with rule- to mark them as rule for myself.
# Prefix x- is necessary to sort them after urgency_ defaults in generated ini file.
# All sections are sorted alphabetical, done would come before urgency and would be overwritten again.
x-rule-networkmanager = {
appname = "NetworkManager";
urgency = "low";
new_icon = "network-wireless";
timeout = 2;
};
x-rule-james = {
summary = "*James Greenwood*";
foreground = "#E09690";
urgency = "critical";
timeout = 30;
format = "<b>%s</b>(%a)";
};
x-rule-reute-export = {
summary = "TYPO3 Export";
foreground = "#8EB33B";
timeout = 30;
};
x-rule-switching = {
summary = "switching*";
foreground = "#8EB33B";
timeout = 3;
};
x-rule-done = {
summary = "*done*";
foreground = "#8EB33B";
timeout = 60;
};
};
};
}

View file

@ -1,23 +0,0 @@
self: super: {
myPackages = super.buildEnv {
name = "my-packages";
paths = [
# System tools
self.dmenu
self.st
self.dunst
self.i3lock-color
# Dev tools
self.litecli
self.mycli
self.mkcert
# Writing
self.languagetool
# Media
self.vlc
];
};
}

View file

@ -5,6 +5,9 @@ I currently use Ubuntu and installed nix alongside.
This repository contains my personal ``~/.config/nixpkgs`` folder,
for sharing, inspiration and retrieving feedback.
This includes ``home.nix`` to maintain ``home-manager``,
see: https://nix-community.github.io/home-manager/index.html
.. contents:: Table of Contents
Disclaimer
@ -20,38 +23,13 @@ Installation
Install (clone) into ``~/.config/nixpkgs``.
Install ``home-manager`` see: https://nix-community.github.io/home-manager/index.html
Execute ``home-manager switch``
Usage
-----
Install packages as usual.
``my-packages``
---------------
The special ``my-packages`` includes a derivation which holds a set of packages.
The idea: Provide a configuration instead of some state.
It can be installed via ``nix-env -i my-packages``
which also "updates" state accordingly to the current defined set.
Configurations
--------------
Some derivations will provide ready to use configuration.
Those are most likely placed within ``~/.nix-profile/etc/*``.
One can symlink them into ``~/.config/*``.
E.g. ``~/.config/dunst -> ~/.nix-profile/etc/dunst``
systemd units
-------------
Some derivations will provide ready to use systemd units.
Those are most likely placed within ``~/.nix-profile/share/systemd/*``.
One can symlink them into ``~/.config/systemd``.
E.g. ``~/.config/systemd/user/dunst.service -> ~/.nix-profile/share/systemd/user/dunst.service``
Add packages to ``home.nix`` and run ``home-manager switch``.
Update
------
@ -59,8 +37,9 @@ Update
The following will update the whole system and clean things up::
nix-channel --update \
&& nix-env -iA nixpkgs.nix nixpkgs.cacert \
&& nix-env --upgrade \
&& nix-env -ia nixpkgs.nix nixpkgs.cacert \
&& home-manager switch \
&& home-manager expire-generations '-30 days' \
&& nix-env --delete-generations +5 \
&& nix-store --gc