From fc1c829d3a21bb30c408a3f50e88b1625c9d6d4c Mon Sep 17 00:00:00 2001 From: chayleaf Date: Mon, 25 Dec 2023 03:40:33 +0700 Subject: [PATCH] flake: add nix-index-database --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 4 ++++ home/modules/general.nix | 30 ++++++++---------------------- home/modules/i3-sway.nix | 1 - 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index 177dae5..a50109a 100644 --- a/flake.lock +++ b/flake.lock @@ -253,6 +253,26 @@ "type": "github" } }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700967448, + "narHash": "sha256-sWVi7Nm/fuTgwN8R7Tt3GM3vBP3r6M1/lhX0+LK3p7E=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "d189d05f9de237d3b554c91029f9cb78efec8ace", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1700559156, @@ -414,6 +434,7 @@ "maubot": "maubot", "mobile-nixos": "mobile-nixos", "nix-gaming": "nix-gaming", + "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixos-mailserver": "nixos-mailserver", "nixos-router": "nixos-router", diff --git a/flake.nix b/flake.nix index fb9b6fe..538ae4f 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,10 @@ # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:chayleaf/nixpkgs"; nixos-hardware.url = "github:NixOS/nixos-hardware"; + nix-index-database = { + url = "github:nix-community/nix-index-database"; + inputs.nixpkgs.follows = "nixpkgs"; + }; mobile-nixos = { # url = "github:NixOS/mobile-nixos"; url = "github:chayleaf/mobile-nixos/fix-op6-modem"; diff --git a/home/modules/general.nix b/home/modules/general.nix index 3a0d815..561e614 100644 --- a/home/modules/general.nix +++ b/home/modules/general.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, ... }: +{ config +, pkgs +, lib +, inputs +, ... +}: + { imports = [ ./options.nix @@ -183,27 +189,7 @@ text/html; ${pkgs.w3m}/bin/w3m -dump -o document_charset=%{charset} -o display_link_number=1 '%s'; nametemplate=%s.html; copiousoutput ''; - systemd.user.timers.nix-index = { - Install.WantedBy = [ "timers.target" ]; - Unit = { - Description = "Update nix-index"; - PartOf = [ "nix-index.service" ]; - }; - Timer = { - OnCalendar = "Mon *-*-* 00:00:00"; - RandomizedDelaySec = 600; - Persistent = true; - }; - }; - systemd.user.services.nix-index = { - Unit.Description = "Update nix-index"; - Service = { - Type = "oneshot"; - ExecStart = "${config.programs.nix-index.package}/bin/nix-index"; - Environment = [ "PATH=/home/${config.home.username}/.nix-profile/bin:/etc/profiles/per-user/${config.home.username}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" ]; - TimeoutStartSec = 1800; - }; - }; + home.file.".cache/nix-index/files".source = assert config.xdg.cacheHome == "${config.home.homeDirectory}/.cache"; inputs.nix-index-database.legacyPackages.${pkgs.system}.database; systemd.user.tmpfiles.rules = builtins.map (file: "r! \"/home/${config.home.username}/${file}\"") [ ".local/share/clipman.json" diff --git a/home/modules/i3-sway.nix b/home/modules/i3-sway.nix index a592c97..caced24 100644 --- a/home/modules/i3-sway.nix +++ b/home/modules/i3-sway.nix @@ -355,7 +355,6 @@ in "--locked --inhibited --release XF86PowerOff" = lib.mkIf config.phone.enable "exec ${pkgs.writeShellScript "power-key" '' if ${config.wayland.windowManager.sway.package}/bin/swaymsg -rt get_outputs | ${pkgs.jq}/bin/jq ".[].power" | ${pkgs.gnugrep}/bin/grep true; then ${dpms-off} - ${lock-script} else ${dpms-on} fi