mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
Work in progress refactor.
This commit is contained in:
parent
ad1faf2f24
commit
9ece41ee80
14 changed files with 130 additions and 76 deletions
|
|
@ -1,8 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, sources, ... }:
|
||||
|
||||
let sources = import ../../nix/sources.nix;
|
||||
in {
|
||||
imports = [ ../../modules ../users (sources.home-manager + "/nixos") ];
|
||||
{
|
||||
imports = [../users (sources.home-manager + "/nixos") ];
|
||||
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
boot.loader.grub.configurationLimit = 8;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ config, pkgs, lib, sources, witch, ... }:
|
||||
|
||||
let sources = (import ../../../nix/sources.nix);
|
||||
in {
|
||||
{
|
||||
imports = [
|
||||
../../services/zfs.nix
|
||||
./hardware.nix
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, witch, ... }:
|
||||
|
||||
let style = import ./style.nix;
|
||||
in {
|
||||
{
|
||||
config = lib.mkIf (lib.elem "desktop" config.meta.deploy.profiles) {
|
||||
|
||||
home-manager.users.kat = {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font.name = style.font.name;
|
||||
font.name = witch.style.font.name;
|
||||
settings = {
|
||||
font_size = style.font.size;
|
||||
background = style.base16.color0;
|
||||
font_size = witch.style.font.size;
|
||||
background = witch.style.base16.color0;
|
||||
background_opacity = "0.7";
|
||||
foreground = style.base16.color7;
|
||||
selection_background = style.base16.color7;
|
||||
selection_foreground = style.base16.color0;
|
||||
url_color = style.base16.color3;
|
||||
cursor = style.base16.color7;
|
||||
foreground = witch.style.base16.color7;
|
||||
selection_background = witch.style.base16.color7;
|
||||
selection_foreground = witch.style.base16.color0;
|
||||
url_color = witch.style.base16.color3;
|
||||
cursor = witch.style.base16.color7;
|
||||
active_border_color = "#75715e";
|
||||
active_tab_background = "#9900ff";
|
||||
active_tab_foreground = style.base16.color7;
|
||||
active_tab_foreground = witch.style.base16.color7;
|
||||
inactive_tab_background = "#3a3a3a";
|
||||
inactive_tab_foreground = "#665577";
|
||||
} // style.base16;
|
||||
} // witch.style.base16;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{ config, pkgs, lib, witch, ... }:
|
||||
|
||||
let
|
||||
style = import ./style.nix;
|
||||
secrets = import ../../../secrets.nix;
|
||||
in {
|
||||
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
||||
|
|
@ -26,16 +25,16 @@ in {
|
|||
programs.mako = {
|
||||
enable = true;
|
||||
defaultTimeout = 3000;
|
||||
borderColor = style.base16.color7;
|
||||
backgroundColor = "${style.base16.color0}70";
|
||||
textColor = style.base16.color7;
|
||||
borderColor = witch.style.base16.color7;
|
||||
backgroundColor = "${witch.style.base16.color0}70";
|
||||
textColor = witch.style.base16.color7;
|
||||
};
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
config = let
|
||||
dmenu =
|
||||
"${pkgs.bemenu}/bin/bemenu --fn '${style.font.name} ${style.font.size}' --nb '${style.base16.color0}' --nf '${style.base16.color7}' --sb '${style.base16.color1}' --sf '${style.base16.color7}' -l 5 -m -1 -i";
|
||||
"${pkgs.bemenu}/bin/bemenu --fn '${witch.style.font.name} ${witch.style.font.size}' --nb '${witch.style.base16.color0}' --nf '${witch.style.base16.color7}' --sb '${witch.style.base16.color1}' --sf '${witch.style.base16.color7}' -l 5 -m -1 -i";
|
||||
lockCommand = "swaylock -i ${./wallpapers/main.png} -s fill";
|
||||
cfg = config.home-manager.users.kat.wayland.windowManager.sway.config;
|
||||
in {
|
||||
|
|
@ -84,7 +83,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
fonts = [ "${style.font.name} ${style.font.size}" ];
|
||||
fonts = [ "${witch.style.font.name} ${witch.style.font.size}" ];
|
||||
terminal = "${pkgs.kitty}/bin/kitty";
|
||||
# TODO: replace with wofi
|
||||
menu =
|
||||
|
|
@ -192,32 +191,32 @@ in {
|
|||
|
||||
colors = {
|
||||
focused = {
|
||||
border = style.base16.color8;
|
||||
background = style.base16.color4;
|
||||
text = style.base16.color0;
|
||||
indicator = style.base16.color2;
|
||||
childBorder = style.base16.color8;
|
||||
border = witch.style.base16.color8;
|
||||
background = witch.style.base16.color4;
|
||||
text = witch.style.base16.color0;
|
||||
indicator = witch.style.base16.color2;
|
||||
childBorder = witch.style.base16.color8;
|
||||
};
|
||||
focusedInactive = {
|
||||
border = style.base16.color0;
|
||||
background = style.base16.color11;
|
||||
text = style.base16.color12;
|
||||
indicator = style.base16.color2;
|
||||
childBorder = style.base16.color8;
|
||||
border = witch.style.base16.color0;
|
||||
background = witch.style.base16.color11;
|
||||
text = witch.style.base16.color12;
|
||||
indicator = witch.style.base16.color2;
|
||||
childBorder = witch.style.base16.color8;
|
||||
};
|
||||
unfocused = {
|
||||
border = style.base16.color0;
|
||||
background = style.base16.color8;
|
||||
text = style.base16.color12;
|
||||
indicator = style.base16.color8;
|
||||
childBorder = style.base16.color8;
|
||||
border = witch.style.base16.color0;
|
||||
background = witch.style.base16.color8;
|
||||
text = witch.style.base16.color12;
|
||||
indicator = witch.style.base16.color8;
|
||||
childBorder = witch.style.base16.color8;
|
||||
};
|
||||
urgent = {
|
||||
border = style.base16.color8;
|
||||
background = style.base16.color9;
|
||||
text = style.base16.color0;
|
||||
indicator = style.base16.color1;
|
||||
childBorder = style.base16.color8;
|
||||
border = witch.style.base16.color8;
|
||||
background = witch.style.base16.color9;
|
||||
text = witch.style.base16.color0;
|
||||
indicator = witch.style.base16.color1;
|
||||
childBorder = witch.style.base16.color8;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, witch, ... }:
|
||||
|
||||
let
|
||||
style = import ../style.nix;
|
||||
secrets = import ../../../../secrets.nix;
|
||||
in {
|
||||
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
||||
|
|
@ -9,8 +8,8 @@ in {
|
|||
programs.waybar = {
|
||||
enable = true;
|
||||
style = import ./waybar.css.nix {
|
||||
inherit style;
|
||||
hextorgba = pkgs.colorhelpers.hextorgba;
|
||||
style = witch.style;
|
||||
hextorgba = witch.colorhelpers.hextorgba;
|
||||
};
|
||||
settings = [{
|
||||
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
||||
|
|
|
|||
13
default.nix
13
default.nix
|
|
@ -1,13 +1,14 @@
|
|||
let
|
||||
rec {
|
||||
sources = import ./nix/sources.nix;
|
||||
pkgs = import ./pkgs { };
|
||||
hosts = import ./lib/hosts.nix { inherit pkgs; };
|
||||
in {
|
||||
inherit pkgs;
|
||||
witch = import ./lib/witch.nix { lib = pkgs.lib; };
|
||||
|
||||
hosts = import ./lib/hosts.nix { inherit pkgs sources witch; };
|
||||
|
||||
inherit (pkgs) lib;
|
||||
inherit (hosts) hosts profiles;
|
||||
|
||||
deploy = import ./lib/deploy.nix {
|
||||
inherit pkgs;
|
||||
inherit (hosts) hosts profiles;
|
||||
};
|
||||
sources = import ./nix/sources.nix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
{ pkgs, hostsDir ? ../config/hosts, privateHostsDir ? ../config/private/hosts
|
||||
, commonImports ? [ ../config/common ../modules ], pkgsPath ? ../pkgs }:
|
||||
{
|
||||
pkgs,
|
||||
hostsDir ? ../config/hosts,
|
||||
privateHostsDir ? ../config/private/hosts,
|
||||
commonImports ? [ ../config/common ../modules/nixos ],
|
||||
pkgsPath ? ../pkgs,
|
||||
sources ? {},
|
||||
witch ? {}
|
||||
}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
|
|
@ -7,22 +14,37 @@ rec {
|
|||
hostNames = attrNames
|
||||
(filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir));
|
||||
|
||||
hostConfig = hostName:
|
||||
{ config, ... }: {
|
||||
_module.args = { inherit hosts profiles; };
|
||||
imports = [
|
||||
(import (hostsDir + "/${hostName}/configuration.nix"))
|
||||
(import (privateHostsDir + "/${hostName}/configuration.nix"))
|
||||
../modules/deploy
|
||||
] ++ commonImports;
|
||||
networking = { inherit hostName; };
|
||||
nixpkgs.pkgs = import pkgsPath { inherit (config.nixpkgs) config; };
|
||||
hostConfig = hostName: { config, ... }: {
|
||||
_module.args = {
|
||||
inherit hosts profiles;
|
||||
};
|
||||
imports = [
|
||||
(import (hostsDir + "/${hostName}/configuration.nix"))
|
||||
(import (privateHostsDir + "/${hostName}/configuration.nix"))
|
||||
# urgh, yes, we still need to manually import the deploy module for now
|
||||
# at least if i want to keep my thing reusable.
|
||||
../modules/nixos/deploy
|
||||
] ++ commonImports;
|
||||
networking = {
|
||||
inherit hostName;
|
||||
};
|
||||
nixpkgs.pkgs = import pkgsPath { inherit (config.nixpkgs) config; };
|
||||
};
|
||||
|
||||
hosts = listToAttrs (map (hostName:
|
||||
nameValuePair hostName
|
||||
(import (pkgs.path + "/nixos") { configuration = hostConfig hostName; }))
|
||||
hostNames);
|
||||
|
||||
hosts = listToAttrs (
|
||||
map (
|
||||
hostName: nameValuePair hostName (
|
||||
import (pkgs.path + "/nixos/lib/eval-config.nix") {
|
||||
modules = [
|
||||
(hostConfig hostName)
|
||||
(if sources ? home-manager then sources.home-manager + "/nixos" else {})
|
||||
];
|
||||
specialArgs = { inherit sources witch; };
|
||||
}
|
||||
)
|
||||
) hostNames
|
||||
);
|
||||
|
||||
profileNames = unique (concatLists
|
||||
(mapAttrsToList (name: host: host.config.meta.deploy.profiles) hosts));
|
||||
|
|
|
|||
22
lib/modules.nix
Normal file
22
lib/modules.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
modulesDir,
|
||||
defaultFile ? "default.nix",
|
||||
importAll ? false
|
||||
}:
|
||||
|
||||
with builtins;
|
||||
|
||||
let
|
||||
filterAttrNamesToList = filter: set: foldl' (a: b: a ++ b) [] (
|
||||
map (e: if (filter e set.${e}) then [ e ] else []) (attrNames set)
|
||||
);
|
||||
nameValuePair = name: value: { inherit name value; };
|
||||
listToAttrs = foldl' (acc: val: acc // { ${val.name} = val.value; }) {};
|
||||
directories = filterAttrNamesToList (_: type: type == "directory") (readDir modulesDir);
|
||||
files = map (dir: nameValuePair dir (modulesDir + "/${dir}/${defaultFile}")) directories;
|
||||
modules = map ({name, value}:
|
||||
# if the file contains a function, assume it to be a module and pass the path
|
||||
# (for dedup and such). if it contains anything else, pass that.
|
||||
let m = import value; in { inherit name; value = if (isFunction m) && !importAll then value else m; }
|
||||
) files;
|
||||
in (listToAttrs modules)
|
||||
6
lib/witch.nix
Normal file
6
lib/witch.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ lib }:
|
||||
|
||||
{
|
||||
style = import ./style.nix;
|
||||
colorhelpers = import ./colorhelpers.nix { inherit lib; };
|
||||
}
|
||||
10
modules/home/default.nix
Normal file
10
modules/home/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
|
||||
let sources = import ../../nix/sources.nix;
|
||||
in {
|
||||
home-manager.users = {
|
||||
imports = [
|
||||
(sources.tf-nix + "/modules/home/secrets.nix")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{ ... }:
|
||||
|
||||
let sources = import ../nix/sources.nix;
|
||||
let sources = import ../../nix/sources.nix;
|
||||
in {
|
||||
imports = [
|
||||
./deploy
|
||||
|
|
@ -25,8 +25,6 @@ let
|
|||
vendor-reset =
|
||||
(super.callPackage ./vendor-reset { kernel = ksuper.kernel; }).out;
|
||||
});
|
||||
|
||||
colorhelpers = import ../lib/colorhelpers.nix { inherit (self) lib; };
|
||||
};
|
||||
|
||||
in pkgs.extend (overlay)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue