From 09e4b21909a9c50c14c428c919830036d17c9df5 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Tue, 20 Feb 2024 22:03:30 +0300 Subject: [PATCH] Dotfiles : Load from nix store. --- .config/linux/system/flake.nix | 2 +- .config/linux/system/module/common/Dotfile.nix | 15 --------------- .config/linux/system/module/common/Dotfiles.nix | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 .config/linux/system/module/common/Dotfile.nix create mode 100644 .config/linux/system/module/common/Dotfiles.nix diff --git a/.config/linux/system/flake.nix b/.config/linux/system/flake.nix index 7ee4ec9..82b007b 100644 --- a/.config/linux/system/flake.nix +++ b/.config/linux/system/flake.nix @@ -18,7 +18,7 @@ nixosModules.common.imports = [ ./module/common/Bootloader.nix ./module/common/Distrobox.nix - ./module/common/Dotfile.nix + ./module/common/Dotfiles.nix ./module/common/Firewall.nix ./module/common/Kernel.nix ./module/common/Locale.nix diff --git a/.config/linux/system/module/common/Dotfile.nix b/.config/linux/system/module/common/Dotfile.nix deleted file mode 100644 index 19b938c..0000000 --- a/.config/linux/system/module/common/Dotfile.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: let - unit = { - description = "Install/update dotfiles on startup."; - wantedBy = [ "multi-user.target" ]; - serviceConfig.Type = "oneshot"; - script = '' - cd ~ - test -d .git || { ${pkgs.curl}/bin/curl https://git.voronind.com/voronind/linux/raw/branch/main/.Bootstrap.sh | ${pkgs.bash}/bin/bash; } - ${pkgs.git}/bin/git pull - ''; - }; -in { - systemd.user.services.dotfiles = unit; - systemd.services.dotfiles = unit; -} diff --git a/.config/linux/system/module/common/Dotfiles.nix b/.config/linux/system/module/common/Dotfiles.nix new file mode 100644 index 0000000..4632330 --- /dev/null +++ b/.config/linux/system/module/common/Dotfiles.nix @@ -0,0 +1,17 @@ +{ pkgs, inputs, ... }: let + unit = { + description = "Install/update dotfiles on startup."; + wantedBy = [ "multi-user.target" ]; + serviceConfig.Type = "oneshot"; + script = '' + cd ~ + test -d .git || cp -r ${inputs.dotfiles}/{*,.*} . + ${pkgs.git}/bin/git pull + ''; + }; + dotsSource = inputs.dotfiles; +in { + systemd.user.services.dotfiles = unit; + systemd.services.dotfiles = unit; + environment.etc.dotfiles.source = dotsSource; +}