lib; init with common functions
This commit is contained in:
parent
9924444dcb
commit
3c2e26c98e
@ -97,6 +97,7 @@
|
|||||||
, tsRevProx, taskobs, mcchunkie, gqrss, darwin, xin-secrets, talon, peerix
|
, tsRevProx, taskobs, mcchunkie, gqrss, darwin, xin-secrets, talon, peerix
|
||||||
, ... }@inputs:
|
, ... }@inputs:
|
||||||
let
|
let
|
||||||
|
xinlib = import ./lib;
|
||||||
supportedSystems = [ "x86_64-linux" ];
|
supportedSystems = [ "x86_64-linux" ];
|
||||||
#[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
#[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||||
forAllSystems = unstable.lib.genAttrs supportedSystems;
|
forAllSystems = unstable.lib.genAttrs supportedSystems;
|
||||||
@ -158,7 +159,10 @@
|
|||||||
buildSys = sys: sysBase: extraMods: name:
|
buildSys = sys: sysBase: extraMods: name:
|
||||||
sysBase.lib.nixosSystem {
|
sysBase.lib.nixosSystem {
|
||||||
system = sys;
|
system = sys;
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
inherit xinlib;
|
||||||
|
};
|
||||||
modules = hostBase.modules ++ extraMods ++ [{
|
modules = hostBase.modules ++ extraMods ++ [{
|
||||||
nix = {
|
nix = {
|
||||||
registry.nixpkgs.flake = sysBase;
|
registry.nixpkgs.flake = sysBase;
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
{ config, pkgs, lib, modulesPath, inputs, ... }:
|
{ config, pkgs, lib, modulesPath, inputs, xinlib, ... }:
|
||||||
let
|
let
|
||||||
myEmacs = pkgs.callPackage ../../configs/emacs.nix { };
|
myEmacs = pkgs.callPackage ../../configs/emacs.nix { };
|
||||||
peerixUser = if builtins.hasAttr "peerix" config.users.users then
|
peerixUser = if builtins.hasAttr "peerix" config.users.users then
|
||||||
config.users.users.peerix.name
|
config.users.users.peerix.name
|
||||||
else
|
else
|
||||||
"root";
|
"root";
|
||||||
mkCronScript = name: src: ''
|
|
||||||
. /etc/profile;
|
|
||||||
set -x
|
|
||||||
# autogenreated ${name}
|
|
||||||
${src}
|
|
||||||
'';
|
|
||||||
jobs = [
|
jobs = [
|
||||||
{
|
{
|
||||||
name = "brain";
|
name = "brain";
|
||||||
@ -31,14 +25,6 @@ let
|
|||||||
path = [ pkgs.taskobs ] ++ pkgs.taskobs.buildInputs;
|
path = [ pkgs.taskobs ] ++ pkgs.taskobs.buildInputs;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
jobToService = job: {
|
|
||||||
name = "${job.name}";
|
|
||||||
value = {
|
|
||||||
script = mkCronScript "${job.name}_script" job.script;
|
|
||||||
inherit (job) startAt;
|
|
||||||
inherit (job) path;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
_module.args.isUnstable = true;
|
_module.args.isUnstable = true;
|
||||||
|
|
||||||
@ -200,7 +186,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.services = lib.listToAttrs (builtins.map jobToService jobs);
|
systemd.user.services = lib.listToAttrs (builtins.map xinlib.jobToService jobs);
|
||||||
systemd.services."whytailscalewhy" = {
|
systemd.services."whytailscalewhy" = {
|
||||||
description = "Tailscale restart on resume";
|
description = "Tailscale restart on resume";
|
||||||
wantedBy = [ "post-resume.target" ];
|
wantedBy = [ "post-resume.target" ];
|
||||||
|
@ -1,32 +1,16 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, xinlib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
myEmacs = pkgs.callPackage ../../configs/emacs.nix { };
|
myEmacs = pkgs.callPackage ../../configs/emacs.nix { };
|
||||||
pubKeys = [
|
pubKeys = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7v+/xS8832iMqJHCWsxUZ8zYoMWoZhjj++e26g1fLT europa"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7v+/xS8832iMqJHCWsxUZ8zYoMWoZhjj++e26g1fLT europa"
|
||||||
];
|
];
|
||||||
mkCronScript = name: src: ''
|
jobs = [{
|
||||||
. /etc/profile;
|
name = "xin-ci";
|
||||||
set -x
|
script = "cd ~/src/xin && ./ci";
|
||||||
# autogenreated ${name}
|
startAt = "daily";
|
||||||
${src}
|
path = [ ];
|
||||||
'';
|
}];
|
||||||
jobs = [
|
|
||||||
{
|
|
||||||
name = "xin-ci";
|
|
||||||
script = "cd ~/src/xin && ./ci";
|
|
||||||
startAt = "daily";
|
|
||||||
path = [ ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
jobToService = job: {
|
|
||||||
name = "${job.name}";
|
|
||||||
value = {
|
|
||||||
script = mkCronScript "${job.name}_script" job.script;
|
|
||||||
inherit (job) startAt;
|
|
||||||
inherit (job) path;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
_module.args.isUnstable = true;
|
_module.args.isUnstable = true;
|
||||||
imports = [ ./hardware-configuration.nix ];
|
imports = [ ./hardware-configuration.nix ];
|
||||||
@ -37,7 +21,7 @@ in {
|
|||||||
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
systemd.user.services = lib.listToAttrs (builtins.map jobToService jobs);
|
systemd.user.services = lib.listToAttrs (builtins.map xinlib.jobToService jobs);
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "pwntie";
|
hostName = "pwntie";
|
||||||
|
18
lib/default.nix
Normal file
18
lib/default.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
let
|
||||||
|
mkCronScript = name: src: ''
|
||||||
|
. /etc/profile;
|
||||||
|
set -x
|
||||||
|
# autogenreated ${name}
|
||||||
|
${src}
|
||||||
|
'';
|
||||||
|
jobToService = job: {
|
||||||
|
name = "${job.name}";
|
||||||
|
value = {
|
||||||
|
script = mkCronScript "${job.name}_script" job.script;
|
||||||
|
inherit (job) startAt path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
xinlib = { inherit mkCronScript jobToService; };
|
||||||
|
|
||||||
|
in xinlib
|
Loading…
Reference in New Issue
Block a user