Revisiting dotfiles installation

Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
Ivan Bushchik 2024-01-02 17:17:59 +03:00
parent 607bd19125
commit a23bb49688
No known key found for this signature in database
GPG key ID: 2F16FBF3262E090C
6 changed files with 62 additions and 9 deletions

View file

@ -55,9 +55,11 @@ in {
I "made" some shell in [shells/](./shells).
## Dotfiles (from `ivabus/dotfiles`)
## Dotfiles development
I install my dotfiles with prepared script
As I fully manage my dotfiles through home-manager and `fetchGit` they are readonly.
To install normal version of them disable `my.users.ivabus.dotfiles.enable` and run this command (which installs and links dotfiles)
```
curl https://iva.bz/nix | sh
@ -71,7 +73,6 @@ curl https://iva.bz/nix | sh
- [x] ивабус.рф (proxying not-Nix env)
- Setup "secret" roles (I need them)
- Setup router (in progress with `periculo`, aughhhhhhhhh it seems like I need to crosscompile it for 30 days straight, so no fast progress)
- Setup dotfiles properly with home-manager
## Copyright

View file

@ -1,7 +1,7 @@
{
imports = [
./base.nix
# ./dotfiles.nix unfinished yet
./dotfiles.nix
./git.nix
./laptop.nix
./locale.nix

40
common/dotfiles.nix Normal file
View file

@ -0,0 +1,40 @@
{ config, pkgs, lib, ... }:
let
dotfiles = builtins.fetchGit {
url = "https://github.com/ivabus/dotfiles";
rev = "a13b0d425230661e1942484fcdfb5646abb4fddb";
};
theme = builtins.fetchurl {
url =
"https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme";
};
highlighting = builtins.fetchGit {
url = "https://github.com/zsh-users/zsh-syntax-highlighting.git";
# Just install the latest and don't care about updating
ref = "master";
};
in {
# Option to disable dotfiles for development
options.my.users.ivabus.dotfiles.enable =
lib.mkEnableOption "Enable automatic dotfiles installation";
config.my.users.ivabus.dotfiles.enable = lib.mkDefault true;
config.home-manager = lib.mkIf
(config.my.users.ivabus.enable && config.my.users.ivabus.dotfiles.enable) ({
users.ivabus = {
home.file = {
".config" = {
source = "${dotfiles}/configs";
recursive = true;
};
".config/zsh/themes/ivabus.zsh-theme" = { source = theme; };
".config/zsh/plugins/zsh-syntax-highlighting/" = {
source = highlighting;
recursive = true;
};
".profile" = { source = "${dotfiles}/configs/.profile"; };
".zshrc" = { source = "${dotfiles}/configs/.zshrc"; };
};
};
});
}

View file

@ -5,8 +5,6 @@ in {
options = { my.git.enable = lib.mkEnableOption "Enable git configuration"; };
config = lib.mkIf (cfg.enable && config.my.users.ivabus.enable) {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.ivabus = {
programs.git = {
enable = true;
@ -16,7 +14,6 @@ in {
signing.signByDefault = true;
package = pkgs.gitAndTools.gitFull;
};
home.stateVersion = "23.05";
};
};
}

View file

@ -34,6 +34,7 @@ in rec {
hashedPassword = secrets.hashed-password;
};
programs.gnupg.agent.enable = true;
home-manager.users.ivabus.home.stateVersion = "24.05";
})
(lib.mkIf (cfg.user.enable) {
@ -52,6 +53,7 @@ in rec {
openssh.authorizedKeys.keys = keys;
password = "12345";
};
home-manager.users.user.home.stateVersion = "24.05";
})
({

View file

@ -7,7 +7,7 @@ in {
config = lib.mkIf (cfg.enable) {
nixpkgs.overlays = [
(self: super: {
mpv = super.wrapMpv (super.mpv.unwrapped.override {
mpv = (super.wrapMpv (super.mpv.unwrapped.override {
cddaSupport = true;
# No pulse today
pulseSupport = false;
@ -18,11 +18,24 @@ in {
# Sway only
waylandSupport = config.my.roles.graphical.enable;
javascriptSupport = false;
}) { };
}) { }).override { scripts = [ self.mpvScripts.mpris ]; };
})
];
environment.systemPackages = with pkgs; [ vlc yt-dlp ffmpeg mpv ];
# Setting up only for ivabus user, because user user will use Firefox or anything else to play videos
home-manager.users.ivabus = lib.mkIf (config.my.users.ivabus.enable) {
programs.mpv = {
enable = true;
config = {
profile = "gpu-hq";
ytdl-format = "bestvideo+bestaudio";
sub-font = "JetBrains Mono";
sub-scale = "0.6";
};
};
};
# Add support for CD/DVD/BD drives
boot.initrd.availableKernelModules = [ "sr_mod" ];
};