From c9ad1359f1605040860db136ceaf8be984baa7b2 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 18 Apr 2019 07:53:44 +0200 Subject: ma x.r: clean up imports, remove pyload --- makefu/1systems/x/config.nix | 51 +++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index de55e9e89..3c5e50c4b 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -11,9 +11,13 @@ + + + { programs.adb.enable = true; } + # #{ @@ -23,7 +27,14 @@ # }; #} + # Restore: + # systemctl cat borgbackup-job-state + # export BORG_PASSCOMMAND BORG_REPO BORG_RSH + # borg list "$BORG_REPO" + # mount newroot somewhere && cd somewhere + # borg extract "$BORG_REPO::x-state-2019-04-17T01:41:51" --progress # < extract to cwd + # @@ -46,19 +57,18 @@ # Krebs - + # # applications - # # Virtualization - - + # + # #{ # networking.firewall.allowedTCPPorts = [ 8080 ]; @@ -71,35 +81,43 @@ # Services - + # # - - { nixpkgs.overlays = [ (self: super: super.prefer-remote-fetch self super) ]; } + # + # { nixpkgs.overlays = [ (self: super: super.prefer-remote-fetch self super) ]; } + + + # Hardware - - + # # # - - + # + # + # # + { + services.upower.enable = true; + users.users.makefu.packages = [ pkgs.gnome3.gnome-power-manager ]; + } + # Filesystem # Security - { programs.adb.enable = true; } + # temporary - { services.redis.enable = true; } - + # { services.redis.enable = true; } + # # # # @@ -136,6 +154,9 @@ makefu.server.primary-itf = "wlp3s0"; nixpkgs.config.allowUnfree = true; + nixpkgs.config.oraclejdk.accept_license = true; + + # configure pulseAudio to provide a HDMI sink as well networking.firewall.enable = true; @@ -163,7 +184,6 @@ "/home/makefu/.ssh/" "/home/makefu/.zsh_history" "/home/makefu/.bash_history" - "/home/makefu/.zshrc" "/home/makefu/bin" "/home/makefu/.gnupg" "/home/makefu/.imapfilter" @@ -171,6 +191,7 @@ "/home/makefu/docs" "/home/makefu/.password-store" "/home/makefu/.secrets-pass" + "/home/makefu/.config/syncthing" ]; services.syncthing.user = lib.mkForce "makefu"; -- cgit v1.2.3 From 398f96dfff0579e3d62d8ea0f7fd49dd91014d16 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 18 Apr 2019 08:32:33 +0200 Subject: ma binary-cache: add gum --- makefu/2configs/binary-cache/gum.nix | 13 +++++++++++++ makefu/2configs/binary-cache/server.nix | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 makefu/2configs/binary-cache/gum.nix diff --git a/makefu/2configs/binary-cache/gum.nix b/makefu/2configs/binary-cache/gum.nix new file mode 100644 index 000000000..fc54bd917 --- /dev/null +++ b/makefu/2configs/binary-cache/gum.nix @@ -0,0 +1,13 @@ + +{ config, ... }: + +{ + nix = { + binaryCaches = [ + "https://cache.euer.krebsco.de/" + ]; + binaryCachePublicKeys = [ + "gum:iIXIFlCAotib+MgI3V/i3HMlFXiVYOT/jfP0y54Zuvg=" + ]; + }; +} diff --git a/makefu/2configs/binary-cache/server.nix b/makefu/2configs/binary-cache/server.nix index ad6256830..c8f68c84d 100644 --- a/makefu/2configs/binary-cache/server.nix +++ b/makefu/2configs/binary-cache/server.nix @@ -19,9 +19,10 @@ }; services.nginx = { enable = true; - virtualHosts.nix-serve = { - serverAliases = [ "cache.gum.r" - "cache.euer.krebsco.de" + virtualHosts."cache.euer.krebsco.de" = { + forceSSL = true; + enableACME = true; + serverAliases = [ # "cache.gum.r" "cache.gum.krebsco.de" ]; locations."/".proxyPass= "http://localhost:${toString config.services.nix-serve.port}"; -- cgit v1.2.3 From e4744b723728293fda24fccd9180f9e0bbdd80e8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 18 Apr 2019 10:13:57 +0200 Subject: l: RIP ensure-permissions --- lass/3modules/default.nix | 1 - lass/3modules/ensure-permissions.nix | 66 ------------------------------------ 2 files changed, 67 deletions(-) delete mode 100644 lass/3modules/ensure-permissions.nix diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index 59043aeb1..613c7c8ac 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -3,7 +3,6 @@ _: imports = [ ./dnsmasq.nix ./ejabberd - ./ensure-permissions.nix ./folderPerms.nix ./hosts.nix ./mysql-backup.nix diff --git a/lass/3modules/ensure-permissions.nix b/lass/3modules/ensure-permissions.nix deleted file mode 100644 index 36edc1127..000000000 --- a/lass/3modules/ensure-permissions.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ config, pkgs, ... }: with import ; - -let - - cfg = config.lass.ensure-permissions; - -in - -{ - options.lass.ensure-permissions = mkOption { - default = []; - type = types.listOf (types.submodule ({ - options = { - - folder = mkOption { - type = types.absolute-pathname; - }; - - owner = mkOption { - # TODO user type - type = types.str; - default = "root"; - }; - - group = mkOption { - # TODO group type - type = types.str; - default = "root"; - }; - - permission = mkOption { - # TODO permission type - type = types.str; - default = "u+rw,g+rw"; - }; - - }; - })); - }; - - config = mkIf (cfg != []) { - - system.activationScripts.ensure-permissions = concatMapStringsSep "\n" (plan: '' - ${pkgs.coreutils}/bin/mkdir -p ${plan.folder} - ${pkgs.coreutils}/bin/chmod -R ${plan.permission} ${plan.folder} - ${pkgs.coreutils}/bin/chown -R ${plan.owner}:${plan.group} ${plan.folder} - '') cfg; - systemd.services = - listToAttrs (map (plan: nameValuePair "ensure-permisson.${replaceStrings ["/"] ["_"] plan.folder}" { - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "always"; - RestartSec = 10; - ExecStart = pkgs.writeDash "ensure-perms" '' - ${pkgs.inotifyTools}/bin/inotifywait -mrq -e CREATE --format %w%f ${plan.folder} \ - | while IFS= read -r FILE; do - ${pkgs.coreutils}/bin/chmod -R ${plan.permission} "$FILE" 2>/dev/null - ${pkgs.coreutils}/bin/chown -R ${plan.owner}:${plan.group} "$FILE" 2>/dev/null - done - ''; - }; - }) cfg) - ; - - }; -} -- cgit v1.2.3 From 3adcf3a74c00b5e88b8c8c15d6aeb9ab3f9304db Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 18 Apr 2019 10:14:18 +0200 Subject: syncthing: listOf -> attrsOf --- krebs/3modules/syncthing.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/krebs/3modules/syncthing.nix b/krebs/3modules/syncthing.nix index bfbac1db9..897ba1e7f 100644 --- a/krebs/3modules/syncthing.nix +++ b/krebs/3modules/syncthing.nix @@ -10,7 +10,7 @@ let addresses = peer.addresses; }) cfg.peers; - folders = map (folder: { + folders = mapAttrsToList ( _: folder: { inherit (folder) path id type; devices = map (peer: { deviceId = cfg.peers.${peer}.id; }) folder.peers; rescanIntervalS = folder.rescanInterval; @@ -81,17 +81,18 @@ in }; folders = mkOption { - default = []; - type = types.listOf (types.submodule ({ config, ... }: { + default = {}; + type = types.attrsOf (types.submodule ({ config, ... }: { options = { path = mkOption { type = types.absolute-pathname; + default = config._module.args.name; }; id = mkOption { type = types.str; - default = config.path; + default = config._module.args.name; }; peers = mkOption { -- cgit v1.2.3 From 2a89d6587d5ee5d3151b5e5be05e152a539e78d0 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 18 Apr 2019 10:16:02 +0200 Subject: l syncs: use permown, use attrs --- lass/1systems/mors/config.nix | 15 +++++++++------ lass/2configs/green-host.nix | 13 ++++++------- lass/2configs/radio.nix | 15 +++++++++------ lass/2configs/sync/decsync.nix | 15 +++++++++------ lass/2configs/sync/weechat.nix | 12 ++++++------ lass/2configs/syncthing.nix | 20 ++++++++++---------- 6 files changed, 49 insertions(+), 41 deletions(-) diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix index 7e183f40f..f911b79d6 100644 --- a/lass/1systems/mors/config.nix +++ b/lass/1systems/mors/config.nix @@ -49,12 +49,15 @@ with import ; ]; } { - krebs.syncthing.folders = [ - { id = "the_playlist"; path = "/home/lass/tmp/the_playlist"; peers = [ "mors" "phone" "prism" ]; } - ]; - lass.ensure-permissions = [ - { folder = "/home/lass/tmp/the_playlist"; owner = "lass"; group = "syncthing"; } - ]; + krebs.syncthing.folders."the_playlist" = { + path = "/home/lass/tmp/the_playlist"; + peers = [ "mors" "phone" "prism" ]; + }; + krebs.permown."/home/lass/tmp/the_playlist" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; } { lass.umts = { diff --git a/lass/2configs/green-host.nix b/lass/2configs/green-host.nix index 860d7c113..1421eede7 100644 --- a/lass/2configs/green-host.nix +++ b/lass/2configs/green-host.nix @@ -20,13 +20,12 @@ with import ; } ]; - lass.ensure-permissions = [ - { folder = "/var/lib/sync-containers"; owner = "root"; group = "syncthing"; } - ]; - - krebs.syncthing.folders = [ - { path = "/var/lib/sync-containers"; peers = [ "icarus" "skynet" "littleT" "shodan" ]; } - ]; + krebs.syncthing.folders."/var/lib/sync-containers".peers = [ "icarus" "skynet" "littleT" "shodan" ]; + krebs.permown."/var/lib/sync-containers" = { + owner = "root"; + group = "syncthing"; + umask = "0007"; + }; system.activationScripts.containerPermissions = '' mkdir -p /var/lib/containers diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index d67d970f8..521b3c050 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -248,10 +248,13 @@ in { alias ${html}; ''; }; - krebs.syncthing.folders = [ - { id = "the_playlist"; path = "/home/radio/music/the_playlist"; peers = [ "mors" "phone" "prism" ]; } - ]; - lass.ensure-permissions = [ - { folder = "/home/radio/music/the_playlist"; owner = "radio"; group = "syncthing"; } - ]; + krebs.syncthing.folders."the_playlist" = { + path = "/home/radio/music/the_playlist"; + peers = [ "mors" "phone" "prism" ]; + }; + krebs.permown."/home/radio/music/the_playlist" = { + owner = "radio"; + group = "syncthing"; + umask = "0007"; + }; } diff --git a/lass/2configs/sync/decsync.nix b/lass/2configs/sync/decsync.nix index 94569c94d..c3f6511c2 100644 --- a/lass/2configs/sync/decsync.nix +++ b/lass/2configs/sync/decsync.nix @@ -1,8 +1,11 @@ { - krebs.syncthing.folders = [ - { id = "decsync"; path = "/home/lass/decsync"; peers = [ "mors" "blue" "green" "phone" ]; } - ]; - lass.ensure-permissions = [ - { folder = "/home/lass/decsync"; owner = "lass"; group = "syncthing"; } - ]; + krebs.syncthing.folders.decsync = { + path = "/home/lass/decsync"; + peers = [ "mors" "blue" "green" "phone" ]; + }; + krebs.permown."/home/lass/decsync" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; } diff --git a/lass/2configs/sync/weechat.nix b/lass/2configs/sync/weechat.nix index d10177b1d..30c7b262b 100644 --- a/lass/2configs/sync/weechat.nix +++ b/lass/2configs/sync/weechat.nix @@ -1,8 +1,8 @@ { - krebs.syncthing.folders = [ - { path = "/home/lass/.weechat"; peers = [ "blue" "green" "mors" ]; } - ]; - lass.ensure-permissions = [ - { folder = "/home/lass/.weechat"; owner = "lass"; group = "syncthing"; } - ]; + krebs.syncthing.folders."/home/lass/.weechat".peers = [ "blue" "green" "mors" ]; + krebs.permown."/home/lass/.weechat" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; } diff --git a/lass/2configs/syncthing.nix b/lass/2configs/syncthing.nix index fc10b2cb4..48f2625c1 100644 --- a/lass/2configs/syncthing.nix +++ b/lass/2configs/syncthing.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: -with import ; -{ +{ config, pkgs, ... }: with import ; let + peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts); +in { services.syncthing = { enable = true; group = "syncthing"; @@ -14,17 +14,17 @@ with import ; enable = true; cert = toString ; key = toString ; - peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts); - folders = [ - { path = "/home/lass/sync"; peers = [ "icarus" "mors" "skynet" "blue" "green" "littleT" "prism" "shodan" ]; } - ]; + peers = peers; + folders."/home/lass/sync".peers = attrNames peers; }; system.activationScripts.syncthing-home = '' ${pkgs.coreutils}/bin/chmod a+x /home/lass ''; - lass.ensure-permissions = [ - { folder = "/home/lass/sync"; owner = "lass"; group = "syncthing"; } - ]; + krebs.permown."/home/lass/sync" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; } -- cgit v1.2.3 From da336abf88d620648580a8e0a25e2b31c7d110ff Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 18 Apr 2019 13:39:00 +0200 Subject: l radio: set new music directory --- lass/2configs/radio.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 521b3c050..b26237c6d 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -10,7 +10,7 @@ let source-password = import ; add_random = pkgs.writeDashBin "add_random" '' - ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.mpc_cli}/bin/mpc ls | shuf -n1)" + ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.mpc_cli}/bin/mpc ls the_playlist/music | grep '\.ogg$' | shuf -n1)" ''; skip_track = pkgs.writeDashBin "skip_track" '' @@ -57,7 +57,7 @@ in { services.mpd = { enable = true; group = "radio"; - musicDirectory = "/home/radio/the_playlist/music"; + musicDirectory = "/home/radio/music"; extraConfig = '' log_level "default" auto_update "yes" -- cgit v1.2.3 From 8b3030a08d69317404470b96f097635b39be2027 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 18 Apr 2019 13:39:54 +0200 Subject: l radio: grant mpd access to music dir --- lass/2configs/radio.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index b26237c6d..88899c554 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -255,6 +255,6 @@ in { krebs.permown."/home/radio/music/the_playlist" = { owner = "radio"; group = "syncthing"; - umask = "0007"; + umask = "0002"; }; } -- cgit v1.2.3 From 25c15fb7c162bc927310b4d45a58668d9e635a98 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 18 Apr 2019 19:55:10 +0200 Subject: ma sdev.r: do not build with virtualbox extensions --- makefu/1systems/sdev/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/1systems/sdev/config.nix b/makefu/1systems/sdev/config.nix index 2f289d500..e15af8251 100644 --- a/makefu/1systems/sdev/config.nix +++ b/makefu/1systems/sdev/config.nix @@ -6,7 +6,7 @@ [ # Include the results of the hardware scan. - + # # broken since 2019-04-18 #{ # until virtualbox-image is fixed # imports = [ # -- cgit v1.2.3 From 7e99a8215b8ce6d632189c883035e431feb87326 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 18 Apr 2019 20:02:07 +0200 Subject: ma sdev.r: re-enable filesystem --- makefu/1systems/sdev/config.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/makefu/1systems/sdev/config.nix b/makefu/1systems/sdev/config.nix index e15af8251..66f822c02 100644 --- a/makefu/1systems/sdev/config.nix +++ b/makefu/1systems/sdev/config.nix @@ -7,12 +7,12 @@ # # broken since 2019-04-18 - #{ # until virtualbox-image is fixed - # imports = [ - # - # ]; - # boot.loader.grub.device = lib.mkForce "/dev/sda"; - #} + { # until virtualbox-image is fixed + imports = [ + + ]; + boot.loader.grub.device = lib.mkForce "/dev/sda"; + } # -- cgit v1.2.3