Rewrite to use Home manager for configuration.
This commit is contained in:
parent
2fe64aecce
commit
772e0ec65c
5
Makefile
5
Makefile
|
@ -23,9 +23,10 @@ live:
|
||||||
|
|
||||||
.PHONY: android
|
.PHONY: android
|
||||||
android:
|
android:
|
||||||
nix-on-droid switch --flake $(flake); \
|
nix-on-droid switch --flake $(flake)
|
||||||
cp ~/.termux/_font.ttf ~/.termux/font.ttf; \
|
cp ~/.termux/_font.ttf ~/.termux/font.ttf
|
||||||
cp ~/.termux/_colors.properties ~/.termux/colors.properties
|
cp ~/.termux/_colors.properties ~/.termux/colors.properties
|
||||||
|
cp ~/.bashrc ~/.bash_profile
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check:
|
check:
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
variables = {
|
|
||||||
# Default text editor.
|
|
||||||
EDITOR = "nvim";
|
|
||||||
|
|
||||||
# App to use for man pages.
|
|
||||||
MANPAGER = "nvim +Man!";
|
|
||||||
|
|
||||||
# Allow unfree packages in shell.
|
|
||||||
NIXPKGS_ALLOW_UNFREE = "1";
|
|
||||||
|
|
||||||
# Current system architecture.
|
|
||||||
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
|
|
||||||
|
|
||||||
# Terminal settings.
|
|
||||||
TERM = "xterm-256color";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
list = with pkgs; [
|
|
||||||
android-tools # Android adb tool. Can be used to connect to itself via wireless debugging.
|
|
||||||
binwalk # Can analyze files for other files inside them.
|
|
||||||
curl # CLI http client.
|
|
||||||
exiftool # Image info.
|
|
||||||
ffmpeg # Video/audio converter.
|
|
||||||
file # Get general info about a file.
|
|
||||||
gdu # TUI storage analyzer.
|
|
||||||
git # Version control system.
|
|
||||||
gnutar gzip xz # Archive and compression tools.
|
|
||||||
imagemagick # Image converter and transformation tool.
|
|
||||||
inetutils # Things like FTP.
|
|
||||||
jq # Json parser.
|
|
||||||
lsof # Find current file users.
|
|
||||||
man # App to read manuals.
|
|
||||||
gcc # C compiler.
|
|
||||||
nmap # Network analyzer.
|
|
||||||
openssh # Ssh client.
|
|
||||||
parallel # Run programs in parallel.
|
|
||||||
pv # IO progress bar.
|
|
||||||
radare2 # Hex editor.
|
|
||||||
ripgrep # Grep for file search.
|
|
||||||
rsync # File copy tool.
|
|
||||||
sqlite # Serverless file-based database engine.
|
|
||||||
tmux # Terminal multiplexor.
|
|
||||||
tree # Show directory stricture as a tree.
|
|
||||||
wget # CLI http download tool.
|
|
||||||
wireguard-tools # Tools to work with Wireguard.
|
|
||||||
yazi chafa # CLI file manager.
|
|
||||||
yt-dlp # Video downloader.
|
|
||||||
zip unzip # Zip archive/unarchive tools.
|
|
||||||
|
|
||||||
coreutils dnsutils diffutils findutils utillinux # Common utilities.
|
|
||||||
gawk gnused gnugrep gnumake ripgrep # Common Gnu utils.
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, inputs
|
|
||||||
, const
|
|
||||||
, lib
|
|
||||||
, util
|
|
||||||
, config
|
|
||||||
, secret
|
|
||||||
, ... } @args: let
|
|
||||||
# Path where Termux stores user data.
|
|
||||||
homePath = "/data/data/com.termux.nix/files/home";
|
|
||||||
|
|
||||||
# Android modules.
|
|
||||||
environment = import ./Environment.nix args;
|
|
||||||
git = import ./Git.nix args;
|
|
||||||
package = import ./Package.nix args;
|
|
||||||
termux = import ./Termux.nix args;
|
|
||||||
|
|
||||||
# External modules.
|
|
||||||
bash = import ../module/common/bash args;
|
|
||||||
nvim = import ../module/common/nvim args;
|
|
||||||
ssh = import ../module/common/ssh args;
|
|
||||||
stylix = import ../module/common/Stylix.nix args;
|
|
||||||
tmux = import ../module/common/tmux args;
|
|
||||||
yazi = import ../user/common/yazi args;
|
|
||||||
in {
|
|
||||||
# Configure system.
|
|
||||||
time.timeZone = const.timeZone;
|
|
||||||
nix.extraOptions = "experimental-features = nix-command flakes";
|
|
||||||
|
|
||||||
# Install packages.
|
|
||||||
environment.packages = package.list;
|
|
||||||
|
|
||||||
# Home manager config.
|
|
||||||
home-manager.config = stylix // {
|
|
||||||
imports = [
|
|
||||||
inputs.stylix.homeManagerModules.stylix
|
|
||||||
];
|
|
||||||
|
|
||||||
home = {
|
|
||||||
# Release version.
|
|
||||||
stateVersion = const.droidStateVersion;
|
|
||||||
|
|
||||||
# Environment variables.
|
|
||||||
sessionVariables = environment.variables;
|
|
||||||
|
|
||||||
# Where to put config files.
|
|
||||||
file = {
|
|
||||||
".dotfiles".source = inputs.self;
|
|
||||||
".ssh/config".text = ssh.config;
|
|
||||||
".termux/_font.ttf".source = termux.font;
|
|
||||||
".termux/_colors.properties".text = termux.colors;
|
|
||||||
".config/yazi/init.lua".source = yazi.init;
|
|
||||||
".config/yazi/keymap.toml".source = yazi.keymap;
|
|
||||||
".config/yazi/theme.toml".source = yazi.theme;
|
|
||||||
".config/yazi/yazi.toml".source = yazi.yazi;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Special app configuration.
|
|
||||||
programs = {
|
|
||||||
home-manager.enable = true;
|
|
||||||
|
|
||||||
bash = {
|
|
||||||
enable = true;
|
|
||||||
bashrcExtra = bash.config + termux.initScript;
|
|
||||||
};
|
|
||||||
|
|
||||||
tmux = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = tmux.config;
|
|
||||||
};
|
|
||||||
|
|
||||||
git = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = git.config;
|
|
||||||
};
|
|
||||||
|
|
||||||
neovim = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = nvim.config;
|
|
||||||
};
|
|
||||||
|
|
||||||
gpg = {
|
|
||||||
enable = true;
|
|
||||||
inherit (secret.crypto) publicKeys;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ pkgs, config, ... }: {
|
{ pkgs, config, __findFile, ... }: {
|
||||||
stylix = {
|
stylix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
image = config.module.common.wallpaper.path;
|
image = config.module.wallpaper.path;
|
||||||
autoEnable = true;
|
autoEnable = true;
|
||||||
polarity = "dark";
|
polarity = "dark";
|
||||||
opacity = {
|
opacity = {
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
};
|
};
|
||||||
fonts = let
|
fonts = let
|
||||||
serif = {
|
serif = {
|
||||||
package = (pkgs.callPackage ./applefont {});
|
package = (pkgs.callPackage <package/applefont> {});
|
||||||
name = "SF Pro Display";
|
name = "SF Pro Display";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
name = "Noto Color Emoji";
|
name = "Noto Color Emoji";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
override = if config.module.common.wallpaper.forceContrastText then {
|
override = if config.module.wallpaper.forceContrastText then {
|
||||||
base04 = "000000";
|
base04 = "000000";
|
||||||
base05 = "ffffff";
|
base05 = "ffffff";
|
||||||
base06 = "ffffff";
|
base06 = "ffffff";
|
|
@ -4,7 +4,7 @@
|
||||||
forceContrastText = false;
|
forceContrastText = false;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
module.common.wallpaper = {
|
module.wallpaper = {
|
||||||
forceContrastText = mkOption {
|
forceContrastText = mkOption {
|
||||||
default = forceContrastText;
|
default = forceContrastText;
|
||||||
type = types.bool;
|
type = types.bool;
|
122
flake.nix
122
flake.nix
|
@ -137,14 +137,18 @@
|
||||||
url = "https://git.voronind.com/voronind/nixos.git";
|
url = "https://git.voronind.com/voronind/nixos.git";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations = let
|
# Hack to use <container/Change.nix> in other files.
|
||||||
# List all files in a dir.
|
# Need to add __findFile to args tho.
|
||||||
lsFiles = path: map (f: "${path}/${f}") (
|
__findFile = _: p: ./${p};
|
||||||
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
|
|
||||||
builtins.attrNames (builtins.readDir path)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
# List all files in a dir.
|
||||||
|
lsFiles = path: map (f: "${path}/${f}") (
|
||||||
|
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
|
||||||
|
builtins.attrNames (builtins.readDir path)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
nixosConfigurations = let
|
||||||
# Function to create a host. It does basic setup, like adding common modules.
|
# Function to create a host. It does basic setup, like adding common modules.
|
||||||
mkHost = { system, hostname, modules } @args: nixpkgs.lib.nixosSystem {
|
mkHost = { system, hostname, modules } @args: nixpkgs.lib.nixosSystem {
|
||||||
# `Inherit` is just an alias for `system = system;`, which means that
|
# `Inherit` is just an alias for `system = system;`, which means that
|
||||||
|
@ -164,12 +168,11 @@
|
||||||
|
|
||||||
# Add modules.
|
# Add modules.
|
||||||
{ imports =
|
{ imports =
|
||||||
(lsFiles ./container) ++
|
(self.lsFiles ./config) ++
|
||||||
(lsFiles ./module) ++
|
(self.lsFiles ./container) ++
|
||||||
(lsFiles ./module/common) ++
|
(self.lsFiles ./module) ++
|
||||||
(lsFiles ./module/desktop) ++
|
(self.lsFiles ./overlay) ++
|
||||||
(lsFiles ./overlay) ++
|
[ ./home/NixOs.nix ];
|
||||||
(lsFiles ./user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add Home Manager module.
|
# Add Home Manager module.
|
||||||
|
@ -184,23 +187,20 @@
|
||||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
config = self.nixosConfigurations.${hostname}.config;
|
config = self.nixosConfigurations.${hostname}.config;
|
||||||
|
in {
|
||||||
|
inherit inputs self;
|
||||||
|
inherit (self) const __findFile;
|
||||||
|
|
||||||
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
||||||
pkgsStable = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs;
|
||||||
pkgsMaster = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
||||||
|
|
||||||
secret = import ./secret {}; # Secrets (public keys).
|
secret = import ./secret {}; # Secrets (public keys).
|
||||||
container = import ./lib/Container.nix { inherit lib pkgs config; inherit (self) const; }; # Container utils.
|
container = import ./lib/Container.nix { inherit lib pkgs config; inherit (self) const; }; # Container utils.
|
||||||
util = import ./lib/Util.nix { inherit lib; }; # Util functions.
|
util = import ./lib/Util.nix { inherit lib; }; # Util functions.
|
||||||
in {
|
|
||||||
inherit secret container util inputs;
|
|
||||||
inherit (self) const;
|
|
||||||
|
|
||||||
# Stable and Master pkgs.
|
|
||||||
inherit pkgsStable pkgsMaster;
|
|
||||||
|
|
||||||
# Stuff for Jobber container, skip this part.
|
# Stuff for Jobber container, skip this part.
|
||||||
inherit poetry2nixJobber pkgsJobber;
|
inherit poetry2nixJobber;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -221,10 +221,10 @@
|
||||||
{ services.openssh.settings.PermitRootLogin = nixpkgs.lib.mkForce "yes"; }
|
{ services.openssh.settings.PermitRootLogin = nixpkgs.lib.mkForce "yes"; }
|
||||||
|
|
||||||
# Disable auto-updates as they are not possible for Live ISO.
|
# Disable auto-updates as they are not possible for Live ISO.
|
||||||
{ module.common.autoupdate.enable = false; }
|
{ module.autoupdate.enable = false; }
|
||||||
|
|
||||||
# Base Live images also require the LTS kernel.
|
# Base Live images also require the LTS kernel.
|
||||||
{ module.common.kernel.latest = false; }
|
{ module.kernel.latest = false; }
|
||||||
];
|
];
|
||||||
|
|
||||||
x86System = hostname: mkSystem hostname "x86_64-linux" [];
|
x86System = hostname: mkSystem hostname "x86_64-linux" [];
|
||||||
|
@ -245,6 +245,58 @@
|
||||||
(x86LiveSystem "live")
|
(x86LiveSystem "live")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# Home manager (distro-independent).
|
||||||
|
# Install nix: sh <(curl -L https://nixos.org/nix/install) --no-daemon
|
||||||
|
# Or with --daemon for multi-user (as root).
|
||||||
|
# $ nix run home-manager/master -- init --switch
|
||||||
|
# $ nix shell '<home-manager>' -A install
|
||||||
|
# Add to /etc/nix/nix.conf > experimental-features = nix-command flakes
|
||||||
|
# And then # systemctl restart nix-daemon.service
|
||||||
|
# $ home-manager switch --flake ~/hmconf
|
||||||
|
homeConfigurations = let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
secret = import ./secret {};
|
||||||
|
util = import ./lib/Util.nix { inherit lib; };
|
||||||
|
|
||||||
|
mkCommonHome = username: homeDirectory: system: modules: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
pkgsStable = nixpkgsStable.legacyPackages.${system};
|
||||||
|
pkgsMaster = nixpkgsMaster.legacyPackages.${system};
|
||||||
|
in {
|
||||||
|
${username} = home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit self inputs secret util pkgs pkgsStable pkgsMaster;
|
||||||
|
inherit (self) const __findFile;
|
||||||
|
};
|
||||||
|
modules = modules ++ (self.lsFiles ./config) ++ [
|
||||||
|
./home/HomeManager.nix
|
||||||
|
{ home.hm.enable = true; }
|
||||||
|
{ home.hm.username = username; }
|
||||||
|
{ home.hm.homeDirectory = homeDirectory; }
|
||||||
|
{ home.hm.packages.core.enable = true; }
|
||||||
|
|
||||||
|
{ nixpkgs.config.allowUnfree = true; }
|
||||||
|
{ nixpkgs.config.allowUnfreePredicate = (pkg: true); }
|
||||||
|
{ nix.package = pkgs.nix; }
|
||||||
|
{ nix.settings.experimental-features = [ "nix-command " "flakes" ]; }
|
||||||
|
|
||||||
|
inputs.stylix.homeManagerModules.stylix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
x86LinuxHome = username: modules: mkCommonHome username "/home/${username}" "x86_64-linux" modules;
|
||||||
|
x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" [];
|
||||||
|
in nixpkgs.lib.foldl' (acc: h: acc // h) {} [
|
||||||
|
x86LinuxRoot
|
||||||
|
(x86LinuxHome "voronind" [
|
||||||
|
{ home.hm.packages.common.enable = true; }
|
||||||
|
])
|
||||||
|
];
|
||||||
|
|
||||||
# Android.
|
# Android.
|
||||||
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
|
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
modules = let
|
modules = let
|
||||||
|
@ -255,12 +307,18 @@
|
||||||
{ system.stateVersion = self.const.droidStateVersion; }
|
{ system.stateVersion = self.const.droidStateVersion; }
|
||||||
|
|
||||||
# I put all my Android configuration there.
|
# I put all my Android configuration there.
|
||||||
./android
|
./home/Android.nix
|
||||||
|
{ home.android.enable = true; }
|
||||||
|
|
||||||
|
# { nixpkgs.config.allowUnfree = true; }
|
||||||
|
# { nixpkgs.config.allowUnfreePredicate = (pkg: true); }
|
||||||
|
{ nix.extraOptions = "experimental-features = nix-command flakes"; }
|
||||||
|
{ home-manager.config.stylix.autoEnable = lib.mkForce false; }
|
||||||
|
|
||||||
# Some common modules.
|
# Some common modules.
|
||||||
./module/common/Setting.nix
|
./config/Setting.nix
|
||||||
./module/common/Wallpaper.nix
|
./config/Wallpaper.nix
|
||||||
(import ./module/common/Style.nix { inherit lib; inherit (config.home-manager) config; })
|
(import ./config/Style.nix { inherit lib; inherit (config.home-manager) config; })
|
||||||
];
|
];
|
||||||
|
|
||||||
# SpecialArgs allows you to pass objects down to other configuration.
|
# SpecialArgs allows you to pass objects down to other configuration.
|
||||||
|
@ -269,11 +327,11 @@
|
||||||
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
|
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
in {
|
in {
|
||||||
inherit inputs;
|
inherit inputs self;
|
||||||
inherit (self) const;
|
inherit (self) const __findFile;
|
||||||
|
|
||||||
secret = import ./secret {}; # Secrets (public keys).
|
secret = import ./secret {}; # Secrets (public keys).
|
||||||
util = import ./lib/Util.nix { inherit lib; }; # Util functions.
|
util = import ./lib/Util.nix { inherit lib; }; # Util functions.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
40
home/Android.nix
Normal file
40
home/Android.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# This is a common user configuration.
|
||||||
|
{ const
|
||||||
|
, pkgs
|
||||||
|
, self
|
||||||
|
, config
|
||||||
|
, lib
|
||||||
|
, inputs
|
||||||
|
, pkgsStable
|
||||||
|
, pkgsMaster
|
||||||
|
, __findFile
|
||||||
|
, ... } @args: with lib; let
|
||||||
|
cfg = config.home.android;
|
||||||
|
stylix = import <config/Stylix.nix> args;
|
||||||
|
android = import ./android args;
|
||||||
|
package = import <package> args;
|
||||||
|
# homePath = "/data/data/com.termux.nix/files/home";
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
home.android = {
|
||||||
|
enable = mkEnableOption "Android HM config.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
time.timeZone = const.timeZone;
|
||||||
|
environment.packages = package.core;
|
||||||
|
home-manager.config = stylix // {
|
||||||
|
imports = [ inputs.stylix.homeManagerModules.stylix ];
|
||||||
|
home = {
|
||||||
|
stateVersion = const.droidStateVersion;
|
||||||
|
sessionVariables = import ./variable args;
|
||||||
|
file = (import ./config args) // {
|
||||||
|
".termux/_font.ttf".source = android.font;
|
||||||
|
".termux/_colors.properties".text = android.colors;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs = import ./program args;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
59
home/HomeManager.nix
Normal file
59
home/HomeManager.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# This is a common user configuration.
|
||||||
|
{ const
|
||||||
|
, util
|
||||||
|
, config
|
||||||
|
, lib
|
||||||
|
, __findFile
|
||||||
|
, ... } @args: with lib; let
|
||||||
|
cfg = config.home.hm;
|
||||||
|
package = import <package> args;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
home.hm = {
|
||||||
|
enable = mkEnableOption "Home-Manager standalone config.";
|
||||||
|
username = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
homeDirectory = mkOption {
|
||||||
|
default = "/home/${cfg.username}";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
packages = mkOption {
|
||||||
|
default = {};
|
||||||
|
type = types.submodule {
|
||||||
|
options = {
|
||||||
|
core.enable = mkEnableOption "Core apps.";
|
||||||
|
common.enable = mkEnableOption "Common apps.";
|
||||||
|
desktop.enable = mkEnableOption "Desktop apps.";
|
||||||
|
gaming.enable = mkEnableOption "Gaming apps.";
|
||||||
|
creative.enable = mkEnableOption "Creative apps.";
|
||||||
|
dev.enable = mkEnableOption "Dev apps.";
|
||||||
|
extra.enable = mkEnableOption "Extra apps.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{
|
||||||
|
home = {
|
||||||
|
inherit (cfg) username homeDirectory;
|
||||||
|
inherit (const) stateVersion;
|
||||||
|
file = import ./config args;
|
||||||
|
sessionVariables = import ./variable args;
|
||||||
|
};
|
||||||
|
xdg = import ./xdg { inherit (cfg) homeDirectory; };
|
||||||
|
programs = import ./program args;
|
||||||
|
dconf.settings = util.catSet (util.ls ./config/dconf) args;
|
||||||
|
}
|
||||||
|
(mkIf cfg.packages.core.enable { home.packages = package.core; })
|
||||||
|
(mkIf cfg.packages.common.enable { home.packages = package.common; })
|
||||||
|
(mkIf cfg.packages.desktop.enable { home.packages = package.desktop; })
|
||||||
|
(mkIf cfg.packages.gaming.enable { home.packages = package.gaming; })
|
||||||
|
(mkIf cfg.packages.creative.enable { home.packages = package.creative; })
|
||||||
|
(mkIf cfg.packages.dev.enable { home.packages = package.dev; })
|
||||||
|
(mkIf cfg.packages.extra.enable { home.packages = package.extra; })
|
||||||
|
]);
|
||||||
|
}
|
41
home/NixOs.nix
Normal file
41
home/NixOs.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# This is a common user configuration.
|
||||||
|
{ const
|
||||||
|
, config
|
||||||
|
, util
|
||||||
|
, lib
|
||||||
|
, pkgs
|
||||||
|
, ... } @args: with lib; let
|
||||||
|
cfg = config.home.nixos;
|
||||||
|
in {
|
||||||
|
imports = (util.ls ./user);
|
||||||
|
|
||||||
|
options = {
|
||||||
|
home.nixos = {
|
||||||
|
enable = mkEnableOption "NixOS user setup.";
|
||||||
|
users = mkOption {
|
||||||
|
default = [];
|
||||||
|
type = types.listOf types.attrs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home-manager = {
|
||||||
|
users = builtins.foldl' (acc: user: acc // {
|
||||||
|
${user.username} = {
|
||||||
|
home = {
|
||||||
|
inherit (const) stateVersion;
|
||||||
|
inherit (user) username homeDirectory;
|
||||||
|
file = import ./config args;
|
||||||
|
sessionVariables = import ./variable args;
|
||||||
|
};
|
||||||
|
xdg = import ./xdg { inherit (user) homeDirectory; };
|
||||||
|
programs = import ./program args;
|
||||||
|
dconf.settings = util.catSet (util.ls ./config/dconf) args;
|
||||||
|
};
|
||||||
|
}) {} cfg.users;
|
||||||
|
|
||||||
|
backupFileExtension = "old";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, config, util, ... }: {
|
{ pkgs, util, config, ... }: {
|
||||||
font = pkgs.runCommandNoCC "font" {} ''
|
font = pkgs.runCommandNoCC "font" {} ''
|
||||||
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
|
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
|
||||||
'';
|
'';
|
||||||
|
@ -7,12 +7,4 @@
|
||||||
background=#${config.style.color.bg.dark}
|
background=#${config.style.color.bg.dark}
|
||||||
foreground=#${config.style.color.fg.light}
|
foreground=#${config.style.color.fg.light}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
initScript = util.trimTabs ''
|
|
||||||
[[ -f ~/.termux/font.ttf ]] || {
|
|
||||||
cp ~/.termux/_font.ttf ~/.termux/font.ttf
|
|
||||||
cp ~/.termux/_colors.properties ~/.termux/colors.properties
|
|
||||||
_warn "Termux config installed, please restart."
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
}
|
}
|
38
home/config/bash/default.nix
Normal file
38
home/config/bash/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ util, pkgs, ... } @args: let
|
||||||
|
modules = util.catText (util.ls ./module) args;
|
||||||
|
modulesFile = pkgs.writeText "BashModules" modules;
|
||||||
|
in {
|
||||||
|
inherit modules modulesFile;
|
||||||
|
|
||||||
|
bashrc = modules + util.trimTabs ''
|
||||||
|
# Find all functions.
|
||||||
|
function find_function() {
|
||||||
|
/usr/bin/env cat ${modulesFile} | /usr/bin/env grep "^function.*()" | /usr/bin/env sed -e "s/^function //" -e "s/().*//"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Export all functions.
|
||||||
|
export -f $(find_function | tr '\n' ' ')
|
||||||
|
export -f find_function
|
||||||
|
|
||||||
|
# Autostart Sway.
|
||||||
|
if [[ -z $DISPLAY ]] && [[ "$(tty)" = "/dev/tty1" ]]; then
|
||||||
|
exec sway
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
bash_profile = util.trimTabs ''
|
||||||
|
# Home manager.
|
||||||
|
[ -e ~/.nix-profile/etc/profile.d/nix.sh ] && source ~/.nix-profile/etc/profile.d/nix.sh
|
||||||
|
|
||||||
|
# Bashrc.
|
||||||
|
[ -f ~/.bashrc ] && source ~/.bashrc
|
||||||
|
|
||||||
|
# Profile.
|
||||||
|
[ -f ~/.profile ] && source ~/.profile
|
||||||
|
'';
|
||||||
|
|
||||||
|
profile = util.trimTabs ''
|
||||||
|
# Load HM vars.
|
||||||
|
[ -e ~/.nix-profile/etc/profile.d/hm-session-vars.sh ] && source ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||||
|
'';
|
||||||
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Cut full paths.
|
# Cut full paths.
|
||||||
target="''${target##*/}"
|
[[ "''${target##*/}" = "" ]] || target="''${target##*/}"
|
||||||
|
|
||||||
local date=$(_archive_date)
|
local date=$(_archive_date)
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Cut full paths.
|
# Cut full paths.
|
||||||
target="''${target##*/}"
|
[[ "''${target##*/}" = "" ]] || target="''${target##*/}"
|
||||||
|
|
||||||
# Start timestamp.
|
# Start timestamp.
|
||||||
local date=$(_archive_date)
|
local date=$(_archive_date)
|
48
home/config/default.nix
Normal file
48
home/config/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{ self, config, ... } @args: let
|
||||||
|
bash = import ./bash args;
|
||||||
|
btop = import ./top/btop args;
|
||||||
|
editor = import ./editorconfig args;
|
||||||
|
foot = import ./foot args;
|
||||||
|
fuzzel = import ./fuzzel args;
|
||||||
|
git = import ./git args;
|
||||||
|
gtk3 = import ./gtk/3 args;
|
||||||
|
htop = import ./top/htop args;
|
||||||
|
keyd = import ./keyd args;
|
||||||
|
mako = import ./mako args;
|
||||||
|
mangohud = import ./mangohud args;
|
||||||
|
nvim = import ./nvim args;
|
||||||
|
ssh = import ./ssh args;
|
||||||
|
sway = import ./sway args;
|
||||||
|
tmux = import ./tmux args;
|
||||||
|
waybar = import ./waybar args;
|
||||||
|
yazi = import ./yazi args;
|
||||||
|
in {
|
||||||
|
".bashrc".text = bash.bashrc;
|
||||||
|
".bash_profile".text = bash.bash_profile;
|
||||||
|
".profile".text = bash.profile;
|
||||||
|
".config/MangoHud/MangoHud.conf".text = mangohud.config;
|
||||||
|
".config/MangoHud/presets.conf".text = mangohud.presets;
|
||||||
|
".config/btop/btop.conf".text = btop.text;
|
||||||
|
".config/foot/foot.ini".source = foot.file;
|
||||||
|
".config/fuzzel/fuzzel.ini".source = fuzzel.file;
|
||||||
|
".config/gtk-3.0/bookmarks".text = gtk3.bookmarks;
|
||||||
|
".config/htop/htoprc".text = htop.text;
|
||||||
|
".config/keyd/app.conf".text = keyd.text;
|
||||||
|
".config/mako/config".source = mako.file;
|
||||||
|
".config/nvim/init.vim".text = nvim.text;
|
||||||
|
".config/sway/config".text = sway.text;
|
||||||
|
".config/tmux/tmux.conf".text = tmux.text;
|
||||||
|
".config/waybar/config".source = waybar.config;
|
||||||
|
".config/waybar/style.css".source = waybar.style;
|
||||||
|
".config/yazi/init.lua".source = yazi.init;
|
||||||
|
".config/yazi/keymap.toml".source = yazi.keymap;
|
||||||
|
".config/yazi/theme.toml".source = yazi.theme;
|
||||||
|
".config/yazi/yazi.toml".source = yazi.yazi;
|
||||||
|
".editorconfig".source = editor.file;
|
||||||
|
".gitconfig".source = git.file;
|
||||||
|
".nixos".source = self;
|
||||||
|
".parallel/will-cite".text = "";
|
||||||
|
".ssh/config".text = ssh.text;
|
||||||
|
".wallpaper".source = config.module.wallpaper.path;
|
||||||
|
"media/template".source = ./template;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{ secret, ... }: {
|
{ secret, pkgs, ... }: {
|
||||||
config = {
|
file = (pkgs.formats.gitIni { listsAsDuplicateKeys = true; }).generate "GitConfig" {
|
||||||
credential.helper = "store";
|
credential.helper = "store";
|
||||||
gpg.format = secret.crypto.sign.git.format;
|
gpg.format = secret.crypto.sign.git.format;
|
||||||
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
|
gpg.ssh.allowedSignersFile = toString secret.crypto.sign.git.allowed;
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
push.autoSetupRemote = true;
|
push.autoSetupRemote = true;
|
||||||
rebase.autoStash = true;
|
rebase.autoStash = true;
|
||||||
|
safe.directory = "*";
|
||||||
user.signingkey = builtins.readFile secret.crypto.sign.git.key;
|
user.signingkey = builtins.readFile secret.crypto.sign.git.key;
|
||||||
};
|
};
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue