Browse Source

Refactor X11 module -> seperate XDG into own module

main
parent
commit
1c5635d115
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 53
      README.org
  2. 1
      flake.nix
  3. 1
      hosts/nixos/default.nix
  4. 7
      modules/x11.nix
  5. 24
      modules/xdg.nix

53
README.org

@ -590,6 +590,7 @@ nixos = nixpkgs.lib.nixosSystem {
modules = [ modules = [
./hosts/nixos ./hosts/nixos
<<module-x11>> <<module-x11>>
<<module-xdg>>
<<module-ssh>> <<module-ssh>>
<<module-hugo>> <<module-hugo>>
<<module-docker>> <<module-docker>>
@ -614,6 +615,7 @@ Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#nixo
]; ];
modules.x11.enable = true; modules.x11.enable = true;
modules.xdg.enable = true;
modules.ssh.enable = true; modules.ssh.enable = true;
modules.hugo.enable = true; modules.hugo.enable = true;
modules.flakes.enable = true; modules.flakes.enable = true;
@ -723,13 +725,6 @@ in {
services.xserver.displayManager.startx.enable = true; services.xserver.displayManager.startx.enable = true;
environment = { environment = {
variables = {
XDG_DESKTOP_DIR = "$HOME/";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_BIN_HOME = "$HOME/.local/bin";
};
systemPackages = with pkgs; [ systemPackages = with pkgs; [
pkgs.sqlite pkgs.sqlite
pkgs.pfetch pkgs.pfetch
@ -756,6 +751,50 @@ in {
} }
#+END_SRC #+END_SRC
** XDG
#+NAME: module-xdg
#+BEGIN_SRC nix
./modules/x11.nix
#+END_SRC
The [[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html][XDG Base Directory Specification]] is based on the following concepts:
| Environment Variable | Default | Purpose |
|----------------------+--------------------+---------------------------------------------------------------------------|
| XDG_CONFIG_HOME | $HOME/.config | Where user-specific configurations should be written |
| XDG_CACHE_HOME | $HOME/.cache | Where user-specific non essential date should be written |
| XDG_DATA_HOME | $HOME/.local/share | Where user-specific data files should be written |
| XDG_STATE_HOME | $HOME/.local/state | Where user-sspecific state files should be written |
| XDG_RUNTIME_DIR | /run/user/$UID | Non-essential, user-specific date files such as sockets, named pipes, etc |
#+BEGIN_SRC nix :noweb yes :tangle modules/xdg.nix
<<file-warning>
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let cfg = config.modules.xdg;
in {
options.modules.xdg = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.variables = {
XDG_DESKTOP_DIR = "$HOME/";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_BIN_HOME = "$HOME/.local/bin";
};
};
}
#+END_SRC
** SSH ** SSH
#+NAME: module-ssh #+NAME: module-ssh

1
flake.nix

@ -20,6 +20,7 @@
modules = [ modules = [
./hosts/nixos ./hosts/nixos
./modules/x11.nix ./modules/x11.nix
./modules/x11.nix
./modules/ssh.nix ./modules/ssh.nix
./modules/hugo.nix ./modules/hugo.nix
./modules/docker.nix ./modules/docker.nix

1
hosts/nixos/default.nix

@ -8,6 +8,7 @@
]; ];
modules.x11.enable = true; modules.x11.enable = true;
modules.xdg.enable = true;
modules.ssh.enable = true; modules.ssh.enable = true;
modules.hugo.enable = true; modules.hugo.enable = true;
modules.flakes.enable = true; modules.flakes.enable = true;

7
modules/x11.nix

@ -19,13 +19,6 @@ in {
services.xserver.displayManager.startx.enable = true; services.xserver.displayManager.startx.enable = true;
environment = { environment = {
variables = {
XDG_DESKTOP_DIR = "$HOME/";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_BIN_HOME = "$HOME/.local/bin";
};
systemPackages = with pkgs; [ systemPackages = with pkgs; [
pkgs.sqlite pkgs.sqlite
pkgs.pfetch pkgs.pfetch

24
modules/xdg.nix

@ -0,0 +1,24 @@
<<file-warning>
{ config, options, lib, pkgs, ... }:
with lib;
with lib.types;
let cfg = config.modules.xdg;
in {
options.modules.xdg = {
enable = mkOption {
type = bool;
default = false;
};
};
config = mkIf cfg.enable {
environment.variables = {
XDG_DESKTOP_DIR = "$HOME/";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_BIN_HOME = "$HOME/.local/bin";
};
};
}
Loading…
Cancel
Save