lass 3: add wallpaper.nix
lass 2 configs: add wallpaper.nix lass 2: add wallpaper-server.nix lass: refactor realwallpaper
This commit is contained in:
parent
041ef78448
commit
0a7d4c3469
|
@ -14,7 +14,7 @@ in {
|
|||
../2configs/retiolum.nix
|
||||
../2configs/fastpoke-pages.nix
|
||||
../2configs/new-repos.nix
|
||||
../2configs/privoxy-retiolum.nix
|
||||
../2configs/realwallpaper.nix
|
||||
{
|
||||
networking.interfaces.enp2s1.ip4 = [
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ in {
|
|||
../../tv/2configs/CAC-CentOS-7-64bit.nix
|
||||
../2configs/base.nix
|
||||
../2configs/retiolum.nix
|
||||
../2configs/realwallpaper.nix
|
||||
{
|
||||
networking.interfaces.enp2s1.ip4 = [
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
../2configs/wordpress.nix
|
||||
../2configs/bitlbee.nix
|
||||
../2configs/firefoxPatched.nix
|
||||
../2configs/wallpaper.nix
|
||||
../2configs/realwallpaper.nix
|
||||
];
|
||||
|
||||
krebs.build = {
|
||||
|
|
32
lass/2configs/realwallpaper-server.nix
Normal file
32
lass/2configs/realwallpaper-server.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
hostname = config.krebs.build.host.name;
|
||||
inherit (lib)
|
||||
nameValuePair
|
||||
;
|
||||
|
||||
in {
|
||||
imports = [
|
||||
./realwallpaper.nix
|
||||
];
|
||||
|
||||
krebs.nginx.servers.wallpaper = {
|
||||
server-names = [
|
||||
hostname
|
||||
];
|
||||
locations = [
|
||||
(nameValuePair "/wallpaper.png" ''
|
||||
root /tmp/;
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
krebs.iptables = {
|
||||
tables = {
|
||||
filter.INPUT.rules = [
|
||||
{ predicate = "-i retiolum -p tcp --dport 80"; target = "ACCEPT"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
9
lass/2configs/realwallpaper.nix
Normal file
9
lass/2configs/realwallpaper.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../3modules/realwallpaper.nix
|
||||
];
|
||||
|
||||
lass.realwallpaper.enable = true;
|
||||
}
|
|
@ -3,5 +3,6 @@ _:
|
|||
{
|
||||
imports = [
|
||||
./xresources.nix
|
||||
./realwallpaper.nix
|
||||
];
|
||||
}
|
||||
|
|
102
lass/3modules/realwallpaper.nix
Normal file
102
lass/3modules/realwallpaper.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
arg@{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
mkIf
|
||||
;
|
||||
|
||||
lpkgs = import ../5pkgs { inherit pkgs; };
|
||||
|
||||
cfg = config.lass.realwallpaper;
|
||||
|
||||
out = {
|
||||
options.lass.realwallpaper = api;
|
||||
config = mkIf cfg.enable imp;
|
||||
};
|
||||
|
||||
api = {
|
||||
enable = mkEnableOption "realwallpaper";
|
||||
|
||||
workingDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/realwallpaper/";
|
||||
};
|
||||
|
||||
nightmap = mkOption {
|
||||
type = types.str;
|
||||
default = "http://eoimages.gsfc.nasa.gov/images/imagerecords/55000/55167/earth_lights_lrg.jpg";
|
||||
};
|
||||
|
||||
daymap = mkOption {
|
||||
type = types.str;
|
||||
default = "http://www.nnvl.noaa.gov/images/globaldata/SnowIceCover_Daily.png";
|
||||
};
|
||||
|
||||
cloudmap = mkOption {
|
||||
type = types.str;
|
||||
default = "http://xplanetclouds.com/free/local/clouds_2048.jpg";
|
||||
};
|
||||
|
||||
outFile = mkOption {
|
||||
type = types.str;
|
||||
default = "/tmp/wallpaper.png";
|
||||
};
|
||||
|
||||
timerConfig = mkOption {
|
||||
type = types.unspecified;
|
||||
default = {
|
||||
OnCalendar = "*:0/15";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
imp = {
|
||||
systemd.timers.realwallpaper = {
|
||||
description = "real wallpaper generator timer";
|
||||
|
||||
timerConfig = cfg.timerConfig;
|
||||
};
|
||||
|
||||
systemd.services.realwallpaper = {
|
||||
description = "real wallpaper generator";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
path = with pkgs; [
|
||||
xplanet
|
||||
imagemagick
|
||||
curl
|
||||
file
|
||||
];
|
||||
|
||||
environment = {
|
||||
working_dir = cfg.workingDir;
|
||||
nightmap_url = cfg.nightmap;
|
||||
daymap_url = cfg.daymap;
|
||||
cloudmap_url = cfg.cloudmap;
|
||||
out_file = cfg.outFile;
|
||||
};
|
||||
|
||||
restartIfChanged = true;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${lpkgs.realwallpaper}/realwallpaper.sh";
|
||||
User = "realwallpaper";
|
||||
};
|
||||
};
|
||||
|
||||
users.extraUsers.realwallpaper = {
|
||||
uid = 2009435407; #genid realwallpaper
|
||||
home = cfg.workingDir;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
out
|
||||
|
|
@ -13,4 +13,5 @@ rec {
|
|||
ublock = callPackage ./firefoxPlugins/ublock.nix {};
|
||||
vimperator = callPackage ./firefoxPlugins/vimperator.nix {};
|
||||
};
|
||||
realwallpaper = callPackage ./realwallpaper.nix {};
|
||||
}
|
||||
|
|
28
lass/5pkgs/realwallpaper.nix
Normal file
28
lass/5pkgs/realwallpaper.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ stdenv, fetchgit, xplanet, imagemagick, curl, file }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "realwallpaper";
|
||||
|
||||
src = fetchgit {
|
||||
url = https://github.com/Lassulus/realwallpaper;
|
||||
rev = "c2778c3c235fc32edc8115d533a0d0853ab101c5";
|
||||
sha256 = "0yhbjz19zk8sj5dsvccm6skkqq2vardn1yi70qmd5li7qvp17mvs";
|
||||
};
|
||||
|
||||
phases = [
|
||||
"unpackPhase"
|
||||
"installPhase"
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
xplanet
|
||||
imagemagick
|
||||
curl
|
||||
file
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp realwallpaper.sh $out/realwallpaper.sh
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue