diff --git a/flake.nix b/flake.nix index e4a932b..24251bf 100644 --- a/flake.nix +++ b/flake.nix @@ -32,13 +32,27 @@ system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ - ./nixos/configuration.nix + ./nixos/desktop.nix inputs.minegrub-theme.nixosModules.default home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.nora = import ./home-manager/desktop.nix; + home-manager.users.nora = import ./home-manager/home.nix; + home-manager.extraSpecialArgs = { inherit inputs; }; + } + ]; + }; + scrap = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./nixos/laptop.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.nora = import ./home-manager/laptop.nix; home-manager.extraSpecialArgs = { inherit inputs; }; } ]; diff --git a/home-manager/desktop.nix b/home-manager/home.nix similarity index 100% rename from home-manager/desktop.nix rename to home-manager/home.nix diff --git a/home-manager/laptop.nix b/home-manager/laptop.nix new file mode 100644 index 0000000..6f59d51 --- /dev/null +++ b/home-manager/laptop.nix @@ -0,0 +1,7 @@ +{ ... }: { + imports = [ + ./home.nix + ]; + + is-laptop = true; +} diff --git a/home-manager/waybar.nix b/home-manager/waybar.nix index 7d2be0d..64ac3da 100644 --- a/home-manager/waybar.nix +++ b/home-manager/waybar.nix @@ -1,211 +1,255 @@ { config, pkgs, lib, ... }: { - home.file."${config.xdg.configHome}/waybar/config.jsonc" = { - text = - builtins.toJSON { - height = 35; - spacing = 4; + options.is-laptop = lib.mkEnableOption "whether the computer is a laptop"; - modules-left = [ - "systemd-failed-units" - "custom/music-back" - "mpris" - "custom/music-next" - ]; - modules-center = [ - "clock" - ]; - modules-right = [ - "bluetooth" - "privacy" - "pulseaudio" - "cpu" - "memory" - "tray" - "custom/power" - ]; + config = { + home.file."${config.xdg.configHome}/waybar/config.jsonc" = { + text = + builtins.toJSON { + height = 35; + spacing = 4; - systemd-failed-units = { - hide-on-ok = true; # Hide if there are zero failed units. - format = "✗ {nr_failed}"; - format-ok = "✓ systemd is ok but waybar is not"; - system = true; # monitor sytem units - user = true; # monitor user units - }; - "custom/music-back" = { - format = "⏴"; - tooltip = true; - tooltip-format = "Play previous song"; - on-click = "${lib.getExe pkgs.playerctl} previous"; - }; - mpris = { - format = "{status_icon} {dynamic}"; - dynamic-order = [ "title" "artist" ]; - status-icons = { - paused = "⏸"; + modules-left = [ + "systemd-failed-units" + "custom/music-back" + "mpris" + "custom/music-next" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ + "bluetooth" + "privacy" + "pulseaudio" + "cpu" + "memory" + "tray" + ] ++ + (if (config.is-laptop) then + [ "network" "power-profiles-daemon" "battery" ] + else [ ]) ++ + [ + "custom/power" + ]; + + systemd-failed-units = { + hide-on-ok = true; # Hide if there are zero failed units. + format = "✗ {nr_failed}"; + format-ok = "✓ systemd is ok but waybar is not"; + system = true; # monitor sytem units + user = true; # monitor user units }; - }; - "custom/music-next" = { - format = "⏵"; - tooltip = true; - tooltip-format = "Play next song"; - on-click = "${lib.getExe pkgs.playerctl} next"; - }; - clock = { - interval = 1; - format = "{:%a %F %H:%M:%S}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "year"; - mode-mon-col = 3; - weeks-pos = "right"; - on-scroll = 1; - format = { - months = "{}"; - days = "{}"; - weeks = "W{}"; - weekdays = "{}"; - today = "{}"; + "custom/music-back" = { + format = "⏴"; + tooltip = true; + tooltip-format = "Play previous song"; + on-click = "${lib.getExe pkgs.playerctl} previous"; + }; + mpris = { + format = "{status_icon} {dynamic}"; + dynamic-order = [ "title" "artist" ]; + status-icons = { + paused = "⏸"; }; }; - actions = { - on-click-right = "mode"; - on-scroll-up = "shift_up"; - on-scroll-down = "shift_down"; + "custom/music-next" = { + format = "⏵"; + tooltip = true; + tooltip-format = "Play next song"; + on-click = "${lib.getExe pkgs.playerctl} next"; }; - }; - - bluetooth = { - format = " {status}"; - format-disabled = ""; # an empty format will hide the module - format-connected = " {num_connections} connected"; - on-click = lib.getExe pkgs.overskride; - }; - pulseaudio = { - # "scroll-step": 1, // %, can be a float - "format" = "{volume}% {icon} {format_source}"; - "format-bluetooth" = "{volume}% {icon} {format_source}"; - "format-bluetooth-muted" = " {icon} {format_source}"; - "format-muted" = " {format_source}"; - "format-source" = "{volume}% "; - "format-source-muted" = ""; - "format-icons" = { - "headphone" = ""; - "hands-free" = ""; - "headset" = ""; - "phone" = ""; - "portable" = ""; - "car" = ""; - "default" = [ "" "" "" ]; - }; - "on-click" = lib.getExe pkgs.pavucontrol; - }; - cpu = { - format = "{usage}% "; - tooltip = false; - }; - memory = { - format = "{}% "; - }; - tray = { - spacing = 10; - }; - "custom/power" = - let - power-menu = pkgs.writeText "power_menu.xml" '' - - - - - - Lock 🔒 - - - - - - - - Reboot ♻️ - - - - - Poweroff 💤 - - - - - ''; - in - { - "format" = "⏻"; - "tooltip" = false; - "menu" = "on-click"; - "menu-file" = power-menu; - "menu-actions" = { - "lock" = "${lib.getExe pkgs.swaylock}"; - "reboot" = "reboot"; - "poweroff" = "poweroff"; + clock = { + interval = 1; + format = "{:%a %F %H:%M:%S}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "year"; + mode-mon-col = 3; + weeks-pos = "right"; + on-scroll = 1; + format = { + months = "{}"; + days = "{}"; + weeks = "W{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + actions = { + on-click-right = "mode"; + on-scroll-up = "shift_up"; + on-scroll-down = "shift_down"; }; }; - }; - }; - home.file."${config.xdg.configHome}/waybar/style.css" = { - text = '' - ${builtins.readFile ./default-waybar-style.css} - window#waybar { - background: linear-gradient( - to right, - rgb(131, 80, 117) 15%, - rgb(158, 103, 143) 30%, - rgb(131, 80, 117) 45%, - #db88c5 - ); - color: black; - } + bluetooth = { + format = " {status}"; + format-disabled = ""; # an empty format will hide the module + format-connected = " {num_connections} connected"; + on-click = lib.getExe pkgs.overskride; + }; + pulseaudio = { + # "scroll-step": 1, // %, can be a float + "format" = "{volume}% {icon} {format_source}"; + "format-bluetooth" = "{volume}% {icon} {format_source}"; + "format-bluetooth-muted" = " {icon} {format_source}"; + "format-muted" = " {format_source}"; + "format-source" = "{volume}% "; + "format-source-muted" = ""; + "format-icons" = { + "headphone" = ""; + "hands-free" = ""; + "headset" = ""; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = [ "" "" "" ]; + }; + "on-click" = lib.getExe pkgs.pavucontrol; + }; + cpu = { + format = "{usage}% "; + tooltip = false; + }; + memory = { + format = "{}% "; + }; + tray = { + spacing = 10; + }; + "network" = { + # "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi" = " ({signalStrength}%)"; + "format-ethernet" = "{ipaddr}/{cidr} "; + "tooltip-format" = "{ifname} via {gwaddr}  ({ipaddr}/{cidr})"; + "format-linked" = "{ifname} (No IP) "; + "format-disconnected" = "Disconnected ⚠"; + "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + }; + "power-profiles-daemon" = { + "format" = "{icon}"; + "tooltip-format" = "Power profile: {profile}\nDriver: {driver}"; + "tooltip" = true; + "format-icons" = { + "default" = ""; + "performance" = ""; + "balanced" = ""; + "power-saver" = ""; + }; + }; + "battery" = { + "states" = { + # "good": 95, + "warning" = 30; + "critical" = 5; + }; + "format" = "{capacity}% {icon}"; + "format-full" = "{capacity}% {icon}"; + "format-charging" = "{capacity}% "; + "format-plugged" = "{capacity}% "; + "format-alt" = "{time} {icon}"; + # "format-good": "", // An empty format will hide the module + # "format-full": "", + "format-icons" = [ "" "" "" "" "" ]; + }; + "custom/power" = + let + power-menu = pkgs.writeText "power_menu.xml" '' + + + + + + Lock 🔒 + + + + + + + + Reboot ♻️ + + + + + Poweroff 💤 + + + + + ''; + in + { + "format" = "⏻"; + "tooltip" = false; + "menu" = "on-click"; + "menu-file" = power-menu; + "menu-actions" = { + "lock" = "${lib.getExe pkgs.swaylock}"; + "reboot" = "reboot"; + "poweroff" = "poweroff"; + }; + }; + }; + }; + home.file."${config.xdg.configHome}/waybar/style.css" = { + text = '' + ${builtins.readFile ./default-waybar-style.css} - #systemd-failed-units { - padding-left: 30px; - padding-right: 30px; - background-color: red; - } + window#waybar { + background: linear-gradient( + to right, + rgb(131, 80, 117) 15%, + rgb(158, 103, 143) 30%, + rgb(131, 80, 117) 45%, + #db88c5 + ); + color: black; + } - #mpris { - color: white; - } + #systemd-failed-units { + padding-left: 30px; + padding-right: 30px; + background-color: red; + } - #custom-music-back, #custom-music-next { - font-size: 20px; - color: white; - } + #mpris { + color: white; + } - #custom-music-back { - padding: 0 10px 0 15px; - } - #custom-music-next { - padding: 0 10px; - } + #custom-music-back, #custom-music-next { + font-size: 20px; + color: white; + } - #clock { - background: unset; - color: white; - } + #custom-music-back { + padding: 0 10px 0 15px; + } + #custom-music-next { + padding: 0 10px; + } - #privacy *, #pulseaudio, #cpu, #memory, #tray { - background-color: unset; - color: black; - } + #clock { + background: unset; + color: white; + } - #custom-power { - padding-left: 15px; - padding-right: 15px; - font-size: 30px; - background-color: rebeccapurple; - color: white; - } - ''; + #privacy *, #pulseaudio, #cpu, #memory, #tray, #network, #power-profiles-daemon, #battery { + background-color: unset; + color: black; + } + + #custom-power { + padding-left: 15px; + padding-right: 15px; + font-size: 30px; + background-color: rebeccapurple; + color: white; + } + ''; + }; }; } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 1053a72..1a497d0 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -12,17 +12,10 @@ in # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd - # You can also split up your configuration and import pieces of it here: - # ./users.nix - inputs.niri.nixosModules.niri - - # Import your generated (nixos-generate-config) hardware configuration - ./hardware-configuration.nix ]; nixpkgs = { - # You can add overlays here overlays = [ # If you want to use overlays exported from other flakes: # neovim-nightly-overlay.overlays.default @@ -35,14 +28,9 @@ in # }; # ) ]; - # Configure your nixpkgs instance config = { - # Disable if you don't want unfree packages allowUnfree = true; nvidia.acceptLicense = true; - permittedInsecurePackages = [ - "electron-25.9.0" # Temporary fix until the next obsidian release: https://github.com/NixOS/nixpkgs/issues/273611 - ]; }; }; @@ -63,41 +51,21 @@ in }; }; - networking = { - hostName = "nixos"; - networkmanager.enable = true; - extraHosts = - '' - 192.168.122.44 illumos-vm - ''; - }; + networking.networkmanager.enable = true; time.timeZone = "Europe/Zurich"; - # Windows sets the hardware clock in local time by default. - time.hardwareClockInLocalTime = true; i18n.defaultLocale = "en_US.UTF-8"; # Bootloader. # boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - boot.loader.grub = { - enable = true; - device = "nodev"; - efiSupport = true; - useOSProber = true; - minegrub-theme = { - enable = true; - }; - }; boot.binfmt = { emulatedSystems = [ "wasm32-wasi" "aarch64-linux" ]; preferStaticEmulators = true; # required to work with podman (apparently) }; - boot.kernelPackages = pkgs.linuxPackages_6_6; + boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; @@ -116,13 +84,6 @@ in "kernel.sysrq" = 340; }; - boot.supportedFilesystems = [ "ntfs" ]; - - fileSystems."/mnt/nas" = { - device = "192.168.178.47:/volume1/homes"; - fsType = "nfs"; - }; - # Enable the Wayland windowing system. services.displayManager.gdm.enable = true; services.desktopManager = { @@ -145,11 +106,6 @@ in variant = ""; }; - # ndivia drivers - # long story short night light mode is currently broken with nvidia drivers. LMAO - # - https://forums.developer.nvidia.com/t/screen-freezes-at-random-intervals-with-rtx-4060-max-q-mobile-multiple-driver-versions-tested/295811/6?u=mirao - videoDrivers = [ "nvidia" ]; - # mouse settings # https://unix.stackexchange.com/questions/58900/how-to-scroll-the-screen-using-the-middle-click #libinput.mouse = { @@ -159,12 +115,6 @@ in #}; }; - hardware.nvidia = { - # https://github.com/NixOS/nixpkgs/issues/299944#issuecomment-2027246826 - modesetting.enable = true; - open = true; - }; - hardware.graphics = { enable = true; extraPackages = with pkgs; [ @@ -184,8 +134,6 @@ in }; programs.waybar.enable = true; - programs.coolercontrol.enable = true; - programs.coolercontrol.nvidiaSupport = true; services.flatpak.enable = true; console.keyMap = "sg"; @@ -224,11 +172,6 @@ in services.nixseparatedebuginfod.enable = true; - services.tailscale = { - enable = true; - useRoutingFeatures = "both"; - }; - users = { users = { nora = { @@ -273,29 +216,6 @@ in }; }; - systemd.services.paperless-ngx-backup = { - description = "paperless-ngx data backup to NAS"; - serviceConfig = { - Type = "oneshot"; - User = "nora"; - ExecStart = '' - ${lib.getExe pkgs.rsync} -a -v --delete --exclude=redis /home/nora/.local/share/paperless-ngx/ /mnt/nas/HEY/_Nora/paperless/backup - ''; - }; - }; - systemd.timers.paperless-ngx-backup = { - description = "paperless-ngx data backup to NAS"; - wantedBy = [ "timers.target" ]; - timerConfig = { - Unit = "paperless-ngx-backup.service"; - OnCalendar = "daily UTC"; - RandomizedDelaySec = 1800; - FixedRandomDelay = true; - Persistent = true; # ensure it still runs if the computer was down at the timer of trigger - }; - }; - - xdg.mime.defaultApplications = { "text/html" = "firefox.desktop"; "x-scheme-handler/http" = "firefox.desktop"; @@ -304,28 +224,6 @@ in # This is apparently used by Electron? Maybe not anymore. environment.sessionVariables.DEFAULT_BROWSER = lib.getExe pkgs.firefox; - services.openssh = { - enable = true; - hostKeys = [ - { - path = "/etc/ssh/ssh_host_ed25519_key"; - type = "ed25519"; - } - { - # P256 - path = "/etc/ssh/ssh_host_ecdsa_key"; - type = "ecdsa"; - } - { - bits = 4096; - path = "/etc/ssh/ssh_host_rsa_key"; - type = "rsa"; - } - ]; - settings.PermitRootLogin = "no"; - settings.PasswordAuthentication = false; - }; - environment.enableDebugInfo = true; environment.systemPackages = with pkgs; [ vim @@ -334,14 +232,8 @@ in # for firefox-nightly # inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin firefox - os-prober git - (linuxKernel.packagesFor - (linuxKernel.kernels.linux_6_6.override { - stdenv = gcc12Stdenv; - buildPackages = pkgs.buildPackages // { stdenv = gcc12Stdenv; }; - }) - ).perf + (linuxKernel.packagesFor linuxKernel.kernels.linux_latest).perf fish unzip (steam.override { @@ -357,7 +249,6 @@ in man-pages man-pages-posix bpftrace - tailscale file comma alacritty @@ -403,32 +294,12 @@ in }; }; - # TODO: ENABLE NVIDIA DRIVERS WHEN THEY STOP BEING READY - #hardware.nvidia-container-toolkit.enable = true; - hardware.enableAllFirmware = true; # Open ports in the firewall. networking.firewall = { enable = true; - trustedInterfaces = [ "tailscale0" ]; - allowedUDPPorts = [ config.services.tailscale.port ]; - allowedTCPPorts = [ /*SSH*/ 22 ]; - - # https://github.com/tailscale/tailscale/issues/4432#issuecomment-1112819111 - checkReversePath = "loose"; }; - networking.interfaces.enp39s0.wakeOnLan.enable = true; - system.nixos.distroName = "🏳️‍⚧️"; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "22.11"; } diff --git a/nixos/hardware-configuration.nix b/nixos/desktop-hardware-configuration.nix similarity index 97% rename from nixos/hardware-configuration.nix rename to nixos/desktop-hardware-configuration.nix index f24461a..06b2a8d 100644 --- a/nixos/hardware-configuration.nix +++ b/nixos/desktop-hardware-configuration.nix @@ -1,7 +1,7 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, modulesPath, ... }: { imports = diff --git a/nixos/desktop.nix b/nixos/desktop.nix new file mode 100644 index 0000000..d638775 --- /dev/null +++ b/nixos/desktop.nix @@ -0,0 +1,109 @@ +{ pkgs, config, ... }: { + imports = [ + ./desktop-hardware-configuration.nix + ./paperless.nix + ./configuration.nix + ]; + + networking = { + hostName = "nixos"; + extraHosts = + '' + 192.168.122.44 illumos-vm + ''; + }; + + # Windows sets the hardware clock in local time by default. + time.hardwareClockInLocalTime = true; + + boot.loader.grub = { + enable = true; + device = "nodev"; + efiSupport = true; + useOSProber = true; + minegrub-theme = { + enable = true; + }; + }; + + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.supportedFilesystems = [ "ntfs" ]; + + fileSystems."/mnt/nas" = { + device = "192.168.178.47:/volume1/homes"; + fsType = "nfs"; + }; + + services.xserver = { + # ndivia drivers + # long story short night light mode is currently broken with nvidia drivers. LMAO + # - https://forums.developer.nvidia.com/t/screen-freezes-at-random-intervals-with-rtx-4060-max-q-mobile-multiple-driver-versions-tested/295811/6?u=mirao + videoDrivers = [ "nvidia" ]; + }; + + hardware.nvidia = { + # https://github.com/NixOS/nixpkgs/issues/299944#issuecomment-2027246826 + modesetting.enable = true; + open = true; + }; + + programs.coolercontrol.enable = true; + programs.coolercontrol.nvidiaSupport = true; + + services.tailscale = { + enable = true; + useRoutingFeatures = "both"; + }; + + services.openssh = { + enable = true; + hostKeys = [ + { + path = "/etc/ssh/ssh_host_ed25519_key"; + type = "ed25519"; + } + { + # P256 + path = "/etc/ssh/ssh_host_ecdsa_key"; + type = "ecdsa"; + } + { + bits = 4096; + path = "/etc/ssh/ssh_host_rsa_key"; + type = "rsa"; + } + ]; + settings.PermitRootLogin = "no"; + settings.PasswordAuthentication = false; + }; + + environment.systemPackages = with pkgs; [ + tailscale + os-prober + ]; + + networking.firewall = { + trustedInterfaces = [ "tailscale0" ]; + allowedUDPPorts = [ config.services.tailscale.port ]; + allowedTCPPorts = [ /*SSH*/ 22 ]; + + # https://github.com/tailscale/tailscale/issues/4432#issuecomment-1112819111 + checkReversePath = "loose"; + }; + + # TODO: ENABLE NVIDIA DRIVERS WHEN THEY STOP BEING READY + #hardware.nvidia-container-toolkit.enable = true; + + networking.interfaces.enp39s0.wakeOnLan.enable = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "22.11"; +} diff --git a/nixos/laptop-hardware-configuration.nix b/nixos/laptop-hardware-configuration.nix new file mode 100644 index 0000000..1e5aca7 --- /dev/null +++ b/nixos/laptop-hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/646dc4c1-53aa-4fce-9328-f7c42a5b5ea8"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-c16da30d-5953-4ce9-995a-f4acd77dcaf7".device = "/dev/disk/by-uuid/c16da30d-5953-4ce9-995a-f4acd77dcaf7"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E494-B917"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/laptop.nix b/nixos/laptop.nix new file mode 100644 index 0000000..39681b6 --- /dev/null +++ b/nixos/laptop.nix @@ -0,0 +1,15 @@ +{ ... }: { + imports = [ + ./laptop-hardware-configuration.nix + ./configuration.nix + ]; + + networking = { + hostName = "scrap"; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + system.stateVersion = "25.11"; +} diff --git a/nixos/paperless.nix b/nixos/paperless.nix new file mode 100644 index 0000000..53fc995 --- /dev/null +++ b/nixos/paperless.nix @@ -0,0 +1,23 @@ +{ lib, pkgs, ... }: { + systemd.services.paperless-ngx-backup = { + description = "paperless-ngx data backup to NAS"; + serviceConfig = { + Type = "oneshot"; + User = "nora"; + ExecStart = '' + ${lib.getExe pkgs.rsync} -a -v --delete --exclude=redis /home/nora/.local/share/paperless-ngx/ /mnt/nas/HEY/_Nora/paperless/backup + ''; + }; + }; + systemd.timers.paperless-ngx-backup = { + description = "paperless-ngx data backup to NAS"; + wantedBy = [ "timers.target" ]; + timerConfig = { + Unit = "paperless-ngx-backup.service"; + OnCalendar = "daily UTC"; + RandomizedDelaySec = 1800; + FixedRandomDelay = true; + Persistent = true; # ensure it still runs if the computer was down at the timer of trigger + }; + }; +}