home: Use nixosConfig instead of inheriting options
This commit is contained in:
parent
474cc7d0f7
commit
1a7ef37376
|
@ -1,15 +1,4 @@
|
||||||
{ config, options, pkgs, ... }:
|
{ config, options, pkgs, ... }:
|
||||||
let
|
|
||||||
# hacky way of inheriting a nixos option into home manager
|
|
||||||
inheritOption = name:
|
|
||||||
let
|
|
||||||
path = pkgs.lib.splitString "." name;
|
|
||||||
option = pkgs.lib.getAttrFromPath path options;
|
|
||||||
value = pkgs.lib.getAttrFromPath path config;
|
|
||||||
in
|
|
||||||
# setting `value` doesn’t work (always is default value in other modules)
|
|
||||||
option // { default = value; };
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(import "${(import ../../nix/sources.nix).home-manager}/nixos")
|
(import "${(import ../../nix/sources.nix).home-manager}/nixos")
|
||||||
|
@ -34,16 +23,6 @@ in
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
|
|
||||||
home-manager.users.simon = { lib, pkgs, ... }: {
|
home-manager.users.simon = { lib, pkgs, ... }: {
|
||||||
options.sbruder = {
|
|
||||||
full = inheritOption "sbruder.full";
|
|
||||||
gui.enable = inheritOption "sbruder.gui.enable";
|
|
||||||
games.enable = inheritOption "sbruder.games.enable";
|
|
||||||
unfree = {
|
|
||||||
allowAssets = inheritOption "sbruder.unfree.allowAssets";
|
|
||||||
allowSoftware = inheritOption "sbruder.unfree.allowSoftware";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
imports = [ ./modules ];
|
imports = [ ./modules ];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, ... }:
|
{ nixosConfig, ... }:
|
||||||
let
|
let
|
||||||
common = import ./common.nix;
|
common = import ./common.nix;
|
||||||
solarized = common.colorschemes.solarized;
|
solarized = common.colorschemes.solarized;
|
||||||
|
@ -46,7 +46,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = config.sbruder.gui.enable;
|
enable = nixosConfig.sbruder.gui.enable;
|
||||||
settings = {
|
settings = {
|
||||||
font = {
|
font = {
|
||||||
normal = {
|
normal = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, nixosConfig, pkgs, ... }:
|
||||||
|
|
||||||
lib.mkIf config.sbruder.gui.enable {
|
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
pkgs.anki
|
pkgs.anki
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, nixosConfig, pkgs, ... }:
|
||||||
lib.mkIf config.sbruder.games.enable {
|
lib.mkIf nixosConfig.sbruder.games.enable {
|
||||||
home.packages = [ ]
|
home.packages = [ ]
|
||||||
++ lib.optional config.sbruder.unfree.allowSoftware pkgs.unstable.osu-lazer-container;
|
++ lib.optional nixosConfig.sbruder.unfree.allowSoftware pkgs.unstable.osu-lazer-container;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ config, pkgs, ... }:
|
{ nixosConfig, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
gtk = {
|
gtk = {
|
||||||
enable = config.sbruder.gui.enable;
|
enable = nixosConfig.sbruder.gui.enable;
|
||||||
font.name = "sans-serif 10";
|
font.name = "sans-serif 10";
|
||||||
theme = {
|
theme = {
|
||||||
package = pkgs.gnome-themes-extra;
|
package = pkgs.gnome-themes-extra;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, nixosConfig, pkgs, ... }:
|
||||||
|
|
||||||
# I only use mpd on gui systems. If I should ever need it on a headless system,
|
# I only use mpd on gui systems. If I should ever need it on a headless system,
|
||||||
# I will add a separate option.
|
# I will add a separate option.
|
||||||
lib.mkIf config.sbruder.gui.enable {
|
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
services.mpd = {
|
services.mpd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
musicDirectory = "~/Music";
|
musicDirectory = "~/Music";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, nixosConfig, pkgs, ... }:
|
||||||
let
|
let
|
||||||
mpv-prescalers = pkgs.fetchFromGitHub {
|
mpv-prescalers = pkgs.fetchFromGitHub {
|
||||||
owner = "bjin";
|
owner = "bjin";
|
||||||
|
@ -64,7 +64,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.mpv = {
|
programs.mpv = {
|
||||||
enable = config.sbruder.gui.enable;
|
enable = nixosConfig.sbruder.gui.enable;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
# Main application font
|
# Main application font
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, nixosConfig, pkgs, ... }:
|
||||||
let
|
let
|
||||||
languageClientSettings = pkgs.writeText "LanguageClient.json" (builtins.toJSON {
|
languageClientSettings = pkgs.writeText "LanguageClient.json" (builtins.toJSON {
|
||||||
rust.clippy_preference = "on";
|
rust.clippy_preference = "on";
|
||||||
|
@ -246,7 +246,7 @@ in
|
||||||
autocmd BufEnter *.tex syntax sync fromstart
|
autocmd BufEnter *.tex syntax sync fromstart
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
] ++ (lib.optionals config.sbruder.full [
|
] ++ (lib.optionals nixosConfig.sbruder.full [
|
||||||
{
|
{
|
||||||
plugin = LanguageClient-neovim;
|
plugin = LanguageClient-neovim;
|
||||||
config = ''
|
config = ''
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, nixosConfig, pkgs, ... }:
|
||||||
let
|
let
|
||||||
waifu2x-photo-models = pkgs.stdenvNoCC.mkDerivation {
|
waifu2x-photo-models = pkgs.stdenvNoCC.mkDerivation {
|
||||||
name = "waifu2x-photo-models";
|
name = "waifu2x-photo-models";
|
||||||
|
@ -51,7 +51,7 @@ in
|
||||||
|
|
||||||
# file format tools
|
# file format tools
|
||||||
imagemagick # image conversion
|
imagemagick # image conversion
|
||||||
(p7zip.override { enableUnfree = config.sbruder.unfree.allowSoftware; }) # 7z cli (with optional rar support)
|
(p7zip.override { enableUnfree = nixosConfig.sbruder.unfree.allowSoftware; }) # 7z cli (with optional rar support)
|
||||||
pdftk # pdf multitool
|
pdftk # pdf multitool
|
||||||
sqlite-interactive # cli for sqlite databses
|
sqlite-interactive # cli for sqlite databses
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ in
|
||||||
# documents
|
# documents
|
||||||
mupdf # document (pdf) viewer and tools
|
mupdf # document (pdf) viewer and tools
|
||||||
poppler_utils # pdf manipulation tools
|
poppler_utils # pdf manipulation tools
|
||||||
] ++ lib.optionals config.sbruder.gui.enable [
|
] ++ lib.optionals nixosConfig.sbruder.gui.enable [
|
||||||
# communication
|
# communication
|
||||||
claws-mail # email client that looks ugly but just works
|
claws-mail # email client that looks ugly but just works
|
||||||
firefox-wayland # the least bad browser
|
firefox-wayland # the least bad browser
|
||||||
|
@ -177,7 +177,7 @@ in
|
||||||
wl-clipboard # not really gui, but cli tool to manage wayland clipboard
|
wl-clipboard # not really gui, but cli tool to manage wayland clipboard
|
||||||
wxhexeditor # hex editor
|
wxhexeditor # hex editor
|
||||||
xfce.thunar # graphical file manager
|
xfce.thunar # graphical file manager
|
||||||
] ++ lib.optionals (config.sbruder.gui.enable && config.sbruder.full) [
|
] ++ lib.optionals (nixosConfig.sbruder.gui.enable && nixosConfig.sbruder.full) [
|
||||||
# communication
|
# communication
|
||||||
ungoogled-chromium # useful for exporting pages as pdf
|
ungoogled-chromium # useful for exporting pages as pdf
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ in
|
||||||
# office
|
# office
|
||||||
jameica # application framework (used for hibiscus online banking)
|
jameica # application framework (used for hibiscus online banking)
|
||||||
pdfsam-basic # pdf multitool
|
pdfsam-basic # pdf multitool
|
||||||
] ++ lib.optionals (config.sbruder.gui.enable && !config.sbruder.full) [
|
] ++ lib.optionals (nixosConfig.sbruder.gui.enable && !nixosConfig.sbruder.full) [
|
||||||
# creative/design
|
# creative/design
|
||||||
gimp # without plugins
|
gimp # without plugins
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, nixosConfig, pkgs, ... }:
|
||||||
let
|
let
|
||||||
common = import ./common.nix;
|
common = import ./common.nix;
|
||||||
solarized = common.colorschemes.solarized;
|
solarized = common.colorschemes.solarized;
|
||||||
|
@ -19,12 +19,12 @@ let
|
||||||
|
|
||||||
meta.license = lib.licenses.cc0;
|
meta.license = lib.licenses.cc0;
|
||||||
};
|
};
|
||||||
wallpaper = if config.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
||||||
|
|
||||||
cfg = config.wayland.windowManager.sway.config;
|
cfg = config.wayland.windowManager.sway.config;
|
||||||
thinsp = " ";
|
thinsp = " ";
|
||||||
in
|
in
|
||||||
lib.mkIf config.sbruder.gui.enable {
|
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
systemdIntegration = true;
|
systemdIntegration = true;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, lib, ... }:
|
{ lib, nixosConfig, ... }:
|
||||||
|
|
||||||
lib.mkIf config.sbruder.gui.enable {
|
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
home.file.".XCompose".text = ''
|
home.file.".XCompose".text = ''
|
||||||
include "%L"
|
include "%L"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ config, lib, ... }:
|
{ lib, nixosConfig, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
xdg.mimeApps = {
|
xdg.mimeApps = {
|
||||||
enable = config.sbruder.gui.enable;
|
enable = nixosConfig.sbruder.gui.enable;
|
||||||
defaultApplications = {
|
defaultApplications = {
|
||||||
"application/pdf" = "org.pwmt.zathura.desktop";
|
"application/pdf" = "org.pwmt.zathura.desktop";
|
||||||
"image/png" = "mpv.desktop";
|
"image/png" = "mpv.desktop";
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
};
|
};
|
||||||
# Some programs overwrite the mimeapps.list symlink with a normal file which
|
# Some programs overwrite the mimeapps.list symlink with a normal file which
|
||||||
# makes home-manager activation fail
|
# makes home-manager activation fail
|
||||||
xdg.configFile = lib.mkIf config.sbruder.gui.enable {
|
xdg.configFile = lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
"mimeapps.list".force = true;
|
"mimeapps.list".force = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, ... }:
|
{ nixosConfig, ... }:
|
||||||
let
|
let
|
||||||
common = import ./common.nix;
|
common = import ./common.nix;
|
||||||
solarized = common.colorschemes.solarized;
|
solarized = common.colorschemes.solarized;
|
||||||
|
@ -45,7 +45,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.zathura = {
|
programs.zathura = {
|
||||||
enable = config.sbruder.gui.enable;
|
enable = nixosConfig.sbruder.gui.enable;
|
||||||
options = {
|
options = {
|
||||||
selection-clipboard = "clipboard";
|
selection-clipboard = "clipboard";
|
||||||
} // colorschemes.solarized-dark;
|
} // colorschemes.solarized-dark;
|
||||||
|
|
Loading…
Reference in a new issue