Various changes

- `hs` host
  - cam subdomain behind reverse proxy
  - dynamic dns updater script
- `pc` host
  - ext4 instead of btrfs
  - ca-derivations experimental feature
- nix from unstable channel (2.8)
- cura from stable (unstable went broken)
- Emacs
  - company-nixos-options
  - helm-nixos-options
  - nix-modeline
  - disable format hook on save for nix mode
- nix from master (only in overlay, not used)
- bat (alias for cat)
- batman (alias for batman)
- disabled weird extra options for nix I couldn't even remember of
- Fira Code for sway/waybar
- New plain style for waybar
This commit is contained in:
Andrea Ciceri 2022-05-14 00:01:08 +02:00
parent 23b4989e7f
commit 8b80ba24c2
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
13 changed files with 105 additions and 183 deletions

2
.gitignore vendored
View file

@ -10,3 +10,5 @@ doi
pkgs/_sources/.shake* pkgs/_sources/.shake*
*.qcow2 *.qcow2
profiles/cachix/mlabs.nix

12
flake.lock generated
View file

@ -329,11 +329,11 @@
}, },
"nixpkgsDevInput": { "nixpkgsDevInput": {
"locked": { "locked": {
"lastModified": 1650450000, "lastModified": 1650581082,
"narHash": "sha256-/ASymH28AS7KsNvkQ1RMKRoCQKSi1AsWkHdJpQwhXCg=", "narHash": "sha256-aq5jnmGhP0hSXYozkxUKpgSZILvDobxB976JZFG6If8=",
"owner": "aciceri", "owner": "aciceri",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cf941213b48d9602be0dc2656e02e065740798ab", "rev": "24b40a255c6adc6ab32c69737e8b4cfc50d8c8b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -459,11 +459,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1650161686, "lastModified": 1652172129,
"narHash": "sha256-70ZWAlOQ9nAZ08OU6WY7n4Ij2kOO199dLfNlvO/+pf8=", "narHash": "sha256-8e2JMrswaKe02P8rYfvIMoc59pNuw6h/GYu8DBE1c+0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1ffba9f2f683063c2b14c9f4d12c55ad5f4ed887", "rev": "f419dc5763c2b3c5580e396dea065b6d8b58ee27",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -210,9 +210,7 @@
'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"'; 'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"';
''; '';
virtualHosts = { virtualHosts = {
"torrent.ccr.ydns.eu" = { "torrent.ccr.ydns.eu" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
@ -252,9 +250,54 @@
proxyPass = "http://192.168.1.71:80"; proxyPass = "http://192.168.1.71:80";
}; };
}; };
"cam.ccr.ydns.eu" = {
enableACME = true;
addSSL = true;
locations."/" = {
proxyPass = "http://192.168.1.80:80";
}; };
}; };
}; };
};
};
systemd.services.ydns =
let
ydnsUpdater = pkgs.writeScriptBin "ydnsUpdater" ''
#!${pkgs.stdenv.shell}
USER="andrea.ciceri@autistici.org"
PASSWORD=$(${pkgs.stdenv}/bin/cat /home/ccr/.ydns-password)
DOMAIN="ccr.ydns.eu"
for SUBDOMAIN in "books" "music" "sync" "torrent" "gate" "cam"
do
HOST="$SUBDOMAIN.$DOMAIN"
${pkgs.curl}/bin/curl --basic -u "$USER:$PASSWORD" --silent https://ydns.io/api/v1/update/?host=$HOST
done
${pkgs.curl}/bin/curl --basic -u "$USER:$PASSWORD" --silent https://ydns.io/api/v1/update/?host=$DOMAIN
'';
in
{
description = "YDNS IP updater";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
User = "ccr";
Type = "oneshot";
ExecStart = "${ydnsUpdater}/bin/ydnsUpdater";
};
};
systemd.timers.ydnsUpdater = {
wantedBy = [ "timers.target" ];
partOf = [ "ydnsUpdater.service" ];
timerConfig = {
OnCalendar = "*-*-* *:00:00"; # hourly
Unit = "ydnsUpdater.service";
};
};
networking.firewall = { networking.firewall = {
enable = true; enable = true;

View file

@ -38,7 +38,13 @@
fileSystems."/" = fileSystems."/" =
{ {
device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";
fsType = "btrfs"; fsType = "ext4";
};
fileSystems."/home" =
{
device = "/dev/disk/by-label/home";
fsType = "ext4";
}; };
swapDevices = swapDevices =
@ -49,15 +55,16 @@
automatic = true; automatic = true;
options = "--delete-older-than 3d"; options = "--delete-older-than 3d";
}; };
# package = pkgs.nixFromMaster;
package = pkgs.nix; # currently from unstable through an overlay
extraOptions = ''
experimental-features = ca-derivations
'';
}; };
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowPing = true; allowPing = true;
allowedTCPPorts = [
5900 # vnc
];
}; };
# TODO: disable, only for playing # TODO: disable, only for playing

View file

@ -17,7 +17,7 @@ in
customEmacs = prev.callPackage (import ./emacs) { }; customEmacs = prev.callPackage (import ./emacs) { };
amule = prev.callPackage (import ./amule) { }; amule = prev.callPackage (import ./amule) { };
digikam = nixpkgsUnstable.digikam; digikam = nixpkgsUnstable.digikam;
cura = nixpkgsUnstable.cura; #cura = nixpkgsUnstable.cura;
qutebrowser = import ./qutebrowser { pkgs = prev; }; qutebrowser = import ./qutebrowser { pkgs = prev; };
#firefox-unwrapped = nixpkgsUnstable.firefox-unwrapped; #firefox-unwrapped = nixpkgsUnstable.firefox-unwrapped;
xdg-desktop-portal = nixpkgsUnstable.xdg-desktop-portal; xdg-desktop-portal = nixpkgsUnstable.xdg-desktop-portal;
@ -30,5 +30,7 @@ in
v4l2loopback-dc = prev.callPackage (import ./v4l2loopback-dc) { kernel = prev.linux; }; v4l2loopback-dc = prev.callPackage (import ./v4l2loopback-dc) { kernel = prev.linux; };
slack = import ./slack { pkgs = prev; }; slack = import ./slack { pkgs = prev; };
google-chrome = import ./google-chrome { pkgs = prev; }; google-chrome = import ./google-chrome { pkgs = prev; };
nixFromMaster = import ./nix-from-master { nix = nixpkgsUnstable.nix; pkgs = prev; };
nix = nixpkgsUnstable.nix;
# then, call packages with `final.callPackage` # then, call packages with `final.callPackage`
} }

View file

@ -12,6 +12,7 @@ emacsWithPackages (
aggressive-indent aggressive-indent
all-the-icons all-the-icons
company company
company-nixos-options
dap-mode dap-mode
diff-hl diff-hl
envrc envrc
@ -25,6 +26,7 @@ emacsWithPackages (
helm helm
helm-ag helm-ag
helm-company helm-company
helm-nixos-options
helm-projectile helm-projectile
lispy lispy
lsp-haskell lsp-haskell
@ -34,6 +36,8 @@ emacsWithPackages (
magit magit
magit-delta magit-delta
nix-mode nix-mode
nix-modeline
nixos-options
notmuch notmuch
org-download org-download
org-fragtog org-fragtog

View file

@ -0,0 +1,9 @@
{ nix, pkgs }:
nix.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "3ec979fa902c49e975a9af7dc2792fb197030e04";
hash = "sha256-mpFR1OrjayyVe8LpxJVaTLVIPPeTSIu7SDz/wXP78Vg=";
};
})

View file

@ -0,0 +1,10 @@
{
nix = {
binaryCaches = [
"https://cache.ngi0.nixos.org/"
];
binaryCachePublicKeys = [
"cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA="
];
};
}

View file

@ -8,6 +8,8 @@ in
environment = { environment = {
systemPackages = with pkgs; [ systemPackages = with pkgs; [
bat
bat-extras.batman
binutils binutils
coreutils coreutils
curl curl
@ -58,12 +60,6 @@ in
useSandbox = true; useSandbox = true;
allowedUsers = [ "@wheel" ]; allowedUsers = [ "@wheel" ];
trustedUsers = [ "root" "@wheel" ]; trustedUsers = [ "root" "@wheel" ];
extraOptions = ''
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
'';
}; };
services.earlyoom.enable = true; services.earlyoom.enable = true;

View file

@ -2,6 +2,7 @@
:init :init
(setq company-backends '(company-capf (setq company-backends '(company-capf
company-keywords company-keywords
company-nixos-options
company-semantic company-semantic
company-files company-files
company-etags company-etags

View file

@ -1,7 +1,10 @@
(use-package nix-mode (use-package nix-mode
:mode "\\.nix\\'" :mode "\\.nix\\'"
:hook ;;:hook
(before-save . lsp-format-buffer)) ;;(before-save . lsp-format-buffer)
)
(require 'sudo-utils) (require 'sudo-utils)
(defun nixos-rebuild-switch () (defun nixos-rebuild-switch ()

View file

@ -1,9 +1,6 @@
* { * {
border: none; border: none;
border-radius: 5; font-family: "Fira Code";
/* `otf-font-awesome` is required to be installed for icons */
/* font matches sway-config.nix */
font-family: "DejaVu Sans";
font-weight: bold; font-weight: bold;
font-size: 9pt; font-size: 9pt;
min-height: 0; min-height: 0;
@ -17,40 +14,23 @@ window#waybar {
transition-duration: .5s; transition-duration: .5s;
} }
window .modules-right * {
margin: 0 1rem;
}
window#waybar.hidden { window#waybar.hidden {
opacity: 0.2; opacity: 0.2;
} }
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
#workspaces button { #workspaces button {
padding: 0 5px; padding: 0 5px;
background-color: transparent; background-color: transparent;
color: #ffffff; color: #ffffff;
border-bottom: 3px solid transparent;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover { #workspaces button:hover {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
box-shadow: inherit;
border-bottom: 3px solid #ffffff;
} }
#workspaces button.current_output { #workspaces button.current_output {
@ -69,44 +49,7 @@ window#waybar.chromium {
background-color: #eb4d4b; background-color: #eb4d4b;
} }
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
.srht-failed,
.srht-success,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
margin: 0 4px;
color: #ffffff;
}
#clock {
background-color: #000000;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink { @keyframes blink {
to { to {
@ -115,105 +58,6 @@ window#waybar.chromium {
} }
} }
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus { label:focus {
background-color: #000000; background-color: #000000;
} }
#cpu {
background-color: #06989A;
}
#memory {
background-color: #2980b9;
}
#backlight {
background-color: #555753;
}
#network {
background-color: #4E9A06;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #75507B;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #C4A000;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
.srht-success {
background-color: #4E9A06;
}
.srht-failed {
background-color: #f53c3c;
}

View file

@ -41,6 +41,7 @@
"pass-clone" = "[ -d .password-store ] && echo 'Password store archive already exists' || git clone git@git.sr.ht:~zrsk/pass ~/.password-store"; "pass-clone" = "[ -d .password-store ] && echo 'Password store archive already exists' || git clone git@git.sr.ht:~zrsk/pass ~/.password-store";
"getpass" = "pass show $(find .password-store/ -name \"*.gpg\" | sed \"s/\\.password-store\\/\\(.*\\)\\.gpg$/\\1/g\" | fzf) | wl-copy; ((sleep 60 && wl-copy --clear) &)"; "getpass" = "pass show $(find .password-store/ -name \"*.gpg\" | sed \"s/\\.password-store\\/\\(.*\\)\\.gpg$/\\1/g\" | fzf) | wl-copy; ((sleep 60 && wl-copy --clear) &)";
"cat" = "bat"; "cat" = "bat";
"man" = "batman";
"em" = "[[ -z \$XDG_CURRENT_DESKTOP ]] && emacsclient -c -nw || emacsclient -c"; "em" = "[[ -z \$XDG_CURRENT_DESKTOP ]] && emacsclient -c -nw || emacsclient -c";
"emw" = "emacsclient -c"; "emw" = "emacsclient -c";
"emnw" = "emacsclient -c -nw"; "emnw" = "emacsclient -c -nw";