From 48f8d3c11d9117f10e6ca5b76a08b91cef5c861b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 1 Aug 2024 10:31:11 +0200 Subject: ... --- hosts/sif/default.nix | 16 ++++++- hosts/sif/hw.nix | 76 +++++++++++++++++----------------- overlays/radicale.nix | 13 ++++++ overlays/worktime/worktime/__main__.py | 4 +- user-profiles/yt-dlp.nix | 2 +- 5 files changed, 69 insertions(+), 42 deletions(-) create mode 100644 overlays/radicale.nix diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index 87c0f3bf..96cd66cc 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix @@ -31,7 +31,7 @@ in { boot = { initrd = { systemd = { - enable = true; + enable = false; emergencyAccess = config.users.users.root.hashedPassword; }; luks.devices = { @@ -423,6 +423,17 @@ in { }; }; + systemd.tmpfiles.rules = [ + "d /var/lib/lightdm/.cache/lightdm-gtk-greeter 1770 lightdm lightdm -" + "L /var/lib/lightdm/.cache/lightdm-gtk-greeter/state - - - - ${pkgs.writeText "state" '' + [greeter] + last-user=gkleen + last-session=none+xmonad + ''}" + + "L /etc/localtime - - - - /.bcachefs/etc/localtime" + ]; + users = { users.gkleen.extraGroups = [ "media" "plugdev" "input" "rtkit" ]; groups.media = {}; @@ -444,6 +455,7 @@ in { "log.level" = 2; "core.daemon" = true; "core.name" = "pipewire-0"; + "module.x11.bell" = false; }; "context.modules" = [ { @@ -623,7 +635,7 @@ in { zramSwap = { enable = true; algorithm = "zstd"; - writebackDevice = "/dev/disk/by-uuid/50f3f856-cc17-4614-846a-34a14d5006ec"; + writebackDevice = "/dev/disk/by-label/swap"; }; services.pcscd.enable = true; diff --git a/hosts/sif/hw.nix b/hosts/sif/hw.nix index a2991def..d01582e0 100644 --- a/hosts/sif/hw.nix +++ b/hosts/sif/hw.nix @@ -7,87 +7,89 @@ fsType = "vfat"; options = [ "fmask=0033" "dmask=0022" ]; }; - # "/.bcachefs" = - # { device = "/dev/mapper/sif-nvm0:/dev/mapper/sif-nvm1"; - # fsType = "bcachefs"; - # neededForBoot = true; - # }; + "/.bcachefs" = + { device = "/dev/mapper/sif-nvm0:/dev/mapper/sif-nvm1"; + fsType = "bcachefs"; + neededForBoot = true; + }; "/nix" = { device = "/.bcachefs/nix"; fsType = "none"; - options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ]; + options = [ "bind" ]; # "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/root" = { device = "/.bcachefs/root"; fsType = "none"; - options = [ "bind" ]; + options = [ "bind" ]; # "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/var/log" = { device = "/.bcachefs/var/log"; fsType = "none"; - options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ]; + options = [ "bind" ]; # "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/var/lib/sops-nix" = { device = "/.bcachefs/var/lib/sops-nix"; fsType = "none"; - options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ]; + options = [ "bind" ]; # "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; neededForBoot = true; }; "/var/lib/nixos" = { device = "/.bcachefs/var/lib/nixos"; fsType = "none"; - options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ]; + options = [ "bind" ]; # "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/var/lib/chrony" = { device = "/.bcachefs/var/lib/chrony"; fsType = "none"; - options = [ "bind" ]; + options = [ "bind" ]; # "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/var/lib/fprint" = { device = "/.bcachefs/var/lib/fprint"; fsType = "none"; - options = [ "bind" ]; + options = [ "bind" ]; # "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/var/lib/systemd" = { device = "/.bcachefs/var/lib/systemd"; fsType = "none"; - options = [ "bind" "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" ]; + options = [ "bind" ]; # "x-systemd.after=bcachefs.service" "x-systemd.requires=bcachefs.service" "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; neededForBoot = true; }; "/home" = { device = "/.bcachefs/home"; fsType = "none"; - options = [ "bind" ]; + options = [ "bind" ]; # "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; "/etc/NetworkManager/system-connections" = { device = "/.bcachefs/etc/NetworkManager/system-connections"; fsType = "none"; - options = [ "bind" ]; + options = [ "bind" ]; # "x-systemd.after=\\x2ebcachefs.mount" "x-systemd.requires=\\x2ebcachefs.mount" ]; }; }; - boot.initrd.supportedFilesystems.bcachefs = true; - boot.initrd.systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false; - systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false; - boot.initrd.systemd.services."bcachefs" = { - before = [ "initrd-fs.target" ]; - after = [ "local-fs-pre.target" "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; - requires = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; - wantedBy = [ "initrd-fs.target" ]; - unitConfig = { - DefaultDependencies = false; - StopPropagatedFrom = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; - }; - serviceConfig = { - Type = "oneshot"; - ExecStart = "/bin/mount -o X-mount.mkdir -t bcachefs /dev/sif/nvm0:/dev/sif/nvm1 /sysroot/.bcachefs"; - RemainAfterExit = true; - }; - }; - - swapDevices = [ - { label = "swap"; } - ]; + # boot.initrd.supportedFilesystems.bcachefs = true; + # boot.initrd.systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false; + # systemd.units."dev-sif-nvm0:-dev-sif-nvm1.device".enable = false; + # boot.initrd.systemd.services."bcachefs" = { + # before = [ "initrd-fs.target" ]; + # after = [ "local-fs-pre.target" "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; + # requires = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; + # wantedBy = [ "initrd-fs.target" ]; + # unitConfig = { + # DefaultDependencies = false; + # StopPropagatedFrom = [ "dev-sif-nvm0.device" "dev-sif-nvm1.device" ]; + # }; + # serviceConfig = { + # Type = "oneshot"; + # ExecStart = "/bin/mount -o X-mount.mkdir -t bcachefs /dev/sif/nvm0:/dev/sif/nvm1 /sysroot/.bcachefs"; + # RemainAfterExit = true; + # }; + # }; + # systemd.services."bcachefs" = { + # serviceConfig = { + # Type = "oneshot"; + # ExecStart = "${pkgs.coreutils}/bin/true"; + # }; + # }; nix.settings.max-jobs = 12; # High-DPI console diff --git a/overlays/radicale.nix b/overlays/radicale.nix new file mode 100644 index 00000000..a4179295 --- /dev/null +++ b/overlays/radicale.nix @@ -0,0 +1,13 @@ +{ prev, ... }: +let + nixpkgs = prev.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "5fa4d405272ea98dab145f0c9f7ea1dbb9c87c31"; + hash = "sha256-Qwwbt4vbqwllUJElZomSybbZkbmhsuIac3gqrl+GVUs="; + }; + pkgs = (import (nixpkgs + "/pkgs/top-level")) { localSystem = prev.stdenv.buildPlatform.system; }; +in rec { + radicale3 = radicale; + inherit (pkgs) radicale; +} diff --git a/overlays/worktime/worktime/__main__.py b/overlays/worktime/worktime/__main__.py index 5630837b..0df226fa 100755 --- a/overlays/worktime/worktime/__main__.py +++ b/overlays/worktime/worktime/__main__.py @@ -42,7 +42,7 @@ class TogglAPISection(Enum): REPORTS = '/reports/api/v2' class TogglAPIError(Exception): - def __init__(self, http_error, response): + def __init__(self, response, *, http_error=None): self.http_error = http_error self.response = response @@ -179,7 +179,7 @@ class TogglAPI(object): url = self._make_url(api = TogglAPISection.TOGGL, section = ['me', 'time_entries', 'current']) r = self._query(url = url, method='GET') - if not r or not r.json(): + if not r or (not r.json() and r.json() is not None): raise TogglAPIError(r) if not r.json() or not r.json()['billable']: diff --git a/user-profiles/yt-dlp.nix b/user-profiles/yt-dlp.nix index 005f56ff..7d2a1082 100644 --- a/user-profiles/yt-dlp.nix +++ b/user-profiles/yt-dlp.nix @@ -19,7 +19,7 @@ concurrent-fragments = 12; buffer-size = "16K"; sponsorblock-mark = "all"; - restrict-filenames = true; + # restrict-filenames = true; # extractor-args = lib.concatStringsSep ";" [ # "youtube:player-client=android,web" # "youtube:formats=dashy" -- cgit v1.2.3