refactor(tazjin/nixos): First step to extracting shared config

There's some configuration shared betwene my physical machines which
is just duplicated all over the place right now. What's the point of
having Nix if you don't use it fully?

Change-Id: Ic7e89f918d2517637b3d49617b4dc1a2cc6023b9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5536
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2022-05-09 13:35:55 +02:00 committed by tazjin
parent fe78a53bc9
commit 988ac68100
3 changed files with 97 additions and 88 deletions

View file

@ -1,5 +1,5 @@
# //users/tazjin-specific CI configuration.
{ pkgs, ... }:
{ depot, pkgs, ... }:
let
rustfmt = pkgs.writeShellScript "rustfmt-tazjin" ''
@ -9,11 +9,22 @@ let
'';
in
rustfmt.overrideAttrs (_: {
depot.nix.readTree.drvTargets {
rustfmt = rustfmt.overrideAttrs (_: {
# rustfmt not respecting config atm, disable
meta.ci.skip = true;
meta.ci.extraSteps.rustfmt = {
command = rustfmt;
};
})
});
# Use a screen lock command that resets the keyboard layout
# before locking, to avoid locking me out when the layout is
# in Russian.
screenLock = pkgs.writeShellScriptBin "tazjin-screen-lock" ''
${pkgs.xorg.setxkbmap}/bin/setxkbmap us
${pkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
exec ${pkgs.xsecurelock}/bin/xsecurelock
'';
}

View file

@ -0,0 +1,75 @@
# Default configuration settings for physical machines that I use.
{ pkgs, depot, ... }:
{
# Install all the default software.
environment.systemPackages =
# programs from the depot
(with depot; [
users.tazjin.screenLock
users.tazjin.emacs
third_party.agenix.cli
]) ++
# programs from nixpkgs
(with pkgs; [
amber
audacity
bat
curl
ddcutil
direnv
dmd
dnsutils
electrum
emacsNativeComp # emacsclient
exa
fd
file
firefox
fractal
gdb
gh
git
gnupg
google-chrome
gtk3 # for gtk-launch
htop
hyperfine
iftop
imagemagick
jq
lieer
man-pages
mosh
msmtp
mullvad-vpn
networkmanagerapplet
nix-prefetch-github
nmap
notmuch
openssh
openssl
paperlike-go
pass
pavucontrol
pinentry
pinentry-emacs
pulseaudio # for pactl
pwgen
quasselClient
rink
ripgrep
rustup
screen
scrot
tig
tokei
tree
unzip
vlc
whois
xsecurelock
zoxide
]);
}

View file

@ -8,19 +8,13 @@ let
monolithic = false;
};
# Use a screen lock command that resets the keyboard layout
# before locking, to avoid locking me out when the layout is
# in Russian.
screenLock = pkgs.writeShellScriptBin "tazjin-screen-lock" ''
${pkgs.xorg.setxkbmap}/bin/setxkbmap us
${pkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
exec ${pkgs.xsecurelock}/bin/xsecurelock
'';
mod = name: depot.path + ("/ops/modules/" + name);
usermod = name: depot.path + ("/users/tazjin/nixos/modules/" + name);
in
lib.fix (self: {
imports = [
(mod "open_eid.nix")
(usermod "physical.nix")
"${depot.third_party.impermanence}/nixos.nix"
"${pkgs.home-manager.src}/nixos"
] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;
@ -262,77 +256,6 @@ lib.fix (self: {
fuse.userAllowOther = true;
};
environment.systemPackages =
# programs from the depot
(with depot; [
screenLock
tools.nsfv-setup
users.tazjin.emacs
third_party.agenix.cli
]) ++
# programs from nixpkgs
(with pkgs; [
amber
audacity
bat
curl
ddcutil
direnv
dmd
dnsutils
electrum
emacsNativeComp # emacsclient
exa
fd
file
firefox
fractal
gdb
gh
git
gnupg
google-chrome
gtk3 # for gtk-launch
htop
hyperfine
iftop
imagemagick
jq
lieer
man-pages
mosh
msmtp
mullvad-vpn
networkmanagerapplet
nix-prefetch-github
nmap
notmuch
openssh
openssl
paperlike-go
pass
pavucontrol
pinentry
pinentry-emacs
pulseaudio # for pactl
pwgen
quasselClient
rink
ripgrep
rustup
screen
scrot
tig
tokei
tree
unzip
vlc
whois
xsecurelock
zoxide
]);
systemd.user.services.lieer-tazjin = {
description = "Synchronise mail@tazj.in via lieer";
script = "${pkgs.lieer}/bin/gmi sync";
@ -416,7 +339,7 @@ lib.fix (self: {
enable = true;
enableDetectSleep = true;
inactiveInterval = 10; # minutes
lockCmd = "${screenLock}/bin/tazjin-screen-lock";
lockCmd = "${depot.users.tazjin.screenLock}/bin/tazjin-screen-lock";
};
services.picom = {