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 = [../users (sources.home-manager + "/nixos") ];
|
||||||
imports = [ ../../modules ../users (sources.home-manager + "/nixos") ];
|
|
||||||
|
|
||||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||||
boot.loader.grub.configurationLimit = 8;
|
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 = [
|
imports = [
|
||||||
../../services/zfs.nix
|
../../services/zfs.nix
|
||||||
./hardware.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) {
|
config = lib.mkIf (lib.elem "desktop" config.meta.deploy.profiles) {
|
||||||
|
|
||||||
home-manager.users.kat = {
|
home-manager.users.kat = {
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
font.name = style.font.name;
|
font.name = witch.style.font.name;
|
||||||
settings = {
|
settings = {
|
||||||
font_size = style.font.size;
|
font_size = witch.style.font.size;
|
||||||
background = style.base16.color0;
|
background = witch.style.base16.color0;
|
||||||
background_opacity = "0.7";
|
background_opacity = "0.7";
|
||||||
foreground = style.base16.color7;
|
foreground = witch.style.base16.color7;
|
||||||
selection_background = style.base16.color7;
|
selection_background = witch.style.base16.color7;
|
||||||
selection_foreground = style.base16.color0;
|
selection_foreground = witch.style.base16.color0;
|
||||||
url_color = style.base16.color3;
|
url_color = witch.style.base16.color3;
|
||||||
cursor = style.base16.color7;
|
cursor = witch.style.base16.color7;
|
||||||
active_border_color = "#75715e";
|
active_border_color = "#75715e";
|
||||||
active_tab_background = "#9900ff";
|
active_tab_background = "#9900ff";
|
||||||
active_tab_foreground = style.base16.color7;
|
active_tab_foreground = witch.style.base16.color7;
|
||||||
inactive_tab_background = "#3a3a3a";
|
inactive_tab_background = "#3a3a3a";
|
||||||
inactive_tab_foreground = "#665577";
|
inactive_tab_foreground = "#665577";
|
||||||
} // style.base16;
|
} // witch.style.base16;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, witch, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
style = import ./style.nix;
|
|
||||||
secrets = import ../../../secrets.nix;
|
secrets = import ../../../secrets.nix;
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
||||||
|
|
@ -26,16 +25,16 @@ in {
|
||||||
programs.mako = {
|
programs.mako = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultTimeout = 3000;
|
defaultTimeout = 3000;
|
||||||
borderColor = style.base16.color7;
|
borderColor = witch.style.base16.color7;
|
||||||
backgroundColor = "${style.base16.color0}70";
|
backgroundColor = "${witch.style.base16.color0}70";
|
||||||
textColor = style.base16.color7;
|
textColor = witch.style.base16.color7;
|
||||||
};
|
};
|
||||||
|
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = let
|
config = let
|
||||||
dmenu =
|
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";
|
lockCommand = "swaylock -i ${./wallpapers/main.png} -s fill";
|
||||||
cfg = config.home-manager.users.kat.wayland.windowManager.sway.config;
|
cfg = config.home-manager.users.kat.wayland.windowManager.sway.config;
|
||||||
in {
|
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";
|
terminal = "${pkgs.kitty}/bin/kitty";
|
||||||
# TODO: replace with wofi
|
# TODO: replace with wofi
|
||||||
menu =
|
menu =
|
||||||
|
|
@ -192,32 +191,32 @@ in {
|
||||||
|
|
||||||
colors = {
|
colors = {
|
||||||
focused = {
|
focused = {
|
||||||
border = style.base16.color8;
|
border = witch.style.base16.color8;
|
||||||
background = style.base16.color4;
|
background = witch.style.base16.color4;
|
||||||
text = style.base16.color0;
|
text = witch.style.base16.color0;
|
||||||
indicator = style.base16.color2;
|
indicator = witch.style.base16.color2;
|
||||||
childBorder = style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
focusedInactive = {
|
focusedInactive = {
|
||||||
border = style.base16.color0;
|
border = witch.style.base16.color0;
|
||||||
background = style.base16.color11;
|
background = witch.style.base16.color11;
|
||||||
text = style.base16.color12;
|
text = witch.style.base16.color12;
|
||||||
indicator = style.base16.color2;
|
indicator = witch.style.base16.color2;
|
||||||
childBorder = style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
unfocused = {
|
unfocused = {
|
||||||
border = style.base16.color0;
|
border = witch.style.base16.color0;
|
||||||
background = style.base16.color8;
|
background = witch.style.base16.color8;
|
||||||
text = style.base16.color12;
|
text = witch.style.base16.color12;
|
||||||
indicator = style.base16.color8;
|
indicator = witch.style.base16.color8;
|
||||||
childBorder = style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
urgent = {
|
urgent = {
|
||||||
border = style.base16.color8;
|
border = witch.style.base16.color8;
|
||||||
background = style.base16.color9;
|
background = witch.style.base16.color9;
|
||||||
text = style.base16.color0;
|
text = witch.style.base16.color0;
|
||||||
indicator = style.base16.color1;
|
indicator = witch.style.base16.color1;
|
||||||
childBorder = style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, witch, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
style = import ../style.nix;
|
|
||||||
secrets = import ../../../../secrets.nix;
|
secrets = import ../../../../secrets.nix;
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
config = lib.mkIf (lib.elem "sway" config.meta.deploy.profiles) {
|
||||||
|
|
@ -9,8 +8,8 @@ in {
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
enable = true;
|
enable = true;
|
||||||
style = import ./waybar.css.nix {
|
style = import ./waybar.css.nix {
|
||||||
inherit style;
|
style = witch.style;
|
||||||
hextorgba = pkgs.colorhelpers.hextorgba;
|
hextorgba = witch.colorhelpers.hextorgba;
|
||||||
};
|
};
|
||||||
settings = [{
|
settings = [{
|
||||||
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
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 { };
|
pkgs = import ./pkgs { };
|
||||||
hosts = import ./lib/hosts.nix { inherit pkgs; };
|
witch = import ./lib/witch.nix { lib = pkgs.lib; };
|
||||||
in {
|
|
||||||
inherit pkgs;
|
hosts = import ./lib/hosts.nix { inherit pkgs sources witch; };
|
||||||
|
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit (hosts) hosts profiles;
|
|
||||||
deploy = import ./lib/deploy.nix {
|
deploy = import ./lib/deploy.nix {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
inherit (hosts) hosts profiles;
|
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;
|
with pkgs.lib;
|
||||||
|
|
||||||
|
|
@ -7,22 +14,37 @@ rec {
|
||||||
hostNames = attrNames
|
hostNames = attrNames
|
||||||
(filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir));
|
(filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir));
|
||||||
|
|
||||||
hostConfig = hostName:
|
hostConfig = hostName: { config, ... }: {
|
||||||
{ config, ... }: {
|
_module.args = {
|
||||||
_module.args = { inherit hosts profiles; };
|
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; };
|
|
||||||
};
|
};
|
||||||
|
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
|
hosts = listToAttrs (
|
||||||
(import (pkgs.path + "/nixos") { configuration = hostConfig hostName; }))
|
map (
|
||||||
hostNames);
|
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
|
profileNames = unique (concatLists
|
||||||
(mapAttrsToList (name: host: host.config.meta.deploy.profiles) hosts));
|
(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 {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./deploy
|
./deploy
|
||||||
|
|
@ -25,8 +25,6 @@ let
|
||||||
vendor-reset =
|
vendor-reset =
|
||||||
(super.callPackage ./vendor-reset { kernel = ksuper.kernel; }).out;
|
(super.callPackage ./vendor-reset { kernel = ksuper.kernel; }).out;
|
||||||
});
|
});
|
||||||
|
|
||||||
colorhelpers = import ../lib/colorhelpers.nix { inherit (self) lib; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in pkgs.extend (overlay)
|
in pkgs.extend (overlay)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue