refactor: limit use of with lib
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
7fd12f5b04
commit
20dac8791e
16 changed files with 74 additions and 50 deletions
|
@ -1,15 +1,17 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: let
|
||||||
imports = [./programs.nix];
|
inherit (lib) fileContents;
|
||||||
|
|
||||||
programs = {
|
|
||||||
starship = let
|
|
||||||
# TODO: have different colors depending on host
|
# TODO: have different colors depending on host
|
||||||
textColor = "#e3e5e5";
|
textColor = "#e3e5e5";
|
||||||
firstColor = "#bd93f9";
|
firstColor = "#bd93f9";
|
||||||
secondColor = "#715895";
|
secondColor = "#715895";
|
||||||
thirdColor = "#382c4a";
|
thirdColor = "#382c4a";
|
||||||
fourthColor = "#120e18";
|
fourthColor = "#120e18";
|
||||||
in {
|
in {
|
||||||
|
imports = [./programs.nix];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -143,11 +145,11 @@
|
||||||
# Check if shell is interactive
|
# Check if shell is interactive
|
||||||
[[ $- == *i* ]] || return 0
|
[[ $- == *i* ]] || return 0
|
||||||
|
|
||||||
${lib.strings.fileContents ./config/dracula/less.sh}
|
${fileContents ./config/dracula/less.sh}
|
||||||
${lib.strings.fileContents ./config/dracula/fzf.sh}
|
${fileContents ./config/dracula/fzf.sh}
|
||||||
|
|
||||||
${lib.strings.fileContents ./config/colorgrid.sh}
|
${fileContents ./config/colorgrid.sh}
|
||||||
${lib.strings.fileContents ./config/bashrc}
|
${fileContents ./config/bashrc}
|
||||||
'';
|
'';
|
||||||
#initExtra = ''
|
#initExtra = ''
|
||||||
#'';
|
#'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./bash
|
./bash
|
||||||
./git
|
./git
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
coc-stylelintplus-flake,
|
coc-stylelintplus-flake,
|
||||||
tree-sitter-hyprlang-flake,
|
tree-sitter-hyprlang-flake,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib; let
|
|
||||||
inherit (config.vars) neovimIde;
|
inherit (config.vars) neovimIde;
|
||||||
|
inherit (lib) fileContents optionalAttrs optionals;
|
||||||
|
|
||||||
javaSdk = pkgs.temurin-bin-17;
|
javaSdk = pkgs.temurin-bin-17;
|
||||||
nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default;
|
nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./cachix.nix
|
./cachix.nix
|
||||||
./locale.nix
|
./locale.nix
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
lib,
|
lib,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib; let
|
|
||||||
inherit (config.sops.secrets) access-token;
|
inherit (config.sops.secrets) access-token;
|
||||||
|
inherit (lib) hasAttr optionalString;
|
||||||
in {
|
in {
|
||||||
# Minimize dowloads of indirect nixpkgs flakes
|
# Minimize dowloads of indirect nixpkgs flakes
|
||||||
nix = {
|
nix = {
|
||||||
registry.nixpkgs.flake = nixpkgs;
|
registry.nixpkgs.flake = nixpkgs;
|
||||||
nixPath = ["nixpkgs=${nixpkgs}"];
|
nixPath = ["nixpkgs=${nixpkgs}"];
|
||||||
|
|
||||||
extraOptions =
|
extraOptions =
|
||||||
if (hasAttr "sops" config)
|
optionalString (hasAttr "sops" config)
|
||||||
then "!include ${access-token.path}"
|
"!include ${access-token.path}";
|
||||||
else "";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Global hm settings
|
# Global hm settings
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
with lib; let
|
let
|
||||||
|
inherit (lib) concatMapAttrs filterAttrs mkOption pathExists types;
|
||||||
|
|
||||||
mkPackage = name: v: {
|
mkPackage = name: v: {
|
||||||
${name} = pkgs.callPackage ./${name} inputs;
|
${name} = pkgs.callPackage ./${name} inputs;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
options.vars = with lib; let
|
options.vars = let
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (lib) mkOption types;
|
||||||
|
cfg = config.vars;
|
||||||
in {
|
in {
|
||||||
mainUser = mkOption {
|
mainUser = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
|
|
||||||
configDir = mkOption {
|
configDir = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "/home/${mainUser}/.nix/devices/${hostName}/config";
|
default = "/home/${cfg.mainUser}/.nix/devices/${cfg.hostName}/config";
|
||||||
description = ''
|
description = ''
|
||||||
The path to where most of the devices' configs are in the .nix folder
|
The path to where most of the devices' configs are in the .nix folder
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
{config, ...}: let
|
{config, ...}: let
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (config.vars) mainUser hostName;
|
||||||
|
tailscaleNameservers =
|
||||||
|
config
|
||||||
|
.services
|
||||||
|
.headscale
|
||||||
|
.settings
|
||||||
|
.dns_config
|
||||||
|
.nameservers;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
@ -37,7 +44,7 @@ in {
|
||||||
networking = {
|
networking = {
|
||||||
inherit hostName;
|
inherit hostName;
|
||||||
resolvconf.enable = true;
|
resolvconf.enable = true;
|
||||||
nameservers = config.services.headscale.settings.dns_config.nameservers ++ ["1.0.0.1"];
|
nameservers = tailscaleNameservers ++ ["1.0.0.1"];
|
||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) readFile;
|
||||||
inherit (config.vars) mainUser;
|
inherit (config.vars) mainUser;
|
||||||
headscale-flake = headscale.packages.${pkgs.system}.headscale;
|
headscale-flake = headscale.packages.${pkgs.system}.headscale;
|
||||||
in {
|
in {
|
||||||
|
@ -12,7 +13,7 @@ in {
|
||||||
users.users.${mainUser}.extraGroups = ["headscale"];
|
users.users.${mainUser}.extraGroups = ["headscale"];
|
||||||
|
|
||||||
home-manager.users.${mainUser}
|
home-manager.users.${mainUser}
|
||||||
.programs.bash.bashrcExtra = lib.mkAfter (builtins.readFile ./completion.bash);
|
.programs.bash.bashrcExtra = lib.mkAfter (readFile ./completion.bash);
|
||||||
|
|
||||||
services.headscale = {
|
services.headscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -13,7 +13,8 @@ in {
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
IdentityFile ${config.sops.secrets.nixremote.path}
|
IdentityFile ${config.sops.secrets.nixremote.path}
|
||||||
|
|
||||||
# The weakly privileged user on the remote builder – if not set, 'root' is used – which will hopefully fail
|
# The weakly privileged user on the remote builder – if not set,
|
||||||
|
# 'root' is used – which will hopefully fail
|
||||||
User nixremote
|
User nixremote
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,24 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs: let
|
||||||
with lib;
|
inherit
|
||||||
with builtins; let
|
(lib)
|
||||||
|
filter
|
||||||
|
hasSuffix
|
||||||
|
filesystem
|
||||||
|
hasAttr
|
||||||
|
mapAttrs
|
||||||
|
filterAttrs
|
||||||
|
listToAttrs
|
||||||
|
elemAt
|
||||||
|
match
|
||||||
|
removePrefix
|
||||||
|
optionalAttrs
|
||||||
|
mkForce
|
||||||
|
;
|
||||||
inherit (config.vars) mainUser hostName;
|
inherit (config.vars) mainUser hostName;
|
||||||
|
|
||||||
configPath = "/var/lib/arion";
|
configPath = "/var/lib/arion";
|
||||||
in {
|
in {
|
||||||
imports = [arion.nixosModules.arion];
|
imports = [arion.nixosModules.arion];
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib; let
|
inherit (lib) filterAttrs mapAttrs mkDefault mkOption types;
|
||||||
|
|
||||||
cfg = config.services.borgbackup;
|
cfg = config.services.borgbackup;
|
||||||
secrets = config.sops.secrets;
|
secrets = config.sops.secrets;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) readFile;
|
||||||
firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons {});
|
firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons {});
|
||||||
sound-volume = firefox-addons."600-sound-volume";
|
sound-volume = firefox-addons."600-sound-volume";
|
||||||
|
|
||||||
|
@ -22,10 +23,10 @@ in {
|
||||||
id = 0;
|
id = 0;
|
||||||
|
|
||||||
userChrome = ''
|
userChrome = ''
|
||||||
${builtins.readFile "${firefox-gx}/chrome/userChrome.css"}
|
${readFile "${firefox-gx}/chrome/userChrome.css"}
|
||||||
${builtins.readFile ./custom.css}
|
${readFile ./custom.css}
|
||||||
'';
|
'';
|
||||||
extraConfig = builtins.readFile "${firefox-gx}/user.js";
|
extraConfig = readFile "${firefox-gx}/user.js";
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
# Theme
|
# Theme
|
||||||
|
@ -123,7 +124,7 @@ in {
|
||||||
"Noogle" = {
|
"Noogle" = {
|
||||||
urls = [
|
urls = [
|
||||||
{
|
{
|
||||||
template = "https://noogle.dev/?term={searchTerms}";
|
template = "https://noogle.dev/q?term={searchTerms}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
iconUpdateURL = "https://noogle.dev/favicon.ico";
|
iconUpdateURL = "https://noogle.dev/favicon.ico";
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
{
|
{...}: {
|
||||||
nixpkgs,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
programs = {
|
programs = {
|
||||||
wofi = {
|
wofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# FIXME: remove when overlay gets fixed
|
|
||||||
package = pkgs.callPackage "${nixpkgs}/pkgs/applications/misc/wofi/default.nix" {};
|
|
||||||
settings = {
|
settings = {
|
||||||
prompt = "";
|
prompt = "";
|
||||||
allow_images = true;
|
allow_images = true;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib; let
|
inherit (lib) getExe optionals readFile;
|
||||||
inherit (config.vars) mainUser greetdDupe mainMonitor;
|
inherit (config.vars) mainUser greetdDupe mainMonitor;
|
||||||
|
|
||||||
# Nix stuff
|
# Nix stuff
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
with lib; let
|
inherit (lib) concatStringsSep optionals;
|
||||||
# Config stuff
|
|
||||||
inherit (config.vars) configDir mainUser mainMonitor;
|
inherit (config.vars) configDir mainUser mainMonitor;
|
||||||
|
|
||||||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||||
isTouchscreen = config.hardware.sensor.iio.enable;
|
isTouchscreen = config.hardware.sensor.iio.enable;
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue