Skip to content

Commit

Permalink
~
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Feb 20, 2024
1 parent 00f4cf5 commit 14133c0
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 6 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion hosts/hastur/hardware.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
};
kernelModules = [ "ec_sys" "uhid" "kvm-amd" ];
# extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
kernelPackages = pkgs.linuxPackages_latest;
kernelPackages =
pkgs.linuxPackages_latest;
# inputs.nyx.packages.${pkgs.system}.linuxPackages_cachyos-lto-zen3;
# binfmt.emulatedSystems = [
# "riscv64-linux"
Expand Down Expand Up @@ -105,6 +106,8 @@
fileSystems."/persist".neededForBoot = true;


hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
84 changes: 84 additions & 0 deletions modules/snapy.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{ pkgs
, config
, lib
, ...
}:
with lib;
let
cfg = config.services.snapy;
in
{
options.services.snapy = {
instances = mkOption {
type = types.listOf (types.submodule {
options = {
name = mkOption { type = types.str; };
source = mkOption {
type = types.str;
default = "/persist";
};
calendar = mkOption {
type = types.str;
default = "*:0/3";
};
keep = mkOption {
type = types.str;
default = "3day";
};
};
});
default = [ ];
};
};
config =
mkIf (cfg.instances != [ ])
{

systemd.timers = lib.foldr
(s: acc: acc //
{
"snapy-${s.name}" = {
description = "snap task ${s.name}";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = s.calendar;
};
};
})
{ }
cfg.instances;

systemd.services = lib.foldr
(s: acc: acc // {
"snapy-${s.name}" = {
wantedBy = [ "multi-user.target" ];
description = "${s.name} snapy daemon";
serviceConfig =
{
# DynamicUser = true;
User = "root";
ExecStart =
let btrfs = lib.getExe' pkgs.btrfs-progs "btrfs"; in
toString (pkgs.lib.getExe (pkgs.nuenv.writeScriptBin
{
name = "snapy";
script = ''
# take snapshot
date now | format date "%m-%d_%H:%M:%S" | ${btrfs} subvol snapshot -r ${s.source} $'${s.source}/.snapshots/($in)'
date now
# rm out-dated
ls ${s.source}/.snapshots | filter { |i| ((date now) - $i.modified) > ${s.keep} } | each { |d| ${btrfs} sub del $d.name }
'';
}));

# AmbientCapabilities = [ "CAP_SYS_ADMIN" "CAP_SYS_RESOURCE" "CAP_DAC_OVERRIDE" ];
# CapabilityBoundingSet = [ "CAP_SYS_ADMIN" "CAP_SYS_RESOURCE" "CAP_DAC_OVERRIDE" ];
};
};
})
{ }
cfg.instances;
}
;
}
2 changes: 1 addition & 1 deletion overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let system = "x86_64-linux"; in [
# }).lazygit;
inherit ((import inputs.nixpkgs-master {
inherit system; config.allowUnfree = true;
})) monaspace factorio-headless-experimental;
})) monaspace factorio-headless-experimental linuxPackages_latest;
# inherit ((import inputs.nixpkgs-dae {
# inherit system; config.allowUnfree = true;
# })) dae;
Expand Down
2 changes: 1 addition & 1 deletion packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let
e = with pkgs;{
crypt = [ minisign rage age-plugin-yubikey cryptsetup tpm2-tss tpm2-tools yubikey-manager yubikey-manager-qt monero-cli ];

python = [ (python311.withPackages (ps: with ps; [ pandas requests absl-py tldextract ])) ];
python = [ (python311.withPackages (ps: with ps; [ pandas requests absl-py tldextract bleak dotenv ])) ];

lang = [
[
Expand Down

0 comments on commit 14133c0

Please sign in to comment.