Compare commits

...

3 commits

Author SHA1 Message Date
Geoffrey Frogeye 43e7a5af46
style: Split out and fixes 2024-01-15 19:26:44 +01:00
Geoffrey Frogeye 1b008c1ae8
presentation: Split out 2024-01-15 18:54:19 +01:00
Geoffrey Frogeye c1d8bc65af
Update and more backups 2024-01-15 18:36:51 +01:00
16 changed files with 185 additions and 151 deletions

View file

@ -2,13 +2,13 @@
# MANU Snapper is not able to create the snapshot directory, so you'll need to do this after eventually running the backup script: # MANU Snapper is not able to create the snapshot directory, so you'll need to do this after eventually running the backup script:
# sudo btrfs subvol create /mnt/razmo/$subvolume/.snapshots # sudo btrfs subvol create /mnt/razmo/$subvolume/.snapshots
let let
backup_subvolumes = [ "nixos" "home.rapido" ]; backup_subvolumes = [ "nixos" "home.rapido" "home.nixos" ];
backup_app = pkgs.writeShellApplication { backup_app = pkgs.writeShellApplication {
name = "backup-subvolume"; name = "backup-subvolume";
runtimeInputs = with pkgs; [ coreutils btrfs-progs ]; runtimeInputs = with pkgs; [ coreutils btrfs-progs ];
text = builtins.readFile ./backup.sh; text = builtins.readFile ./backup.sh;
}; };
snapper_subvolumes = [ "nixos" "home.rapido" "home.razmo" ]; snapper_subvolumes = [ "nixos" "home.rapido" "home.razmo" "home.nixos" ];
in in
{ {
services = services =

View file

@ -137,11 +137,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1704741201, "lastModified": 1705281959,
"narHash": "sha256-Y420NeqPWRSpxHpXsxhKILfTxT5exjtTgCgDwSpcEfU=", "narHash": "sha256-9NZiSMAduz4qbFu77Cg9RNFcrjgS9UOjriD+v8FeueY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "f0a3425a7b173701922e7959d8bfb136ef53aa54", "rev": "2a561be6b5dd049182af1973bb7e28f7a0ac9be2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -277,11 +277,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1704099619, "lastModified": 1705273357,
"narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=", "narHash": "sha256-JAlkxgJbWh7+auiT0rJL3IUXXtkULRqygfxQA6mvLgc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851", "rev": "924d91e1e4c802fd8e60279a022dbae5acb36f2d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -334,11 +334,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1704786394, "lastModified": 1705312285,
"narHash": "sha256-aJM0ln9fMGWw1+tjyl5JZWZ3ahxAA2gw2ZpZY/hkEMs=", "narHash": "sha256-rd+dY+v61Y8w3u9bukO/hB55Xl4wXv4/yC8rCGVnK5U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "b34a6075e9e298c4124e35c3ccaf2210c1f3a43b", "rev": "bee2202bec57e521e3bd8acd526884b9767d7fa0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -348,11 +348,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1704420045, "lastModified": 1705183652,
"narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=", "narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d", "rev": "428544ae95eec077c7f823b422afae5f174dee4b",
"type": "github" "type": "github"
}, },
"original": { "original": {

36
hm/brightness/default.nix Normal file
View file

@ -0,0 +1,36 @@
# Light theme during the day, dark theme during the night (not automatic)
{ pkgs, lib, config, ... }:
let
phases = [
{ command = "jour"; polarity = "light"; }
{ command = "crepuscule"; polarity = "dark"; }
{ command = "nuit"; polarity = "dark"; }
];
phasesBrightness = config.frogeye.desktop.phasesBrightness;
in
{
config = {
home.packages = map
(phase: (pkgs.writeShellApplication {
name = "${phase.command}";
runtimeInputs = [ pkgs.brightnessctl ];
text = (lib.optionalString phasesBrightness.enable ''
brightnessctl set ${builtins.getAttr phase.command phasesBrightness}
'') + ''
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
if [ -x "$switch" ]
then
# In two steps to get the visual changes slightly earlier
sudo "$switch" test
sudo "$switch" boot
fi
'';
})
)
phases;
xsession.windowManager.i3.config.keybindings = {
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
};
};
}

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
../options.nix ../options.nix
./brightness
./common.nix ./common.nix
./desktop ./desktop
./dev ./dev
@ -18,7 +19,7 @@
./rebuild ./rebuild
./shell ./shell
./ssh.nix ./ssh.nix
./style.nix ./theme
./tmux ./tmux
./usernix ./usernix
./vim ./vim

View file

@ -0,0 +1,13 @@
{ pkgs, config, lib, ... }:
{
config = lib.mkIf config.frogeye.desktop.xorg {
stylix.image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
# This correctly sets the background on some occasions, below does the rest
programs.autorandr.hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
};
};
}

View file

@ -7,11 +7,14 @@ in
imports = [ imports = [
./audio ./audio
./autorandr ./autorandr
./background
./frobar ./frobar
./i3.nix ./i3.nix
./lock ./lock
./mpd ./mpd
./presentation
./qutebrowser.nix ./qutebrowser.nix
./redness
./screenshots ./screenshots
]; ];
config = lib.mkIf config.frogeye.desktop.xorg { config = lib.mkIf config.frogeye.desktop.xorg {

View file

@ -62,9 +62,6 @@ in
}"; }";
"${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt"; "${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt";
"${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar"; "${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar";
# Backlight
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
# Misc # Misc
"${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout" "${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout"
'' ''
@ -161,9 +158,6 @@ in
hideEdgeBorders = "both"; hideEdgeBorders = "both";
titlebar = false; # So that single-container screens are basically almost fullscreen titlebar = false; # So that single-container screens are basically almost fullscreen
commands = [ commands = [
# Open specific applications in floating mode
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
# switch to workspace with urgent window automatically # switch to workspace with urgent window automatically
{ criteria = { urgent = "latest"; }; command = "focus"; } { criteria = { urgent = "latest"; }; command = "focus"; }
]; ];
@ -196,62 +190,28 @@ in
in in
forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; }); forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; });
}; };
frogeye.desktop.i3.bindmodes = frogeye.desktop.i3.bindmodes = {
let "Resize" = {
mode_pres_main = "Presentation (main display)"; bindings = {
mode_pres_sec = "Presentation (secondary display)"; "h" = "resize shrink width 10 px or 10 ppt; ${focus}";
in "j" = "resize grow height 10 px or 10 ppt; ${focus}";
{ "k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"Resize" = { "l" = "resize grow width 10 px or 10 ppt; ${focus}";
bindings = {
"h" = "resize shrink width 10 px or 10 ppt; ${focus}";
"j" = "resize grow height 10 px or 10 ppt; ${focus}";
"k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"l" = "resize grow width 10 px or 10 ppt; ${focus}";
};
mod_enter = "r";
};
"[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction" = {
bindings = {
"l" = "exec --no-startup-id exec xlock, mode default";
"e" = "exit, mode default";
"s" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl suspend --check-inhibitors=no, mode default";
"h" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
};
mod_enter = "Escape";
};
"${mode_pres_main}" = {
mod_enter = "Shift+p";
bindings = {
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
"${mode_pres_sec}" = {
mod_enter = "Shift+p+2"; # Bogus, just so I don't have to implement no binding
bindings = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
"Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue" = {
bindings = {
"r" = "exec ${pkgs.sct}/bin/sct 1000";
"d" = "exec ${pkgs.sct}/bin/sct 2000";
"c" = "exec ${pkgs.sct}/bin/sct 4500";
"o" = "exec ${pkgs.sct}/bin/sct";
"a" = "exec ${pkgs.sct}/bin/sct 8000";
"b" = "exec ${pkgs.sct}/bin/sct 10000";
};
mod_enter = "y";
}; };
mod_enter = "r";
}; };
"[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction" = {
bindings = {
"l" = "exec --no-startup-id exec xlock, mode default";
"e" = "exit, mode default";
"s" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl suspend --check-inhibitors=no, mode default";
"h" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
};
mod_enter = "Escape";
};
};
}; };
options = { options = {
frogeye.desktop.i3.bindmodes = lib.mkOption { frogeye.desktop.i3.bindmodes = lib.mkOption {

View file

@ -0,0 +1,39 @@
# Dual-screen presenting for slideshows and stuff.
# Not tested since Nix.
# Config mentions pdfpc, although the last thing I used was Impressive, even made patches to it.
# UPST Add Impressive to nixpkgs
{ pkgs, lib, config, ... }:
let
mode_pres_main = "Presentation (main display)";
mode_pres_sec = "Presentation (secondary display)";
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.desktop.i3.bindmodes = {
"${mode_pres_main}" = {
mod_enter = "Shift+p";
bindings = {
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
"${mode_pres_sec}" = {
mod_enter = "Shift+p+2"; # Bogus, just so I don't have to implement no binding
bindings = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
};
xsession.windowManager.i3.config.window.commands = [
# Open specific applications in floating mode
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
];
};
}

View file

@ -0,0 +1,28 @@
{ pkgs, lib, config, ... }:
let
# UPST
sct = pkgs.sct.overrideAttrs
(old: {
patches = (old.patches or [ ]) ++ [
./sct_aarch64.patch
];
});
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.desktop.i3.bindmodes = {
"Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue" = {
bindings = {
"r" = "exec ${sct}/bin/sct 1000";
"d" = "exec ${sct}/bin/sct 2000";
"c" = "exec ${sct}/bin/sct 4500";
"o" = "exec ${sct}/bin/sct";
"a" = "exec ${sct}/bin/sct 8000";
"b" = "exec ${sct}/bin/sct 10000";
};
mod_enter = "y";
};
};
home.packages = [ sct ];
};
}

View file

@ -1,59 +0,0 @@
{ pkgs, config, lib, ... }:
let
# Currently last commit in https://github.com/danth/stylix/pull/194
phases = [
{ command = "jour"; polarity = "light"; }
{ command = "crepuscule"; polarity = "dark"; }
{ command = "nuit"; polarity = "dark"; }
];
cfg = config.frogeye.desktop.phasesBrightness;
in
{
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-${config.frogeye.polarity}.yaml";
image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
# The background is set on some occasions, autorandr + feh do the rest
fonts = {
monospace = {
package = pkgs.nerdfonts.override {
fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix
};
name = "DejaVuSansM Nerd Font";
};
};
};
programs.autorandr.hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
};
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
# home.packages = [ pkgs.dconf ];
dconf.enable = false; # Otherwise standalone home-manager complains it can't find /etc/dbus-1/session.conf on Arch.
# Symlinking it to /usr/share/dbus-1/session.conf goes further but not much.
home.packages = map
(phase: (pkgs.writeShellApplication {
name = "${phase.command}";
runtimeInputs = [ pkgs.brightnessctl ];
text = (lib.optionalString cfg.enable ''
brightnessctl set ${builtins.getAttr phase.command cfg}
'') + ''
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
if [ -x "$switch" ]
then
# In two steps to get the visual changes slightly earlier
sudo "$switch" test
sudo "$switch" boot
fi
'';
})
)
phases;
}

24
hm/theme/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, config, lib, ... }:
let
basetheme = "solarized";
in
{
config = {
# Setting a custom base16 theme via nixvim is required so feline works, and
# because stylix makes a config that otherwise only works with dark
# polarity.
programs.nixvim.colorschemes.base16.colorscheme = "${basetheme}-${config.frogeye.polarity}";
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/${basetheme}-${config.frogeye.polarity}.yaml";
fonts = {
monospace = {
package = pkgs.nerdfonts.override {
fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix
};
name = "DejaVuSansM Nerd Font";
};
};
};
};
}

View file

@ -5,6 +5,10 @@ let
in in
{ {
config = lib.mkIf config.frogeye.userNix { config = lib.mkIf config.frogeye.userNix {
dconf.enable = lib.mkForce false;
# Otherwise standalone home-manager complains it can't find /etc/dbus-1/session.conf.
# Symlinking it to /usr/share/dbus-1/session.conf goes further but not much.
home.activation = { home.activation = {
# When Nix is installed in the user directory via a proot, systemd --user # When Nix is installed in the user directory via a proot, systemd --user
# is started outside of it, so it cannot access /nix. So we need to: # is started outside of it, so it cannot access /nix. So we need to:

View file

@ -12,10 +12,6 @@
vim = "nvim"; vim = "nvim";
}; };
programs.nixvim = { programs.nixvim = {
# Setting a custom base16 theme via nixvim is required so feline works, and
# because stylix makes a config that otherwise only works with dark
# polarity.
colorschemes.base16.colorscheme = "solarized-${config.frogeye.polarity}";
options = { options = {
ignorecase = true; ignorecase = true;
smartcase = true; smartcase = true;

View file

@ -41,18 +41,5 @@
pulseaudio.enable = true; pulseaudio.enable = true;
# TODO Try pipewire # TODO Try pipewire
}; };
# UPST
# TODO Find a way to override packages either at NixOS level or HM level depending on what is used
nixpkgs.overlays = [
(final: prev: {
sct = prev.sct.overrideAttrs
(old: {
patches = (old.patches or [ ]) ++ [
./sct_aarch64.patch
];
});
})
];
}; };
} }

View file

@ -35,6 +35,8 @@
light.configuration.frogeye.polarity = "light"; light.configuration.frogeye.polarity = "light";
}; };
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
programs.dconf.enable = true;
# Because everything is encrypted and I'm the only user, this is fine. # Because everything is encrypted and I'm the only user, this is fine.
services.xserver.displayManager.autoLogin.user = "geoffrey"; services.xserver.displayManager.autoLogin.user = "geoffrey";