home: Use nixosConfig instead of inheriting options
This commit is contained in:
parent
474cc7d0f7
commit
1a7ef37376
|
@ -1,15 +1,4 @@
|
|||
{ 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 = [
|
||||
(import "${(import ../../nix/sources.nix).home-manager}/nixos")
|
||||
|
@ -34,16 +23,6 @@ in
|
|||
home-manager.useGlobalPkgs = true;
|
||||
|
||||
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 ];
|
||||
|
||||
config = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, ... }:
|
||||
{ nixosConfig, ... }:
|
||||
let
|
||||
common = import ./common.nix;
|
||||
solarized = common.colorschemes.solarized;
|
||||
|
@ -46,7 +46,7 @@ let
|
|||
in
|
||||
{
|
||||
programs.alacritty = {
|
||||
enable = config.sbruder.gui.enable;
|
||||
enable = nixosConfig.sbruder.gui.enable;
|
||||
settings = {
|
||||
font = {
|
||||
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 = [
|
||||
pkgs.anki
|
||||
];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
lib.mkIf config.sbruder.games.enable {
|
||||
{ lib, nixosConfig, pkgs, ... }:
|
||||
lib.mkIf nixosConfig.sbruder.games.enable {
|
||||
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 = {
|
||||
enable = config.sbruder.gui.enable;
|
||||
enable = nixosConfig.sbruder.gui.enable;
|
||||
font.name = "sans-serif 10";
|
||||
theme = {
|
||||
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 will add a separate option.
|
||||
lib.mkIf config.sbruder.gui.enable {
|
||||
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
musicDirectory = "~/Music";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
mpv-prescalers = pkgs.fetchFromGitHub {
|
||||
owner = "bjin";
|
||||
|
@ -64,7 +64,7 @@ let
|
|||
in
|
||||
{
|
||||
programs.mpv = {
|
||||
enable = config.sbruder.gui.enable;
|
||||
enable = nixosConfig.sbruder.gui.enable;
|
||||
|
||||
config = {
|
||||
# Main application font
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
languageClientSettings = pkgs.writeText "LanguageClient.json" (builtins.toJSON {
|
||||
rust.clippy_preference = "on";
|
||||
|
@ -246,7 +246,7 @@ in
|
|||
autocmd BufEnter *.tex syntax sync fromstart
|
||||
'';
|
||||
}
|
||||
] ++ (lib.optionals config.sbruder.full [
|
||||
] ++ (lib.optionals nixosConfig.sbruder.full [
|
||||
{
|
||||
plugin = LanguageClient-neovim;
|
||||
config = ''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
waifu2x-photo-models = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "waifu2x-photo-models";
|
||||
|
@ -51,7 +51,7 @@ in
|
|||
|
||||
# file format tools
|
||||
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
|
||||
sqlite-interactive # cli for sqlite databses
|
||||
|
||||
|
@ -134,7 +134,7 @@ in
|
|||
# documents
|
||||
mupdf # document (pdf) viewer and tools
|
||||
poppler_utils # pdf manipulation tools
|
||||
] ++ lib.optionals config.sbruder.gui.enable [
|
||||
] ++ lib.optionals nixosConfig.sbruder.gui.enable [
|
||||
# communication
|
||||
claws-mail # email client that looks ugly but just works
|
||||
firefox-wayland # the least bad browser
|
||||
|
@ -177,7 +177,7 @@ in
|
|||
wl-clipboard # not really gui, but cli tool to manage wayland clipboard
|
||||
wxhexeditor # hex editor
|
||||
xfce.thunar # graphical file manager
|
||||
] ++ lib.optionals (config.sbruder.gui.enable && config.sbruder.full) [
|
||||
] ++ lib.optionals (nixosConfig.sbruder.gui.enable && nixosConfig.sbruder.full) [
|
||||
# communication
|
||||
ungoogled-chromium # useful for exporting pages as pdf
|
||||
|
||||
|
@ -194,7 +194,7 @@ in
|
|||
# office
|
||||
jameica # application framework (used for hibiscus online banking)
|
||||
pdfsam-basic # pdf multitool
|
||||
] ++ lib.optionals (config.sbruder.gui.enable && !config.sbruder.full) [
|
||||
] ++ lib.optionals (nixosConfig.sbruder.gui.enable && !nixosConfig.sbruder.full) [
|
||||
# creative/design
|
||||
gimp # without plugins
|
||||
];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
common = import ./common.nix;
|
||||
solarized = common.colorschemes.solarized;
|
||||
|
@ -19,12 +19,12 @@ let
|
|||
|
||||
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;
|
||||
thinsp = " ";
|
||||
in
|
||||
lib.mkIf config.sbruder.gui.enable {
|
||||
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||
wayland.windowManager.sway = {
|
||||
enable = 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 = ''
|
||||
include "%L"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
{ lib, nixosConfig, ... }:
|
||||
|
||||
{
|
||||
xdg.mimeApps = {
|
||||
enable = config.sbruder.gui.enable;
|
||||
enable = nixosConfig.sbruder.gui.enable;
|
||||
defaultApplications = {
|
||||
"application/pdf" = "org.pwmt.zathura.desktop";
|
||||
"image/png" = "mpv.desktop";
|
||||
|
@ -11,7 +11,7 @@
|
|||
};
|
||||
# Some programs overwrite the mimeapps.list symlink with a normal file which
|
||||
# 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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, ... }:
|
||||
{ nixosConfig, ... }:
|
||||
let
|
||||
common = import ./common.nix;
|
||||
solarized = common.colorschemes.solarized;
|
||||
|
@ -45,7 +45,7 @@ let
|
|||
in
|
||||
{
|
||||
programs.zathura = {
|
||||
enable = config.sbruder.gui.enable;
|
||||
enable = nixosConfig.sbruder.gui.enable;
|
||||
options = {
|
||||
selection-clipboard = "clipboard";
|
||||
} // colorschemes.solarized-dark;
|
||||
|
|
Loading…
Reference in a new issue